From 578459f8088474f8b1d1d29e4ca6f3aa3a5f42c5 Mon Sep 17 00:00:00 2001 From: fumihiko kakuma Date: Thu, 7 Apr 2016 08:15:45 +0900 Subject: [PATCH] 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 --- tools/worlddump.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/worlddump.py b/tools/worlddump.py index 3ff22a9dfd..f931f11b2e 100755 --- a/tools/worlddump.py +++ b/tools/worlddump.py @@ -76,6 +76,12 @@ def _header(name): 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 @@ def ovs_dump(): 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: