Skip to content

Commit

Permalink
Fix: parent_ifindex of a VLAN subinterface could be zero
Browse files Browse the repository at this point in the history
The 'check_mixed_trunks' VLAN function identified routed VLAN
subinterface based on parent_ifindex being non-false. That failed
on Junos where the ifindex starts with zero.

Changed the test to check for the presence of parent_ifindex
attribute.

Probably fixes #1708
  • Loading branch information
ipspace committed Dec 30, 2024
1 parent 0cab914 commit 2cbc272
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion netsim/modules/vlan.py
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,7 @@ def check_mixed_trunks(node: Box, topology: Box) -> None:

err_ifmap = {}
for intf in node.interfaces:
if not intf.get('parent_ifindex') or intf.type != 'vlan_member': # Skip everything that is not a VLAN subinterface
if 'parent_ifindex' not in intf or intf.type != 'vlan_member': # Skip everything that is not a VLAN subinterface
continue

parent_intf_list = [ x for x in node.interfaces if x.ifindex == intf.parent_ifindex ]
Expand Down

1 comment on commit 2cbc272

@jbemmel
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar issue at:

if intf.get('parent_ifindex',None):

Although not as impactful

Please sign in to comment.