[ovs-dev] [PATCH v11 3/3] ovs-bugtool: Script to collect the port statistics

Sriram Vatala sriram.v at altencalsoftlabs.com
Tue Oct 29 14:50:06 UTC 2019


Sometimes, analysing the drop statistics of the ports
will be helpful in debugging. This patch adds script
to collect all supported port stats which also includes
the drop counters in userspace datapath. The output of
this script is included in the bugtool output.

Signed-off-by: Sriram Vatala <sriram.v at altencalsoftlabs.com>
---
 utilities/bugtool/automake.mk                     |  3 ++-
 utilities/bugtool/ovs-bugtool-get-port-stats      | 15 +++++++++++++++
 .../plugins/network-status/openvswitch.xml        |  1 +
 3 files changed, 18 insertions(+), 1 deletion(-)
 create mode 100755 utilities/bugtool/ovs-bugtool-get-port-stats

diff --git a/utilities/bugtool/automake.mk b/utilities/bugtool/automake.mk
index 4c85b9cba..0a9b93088 100644
--- a/utilities/bugtool/automake.mk
+++ b/utilities/bugtool/automake.mk
@@ -21,7 +21,8 @@ bugtool_scripts = \
 	utilities/bugtool/ovs-bugtool-ovs-bridge-datapath-type \
 	utilities/bugtool/ovs-bugtool-ovs-vswitchd-threads-affinity \
 	utilities/bugtool/ovs-bugtool-qos-configs \
-	utilities/bugtool/ovs-bugtool-get-dpdk-nic-numa
+	utilities/bugtool/ovs-bugtool-get-dpdk-nic-numa \
+	utilities/bugtool/ovs-bugtool-get-port-stats
 
 scripts_SCRIPTS += $(bugtool_scripts)
 
diff --git a/utilities/bugtool/ovs-bugtool-get-port-stats b/utilities/bugtool/ovs-bugtool-get-port-stats
new file mode 100755
index 000000000..23e61034e
--- /dev/null
+++ b/utilities/bugtool/ovs-bugtool-get-port-stats
@@ -0,0 +1,15 @@
+#! /bin/bash
+
+#Iterate through each port of every bridge and print
+#the port statistics
+
+for bridge in `ovs-vsctl -- --real list-br`
+do
+    echo "${bridge} : "
+    echo "  ${bridge} : `ovs-vsctl get interface ${bridge} statistics`"
+    for iface in `ovs-vsctl list-ifaces ${bridge}`
+    do
+        echo "  ${iface} : `ovs-vsctl get interface ${iface} statistics`"
+    done
+    echo -e "\n"
+done
diff --git a/utilities/bugtool/plugins/network-status/openvswitch.xml b/utilities/bugtool/plugins/network-status/openvswitch.xml
index b0e7a1510..72aa44930 100644
--- a/utilities/bugtool/plugins/network-status/openvswitch.xml
+++ b/utilities/bugtool/plugins/network-status/openvswitch.xml
@@ -41,4 +41,5 @@
     <command label="ovs-ofctl-dump-group-stats" filters="ovs" repeat="2">/usr/share/openvswitch/scripts/ovs-bugtool-ovs-ofctl-loop-over-bridges "dump-group-stats"</command>
     <command label="get_dpdk_nic_numa" filters="ovs">/usr/share/openvswitch/scripts/ovs-bugtool-get-dpdk-nic-numa</command>
     <command label="get_device_stats" filters="ovs">ip -s -s link show</command>
+    <command label="get_port_stats" filters="ovs">/usr/share/openvswitch/scripts/ovs-bugtool-get-port-stats</command>
 </collect>
-- 
2.20.1



More information about the dev mailing list