Assert that a QinX cannot have higher MTU than its intermediate interface
This commit is contained in:
@ -480,8 +480,14 @@ def validate_interfaces(yaml):
|
|||||||
|
|
||||||
sub_mtu = get_mtu(yaml, sub_ifname)
|
sub_mtu = get_mtu(yaml, sub_ifname)
|
||||||
if sub_mtu > iface_mtu:
|
if sub_mtu > iface_mtu:
|
||||||
msgs.append("sub-interface %s has MTU %d higher than parent MTU %d" % (sub_ifname, sub_iface['mtu'], iface_mtu))
|
msgs.append("sub-interface %s has MTU %d higher than parent %s MTU %d" % (sub_ifname, sub_iface['mtu'], ifname, iface_mtu))
|
||||||
result = False
|
result = False
|
||||||
|
if is_qinx(yaml, sub_ifname):
|
||||||
|
mid_ifname, mid_iface = get_qinx_parent_by_name(yaml, sub_ifname)
|
||||||
|
mid_mtu = get_mtu(yaml, mid_ifname)
|
||||||
|
if sub_mtu > mid_mtu:
|
||||||
|
msgs.append("sub-interface %s has MTU %d higher than parent %s MTU %d" % (sub_ifname, sub_iface['mtu'], mid_ifname, mid_mtu))
|
||||||
|
result = False
|
||||||
|
|
||||||
sub_lcp = get_lcp(yaml, sub_ifname)
|
sub_lcp = get_lcp(yaml, sub_ifname)
|
||||||
if is_l2(yaml, sub_ifname) and sub_lcp:
|
if is_l2(yaml, sub_ifname) and sub_lcp:
|
||||||
|
@ -2,8 +2,10 @@ test:
|
|||||||
description: "MTU of sub-interfaces cannot be higher than their parent"
|
description: "MTU of sub-interfaces cannot be higher than their parent"
|
||||||
errors:
|
errors:
|
||||||
expected:
|
expected:
|
||||||
- "sub-interface .* has MTU 9001 higher than parent MTU 9000"
|
- "sub-interface .* has MTU 9001 higher than parent .* MTU 9000"
|
||||||
count: 1
|
- "sub-interface .* has MTU 9002 higher than parent .* MTU 9001"
|
||||||
|
- "sub-interface .* has MTU 9002 higher than parent .* MTU 9000"
|
||||||
|
count: 3
|
||||||
---
|
---
|
||||||
interfaces:
|
interfaces:
|
||||||
GigabitEthernet1/0/0:
|
GigabitEthernet1/0/0:
|
||||||
@ -11,3 +13,9 @@ interfaces:
|
|||||||
sub-interfaces:
|
sub-interfaces:
|
||||||
100:
|
100:
|
||||||
mtu: 9001
|
mtu: 9001
|
||||||
|
200:
|
||||||
|
encapsulation:
|
||||||
|
exact-match: True
|
||||||
|
inner-dot1q: 1234
|
||||||
|
dot1q: 100
|
||||||
|
mtu: 9002
|
||||||
|
@ -824,9 +824,9 @@ class Reconciler():
|
|||||||
config_mtu = config_iface['mtu']
|
config_mtu = config_iface['mtu']
|
||||||
|
|
||||||
if shrink and config_mtu < vpp_iface.mtu[0]:
|
if shrink and config_mtu < vpp_iface.mtu[0]:
|
||||||
self.logger.info("shrink 1> set interface mtu packet %d %s" % (config_mtu, vpp_iface.interface_name))
|
self.logger.info("1> set interface mtu packet %d %s" % (config_mtu, vpp_iface.interface_name))
|
||||||
elif not shrink and config_mtu > vpp_iface.mtu[0]:
|
elif not shrink and config_mtu > vpp_iface.mtu[0]:
|
||||||
self.logger.info("grow 2> set interface mtu packet %d %s" % (config_mtu, vpp_iface.interface_name))
|
self.logger.info("2> set interface mtu packet %d %s" % (config_mtu, vpp_iface.interface_name))
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user