ipspace / netlab

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

[BUG] netlab loop if node name is asXXX #1193

Closed ssasso closed 1 month ago

ssasso commented 1 month ago

netlab hangs in a loop (with cpu core to 100%) if node names are in the format asXXX, and bgp is enabled.

i.e.:

nodes:
  as1:
    module: [ bgp ]
    bgp.as: 1
  as2:
    module: [ bgp ]
    bgp.as: 2

links:
- as1-as2

Ctrl-C:

Traceback (most recent call last):
  File "/usr/local/bin/netlab", line 7, in <module>
    exec(compile(f.read(), __file__, 'exec'))
  File "/root/GIT_H/netlab/netlab", line 12, in <module>
    netsim.cli.lab_commands(__file__)
  File "/root/GIT_H/netlab/netsim/cli/__init__.py", line 321, in lab_commands
    mod.run(sys.argv[arg_start:])   # type: ignore
  File "/root/GIT_H/netlab/netsim/cli/create.py", line 81, in run
    augment.main.transform(topology)
  File "/root/GIT_H/netlab/netsim/augment/main.py", line 105, in transform
    transform_setup(topology)
  File "/root/GIT_H/netlab/netsim/augment/main.py", line 42, in transform_setup
    augment.groups.init_groups(topology)
  File "/root/GIT_H/netlab/netsim/augment/groups.py", line 536, in init_groups
    copy_group_node_data(topology,'as')               # And add group data from 'asxxxx' into nodes
  File "/root/GIT_H/netlab/netsim/augment/groups.py", line 365, in copy_group_node_data
    for grp in reverse_topsort(topology):
  File "/root/GIT_H/netlab/netsim/augment/groups.py", line 311, in reverse_topsort
    for g in sorted(group_copy.keys()):        # Iterate over remaining groups
KeyboardInterrupt

I guess this is due to the fact that netlabs automatically creates the groups called asXXX which conflict somehow with the nodes themselves.

The easiest fix could be to validate that node names are not in the format asXXX.

ipspace commented 1 month ago

Good one. Thank you, will fix.