Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
In worlddump, cover all supported version of OpenFlow protocol by ovs…
…-ofctl

This change includes the following commits.

Fix a typo in comment for _get_ofp_version

OpenFlow11 -> OpenFlow10

Change-Id: I2a501ccd32f5f7a39fd4bc746f00ca3f67bd98c1
(cherry picked from commit 2bd2568)

In worlddump, cover all supported version of OpenFlow protocol by ovs-ofctl

Currently ovs-ofctl command is executed for only default ofp version
(OpenFlow10).
Some Neutron's plugin uses OpenFlow13 and in that case ovs-ofctl fails.
This chage allows us to get ovs info for all ofp versions supported by ovs.
And adds dump by dump-ports and dump-ports-desc.

Change-Id: I2d3c42835a5ad0f5ebf540e8127762f466347c9c
(cherry picked from commit 6099401)
  • Loading branch information
fkakuma committed May 19, 2016
commit 23f5d5c2abe10447f5ffb2895e517bf4f6f1bc59
31 changes: 27 additions & 4 deletions tools/worlddump.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,24 @@ def _header(name):
print


# This method gets a max openflow version supported by openvswitch.
# For example 'ovs-ofctl --version' displays the following:
#
# ovs-ofctl (Open vSwitch) 2.0.2
# Compiled Dec 9 2015 14:08:08
# OpenFlow versions 0x1:0x4
#
# The above shows that openvswitch supports from OpenFlow10 to OpenFlow13.
# This method gets max version searching 'OpenFlow versions 0x1:0x'.
# And return a version value converted to an integer type.
def _get_ofp_version():
process = subprocess.Popen(['ovs-ofctl', '--version'], stdout=subprocess.PIPE)
stdout, _ = process.communicate()
find_str = 'OpenFlow versions 0x1:0x'
offset = stdout.find(find_str)
return int(stdout[offset + len(find_str):-1]) - 1


def disk_space():
# the df output
_header("File System Summary")
Expand Down Expand Up @@ -143,11 +161,16 @@ def ovs_dump():
# grenade), so there is no single place to determine the bridge names from.
# Hardcode for now.
bridges = ('br-int', 'br-tun', 'br-ex')
ofctl_cmds = ('show', 'dump-ports-desc', 'dump-ports', 'dump-flows')
ofp_max = _get_ofp_version()
vers = 'OpenFlow10'
for i in range(ofp_max + 1):
vers += ',OpenFlow1' + str(i)
_dump_cmd("sudo ovs-vsctl show")
for bridge in bridges:
_dump_cmd("sudo ovs-ofctl show %s" % bridge)
for bridge in bridges:
_dump_cmd("sudo ovs-ofctl dump-flows %s" % bridge)
for ofctl_cmd in ofctl_cmds:
for bridge in bridges:
args = {'vers': vers, 'cmd': ofctl_cmd, 'bridge': bridge}
_dump_cmd("sudo ovs-ofctl --protocols=%(vers)s %(cmd)s %(bridge)s" % args)


def process_list():
Expand Down