Assert that BVI loopback's mtu is the same as its bridge MTU

This commit is contained in:
Pim van Pelt
2022-04-05 17:54:23 +00:00
parent 8971c325c0
commit a8ced1b982
4 changed files with 22 additions and 5 deletions

View File

@ -137,11 +137,20 @@ def validate_bridgedomains(yaml):
if 'bvi' in iface:
bviname = iface['bvi']
if (None,None) == loopback.get_by_name(yaml, bviname):
msgs.append("bridgedomain %s BVI %s does not exist" % (ifname, bviname))
bvi_ifname, bvi_iface = loopback.get_by_name(yaml,iface['bvi'])
if not bvi_unique(yaml, bvi_ifname):
msgs.append("bridgedomain %s BVI %s is not unique" % (ifname, bvi_ifname))
result = False
if not bvi_unique(yaml, bviname):
msgs.append("bridgedomain %s BVI %s is not unique" % (ifname, bviname))
if not bvi_iface:
msgs.append("bridgedomain %s BVI %s does not exist" % (ifname, bvi_ifname))
result = False
continue
bvi_mtu = 1500
if 'mtu' in bvi_iface:
bvi_mtu = bvi_iface['mtu']
if bvi_mtu != bd_mtu:
msgs.append("bridgedomain %s BVI %s has MTU %d, while bridge has %d" % (ifname, bvi_ifname, bvi_mtu, bd_mtu))
result = False
if 'interfaces' in iface:

View File

@ -73,6 +73,7 @@ loopbacks:
addresses: [ 10.0.0.1/32, 2001:db8::1/128 ]
loop1:
lcp: "bvi1"
mtu: 2000
addresses: [ 10.0.1.1/24, 2001:db8:1::1/64 ]
bridgedomains:

View File

@ -43,6 +43,7 @@ interfaces:
loopbacks:
loop0:
lcp: "bvi0"
mtu: 3000
addresses: [ 192.0.2.1/29, 2001:db8:1::1/64 ]
bridgedomains:

View File

@ -3,7 +3,8 @@ test:
errors:
expected:
- "bridgedomain .* member .* has MTU (2000|3000|500), while bridge has 1500"
count: 3
- "bridgedomain .* BVI .* has MTU 9000, while bridge has 1500"
count: 4
---
interfaces:
GigabitEthernet1/0/0:
@ -14,8 +15,13 @@ interfaces:
101:
mtu: 500
loopbacks:
loop1:
mtu: 9000
bridgedomains:
bd10:
description: "Bridge Domain 10"
mtu: 1500
bvi: loop1
interfaces: [ GigabitEthernet1/0/0, GigabitEthernet2/0/0, GigabitEthernet2/0/0.101 ]