Assert that target unnumbered interfaces AND loopbacks also cannot be unnumbered
This commit is contained in:
@ -530,7 +530,7 @@ def validate_interfaces(yaml):
|
|||||||
f"interface {ifname} unnumbered target {target} cannot be in L2 mode"
|
f"interface {ifname} unnumbered target {target} cannot be in L2 mode"
|
||||||
)
|
)
|
||||||
result = False
|
result = False
|
||||||
if is_unnumbered(yaml, target):
|
if is_unnumbered(yaml, target) or loopback.is_unnumbered(yaml, target):
|
||||||
msgs.append(
|
msgs.append(
|
||||||
f"interface {ifname} unnumbered target {target} cannot also be unnumbered"
|
f"interface {ifname} unnumbered target {target} cannot also be unnumbered"
|
||||||
)
|
)
|
||||||
@ -692,7 +692,7 @@ def validate_interfaces(yaml):
|
|||||||
f"sub-interface {sub_ifname} unnumbered target {target} cannot be in L2 mode"
|
f"sub-interface {sub_ifname} unnumbered target {target} cannot be in L2 mode"
|
||||||
)
|
)
|
||||||
result = False
|
result = False
|
||||||
if is_unnumbered(yaml, target):
|
if is_unnumbered(yaml, target) or loopback.is_unnumbered(yaml, target):
|
||||||
msgs.append(
|
msgs.append(
|
||||||
f"sub-interface {sub_ifname} unnumbered target {target} cannot also be unnumbered"
|
f"sub-interface {sub_ifname} unnumbered target {target} cannot also be unnumbered"
|
||||||
)
|
)
|
||||||
|
@ -113,7 +113,7 @@ def validate_loopbacks(yaml):
|
|||||||
f"loopback {ifname} unnumbered target {target} does not exist"
|
f"loopback {ifname} unnumbered target {target} does not exist"
|
||||||
)
|
)
|
||||||
result = False
|
result = False
|
||||||
if is_unnumbered(yaml, target):
|
if is_unnumbered(yaml, target) or interface.is_unnumbered(yaml, target):
|
||||||
msgs.append(
|
msgs.append(
|
||||||
f"loopback {ifname} unnumbered target {target} cannot also be unnumbered"
|
f"loopback {ifname} unnumbered target {target} cannot also be unnumbered"
|
||||||
)
|
)
|
||||||
|
@ -6,7 +6,7 @@ test:
|
|||||||
- "(sub-)?interface .* unnumbered target .* cannot also be unnumbered"
|
- "(sub-)?interface .* unnumbered target .* cannot also be unnumbered"
|
||||||
- "loopback .* unnumbered target cannot point to itself"
|
- "loopback .* unnumbered target cannot point to itself"
|
||||||
- "loopback .* unnumbered target .* cannot also be unnumbered"
|
- "loopback .* unnumbered target .* cannot also be unnumbered"
|
||||||
count: 12
|
count: 16
|
||||||
---
|
---
|
||||||
loopbacks:
|
loopbacks:
|
||||||
loop0:
|
loop0:
|
||||||
@ -15,6 +15,10 @@ loopbacks:
|
|||||||
unnumbered: loop0
|
unnumbered: loop0
|
||||||
loop2:
|
loop2:
|
||||||
unnumbered: loop2
|
unnumbered: loop2
|
||||||
|
loop3:
|
||||||
|
unnumbered: GigabitEthernet2/0/0
|
||||||
|
loop4:
|
||||||
|
unnumbered: GigabitEthernet1/0/0.100
|
||||||
|
|
||||||
interfaces:
|
interfaces:
|
||||||
GigabitEthernet1/0/0:
|
GigabitEthernet1/0/0:
|
||||||
@ -31,6 +35,9 @@ interfaces:
|
|||||||
GigabitEthernet2/0/1:
|
GigabitEthernet2/0/1:
|
||||||
description: "Cannot point to Gi2/0/0, as that interface is itself unnumbered"
|
description: "Cannot point to Gi2/0/0, as that interface is itself unnumbered"
|
||||||
unnumbered: GigabitEthernet2/0/0
|
unnumbered: GigabitEthernet2/0/0
|
||||||
|
GigabitEthernet2/0/2:
|
||||||
|
description: "Cannot point to Gi2/0/0, as that interface is itself unnumbered"
|
||||||
|
unnumbered: loop0
|
||||||
|
|
||||||
GigabitEthernet3/0/0:
|
GigabitEthernet3/0/0:
|
||||||
sub-interfaces:
|
sub-interfaces:
|
||||||
@ -40,3 +47,6 @@ interfaces:
|
|||||||
101:
|
101:
|
||||||
description: "Cannot point to Gi3/0/0.100, as that interface is itself unnumbered"
|
description: "Cannot point to Gi3/0/0.100, as that interface is itself unnumbered"
|
||||||
unnumbered: GigabitEthernet3/0/0.100
|
unnumbered: GigabitEthernet3/0/0.100
|
||||||
|
102:
|
||||||
|
description: "Cannot point to Gi3/0/0.100, as that interface is itself unnumbered"
|
||||||
|
unnumbered: loop0
|
||||||
|
Reference in New Issue
Block a user