ipspace / netlab

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

[BUG] Removing vlan.native attribute removes trunk from topology #1113

Closed jbemmel closed 4 months ago

jbemmel commented 4 months ago

Describe the bug

e.g. in https://github.com/ipspace/netlab/blob/dev/tests/integration/vlan/41-vlan-bridge-native.yml#L40 if I comment out the

vlan.native: red

line there is no more 'trunk' attribute generated in the topology

To Reproduce

Comment out that line, then 'netlab create -d frr'

Expected behavior

In host_vars/s1/topology.yml I'd expect to see

vlan:
    access_id: 1000
    trunk:
      blue: {}
      red: {}
    trunk_id:
    - 1000

Output

Missing 'trunk' dict

Version

Latest HEAD under dev tree

ipspace commented 4 months ago

The trunk dictionary is not guaranteed to exist in the final data model. See https://netlab.tools/dev/config/vlan/#interface-vlan-parameters for details.

It looks like it's still there if one of the VLANs is native. I could remove it, but why bother?

jbemmel commented 4 months ago

SR OS template logic currently depends on it, to configure 'hybrid' port types: https://github.com/ipspace/netlab/blob/dev/netsim/ansible/templates/initial/sros.j2#L112

Both the 'trunk' and 'trunk_id' attribute are removed, there is 'subif_index' which for this case represents the count of members; when I put back the native vlan, the count is one less

From a templating perspective, it's hard to understand the intent - information is lost