From c17c04df0b33fc502dce97d31c03699799d54d24 Mon Sep 17 00:00:00 2001 From: Robb Manes Date: Thu, 15 Jun 2017 13:10:37 -0400 Subject: [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 (minor style tweaks) Signed-off-by: Bryn M. Reeves --- sos/plugins/openvswitch.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) 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): -- cgit