Organise Openvswitch switch contents - bridges, ports, flows etc - into a filesystem structure to make it easy to query either using built-in commands or conventional tools like find and grep. Built-in tools exist to query Openstack and build ovs-appctl ofproto/trace commands.
Use ovs-stat on a host running openvswitch or a sosreport containing ovs data (requires openvswitch and networking plugin output). The result is a "dataset" - a sysfs-style representation of the switch - along with a summary of key attributes. This structure can then be queried manually or by using the built-in queries provided. It can also be viewed as a tree using the --tree command or exported as a tarball. Each dataset is keyed by hostname so that you can build a catalog of datasets from multiple hosts to allow searching across them.
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 ovs-stat
sudo snap connect ovs-stat:openvswitch
sudo snap connect ovs-stat:network-control
NOTE: the above interfaces are needed for a live ovs. If analysing sosreport data and your sosreport lives on a separate/remote filesystem you only need the following:
sudo snap connect ovs-stat:removable-media
Usage Examples:
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: because this is a snap, /tmp/results is converted to /tmp/snap.ovs-stat/tmp/results under the hood
Create dataset from local host and prints summary
sudo ovs-stat
Display an existing dataset using tree command
sudo ovs-stat -p /tmp/results --tree
Create dataset from sosreport. note that we don't use sudo for this.`
ovs-stat -p /tmp/results /path/to/sosreport
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 you will need to use --force.
Create dataset from local host and include openstack assertions
sudo ovs-stat -p /tmp/results --openstack
Show all Openstack ports on a bridge br-int
ovs-stat -p /tmp/results --query "openstack.ports br-int"
Show all Openstack ports on vlan 53
ovs-stat -p /tmp/results --query "openstack.ports 53"
Show all Neutron layer2-population flood tunnels for vlan 53
ovs-stat -p /tmp/results --query "openstack.l2pop 53"
Generate ofproto/trace commands for a given port
$ ovs-stat -p ./mydataset --query "ofproto-trace.port tapa05cfc36-21 dhcp"
sudo ovs-appctl ofproto/trace br-int udp,in_port=157,dl_src=b3:22:2f:03:42:5d,dl_dst=ff:ff:ff:ff:ff:ff,nw_src=0.0.0.0,nw_dst=255.255.255.255,udp_src=68,udp_dst=67
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).
Thank you for your report. Information you provided will help us investigate further.
There was an error while sending your report. Please try again later.
You are about to open
Do you wish to proceed?
Snaps are applications packaged with all their dependencies to run on all popular Linux distributions from a single build. They update automatically and roll back gracefully.
Snaps are discoverable and installable from the Snap Store, an app store with an audience of millions.
Snap is available for Red Hat Enterprise Linux (RHEL) 8 and RHEL 7, from the 7.6 release onward.
The packages for RHEL 7, RHEL 8, and RHEL 9 are in each distribution’s respective Extra Packages for Enterprise Linux (EPEL) repository. The instructions for adding this repository diverge slightly between RHEL 7, RHEL 8 and RHEL 9, which is why they’re listed separately below.
The EPEL repository can be added to RHEL 9 with the following command:
sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
sudo dnf upgrade
The EPEL repository can be added to RHEL 8 with the following command:
sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo dnf upgrade
The EPEL repository can be added to RHEL 7 with the following command:
sudo rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Adding the optional and extras repositories is also recommended:
sudo subscription-manager repos --enable "rhel-*-optional-rpms" --enable "rhel-*-extras-rpms"
sudo yum update
Snap can now be installed as follows:
sudo yum install snapd
Once installed, the systemd unit that manages the main snap communication socket needs to be enabled:
sudo systemctl enable --now snapd.socket
To enable classic snap support, enter the following to create a symbolic link between /var/lib/snapd/snap
and /snap
:
sudo ln -s /var/lib/snapd/snap /snap
Either log out and back in again or restart your system to ensure snap’s paths are updated correctly.
To install ovs-stat, simply use the following command:
sudo snap install ovs-stat
Browse and find snaps from the convenience of your desktop using the snap store snap.
Interested to find out more about snaps? Want to publish your own application? Visit snapcraft.io now.
Get to know Canonical, the company behind the products.
The world's favourite Linux OS for servers, desktops and IoT.
One subscription for security maintenance, support, FIPS and other compliance certifications.
The app store for Linux: secure packages and ultra-reliable updates.
A pure-container hypervisor. Run system containers and VMs at scale.
Build a bare metal cloud with super fast server provisioning.
Upgrades, maintenance, support, and fully managed options for long-term, low-cost infra.
Software-defined storage that lowers your total cost of ownership.
App portability for K8s on VMware, Amazon, Azure, Google, Oracle, IBM and bare metal.
Deploy, integrate and manage applications at any scale, on any infrastructure.
Stream Android applications to any device.
The software collaboration platform behind Ubuntu.
Optimised Ubuntu for public clouds.
Spin up Ubuntu VMs on Windows, Mac and Linux.
Control and customise your cloud instances.
Systems management and security patching for Ubuntu.
Simplify and standardise complex network configuration.
AI and MLOps at any scale, on any cloud.
Deploy a fully functional cloud in minutes.