Assert that sub-ints with addresses must have exact-match set
This commit is contained in:
@ -502,12 +502,16 @@ def validate_interfaces(yaml):
|
|||||||
elif not get_lcp(yaml, mid_ifname):
|
elif not get_lcp(yaml, mid_ifname):
|
||||||
msgs.append("sub-interface %s is QinX and has LCP name %s but %s does not have an LCP" % (sub_ifname, sub_lcp, mid_ifname))
|
msgs.append("sub-interface %s is QinX and has LCP name %s but %s does not have an LCP" % (sub_ifname, sub_lcp, mid_ifname))
|
||||||
result = False
|
result = False
|
||||||
if sub_lcp and 'encapsulation' in sub_iface and 'exact-match' in sub_iface['encapsulation'] and not sub_iface['encapsulation']['exact-match']:
|
|
||||||
|
encap = get_encapsulation(yaml, sub_ifname)
|
||||||
|
if sub_lcp and (not encap or not encap['exact-match']):
|
||||||
msgs.append("sub-interface %s has LCP name %s but its encapsulation is not exact-match" % (sub_ifname, sub_lcp))
|
msgs.append("sub-interface %s has LCP name %s but its encapsulation is not exact-match" % (sub_ifname, sub_lcp))
|
||||||
result = False
|
result = False
|
||||||
|
|
||||||
|
|
||||||
if has_address(yaml, sub_ifname):
|
if has_address(yaml, sub_ifname):
|
||||||
|
if not encap or not encap['exact-match']:
|
||||||
|
msgs.append("sub-interface %s has an address but its encapsulation is not exact-match" % (sub_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
|
||||||
|
@ -4,7 +4,8 @@ test:
|
|||||||
expected:
|
expected:
|
||||||
- "sub-interface GigabitEthernet1/0/0.(101|102) has invalid encapsulation"
|
- "sub-interface GigabitEthernet1/0/0.(101|102) has invalid encapsulation"
|
||||||
- "sub-interface .* has LCP name .* but its encapsulation is not exact-match"
|
- "sub-interface .* has LCP name .* but its encapsulation is not exact-match"
|
||||||
count: 4
|
- "sub-interface .* has an address but its encapsulation is not exact-match"
|
||||||
|
count: 5
|
||||||
---
|
---
|
||||||
interfaces:
|
interfaces:
|
||||||
GigabitEthernet1/0/0:
|
GigabitEthernet1/0/0:
|
||||||
|
Reference in New Issue
Block a user