On 10/1/24 10:44, Adrián Moreno via discuss wrote: > On Mon, Sep 30, 2024 at 01:52:13PM GMT, Harald Albrecht via discuss wrote: >> My "quest" is to discover the topology of OVS switches and their netdev ports >> to provide some (albeit limited) OVS-related information to users of the >> Ghostwire Linux kernel networking discovery engine >> (https://github.com/siemens/ >> ghostwire). This engine is used, for instance, by containerlab (https:// >> containerlab.dev/) users to quickly pick and "shoot" their capture targets in >> containers acting as routers. >> >> Before asking here I've searched for information in the OVS documentation >> itself, trying to find other sources, and looked at the ovs_vport NETLINK >> generic family description (https://docs.kernel.org/networking/netlink_spec/ >> ovs_vport.html). >> >> What I would like to achieve: discover which netdev-based network interfaces >> are related to which OVS bridge instances. What I have to avoid is bringing >> in >> user-space CLI binaries that produce stdout output and then having to parse >> this output, as it is at least slow and has turned out to be a nightmare in >> other similar situations (podman is an infamous example here). >> >> The current discovery sees a "master"-"slave" relationship between the >> "system" >> OVS kernel bridge and all netdev-based ports of all the other OVS kernel >> bridges. This differs from Linux stock kernel bridges where this relationship >> uniquely represents the switch-port topology. Reading >> https://docs.kernel.org/ >> networking/netlink_spec/ovs_vport.html I'm at a loss at how to figure out >> which >> OVS kernel bridge a netdev port has been attached to. Can you please be so >> kind >> as to point me to information that I've missed or maybe give me here more >> information on how I can discover this topology without the need for >> user-space >> CLI tools? >> >> With best regards, >> TheDiveO >> > > Hi Harald, > > A similar discussion occurred on netdev recently. > The OVS kernel datapath does not contain any "logical" topology > information (i.e: bridges, ports, etc). Furthermore, internal interfaces > called after OpenFlow bridges are not stacked under "ovs-system".
Note also, that some datapath ports, like tunnel backing interfaces, can represent multiple OpenFlow ports from multiple bridges. So, they cannot be associated with a single OVS bridge at all. > > From netlink, the best you can get is the list of OVS-managed netdevs. > To extract the OpenFlow topology, you need to use the OpenFlow API, > in userspace or look at the OVSDB. You should be able to access both > programatically without parsing the output of CLI tools. > > Thanks. > Adrián > >> _______________________________________________ >> discuss mailing list >> disc...@openvswitch.org >> https://mail.openvswitch.org/mailman/listinfo/ovs-discuss > > _______________________________________________ > discuss mailing list > disc...@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-discuss _______________________________________________ discuss mailing list disc...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-discuss