Relax the LCP requirements - it is OK to have an address without an LCP

This commit is contained in:
Pim van Pelt
2022-04-03 09:04:11 +00:00
parent f786a00e9a
commit d30f2d8965
3 changed files with 1 additions and 28 deletions

View File

@ -415,9 +415,6 @@ def validate_interfaces(yaml):
iface_lcp = get_lcp(yaml, ifname) iface_lcp = get_lcp(yaml, ifname)
iface_address = has_address(yaml, ifname) iface_address = has_address(yaml, ifname)
if iface_address and not iface_lcp:
msgs.append("interface %s has an address but no LCP" % ifname)
result = False
if is_l2(yaml, ifname) and iface_lcp: if is_l2(yaml, ifname) and iface_lcp:
msgs.append("interface %s is in L2 mode but has LCP name %s" % (ifname, iface_lcp)) msgs.append("interface %s is in L2 mode but has LCP name %s" % (ifname, iface_lcp))
result = False result = False
@ -511,10 +508,6 @@ def validate_interfaces(yaml):
if has_address(yaml, sub_ifname): if has_address(yaml, sub_ifname):
## The sub_iface lcp is not required: it can be derived from the iface_lcp, which has to be set
if not iface_lcp:
msgs.append("sub-interface %s has an address but %s does not have an LCP" % (sub_ifname, ifname))
result = False
if is_l2(yaml, sub_ifname): if is_l2(yaml, sub_ifname):
msgs.append("sub-interface %s is in L2 mode but has an address" % sub_ifname) msgs.append("sub-interface %s is in L2 mode but has an address" % sub_ifname)
result = False result = False

View File

@ -2,12 +2,10 @@ test:
description: "Interfaces put into the bridge, can't be L3 (so cannot have an address)" description: "Interfaces put into the bridge, can't be L3 (so cannot have an address)"
errors: errors:
expected: expected:
- "interface .* has an address but no LCP"
- "sub-interface .* has an address but .* does not have an LCP"
- "bridgedomain .* member .* has an address" - "bridgedomain .* member .* has an address"
- "interface .* is in L2 mode but has an address" - "interface .* is in L2 mode but has an address"
- "sub-interface .* is in L2 mode but has an address" - "sub-interface .* is in L2 mode but has an address"
count: 9 count: 6
--- ---
interfaces: interfaces:
GigabitEthernet1/0/0: GigabitEthernet1/0/0:

View File

@ -1,18 +0,0 @@
test:
description: "Sub-interface with addresses must have an LCP. Gi1/0/0 does this wrong, while Gi2/0/0 does it correctly"
errors:
expected:
- "sub-interface .* has an address but .* does not have an LCP"
count: 1
---
interfaces:
GigabitEthernet1/0/0:
sub-interfaces:
100:
addresses: [ 192.0.2.1/24 ]
GigabitEthernet2/0/0:
lcp: "xe2-0-0"
sub-interfaces:
100:
addresses: [ 192.168.1.1/24 ]