Force loopbacks with an address to have an LCP

This commit is contained in:
Pim van Pelt
2022-03-13 19:27:27 +00:00
parent d693c41c72
commit 8825984d49
3 changed files with 16 additions and 5 deletions

View File

@ -10,11 +10,6 @@ loopbacks:
mtu: 9216
addresses: [ 192.0.2.1/29 ]
loop10:
description: "Loopback instance loop10, with address, but no LCP"
mtu: 9216
addresses: [ 192.0.2.1/29 ]
loop20:
description: "Loopback instance loop20, with LCP, but no address"
mtu: 9216

View File

@ -0,0 +1,12 @@
test:
description: "Cannot give an IP address to a loopback without LCP"
errors:
expected:
- "loopback .* has an address but no LCP"
count: 1
---
loopbacks:
loop10:
description: "Loopback instance loop10, with address, but no LCP"
mtu: 9216
addresses: [ 192.0.2.1/29 ]

View File

@ -26,4 +26,8 @@ def validate_loopbacks(yaml):
logger.debug("Validating loopbacks...")
for ifname, iface in yaml['loopbacks'].items():
logger.debug("loopback %s" % iface)
if 'addresses' in iface and not 'lcp' in iface:
msgs.append("loopback %s has an address but no LCP" % ifname)
result = False
return result, msgs