Skip to content

Instantly share code, notes, and snippets.

@odivlad
Last active December 29, 2023 07:07
Show Gist options
  • Save odivlad/302d30e333ac2296850827bf4917913a to your computer and use it in GitHub Desktop.
Save odivlad/302d30e333ac2296850827bf4917913a to your computer and use it in GitHub Desktop.
OVN cheat sheet

Manpages

Architecture:

man ovn-architecture

OVN_Northbound:

man ovn-nb

OVN_Southbound:

man ovn-sb

... same for OVN_IC.

Northbound commands

Show database (LRs, LSs, NAT, addresses):

ovn-nbctl show
ovn-nbctl show <LS uuid>/<LS name>/<LR uuid>/<LR name>

Southbound commands

Show chassis and claimed ports:

ovn-sbctl show

Logical Flow actions details:

man ovn-sb
/Logical_Flow TABLE

Logical Flow pipeline stages description:

man ovn-northd
/LOGICAL FLOW TABLE STRUCTURE

OVSDB

Query OVSDB

Pure OVSDB:

ovsdb-client dump
ovsdb-client dump <table_name>
ovsdb-client dump unix:///run/ovn/ovnnb_db.sock <table_name> 

For DB-specific: ovn northbound:

ovn-nbctl list logical-router
ovn-nbctl list logical-router <uuid>/<name>
ovs-vsctl list interface br-int

Search all routes by ip_prefix and nexthop:

ovn-nbctl find logical-router-static-route ip_prefix=<cidr> nexthop=<nexthop>

Upgrade database schema

For standalone/active-standby:

ovsdb-tool convert Open_vSwitch /usr/share/openvswitch/vswitch.ovsschema

For clustered DB:

ovsdb-client -t 30 convert unix:///run/ovn/ovnnb_db.sock /usr/share/ovn/ovn-nb.ovsschema

View ovsdb queries in logs

ovs-appctl -t /var/run/ovn/ovnnb_db.ctl vlog/set file:jsonrpc:info

OpenFlow

Dump openflow table for br-int:

ovs-ofctl dump-flows br-int

Dump only table 8:

ovs-ofctl dump-flows br-int table=8

Datapath flows

Dump full ovs DP cache flows (for simplicity, pass --names to see real ports names):

ovs-dpctl dump-flows --names

Trace DP flow against openflow tables:

ovs-appctl ofproto/trace '<dp flow match portion>'

Trace DP flow against openflow with OVN:

ovs-appctl ofproto/trace '<dp flow match portion>' | ovn-detrace

OVS daemons

ctl socket

List supported commands

ovs-appctl -t ovs-vswitchd list-commands

Show bfd information

ovs-appctl -t ovs-vswitchd bfd/show

View NB cluster status:

ovs-appctl -t /run/ovn/ovnnb_db.ctl cluster/status OVN_Northbound

View SB cluster status:

ovs-appctl -t /run/ovn/ovnsb_db.ctl cluster/status OVN_Southbound
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment