SONiC containerlab: name the link endpoints ethN so docker-sonic-vs maps its ports - #3872
SONiC containerlab: name the link endpoints ethN so docker-sonic-vs maps its ports#3872roc-ops wants to merge 2 commits into
Conversation
…ts ports
docker-sonic-vs builds lanemap.ini/port_config.ini from the ethN netdevs present
at boot and syncd then creates a TAP named Ethernet<4n> per mapped port, bridged
to eth<n+1> -- the contract containerlab documents for the sonic-vs kind. The
device declared no clab.interface.name, so containerlab injected the veth as
Ethernet0 itself: the lane map came out empty, syncd failed to create every TAP
(TUNSETIFF: name in use), and SONiC port state and admin control were detached
from the link. "show interfaces status" reported oper/admin down on a port
carrying a Full OSPF adjacency, and "config interface shutdown" changed nothing.
Declare clab.interface.name eth{ifindex + 1} (ifindex starts at 0 here, eth0 is
management), as eos (et{ifindex}) and srlinux (e1-{ifindex}) do.
With the port a syncd TAP rather than the raw veth, CONFIG_DB reaches the netdev
again: the MTU goes back through "config interface mtu" (measured on a 9000-byte
link -- netdev, CONFIG_DB and APPL_DB all agree, an 8972-byte DF ping crosses)
and the loop that mirrored CONFIG_DB INTERFACE rows onto the netdev with
"ip addr add" is gone, because intfmgrd programs routed-port addresses. portmgrd
still leaves every front-panel port admin-down at boot, so "config interface
startup" stays, now issued for the ports the lab uses and under the script's
set -e. The vlan, lag and vxlan datapaths are out of scope: those features
are off on this device (vlan: False, lag: False, vxlan: false) and were not
re-measured.
A node now has two netdevs per link, and the kernel answers ARP for the port's
address on both of them, each with its own MAC. The neighbour caches whichever
replies first, so the port's address becomes reachable through a MAC that is not
the port's, and anything keyed on the port's MAC is left to chance -- measured,
"ip neigh" on the neighbour showed the veth's MAC, and with the sysctl it shows
the TAP's. arp_ignore=8 on each link's veth, set before the ports are addressed,
leaves the port as the only answerer. This surfaced on our fork as an SR-MPLS
L3VPN ping at 100% loss, MPLS input being enabled on the port only; upstream's
sonic device does not enable MPLS.
The transformation case pins the container name on the node interface and, by
covering the whole transformed topology, also pins that the node keeps its own
config_templates rather than inheriting FRR's bind mounts.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A containerlab SONiC node has two kernel interfaces per link: the wire veth ethN that containerlab creates and the port Ethernet<4n> that syncd bridges to it. Only the port is configured and addressed, and netlab suppresses ARP on the veth so neighbours resolve the port's MAC. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
31eff8b to
ef8f6be
Compare
|
This seems convoluted - having to manually orchestrate ARP ignores such that neighbors cache the correct MAC is hideous I don’t think this is the right solution (it’s additional problems and complexity that comes from AI not understanding design intent) |
|
Agreed, and thanks for the pushback. The Once that lands I will cut this PR down to netlab's part only: the |
docker-sonic-vsbuilds its front-panel port map from theethNnetdevs present when the container boots (eth1becomesEthernet0), andsyncdthen creates a TAP namedEthernet<4n>for each mapped port and bridges it to the veth. Thesonicdevice declared noclab.interface.name, so containerlab named the link endpointEthernet0itself: the lane map came out empty,syncdcould not create a single TAP, and SONiC's port objects had no relationship to the links --show interfaces statusreported a port down while it carried a Full OSPF adjacency, andconfig interface shutdowndid nothing.This PR declares
clab.interface.name: eth{ifindex + 1}, the same thingeosandsrlinuxdo. With the port a real TAP again, CONFIG_DB reaches the kernel: the initial template goes back toconfig interface mtuand drops the loop that mirrored CONFIG_DB routed-port addresses onto the netdev by hand. A node now has two netdevs per link and the kernel answers ARP for the port's address on both of them, each with its own MAC; the neighbour caches whichever answers first, so the port's address can end up reachable through a MAC that is not the port's. The template therefore setsarp_ignore=8on each wire veth before the ports are addressed, leaving the port as the only answerer. The vlan, lag and vxlan datapaths are out of scope here: those features are off on this device and were not re-measured.Verified:
lanemap.inipopulated, noTUNSETIFFerrors in syslog,show interfaces statusshows oper/admin up only on the two ports the lab uses, and OSPF reaches Full with both neighbours.sonic-clab-ifnames; the full transformation suite passes (303 passed, 1 skipped), as dorun-yamllint.shandrun-typing.sh.show interfaces statusall read 9000 on a 9000-byte link, and an 8972-byte DF ping crosses it.tests/integration/device-module-test -d sonic -p clab initial: every case that deploys a SONiC node passes. The rest abort innetlab createon the device's own declared feature gaps, and04-mtuneeds a cEOS image I do not have locally.One pre-existing issue is left alone on purpose:
initial/01-interfaceswarns that ashutdown: Trueinterface still pings on SONiC, because the vtysh block renders a bareno shutdownfor every interface.config interface shutdownworks now, so that is a separate one-line follow-up.🤖 Generated with Claude Code