ipspace / netlab

Making virtual networking labs suck less
https://netlab.tools
Other
439 stars 66 forks source link

[BUG] FRR with Vlan module fails on provider libvirt (ok with clab) #1429

Closed sdargoeuves closed 48 minutes ago

sdargoeuves commented 3 hours ago

Describe the bug

I got an error with an Ansible playbook when testing frr as part of #1420 (only because my first topology was doing vrrp on the Vlan interface, which I've later modified to be able to test on IOS) The same topology works on cumulus, or it also works using clab provider for frr...

To Reproduce

Run netlab up on the topology file below

Expected behavior

I am expecting the lab to start, or to throw an error if the topology is incorrect.

Lab topology

---
plugin: [ multilab ]
defaults.multilab.id: 3
defaults.addressing.mgmt.start: 10
provider: libvirt

groups:
  vl1_gws:
    device: frr
    module: [vlan, gateway, ospf]
    members: [ gw1, gw2 ]
    vlans:
      vl_blue:
      vl_red:

vlans:
  vl_blue:
    id: 3032
    prefix: 172.16.32.0/24
    ospf.passive: true
  vl_red:
    id: 3033
    prefix: 172.16.33.0/24
    ospf.passive: true

nodes:
  gw1:
  gw2:

links:
  - gw1:
    gw2:
    vlan.trunk: [ vl_blue, vl_red ]

Output

TASK [run /tmp/config.sh to deploy vlan config from /home/sa/code/quick-netlab-lab/netlab/netsim/ansible/templates/vlan/frr.j2] *********************************************************************************
fatal: [gw2]: FAILED! => changed=true
  cmd:
  - bash
  - /tmp/config.sh
  delta: '0:00:00.054049'
  end: '2024-10-24 13:45:20.909889'
  msg: non-zero return code
  rc: 127
  start: '2024-10-24 13:45:20.855840'
  stderr: '/tmp/config.sh: line 14: brctl: command not found'
  stderr_lines: <omitted>
  stdout: ''
  stdout_lines: <omitted>
fatal: [gw1]: FAILED! => changed=true
  cmd:
  - bash
  - /tmp/config.sh
  delta: '0:00:00.058280'
  end: '2024-10-24 13:45:20.099523'
  msg: non-zero return code
  rc: 127
  start: '2024-10-24 13:45:20.041243'
  stderr: '/tmp/config.sh: line 14: brctl: command not found'
  stderr_lines: <omitted>
  stdout: ''
  stdout_lines: <omitted>

PLAY RECAP ******************************************************************************************************************************************************************************************************
gw1                        : ok=20   changed=3    unreachable=0    failed=1    skipped=4    rescued=0    ignored=0
gw2                        : ok=20   changed=3    unreachable=0    failed=1    skipped=4    rescued=0    ignored=0

Error executing ansible-playbook /home/sa/code/quick-netlab-lab/netlab/netsim/ansible/initial-config.ansible:
  Command '['ansible-playbook', '/home/sa/code/quick-netlab-lab/netlab/netsim/ansible/initial-config.ansible']' returned non-zero exit status 2.
[FATAL]   Executing Ansible playbook /home/sa/code/quick-netlab-lab/netlab/netsim/ansible/initial-config.ansible failed
Error executing netlab initial --no-message:
  Command '['netlab', 'initial', '--no-message']' returned non-zero exit status 1.
[FATAL]   netlab up: netlab initial failed, aborting...

Version

gw1# show version
FRRouting 10.0.1_git (gw1) on Linux(5.4.0-198-generic).
[...]
gw1(bash)#sudo brctl
bash: sudo: command not found
gw1(bash)#brctl
BusyBox v1.36.1 (2023-11-07 18:53:09 UTC) multi-call binary.

Usage: brctl COMMAND [BRIDGE [ARGS]]
[...]
gw1(bash)#cat /etc/os-release
NAME="Alpine Linux"
gw1# show version
FRRouting 10.1.1 (gw1) on Linux(5.4.0-126-generic).
[...]
gw1(bash)#sudo brctl
sudo: brctl: command not found
gw1(bash)#brctl

Command 'brctl' not found, but can be installed with:

apt install bridge-utils
Please ask your administrator.

gw1(bash)#cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.5 LTS (Focal Fossa)"

Additional context

The line brctl addbr {{i.ifname}} up is the one causing the issue

{% for i in interfaces if i.type == 'svi' %}
if [ ! -e /sys/devices/virtual/net/{{ i.ifname }} ]; then
  brctl addbr {{ i.ifname }}
  ip link set dev {{ i.ifname }} up
  ip addr flush dev {{ i.ifname }}
jbemmel commented 3 hours ago

Need to add bridge-utils here: https://github.com/ipspace/netlab/blob/1b3218cae21b1132321adae850db11dc1871baca/netsim/ansible/templates/initial/frr.j2#L39

sdargoeuves commented 1 hour ago

Thank you!

ipspace commented 47 minutes ago

When seeing a bug like this, I always start wondering whether anyone is using this tool :( How could such a blatant bug remain unreported for a few years :((

Thanks a million for finding and fixing it!