Analyze OVS data from sosreport (text files or database)
Analyzes Open vSwitch data from sosreports to identify topology, flows, drops, and configuration issues.
/plugin marketplace add openshift-eng/ai-helpers/plugin install sosreport@ai-helpers[sosreport-path] [--db] [--flows-only] [--query <json>]sosreport:ovs-db
/sosreport:ovs-db [sosreport-path] [--db] [--flows-only] [--query <json>]
The ovs-db command analyzes Open vSwitch data collected in sosreports. It operates in four modes:
--db): Database only - analyze conf.db (requires ovsdb-tool)--flows-only): Text files only - no ovsdb-tool needed!--query): Run custom OVSDB JSON queries (requires ovsdb-tool)What it analyzes:
--db Mode)--flows-only Mode)ovs-vsctl list Open_vSwitch)ovs-vsctl show)ovs-vsctl list bridge)ovs-vsctl list interface)ovs-ofctl dump-flows)ovs-ofctl dump-ports)ovs-appctl tnl.ports.show)ovs-appctl upcall.show)ovs-appctl coverage.show)--query Mode)Modes of operation:
--db): Database only - analyze conf.db (requires ovsdb-tool)--flows-only): Text files only - no ovsdb-tool needed--query): Run custom OVSDB JSON queries (requires ovsdb-tool)Default mode (full analysis):
ovsdb-tool must be installed (from openvswitch package)--flows-only if ovsdb-tool not foundsos_commands/openvswitch/ directory and conf.dbDatabase mode (--db):
ovsdb-tool must be installed (from openvswitch package)
which ovsdb-toolsudo dnf install openvswitchsudo apt install openvswitch-commonconf.db fileText files mode (--flows-only):
sos_commands/openvswitch/ directoryQuery mode (--query):
ovsdb-tool must be installed--flows-onlySosreport Data:
The sosreport should contain:
sosreport-hostname-date/
├── etc/openvswitch/conf.db (for --db mode)
│ OR var/lib/openvswitch/conf.db
└── sos_commands/openvswitch/ (default mode)
├── ovs-vsctl_-t_5_show (topology)
├── ovs-vsctl_-t_5_list_* (tables)
├── ovs-ofctl_dump-flows_<bridge> (flows)
├── ovs-ofctl_dump-ports_<bridge> (port stats)
├── ovs-appctl_coverage.show (internal stats)
├── ovs-appctl_upcall.show (datapath health)
└── ...
Analysis Script:
The script is bundled with this plugin:
<plugin-root>/skills/ovs-db-analysis/scripts/analyze_ovs_db.py
The command performs the following steps:
Locate Analysis Script:
SCRIPT_PATH=$(find ~ -name "analyze_ovs_db.py" -path "*/sosreport/skills/ovs-db-analysis/scripts/*" 2>/dev/null | head -1)
if [ -z "$SCRIPT_PATH" ]; then
echo "ERROR: analyze_ovs_db.py script not found."
exit 1
fi
Handle Input Path:
.tar.gz, .tar.xz): Extract to temporary directoryconf.db file: Use database mode automaticallyRun Analysis:
sos_commands/openvswitch/conf.db using ovsdb-toolAnalyze Data:
--flows-only modes)The command outputs structured analysis:
================================================================================
OVS ANALYSIS - sosreport-hostname-2024-01-15
================================================================================
Mode: Text file analysis (no ovsdb-tool required)
================================================================================
OVS SYSTEM INFORMATION
================================================================================
Field Value
------------------------- --------------------------------------------------
OVS Version "3.3.4-62.el9fdp"
DB Version "8.5.0"
System Type rhcos
System Version "4.16"
DPDK Initialized false
Datapath Types [netdev, system]
External IDs:
hostname: master2.example.com
ovn-encap-ip: 10.32.110.5
ovn-encap-type: geneve
ovn-bridge-mappings: physnet:br-ex
================================================================================
OVS TOPOLOGY
================================================================================
System UUID: 7e9a3f70-86fa-4578-a849-4fd807a64a10
Total Bridges: 2
Bridge: br-ex
ports: 3
internal: br-ex
patch: patch-br-ex-to-br-int
system: nm-bond
Bridge: br-int
fail_mode: secure
datapath_type: system
ports: 12
geneve: 9 ports
internal: ovn-k8s-mp0, br-int
patch: patch-br-int-to-br-ex
================================================================================
BRIDGE DETAILS
================================================================================
Bridge: br-int
------------------------------------------------------------
Datapath: system (kernelspace)
Fail Mode: secure
Datapath ID: "00005ac5dfc26094"
Port Count: 12
CT Zones: 19
================================================================================
INTERFACE ANALYSIS
================================================================================
Total Interfaces: 15
By Type:
geneve: 9 interfaces
internal: br-int, ovn-k8s-mp0, br-ex
patch: patch-br-ex-to-br-int, patch-br-int-to-br-ex
system: nm-bond
Pod Interfaces: 0
----------------------------------------------------------------------
(none on this node)
================================================================================
OPENFLOW ANALYSIS
================================================================================
Bridge: br-int
----------------------------------------------------------------------
Total flows: 2,017
Flows with hits: 318
Drop flows: 150 (9 actively dropping)
Tables used: 53 (0-79)
Top tables by flow count:
Table 21: 200 flows
Table 13: 163 flows
⚠️ ACTIVE DROP FLOWS (9):
table=40, priority=0, packets=8,105
table=79, priority=100, packets=1,356
match: ip,reg14=0x2,metadata=0x5,dl_src=00:62:0b:ea:b5:e0
--------------------------------------------------------------------------------
PORT STATISTICS
--------------------------------------------------------------------------------
Bridge: br-int
Total ports: 12
⚠️ Ports with drops/errors:
Port 1: drops=11, errors=0
RX: 852 pkts, 23,856 bytes
TX: 7 pkts, 826 bytes
--------------------------------------------------------------------------------
DATAPATH FLOW TABLE HEALTH
--------------------------------------------------------------------------------
Current flows: 155 / 200,000 (0.1% used)
Average: 156, Max seen: 215
✓ Flow table healthy
--------------------------------------------------------------------------------
OVS INTERNAL STATISTICS
--------------------------------------------------------------------------------
METRIC DESCRIPTION TOTAL RATE/s
------------------------- ----------------------------------- --------------- ----------
netlink_sent Netlink messages sent 46,153 12.8
netlink_received Netlink messages received 56,078 15.5
txn_success OVSDB transactions (success) 471 0.1
Full analysis (requires ovsdb-tool):
/sosreport:ovs-db /tmp/sosreport-server01-2024-01-15/
Analyzes conf.db + all text files. Falls back to text files if ovsdb-tool not installed.
Analyze from archive:
/sosreport:ovs-db /tmp/sosreport-server01-2024-01-15.tar.xz
Extracts and runs full analysis.
--db)Database only (requires ovsdb-tool):
/sosreport:ovs-db /tmp/sosreport/ --db
Queries conf.db only - no flow analysis.
Analyze conf.db directly:
/sosreport:ovs-db /var/lib/openvswitch/conf.db
Automatically uses database mode.
--flows-only)/sosreport:ovs-db /tmp/sosreport/ --flows-only
Parses all text files in sos_commands/openvswitch/.--query)Query all bridges:
/sosreport:ovs-db /tmp/sosreport/ --query '["Open_vSwitch", {"op":"select", "table":"Bridge", "where":[], "columns":["name","datapath_type"]}]'
Query VXLAN tunnels:
/sosreport:ovs-db /tmp/sosreport/ --query '["Open_vSwitch", {"op":"select", "table":"Interface", "where":[["type","==","vxlan"]], "columns":["name","options"]}]'
Check interface errors:
/sosreport:ovs-db /tmp/sosreport/ --query '["Open_vSwitch", {"op":"select", "table":"Interface", "where":[], "columns":["name","error","link_state"]}]'
Check DPDK configuration:
/sosreport:ovs-db /tmp/sosreport/ --query '["Open_vSwitch", {"op":"select", "table":"Open_vSwitch", "where":[], "columns":["dpdk_initialized","other_config"]}]'
Missing ovsdb-tool (only for --db mode):
Error: ovsdb-tool not found. Please install openvswitch package.
Fedora/RHEL: sudo dnf install openvswitch
Ubuntu/Debian: sudo apt install openvswitch-common
Solution: Either install ovsdb-tool or use default mode (without --db).
sos_commands/openvswitch not found:
Error: sos_commands/openvswitch not found in /path/to/sosreport
Solution: Ensure the sosreport has OVS data collected.
conf.db not found (for --db mode):
Error: conf.db not found in /path/to/sosreport
Looked for conf.db in:
- etc/openvswitch/conf.db
- var/lib/openvswitch/conf.db
Tip: Run without --db to analyze text files only
--db) analyzes conf.db only, requires ovsdb-tool--flows-only) parses text files only - no special tools needed--query) runs raw OVSDB JSON queries, requires ovsdb-tool, incompatible with --flows-onlyexternal_ids and interface naming conventionsactions=drop that have packet hits["Open_vSwitch", {"op":"select", ...}]Troubleshoot Packet Drops:
Check Datapath Health:
Map Pods to Interfaces:
Investigate DPDK Configuration:
Debug OVN Connectivity:
Audit Configuration:
.tar.gz, .tar.xz), extracted directory, or direct conf.db file.--flows-only)./must-gather:ovn-dbs - For analyzing OVN Northbound/Southbound databases/sosreport:analyze - Comprehensive sosreport analysis/sosreport:analyze --only network - Network-focused analysis