Currently ovn-nbctl displays OVN (NB database) related information in two ways:
- custom show commands ("ovn-nbctl show", "ovn-nbctl lr-list", "ovn-nbctl lr-route-list", etc) that require custom handlers to display information in a nicely formatted way.
- "automatic" show commands implemented through OVS's db-ctl-base library.
The former require manual intervention every time a feature changes.
The latter only operate on single database tables. It would be useful to enhance this second type of commands in order to achieve a way of automatically traverse the links between database tables.
For example, listing a logical switch today looks like this:
$ ovn-nbctl list logical_switch sw0 _uuid : 70d89082-9c72-43f7-ba6c-711c189ab3fd acls : [c136b913-3268-4e3b-b435-307ea2eabb3f] copp : [] dns_records : [] external_ids : {} forwarding_groups : [] load_balancer : [] load_balancer_group : [] name : sw0 other_config : {} ports : [3ccb93dd-ce54-413d-ba1b-fac8f6d25a55, fcd6a74f-5187-4044-bc2b-a28d757c1079] qos_rules : []
But a better display might be:
$ ovn-nbctl --all list logical_switch sw0 _uuid : 70d89082-9c72-43f7-ba6c-711c189ab3fd acls : [ ACL1 ] copp : [] dns_records : [] external_ids : {} forwarding_groups : [] load_balancer : [] load_balancer_group : [] name : sw0 other_config : {} ports : [ PORT1, PORT2] qos_rules : []
Where ACL1 expands to the c136b913-3268-4e3b-b435-307ea2eabb3f NB.ACL record contents and PORT1 and PORT2 expand to the 3ccb93dd-ce54-413d-ba1b-fac8f6d25a55 and fcd6a74f-5187-4044-bc2b-a28d757c1079 NB.Logical_Switch_Port contents.
A potential way of doing that is expanding the IDL API that's automatically generated (https://github.com/ovn-org/ovn/blob/main/lib/ovsdb_automake.mk) with the help of ovsdb-idlc.in (https://github.com/openvswitch/ovs/blob/main/ovsdb/ovsdb-idlc.in) to also generate print functions for each table. These print functions could, based on the schema, automatically expand all database references.