Comment 13 for bug 1912844

Revision history for this message
Frode Nordahl (fnordahl) wrote :

Particulars about what role a Open vSwitch port/interface has is unfortunately not exposed through sysfs nor iproute2 tools POV. Open vSwitch and its data path driver would manage that based on configuration stored in Open vSwitch.

If it is sufficient to know that this is a Open vSwitch managed port I guess we could get that from udev, for example:

# udevadm info /sys/class/net/enp6s0.9
P: /devices/virtual/net/enp6s0.9
L: 0
E: DEVPATH=/devices/virtual/net/enp6s0.9
E: INTERFACE=enp6s0.9
E: IFINDEX=7
E: SUBSYSTEM=net
E: USEC_INITIALIZED=229384665
E: ID_MM_CANDIDATE=1
E: ID_NET_NAMING_SCHEME=v245
E: ID_NET_DRIVER=openvswitch
E: ID_NET_LINK_FILE=/usr/lib/systemd/network/99-default.link
E: SYSTEMD_ALIAS=/sys/subsystem/net/devices/enp6s0.9
E: TAGS=:systemd:

If you really need to know the specific role the port has you would have to query Open vSwitch:

Create a Open vSwitch vlan interface:
# ovs-vsctl add-br br0
# ovs-vsctl add-port br0 enp6s0
# ovs-vsctl add-port br0 enp6s0.9 tag=9 -- set interface enp6s0.9 type=internal

Alternatively you could do the same with "fake bridges" which allows for a slightly different CLI experience, I think netplan does the latter. Anyway, the underlying data structures inside Open vSwitch should be similar.

# ovs-vsctl find interface name=enp6s0.9
_uuid : 72ce2c2e-d004-4b07-8c81-c7f688508040
admin_state : down
bfd : {}
bfd_status : {}
cfm_fault : []
cfm_fault_status : []
cfm_flap_count : []
cfm_health : []
cfm_mpid : []
cfm_remote_mpids : []
cfm_remote_opstate : []
duplex : []
error : []
external_ids : {}
ifindex : 7
ingress_policing_burst: 0
ingress_policing_rate: 0
lacp_current : []
link_resets : 0
link_speed : []
link_state : down
lldp : {}
mac : []
mac_in_use : "d2:27:14:2d:60:88"
mtu : 1500
mtu_request : []
name : enp6s0.9
ofport : 2
ofport_request : []
options : {}
other_config : {}
statistics : {collisions=0, rx_bytes=0, rx_crc_err=0, rx_dropped=0, rx_errors=0, rx_frame_err=0, rx_missed_errors=0, rx_over_err=0, rx_packets=0, tx_bytes=0, tx_dropped=0, tx_errors=0, tx_packets=0}
status : {driver_name=openvswitch}
type : internal

# ovs-vsctl find port name=enp6s0.9
_uuid : 2c9e20de-53de-456e-9c32-f1541c9d3982
bond_active_slave : []
bond_downdelay : 0
bond_fake_iface : false
bond_mode : []
bond_updelay : 0
cvlans : []
external_ids : {}
fake_bridge : false
interfaces : [72ce2c2e-d004-4b07-8c81-c7f688508040]
lacp : []
mac : []
name : enp6s0.9
other_config : {}
protected : false
qos : []
rstp_statistics : {}
rstp_status : {}
statistics : {}
status : {}
tag : 9
trunks : []
vlan_mode : []

# ovs-vsctl port-to-br enp6s0.9
br0

# ovs-vsctl find bridge name=br0
_uuid : 4c807016-98b8-43bf-aadf-8d80c7a73aff
auto_attach : []
controller : []
datapath_id : "000000163e96aa14"
datapath_type : ""
datapath_version : "<unknown>"
external_ids : {}
fail_mode : []
flood_vlans : []
flow_tables : {}
ipfix : []
mcast_snooping_enable: false
mirrors : []
name : br0
netflow : []
other_config : {}
ports : [2c9e20de-53de-456e-9c32-f1541c9d3982, bbcdb1a8-4fc8-4e4e-89c9-5150f7146e7b, c823daf6-b1e6-45fa-9e27-10b15e244ede]
protocols : []
rstp_enable : false
rstp_status : {}
sflow : []
status : {}
stp_enable : false

# ovs-vsctl show
e7c3bd47-dc4d-495a-914e-66e049a66a82
    Bridge br0
        Port enp6s0.9
            tag: 9
            Interface enp6s0.9
                type: internal
        Port enp6s0.10
            tag: 10
            Interface enp6s0.10
                type: internal
        Port br0
            Interface br0
                type: internal
        Port enp6s0
            Interface enp6s0
    ovs_version: "2.13.1"