Skip to content

Commit bc85660

Browse files
authored
Use correct getter function to get per-interface vlan.native value (#2041)
Fixes #2032 using a solution by @jbemmel
1 parent 8bf7f6e commit bc85660

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

netsim/modules/vlan.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ def validate_link_vlan_attributes(link: Box,v_attr: Box,topology: Box) -> bool:
304304
f'Node {intf.node} is using native VLAN without VLAN trunk\n... {link}',
305305
log.IncorrectValue,
306306
'vlan')
307-
elif not intf.vlan.native in node_trunk: # ... native VLAN not in trunk, that's not valid
307+
elif node_native not in node_trunk: # ... native VLAN not in trunk, that's not valid
308308
log.error(
309309
f'Node {intf.node} is using native VLAN that is not defined in its VLAN trunk\n... {link}',
310310
log.IncorrectValue,

tests/topology/expected/vlan-trunk-native.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ links:
154154
native: green
155155
trunk:
156156
blue: {}
157-
green: {}
157+
green:
158+
vlan:
159+
mode: irb
158160
red: {}
159161
- _vlan_mode: irb
160162
ifindex: 5
@@ -540,7 +542,9 @@ nodes:
540542
native: green
541543
trunk:
542544
blue: {}
543-
green: {}
545+
green:
546+
vlan:
547+
mode: irb
544548
red: {}
545549
trunk_id:
546550
- 1002

tests/topology/input/vlan-trunk-native.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ links:
4141
vlan.native: green
4242
h1:
4343
- s1:
44+
vlan.trunk.green.vlan.mode: irb # A no-op to trigger #2032
4445
s2:
4546
vlan:
4647
trunk: [red, blue, green]

0 commit comments

Comments
 (0)