2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

ovs-vsctl: additional commands for querying VLAN fake bridges.

Our test automation needs to be able to validate that a VLAN bridge and
for this I needed two new operations in ovs-vsctl:
      * The ability to query the VLAN tag for a bridge.
      * The ability to query the 'parent' of a bridge. The parent is the
        non-VLAN/untagged bridge with the same physical devices and
        could be a bond.

So given xenbr0 (containing eth0) + xapi2 (VLAN 42 on eth0) and xapi1
(containing bond0 == eth2+eth3) + xapi3 (VLAN 23 on the bonded
interface):

[root@warlock ~]# ovs-vsctl br-to-vlan xapi2
42
[root@warlock ~]# ovs-vsctl br-to-vlan xapi3
23
[root@warlock ~]# ovs-vsctl br-to-parent xapi2
xenbr0
[root@warlock ~]# ovs-vsctl br-to-parent xapi3
xapi1
This commit is contained in:
Ian Campbell
2009-09-14 11:27:39 -07:00
committed by Ben Pfaff
parent 3b135da329
commit 2e44e26d10

View File

@@ -277,7 +277,9 @@ Bridge commands:
del-br BRIDGE delete BRIDGE and all of its ports
list-br print the names of all the bridges
br-exists BRIDGE test whether BRIDGE exists
br-to-vlan BRIDGE print the VLAN which BRIDGE is on
br-to-parent BRIDGE print the parent of BRIDGE
Port commands:
list-ports BRIDGE print the names of all the ports on BRIDGE
add-port BRIDGE PORT add network device PORT to BRIDGE
@@ -427,6 +429,16 @@ def cmd_iface_to_br(iface):
return
raise Error("no interface named %s" % iface)
def cmd_br_to_vlan(bridge):
cfg = cfg_read(VSWITCHD_CONF)
parent, vlan = find_bridge(cfg, bridge)
print vlan
def cmd_br_to_parent(bridge):
cfg = cfg_read(VSWITCHD_CONF)
parent, vlan = find_bridge(cfg, bridge)
print parent
def main():
# Parse command line.
try:
@@ -475,6 +487,8 @@ def main():
'add-bond': (cmd_add_bond, lambda n: n >= 4),
'del-port': (cmd_del_port, 2),
'port-to-br': (cmd_port_to_br, 1),
'br-to-vlan': (cmd_br_to_vlan, 1),
'br-to-parent': (cmd_br_to_parent, 1),
'list-ifaces': (cmd_list_ifaces, 1),
'iface-to-br': (cmd_iface_to_br, 1)}
command = args[0]