Description

Analysing Openvswitch flow tables can be hard, particularly if they are large. This tool organises the contents of an Openvswitch switch - such as flows and ports - into a filesystem structure so that conventional tools like find, ls and grep can be used to perform queries and provide a more intuitive visualisation of an ovs switch.

Run ovs-stat on a system running openvswitch or against a sosreport containing ovs data (i.e. sos_commands/openvswitch must exist in your sosreport) and it will create a "dataset" - a sysfs-style representation of bridges, ports, flows etc - along with a summary of what the switch looks like. You can then use built-in commands e.g. --tree to display the dataset or --compress to create a tarball for export. A dataset root can contain one or more hostnames representing data from one or more hosts/sosreports allowing for queries to be run against data from multiple hosts at once.

Install:

NOTE: a recent version of snapd is needed to get latest support for ovs interface hence why we use the snap version since distro apt package may not be sufficient.

sudo snap install snapd ovs-stat

sudo snap connect ovs-stat:openvswitch

sudo snap connect ovs-stat:network-control

NOTE: if analysing sosreport data, you do not need these interfaces but if your sosreport lives on a separate/remote filesystem you will need the following interface:

sudo snap connect ovs-stat:removable-media

Usage Examples:

sudo ovs-stat -p /tmp/results # create dataset from local host and prints summary

sudo ovs-stat -p /tmp/results --tree # create dataset, print summary and run tree command against dataset

ovs-stat -p /tmp/results mysosreport # creates dataset from sosreport. note that we don't use sudo for this.

Using a path (-p) that contains an existing dataset will switch to read-only mode and will not clobber existing data. To refresh an existing dataset will need to use --overwrite.

NOTE: because running commands against an openvswitch is typically root-only and because a strictly confined snap can only access the $HOME of the current user, we need to use a location outside $HOME such as /tmp so that the snap can access the path as root.

NOTE: root only needed if running on live openvswitch e.g. for sosreport you can do:

ovs-stat -p results /path/to/sosreport-hostA

ovs-stat -p results --host HostA --tree

find results -name tap-foo

ls results/*/ovs/ports/*

Troubleshooting

If your dataset is empty or you see a bunch of "permission denied" make sure you have added the necessary interface connections (see Install section).

If you are running ovs-stat against a sosreport make sure not to use sudo (since snap can only access your $HOME).

If you run the snap on Ubuntu Unity desktop you are likely to see the following message which is due to a known issue with gtk3 and is also benign:

ERROR: ld.so: object 'libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded (failed to map segment from shared object): ignored.

You can make it go away by adding the following to your .bashrc:

export LD_PRELOAD=$LD_PRELOAD:/usr/lib/x86_64-linux-gnu/libgtk3-nocsd.so.0

Get it from the Snap Store

Search for another snap, or go back to the homepage.