diff options
author | Robb Manes <robb.manes@gmail.com> | 2017-06-15 13:10:37 -0400 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2017-08-08 16:25:12 +0100 |
commit | c17c04df0b33fc502dce97d31c03699799d54d24 (patch) | |
tree | f82594ae1bb631be8b640aee959695d9c4cd94dd | |
parent | 32e462a5e1495f36e4107324c6f656c5f7db06ec (diff) | |
download | sos-c17c04df0b33fc502dce97d31c03699799d54d24.tar.gz |
[openvswitch] get specific flow version commands
The output of ovs-ofctl varies depending on the version of OpenFlow you
query it with. Using the currently supported versions, retrieve
ovs-ofctl output for each ovs-bridge depending on which specified
versions of OpenFlow are in use.
Signed-off-by: Robb Manes <rmanes@redhat.com>
(minor style tweaks)
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/plugins/openvswitch.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/sos/plugins/openvswitch.py b/sos/plugins/openvswitch.py index b2083ff7..e50111ac 100644 --- a/sos/plugins/openvswitch.py +++ b/sos/plugins/openvswitch.py @@ -96,6 +96,32 @@ class OpenVSwitch(Plugin): "ovs-ofctl show %s" % br ]) + # Flow protocols currently supported + flow_versions = [ + "OpenFlow10", + "OpenFlow11", + "OpenFlow12", + "OpenFlow13" + ] + + # List protocols currently in use, if any + ovs_list_bridge_cmd = "ovs-vsctl list bridge %s" % br + br_info_file = self.get_cmd_output_now(ovs_list_bridge_cmd) + + br_info = open(br_info_file).read() + for line in br_info.splitlines(): + if "protocols" in line: + br_protos_ln = line[line.find("[")+1:line.find("]")] + br_protos = br_protos_ln.replace('"', '').split(", ") + + # Collect flow information for relevant protocol versions only + for flow in flow_versions: + if flow in br_protos: + self.add_cmd_output([ + "ovs-ofctl -O %s dump-flows %s" % (flow, br), + "ovs-ofctl -O %s dump-ports-desc %s" % (flow, br) + ]) + class RedHatOpenVSwitch(OpenVSwitch, RedHatPlugin): |