Analysing Openvswitch flow tables can be hard, particularly if they are large. This tool organises information from 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 the configuration 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 of the dataset 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.
NOTE: recent version of snapd needed to get latest support for ovs interface hence why 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 any interfaces connected but if your sosreport lives on a separate filesystem you will need the following interface:
sudo snap connect ovs-stat:removable-media
sudo ovs-stat -p /tmp/results # creates dataset and prints summary
sudo ovs-stat -p /tmp/results --tree # creates dataset, prints summary and runs tree command against dataset
NOTE: because we need to use root for live ovs 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 /path/to/sosreport-hostB
ovs-stat -p results --host HostA --tree
ovs-stat -p results --host HostB --tree
find results -name tap-foo
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 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: