Skip to content

Commit

Permalink
ovs-bugtool: Bugfix for bugtool plugin queries.
Browse files Browse the repository at this point in the history
Introducing 'ovs-bugtool-ovs-ofctl-loop-over-bridges' bash script.
It calls ovs-ofctl commands given as first parameter for each
bridge with the corresponding open flow protocol option.
Usage:
ovs-bugtool-ovs-ofctl-loop-over-bridges "param1" "param2"
 - param1: ovs-ofctl command to call (show, dump-flows, etc...)
 - param2: optional, add further parts for the shell command
   (like "| grep something")

Calling ovs-ofctl commands 'show' and 'dump-flows' with the
'ovs-bugtool-ovs-ofctl-loop-over-bridges' bash script.

Signed-off-by: David Patrik Pinter <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
Dávid Patrik Pintér authored and blp committed Jan 10, 2018
1 parent 092bc0f commit 97cb2cf
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 33 deletions.
3 changes: 1 addition & 2 deletions utilities/bugtool/automake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ bugtool_scripts = \
utilities/bugtool/ovs-bugtool-vsctl-show \
utilities/bugtool/ovs-bugtool-ovsdb-dump \
utilities/bugtool/ovs-bugtool-daemons-ver \
utilities/bugtool/ovs-bugtool-ovs-ofctl-show \
utilities/bugtool/ovs-bugtool-ovs-ofctl-dump-flows \
utilities/bugtool/ovs-bugtool-ovs-ofctl-loop-over-bridges \
utilities/bugtool/ovs-bugtool-ovs-appctl-dpif \
utilities/bugtool/ovs-bugtool-bond-show \
utilities/bugtool/ovs-bugtool-conntrack-dump
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
#! /bin/bash

# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General
Expand All @@ -14,11 +14,20 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA
#
# Copyright (C) 2013 Nicira, Inc.
# Copyright (C) 2017 Ericsson AB

for bridge in `ovs-vsctl list-br`
for bridge in `ovs-vsctl -- --real list-br`
do
echo "ovs-ofctl dump-flows ${bridge}"
ovs-ofctl dump-flows "$bridge"
PROTOCOLS="$(ovs-vsctl get Bridge "$bridge" protocols)"
if [ "$PROTOCOLS" = "[]" ]
then
echo "ovs-ofctl $1 ${bridge} $2"
eval ovs-ofctl $1 "${bridge}" $2
else
LENGTHPRO="$(expr length "$PROTOCOLS")"
COMMAIND="$(expr index "$PROTOCOLS" ,)"
echo "ovs-ofctl $1 -O${PROTOCOLS:${COMMAIND}+2:${LENGTHPRO}-${COMMAIND}-4} ${bridge} $2"
eval ovs-ofctl $1 -O"${PROTOCOLS:${COMMAIND}+2:${LENGTHPRO}-${COMMAIND}-4}" "${bridge}" $2
fi
echo ""
done
24 changes: 0 additions & 24 deletions utilities/bugtool/ovs-bugtool-ovs-ofctl-show

This file was deleted.

4 changes: 2 additions & 2 deletions utilities/bugtool/plugins/network-status/openvswitch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
<command label="ovs-appctl-coverage-show" filters="ovs">/usr/share/openvswitch/scripts/ovs-bugtool-coverage-show</command>
<command label="ovs-appctl-bond-show" filters="ovs">/usr/share/openvswitch/scripts/ovs-bugtool-bond-show</command>
<command label="ovs-appctl-memory-show" filters="ovs">/usr/share/openvswitch/scripts/ovs-bugtool-memory-show</command>
<command label="ovs-ofctl-show" filters="ovs">/usr/share/openvswitch/scripts/ovs-bugtool-ovs-ofctl-show</command>
<command label="ovs-ofctl-dump-flows" filters="ovs">/usr/share/openvswitch/scripts/ovs-bugtool-ovs-ofctl-dump-flows</command>
<command label="ovs-ofctl-show" filters="ovs">/usr/share/openvswitch/scripts/ovs-bugtool-ovs-ofctl-loop-over-bridges "show"</command>
<command label="ovs-ofctl-dump-flows" filters="ovs">/usr/share/openvswitch/scripts/ovs-bugtool-ovs-ofctl-loop-over-bridges "dump-flows"</command>
<command label="ovs-appctl-dpif" filters="ovs">/usr/share/openvswitch/scripts/ovs-bugtool-ovs-appctl-dpif</command>
<command label="ovs-appctl-list-dbs" filters="ovs">/usr/share/openvswitch/scripts/ovs-bugtool-list-dbs</command>
</collect>

0 comments on commit 97cb2cf

Please sign in to comment.