Accessing OVN database content from Red Hat OpenStack Enviroment

Solution Verified - Updated -

Environment

  • Red Hat OpenStack v.13
  • Red Hat OpenStack v.14

Issue

  • How to access OVN Content from North and South bound databases?

Resolution

  • Run below script in the controller to extract switch content from OVN North-bound & South-bound databases.

    cat<<'EOF'>ovn-db.sh
    #!/bin/bash
    
    file=/tmp/ovn-db-content.txt
    >$file
    NB=`grep ^[^#] /var/lib/config-data/puppet-generated/neutron/etc/neutron/plugins/ml2/ml2_conf.ini | grep connection= | cut -d = -f 2 | grep 6641`
    SB=`grep ^[^#] /var/lib/config-data/puppet-generated/neutron/etc/neutron/plugins/ml2/ml2_conf.ini | grep connection= | cut -d = -f 2 | grep 6642`
    
    echo "OVN North Bound Endpoint" $NB | tee -a $file
    echo "OVN South Bound Endpoint" $SB | tee -a $file
    
    run_cmd() {
      echo -e "\n\n[`whoami`@`hostname`~]$ $1 " | tee -a $file
      eval "$1" | tee -a $file
    }
    
    run_cmd "hostname -f"
    run_cmd "ovn-nbctl --db=$NB show"
    run_cmd "ovn-sbctl --db=$SB show"
    run_cmd "ovn-nbctl --db=$NB list Logical_Switch"
    run_cmd "ovn-nbctl --db=$NB list Logical_Switch_Port"
    run_cmd "ovn-nbctl --db=$NB list ACL"
    run_cmd "ovn-nbctl --db=$NB list Address_Set"
    run_cmd "ovn-nbctl --db=$NB list Logical_Router"
    run_cmd "ovn-nbctl --db=$NB list Logical_Router_Port"
    run_cmd "ovn-nbctl --db=$NB list Gateway_Chassis"
    run_cmd "ovn-sbctl --db=$SB list Chassis"
    run_cmd "ovn-sbctl --db=$SB list Encap"
    run_cmd "ovn-nbctl --db=$NB list Address_Set"
    run_cmd "ovn-sbctl --db=$SB lflow-list"
    run_cmd "ovn-sbctl --db=$SB list Multicast_Group"
    run_cmd "ovn-sbctl --db=$SB list Datapath_Binding"
    run_cmd "ovn-sbctl --db=$SB list Port_Binding"
    run_cmd "ovn-sbctl --db=$SB list MAC_Binding"
    run_cmd "ovn-sbctl --db=$SB list Gateway_Chassis"
    run_cmd "ovsdb-client dump $SB Datapath_Binding"
    run_cmd "ovsdb-client dump $SB Gateway_Chassis"
    run_cmd "ovsdb-client dump $SB SB_Global"
    run_cmd "ovsdb-client dump $SB Address_Set"
    run_cmd "ovsdb-client dump $SB DHCP_Options"
    run_cmd "ovsdb-client dump $SB Chassis"
    EOF
    

Diagnostic Steps

  • Ensure the overcloud node has below package install whcih helps to query the OVN DB.

    # yum info openvswitch2.10-ovn-common
    Loaded plugins: product-id, search-disabled-repos, subscription-manager
    This system is not registered with an entitlement server. You can use subscription-manager to register.
    Installed Packages
    Name        : openvswitch2.10-ovn-common
    Arch        : x86_64
    Version     : 2.10.0
    Release     : 28.el7fdp.1
    Size        : 8.1 M
    Repo        : installed
    From repo   : rhelosp-14.0-puddle
    Summary     : Open vSwitch - Open Virtual Network support
    URL         : http://www.openvswitch.org/
    License     : ASL 2.0
    Description : Utilities that are use to diagnose and manage the OVN components.
    

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.