In worlddump, execute ovs-ofctl for an only existing bridge
When devstack fails, some or all bridges may not exist.
This change allows an only existing bridge to executes ovs-ofctl command.
And fix duplicate ofp version specified in protocol option of ovs-ofctl.
Change-Id: Ied01de727ca9b867ce87db358f72ae44838b63af
diff --git a/tools/worlddump.py b/tools/worlddump.py
index 3ff22a9..f931f11 100755
--- a/tools/worlddump.py
+++ b/tools/worlddump.py
@@ -76,6 +76,12 @@
print
+def _bridge_list():
+ process = subprocess.Popen(['ovs-vsctl', 'list-br'], stdout=subprocess.PIPE)
+ stdout, _ = process.communicate()
+ return stdout.split()
+
+
# This method gets a max openflow version supported by openvswitch.
# For example 'ovs-ofctl --version' displays the following:
#
@@ -157,14 +163,11 @@
if not _find_cmd('ovs-vsctl'):
return
- # NOTE(ihrachys): worlddump is used outside of devstack context (f.e. in
- # grenade), so there is no single place to determine the bridge names from.
- # Hardcode for now.
- bridges = ('br-int', 'br-tun', 'br-ex')
+ bridges = _bridge_list()
ofctl_cmds = ('show', 'dump-ports-desc', 'dump-ports', 'dump-flows')
ofp_max = _get_ofp_version()
vers = 'OpenFlow10'
- for i in range(ofp_max + 1):
+ for i in range(1, ofp_max + 1):
vers += ',OpenFlow1' + str(i)
_dump_cmd("sudo ovs-vsctl show")
for ofctl_cmd in ofctl_cmds: