srl-labs / containerlab

container-based networking labs
https://containerlab.dev
BSD 3-Clause "New" or "Revised" License
1.54k stars 263 forks source link

Deploying lab with SRL nodes fails when attaching mgmt0 #1640

Closed pdumais closed 1 year ago

pdumais commented 1 year ago
# cat test1.yaml 
name: test1 
topology:
  kinds:
    srl:
      image: ghcr.io/nokia/srlinux:22.11.2
  nodes:
    POD1-LEAF01:
      kind: srl
        #type: ixrd3l
      network-mode: none
  links:
    - endpoints: ["POD1-LEAF01:mgmt0", "macvlan:eth2"]
# clab deploy -t test1.yaml 
INFO[0000] Containerlab v0.46.2 started
INFO[0000] Parsing & checking topology file: test1.yaml 
INFO[0000] Creating docker network: Name="clab", IPv4Subnet="172.20.20.0/24", IPv6Subnet="2001:172:20:20::/64", MTU="1500"
INFO[0000] Creating lab directory: /opt/dtaas/crap/clab-test1 
INFO[0000] Creating container: "POD1-LEAF01"
INFO[0000] Creating MACVLAN link: host:eth2 <--> POD1-LEAF01:mgmt0 
INFO[0000] Running postdeploy actions for Nokia SR Linux 'POD1-LEAF01' node 
panic: runtime error: index out of range [1] with length 1

goroutine 16 [running]:
github.com/srl-labs/containerlab/nodes/srl.(*srl).addDefaultConfig(0xc0000d6000, {0x3506fc8, 0xc000b9cb90})
        github.com/srl-labs/containerlab/nodes/srl/srl.go:595 +0xa47
github.com/srl-labs/containerlab/nodes/srl.(*srl).PostDeploy(0xc0000d6000, {0x3506fc8, 0xc000b9cb90}, 0xc0000bcf78)
        github.com/srl-labs/containerlab/nodes/srl/srl.go:322 +0x4e5
github.com/srl-labs/containerlab/cmd.deployFn.func1({0x3528e18, 0xc0000d6000}, 0xc000607fb8?)
        github.com/srl-labs/containerlab/cmd/deploy.go:251 +0xdf
created by github.com/srl-labs/containerlab/cmd.deployFn
        github.com/srl-labs/containerlab/cmd/deploy.go:248 +0x1865

srl.go:595 seems to indicate that only interfaces with names e-X-Y are supported

hellt commented 1 year ago

yes, this is a legit issue. We haven't accounted for non datapath interfaces to be used in the link definition. You can comment out the offending string and continue your testing.

hellt commented 1 year ago

@pdumais

grab a binary with a fix by running

sudo docker run --rm -v $(pwd):/workspace ghcr.io/oras-project/oras:v1.1.0 \
  pull ghcr.io/srl-labs/clab-oci:39dd3ca5

note, that mgmt0 won't likely come up if your parent macvlan interface has mtu less than 1500B

hellt commented 1 year ago

I am closing this as the fix was merged, but, as mentioned, it fixes the raised issue, but not the use case...

pdumais commented 1 year ago

Thanks for the quick fix. I'll give it a try. What do you mean by "it doesn't fix the use case" ?

hellt commented 1 year ago

srl will not bring up an interface with mtu <1500B, and when you use macvlan with mgmt0, your parent interface was having 13xx something MTU

pdumais commented 1 year ago

Ok, no problem. Thanks again

pdumais commented 1 year ago

Seems to work. I tried with an ovs-bridge instead of macvlan. I'm havving issues with DHCP but that is unlikely to be related.

Fix confirmed.