ipspace / netlab

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

[DOC] Multilab - overwrite management IPv4 addresses issue #1102

Closed sdargoeuves closed 4 months ago

sdargoeuves commented 4 months ago

Document we need to fix

Multilab & overwriting settings: behind-the-scenes

What's wrong

Not sure if it's an issue, or a lack of understanding on my side on how it should be used, but it seems that I am unable to overwrite the management subnet configured in the .../netsim/defaults/multilab.yml

If I use this:

---
plugin: [ multilab ]
defaults.multilab.id: 1
provider: libvirt
addressing.mgmt.ipv4: '10.195.56.0/25'

The subnet are still assigned by the .../netsim/defaults/multilab.yml file:

change:
  name: 'ml_{id}'
  defaults.name: 'ml_{id}'
  defaults.providers.libvirt.tunnel_id: '{id}'
  defaults.providers.libvirt.vifprefix: 'vif_{id}'
  addressing.mgmt:
    ipv4: '10.194.{56 + (id-1)}.0/24'
#    ipv4: '10.194.{56 + (id-1) // 2}.{"0" if (id-1) % 2 == 0 else "128"}/25'
    _network: 'nl_mgmt_{id}'
    _bridge:  'nl_mgmt_{id}'

But if I remove the multilab plugin and id, it then works as expected.

#plugin: [ multilab ]
defaults:
  #multilab.id: 3
  addressing.mgmt.ipv4: '1.1.1.0/24'

Am I doing something wrong, or this is an issue with the multilab behaviour?

ipspace commented 4 months ago

Not sure if it's an issue, or a lack of understanding on my side on how it should be used, but it seems that I am unable to overwrite the management subnet configured in the .../netsim/defaults/multilab.yml

That is correct. Multilab plugin code is ran after the topology and defaults are read, and will modify whatever it wants to modify. If you want to change multilab-controlled default, you have to change the multilab defaults.

Thank you for reporting this. Will add a note to the documentation.