Browse code

Merge "In worlddump, execute ovs-ofctl for an only existing bridge"

Jenkins authored on 2016/04/14 08:48:50
Showing 1 changed files
... ...
@@ -77,6 +77,12 @@ def _header(name):
77 77
     print()
78 78
 
79 79
 
80
+def _bridge_list():
81
+    process = subprocess.Popen(['ovs-vsctl', 'list-br'], stdout=subprocess.PIPE)
82
+    stdout, _ = process.communicate()
83
+    return stdout.split()
84
+
85
+
80 86
 # This method gets a max openflow version supported by openvswitch.
81 87
 # For example 'ovs-ofctl --version' displays the following:
82 88
 #
... ...
@@ -158,14 +164,11 @@ def ovs_dump():
158 158
     if not _find_cmd('ovs-vsctl'):
159 159
         return
160 160
 
161
-    # NOTE(ihrachys): worlddump is used outside of devstack context (f.e. in
162
-    # grenade), so there is no single place to determine the bridge names from.
163
-    # Hardcode for now.
164
-    bridges = ('br-int', 'br-tun', 'br-ex')
161
+    bridges = _bridge_list()
165 162
     ofctl_cmds = ('show', 'dump-ports-desc', 'dump-ports', 'dump-flows')
166 163
     ofp_max = _get_ofp_version()
167 164
     vers = 'OpenFlow10'
168
-    for i in range(ofp_max + 1):
165
+    for i in range(1, ofp_max + 1):
169 166
         vers += ',OpenFlow1' + str(i)
170 167
     _dump_cmd("sudo ovs-vsctl show")
171 168
     for ofctl_cmd in ofctl_cmds: