netlab: How do I Specify VLAN Interface Parameters
Similarly to how it handles VRFs, netlab automatically creates VLANs on a lab device if the device uses them on any access- or trunk link or if the VLAN is mentioned in the node vlans dictionary.
If the VLAN is an IRB VLAN (which can be modified globally or per node with the VLAN mode parameter), netlab also creates the VLAN (or SVI, or BVI) interface. But how do you specify the parameters of the VLAN interface?
Here’s the correct answer: you have to specify them in the node VLAN definition. For example, if you want to change the OSPF cost of the VLAN subnet for a single node connected to that VLAN, use something along these lines:
vlans:
red:
ospf.cost: 10
nodes:
sw1:
vlans:
red:
ospf.cost: 20
The above snippet will set the OSPF cost to 20 on SW1’s red VLAN interface but keep it at 10 on all other nodes’ red VLAN interfaces.
Is there another way to set VLAN interface attributes? No. To be fair, we did copy them from the first VLAN link but then decided that was too confusing and potentially unpredictable and switched to the vlans dictionary model.
But I can still set X on the first access interface. Please don’t. The next time someone reports a related bug and we have to touch the code, that functionality will disappear.
But setting Y in the vlans dictionary does not work. Sadly, you might be correct, but we’re working on it. We already fixed the gateway.vrrp stuff and are working on fixing the static IP addressing bug. If you find anything else, please open a GitHub issue. Thank you!
Except for IP addresses for routed vlan interfaces - those would still have to be set on the interfaces in case there is more than one and the user wants to pick them manually