diff --git a/vppcfg/config/interface.py b/vppcfg/config/interface.py index 4d0e418..30cfef0 100644 --- a/vppcfg/config/interface.py +++ b/vppcfg/config/interface.py @@ -530,7 +530,7 @@ def validate_interfaces(yaml): f"interface {ifname} unnumbered target {target} cannot be in L2 mode" ) result = False - if is_unnumbered(yaml, target): + if is_unnumbered(yaml, target) or loopback.is_unnumbered(yaml, target): msgs.append( 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" ) result = False - if is_unnumbered(yaml, target): + if is_unnumbered(yaml, target) or loopback.is_unnumbered(yaml, target): msgs.append( f"sub-interface {sub_ifname} unnumbered target {target} cannot also be unnumbered" ) diff --git a/vppcfg/config/loopback.py b/vppcfg/config/loopback.py index 4bea0ff..71cab0d 100644 --- a/vppcfg/config/loopback.py +++ b/vppcfg/config/loopback.py @@ -113,7 +113,7 @@ def validate_loopbacks(yaml): f"loopback {ifname} unnumbered target {target} does not exist" ) result = False - if is_unnumbered(yaml, target): + if is_unnumbered(yaml, target) or interface.is_unnumbered(yaml, target): msgs.append( f"loopback {ifname} unnumbered target {target} cannot also be unnumbered" ) diff --git a/vppcfg/unittest/yaml/error-unnumbered2.yaml b/vppcfg/unittest/yaml/error-unnumbered2.yaml index d17e20c..f7b5905 100644 --- a/vppcfg/unittest/yaml/error-unnumbered2.yaml +++ b/vppcfg/unittest/yaml/error-unnumbered2.yaml @@ -6,7 +6,7 @@ test: - "(sub-)?interface .* unnumbered target .* cannot also be unnumbered" - "loopback .* unnumbered target cannot point to itself" - "loopback .* unnumbered target .* cannot also be unnumbered" - count: 12 + count: 16 --- loopbacks: loop0: @@ -15,6 +15,10 @@ loopbacks: unnumbered: loop0 loop2: unnumbered: loop2 + loop3: + unnumbered: GigabitEthernet2/0/0 + loop4: + unnumbered: GigabitEthernet1/0/0.100 interfaces: GigabitEthernet1/0/0: @@ -31,6 +35,9 @@ interfaces: GigabitEthernet2/0/1: description: "Cannot point to Gi2/0/0, as that interface is itself unnumbered" 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: sub-interfaces: @@ -40,3 +47,6 @@ interfaces: 101: description: "Cannot point to Gi3/0/0.100, as that interface is itself unnumbered" unnumbered: GigabitEthernet3/0/0.100 + 102: + description: "Cannot point to Gi3/0/0.100, as that interface is itself unnumbered" + unnumbered: loop0