ipspace / netlab

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

[BUG] netlab initial -o is not considering specific host modules #1104

Closed ssasso closed 4 months ago

ssasso commented 4 months ago

When running netlab initial -o it seems that all the modules defined on the topology "global" level are considered, even if a device is using only a subset (or different modules).

I.e., given this topology snippet:

module: [ vlan, vrf, vxlan, ospf, bgp, evpn, gateway ]

groups:
  routers:
    members: [ r1, r2 ]
    device: vyos
    module: [ bgp ]

netlab initial -o -l r1 reports:

TASK [Create device configurations for ['vlan', 'bgp', 'ospf', 'vrf', 'vxlan', 'gateway', 'evpn']] *******************************************************************************************************************************
included: /root/GIT_H/netlab/netsim/ansible/tasks/create-config.yml for r1 => (item=vlan)
included: /root/GIT_H/netlab/netsim/ansible/tasks/create-config.yml for r1 => (item=bgp)
included: /root/GIT_H/netlab/netsim/ansible/tasks/create-config.yml for r1 => (item=ospf)
included: /root/GIT_H/netlab/netsim/ansible/tasks/create-config.yml for r1 => (item=vrf)
included: /root/GIT_H/netlab/netsim/ansible/tasks/create-config.yml for r1 => (item=vxlan)
included: /root/GIT_H/netlab/netsim/ansible/tasks/create-config.yml for r1 => (item=gateway)
included: /root/GIT_H/netlab/netsim/ansible/tasks/create-config.yml for r1 => (item=evpn)
[cut]
TASK [Compute final module name for vlan] ****************************************************************************************************************************************************************************************
ok: [r1 -> localhost]

TASK [Find vlan configuration template] ******************************************************************************************************************************************************************************************
ok: [r1 -> localhost]

TASK [Throw an error message if we can't find the configuration template] ********************************************************************************************************************************************************
skipping: [r1]

TASK [Create vlan configuration from /root/GIT_H/netlab/netsim/ansible/templates/vlan/vyos.j2] ***********************************************************************************************************************************
ok: [r1 -> localhost]

while netlab up still "computes" all the modules, but then it skips the unused ones:

TASK [Deploy individual configuration modules] ***********************************************************************************************************************************************************************************
included: /root/GIT_H/netlab/netsim/ansible/tasks/deploy-module.yml for r1, r2, sw1, sw2 => (item=vlan)
included: /root/GIT_H/netlab/netsim/ansible/tasks/deploy-module.yml for r1, r2, sw1, sw2 => (item=bgp)
included: /root/GIT_H/netlab/netsim/ansible/tasks/deploy-module.yml for r1, r2, sw1, sw2 => (item=ospf)
included: /root/GIT_H/netlab/netsim/ansible/tasks/deploy-module.yml for r1, r2, sw1, sw2 => (item=vrf)
included: /root/GIT_H/netlab/netsim/ansible/tasks/deploy-module.yml for r1, r2, sw1, sw2 => (item=vxlan)
included: /root/GIT_H/netlab/netsim/ansible/tasks/deploy-module.yml for r1, r2, sw1, sw2 => (item=gateway)
included: /root/GIT_H/netlab/netsim/ansible/tasks/deploy-module.yml for r1, r2, sw1, sw2 => (item=evpn)

TASK [Figure out whether to deploy the module vlan on current device] ************************************************************************************************************************************************************
ok: [r1]
ok: [r2]
ok: [sw1]
ok: [sw2]

TASK [Find configuration template for vlan] **************************************************************************************************************************************************************************************
skipping: [r1]
skipping: [r2]
ok: [sw1]
ok: [sw2]

TASK [Print deployed configuration when running in verbose mode] *****************************************************************************************************************************************************************
skipping: [r1]
skipping: [r2]
skipping: [sw1]
skipping: [sw2]

TASK [Find configuration deployment deploy_script for vlan] **********************************************************************************************************************************************************************
skipping: [r1]
skipping: [r2]
ok: [sw1]
ok: [sw2]

TASK [Deploy vlan configuration] *************************************************************************************************************************************************************************************************
skipping: [r1]
skipping: [r2]
included: /root/GIT_H/netlab/netsim/ansible/tasks/deploy-config/dellos10.yml for sw1, sw2
ipspace commented 4 months ago

Looks like I broke 'netlab initial' with 100540723f4800ea12e256e1842babf86364f4b5. Thank you, will fix.