amorenoz / ovs-dbg

Scripts to help debug OVS and OVN
Apache License 2.0
22 stars 8 forks source link

[RFE] Install ovn package inside containers so it's not required on the host for ovs-offline #72

Closed lewisdenny closed 2 years ago

lewisdenny commented 2 years ago

Currently once the two ovsdb containers are running the instructions from the tool are to use the ovn* commands from the host and target the socket mounted from the container to the host.

❯ ovn-nbctl --db unix:/tmp/ovs-offline/var-run/ovn_nb/db.sock show
zsh: ovn-nbctl: command not found...
Install package 'ovn' to provide command 'ovn-nbctl'? [N/y] ^C

If we installed the OVN tools inside the container image we could check if the host has the ovn package installed and if not create two aliases like the following:

alias ovn-nbctl='podman exec ovsdb-server-ovn_nb ovn-nbctl --db=unix:/usr/local/var/run/openvswitch/db.sock'
alias ovn-sbctl='podman exec ovsdb-server-ovn_sb ovn-sbctl --db=unix:/usr/local/var/run/openvswitch/db.sock'

Results

❯ ovn-sbctl show
Chassis "4fdd83d2-63b4-4a98-a24f-b1cdb7a57136"
    hostname: overcloud-controller-0.localdomain
    Encap geneve
        ip: "172.16.0.69"
        options: {csum="true"}
Chassis "107da918-4d12-4661-b363-88bc3da6f367"
    hostname: overcloud-novacompute-0.localdomain
    Encap geneve
        ip: "172.16.0.242"
        options: {csum="true"}
[...]

❯ ovn-nbctl show
switch e6a8d460-c2e3-4d8b-bbfb-a58a0316f16b (neutron-f2d744b1-dc6e-469f-8023-074f0d3aa325) (aka homelab-network)
    port c51b6cd7-244f-4d2f-8281-ba7010ced1cf
        addresses: ["fa:16:3e:be:cf:c2 10.10.1.185"]
    port 72d927a5-7406-4ba5-b894-6d70c802a045
        addresses: ["fa:16:3e:6f:76:41 10.10.1.198"]
    port edd406e1-8035-4418-8f10-c0b89d7c4df2
        type: localport
        addresses: ["fa:16:3e:10:da:80 10.10.1.100"]
    port 99490ad8-65f1-4c0e-81ce-99e63506ba15
        type: router
        router-port: lrp-99490ad8-65f1-4c0e-81ce-99e63506ba15
[...]