On Fri, 1 May 2020 17:47:14 +0900 Benjamin Poirier <bpoir...@cumulusnetworks.com> wrote:
> More fixes for `bridge vlan` and `bridge vlan tunnelshow` normal and JSON > mode output. > > Some column titles are changed, empty lines removed from the output, > interfaces with no vlans or tunnels are removed, columns are aligned. > > Changes v2: > * dropped patch 1, "bridge: Use the same flag names in input and output" > > Sample outputs with this config: > > ip link add br0 type bridge > > ip link add vx0 type vxlan dstport 4789 external > ip link set dev vx0 master br0 > bridge vlan del vid 1 dev vx0 > > ip link add vx1 type vxlan dstport 4790 external > ip link set dev vx1 master br0 > > ip link add vx2 type vxlan dstport 4791 external > ip link set dev vx2 master br0 > ip link set dev vx2 type bridge_slave vlan_tunnel on > bridge vlan add dev vx2 vid 2 > bridge vlan add dev vx2 vid 2 tunnel_info id 2 > bridge vlan add dev vx2 vid 1010-1020 > bridge vlan add dev vx2 vid 1010-1020 tunnel_info id 1010-1020 > bridge vlan add dev vx2 vid 1030 > bridge vlan add dev vx2 vid 1030 tunnel_info id 65556 > > ip link add vx-longname type vxlan dstport 4792 external > ip link set dev vx-longname master br0 > ip link set dev vx-longname type bridge_slave vlan_tunnel on > bridge vlan add dev vx-longname vid 2 > bridge vlan add dev vx-longname vid 2 tunnel_info id 2 > > Before & after: > > root@vsid:/src/iproute2# bridge -c vlan > port vlan ids > br0 1 PVID Egress Untagged > > vx0 None > vx1 1 PVID Egress Untagged > > vx2 1 PVID Egress Untagged > 2 > 1010-1020 > 1030 > > vx-longname 1 PVID Egress Untagged > 2 > > root@vsid:/src/iproute2# ./bridge/bridge -c vlan > port vlan-id > br0 1 PVID Egress Untagged > vx1 1 PVID Egress Untagged > vx2 1 PVID Egress Untagged > 2 > 1010-1020 > 1030 > vx-longname 1 PVID Egress Untagged > 2 > root@vsid:/src/iproute2# > > === > > root@vsid:/src/iproute2# bridge vlan tunnelshow > port vlan ids tunnel id > br0 > vx0 None > vx1 > vx2 2 2 > 1010-1020 1010-1020 > 1030 65556 > > vx-longname 2 2 > > root@vsid:/src/iproute2# ./bridge/bridge vlan tunnelshow > port vlan-id tunnel-id > vx2 2 2 > 1010-1020 1010-1020 > 1030 65556 > vx-longname 2 2 > root@vsid:/src/iproute2# > > === > > root@vsid:/src/iproute2# bridge -j -p vlan tunnelshow > [ { > "ifname": "br0", > "tunnels": [ ] > },{ > "ifname": "vx1", > "tunnels": [ ] > },{ > "ifname": "vx2", > "tunnels": [ { > "vlan": 2, > "tunid": 2 > },{ > "vlan": 1010, > "vlanEnd": 1020, > "tunid": 1010, > "tunidEnd": 1020 > },{ > "vlan": 1030, > "tunid": 65556 > } ] > },{ > "ifname": "vx-longname", > "tunnels": [ { > "vlan": 2, > "tunid": 2 > } ] > } ] > root@vsid:/src/iproute2# ./bridge/bridge -j -p vlan tunnelshow > [ { > "ifname": "vx2", > "tunnels": [ { > "vlan": 2, > "tunid": 2 > },{ > "vlan": 1010, > "vlanEnd": 1020, > "tunid": 1010, > "tunidEnd": 1020 > },{ > "vlan": 1030, > "tunid": 65556 > } ] > },{ > "ifname": "vx-longname", > "tunnels": [ { > "vlan": 2, > "tunid": 2 > } ] > } ] > root@vsid:/src/iproute2# > > Benjamin Poirier (6): > bridge: Use consistent column names in vlan output > bridge: Fix typo > bridge: Fix output with empty vlan lists > json_print: Return number of characters printed > bridge: Align output columns > Replace open-coded instances of print_nl() > > bridge/vlan.c | 111 +++++++++++++++-------- > include/json_print.h | 24 +++-- > lib/json_print.c | 95 +++++++++++-------- > tc/m_action.c | 14 +-- > tc/m_connmark.c | 4 +- > tc/m_ctinfo.c | 4 +- > tc/m_ife.c | 4 +- > tc/m_mpls.c | 2 +- > tc/m_nat.c | 4 +- > tc/m_sample.c | 4 +- > tc/m_skbedit.c | 4 +- > tc/m_tunnel_key.c | 16 ++-- > tc/q_taprio.c | 8 +- > tc/tc_util.c | 4 +- > testsuite/tests/bridge/vlan/show.t | 30 ++++++ > testsuite/tests/bridge/vlan/tunnelshow.t | 2 +- > 16 files changed, 210 insertions(+), 120 deletions(-) > create mode 100755 testsuite/tests/bridge/vlan/show.t > Looks good, applied.