Skip to content

Commit

Permalink
Cleanup 'unnumbered' references (fixes #1697)
Browse files Browse the repository at this point in the history
  • Loading branch information
ipspace committed Jan 3, 2025
1 parent 8114dbd commit ac62e62
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion netsim/modules/_routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def build_vrf_interface_list(node: Box, proto: str, topology: Box) -> None:
def remove_unaddressed_intf(node: Box, proto: str) -> None:
for intf in node.interfaces:
if proto in intf:
if not any(af in intf for af in ('ipv4','ipv6','unnumbered')): # Do we have at least some addressing on the interface?
if not any(af in intf for af in ('ipv4','ipv6')): # Do we have at least some addressing on the interface?
intf.pop(proto,None) # Nope, no need to run IGP on that interface
#
# remove_unused_igp -- remove IGP module if it's not configured on any interface
Expand Down
9 changes: 3 additions & 6 deletions netsim/modules/isis.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ def isis_unnumbered(node: Box, features: Box) -> bool:
for af in ('ipv4','ipv6'):
is_unnumbered = False
for l in node.get('interfaces',[]):
is_unnumbered = is_unnumbered or \
'unnumbered' in l or \
(af in l and isinstance(l[af],bool) and l[af])
is_unnumbered = is_unnumbered or (af in l and isinstance(l[af],bool) and l[af])

if is_unnumbered and not features.isis.unnumbered[af]:
log.error(
Expand All @@ -26,13 +24,12 @@ def isis_unnumbered(node: Box, features: Box) -> bool:

OK = True
for l in node.get('interfaces',[]):
unnum_v4 = 'unnumbered' in l or ('ipv4' in l and l.ipv4 is True)
unnum_v4 = l.get('ipv4',None) is True
if unnum_v4 and \
len(l.neighbors) > 1 and \
not features.isis.unnumbered.network:
log.error(
f'Device {node.device} used on node {node.name} cannot run IS-IS over\n'+
f'.. unnumbered multi-access interfaces (link {l.name})',
f'Device {node.device} (node {node.name}) cannot run IS-IS over unnumbered multi-access link {l.name}',
log.IncorrectValue,
'interfaces')
OK = False
Expand Down
4 changes: 1 addition & 3 deletions netsim/modules/ospf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ def ospf_unnumbered(node: Box, features: Box) -> bool:
OK = True

for l in node.get('interfaces',[]):
is_unnumbered = \
'unnumbered' in l or \
('ipv4' in l and isinstance(l.ipv4,bool) and l.ipv4)
is_unnumbered = l.get('ipv4',None) is True
if is_unnumbered and 'ospf' in l:
node.ospf.unnumbered = True
if len(l.get('neighbors',[])) > 1:
Expand Down
1 change: 1 addition & 0 deletions tests/errors/isis-capability.log
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
IncorrectValue in interfaces: Device nxos used on node r2 cannot run IS-IS over unnumbered ipv4 interfaces
IncorrectValue in interfaces: Device eos (node r3) cannot run IS-IS over unnumbered multi-access link r3 -> [r1,r2]
Fatal error in netlab: Cannot proceed beyond this point due to errors, exiting
7 changes: 4 additions & 3 deletions tests/errors/isis-capability.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# The scenario changed to use 'unnumbered: True' as a regression test for #1697
#
defaults:
devices:
iosv.features.initial.ipv4.unnumbered: True
nxos.features.isis.unnumbered.ipv4: False
eos.features.isis.unnumbered.network: False

module: [ isis ]

Expand All @@ -17,6 +20,4 @@ links:
- r1:
r2:
r3:
prefix:
ipv4: True
ipv6: True
unnumbered: True

0 comments on commit ac62e62

Please sign in to comment.