Add loopbacks
This commit is contained in:
@ -51,3 +51,10 @@ interfaces:
|
||||
dot1ad: 1000
|
||||
dot1q: 1000
|
||||
inner-dot1q: 1000
|
||||
|
||||
loopbacks:
|
||||
loop0:
|
||||
description: "Core: example.ipng.ch"
|
||||
mtu: 9216
|
||||
lcp: "loop0"
|
||||
addresses: [ 192.0.2.1/32, 2001:db8:1::1/128 ]
|
||||
|
@ -1,5 +1,12 @@
|
||||
interfaces: map(include('interface'),key=str(matches='.*GigabitEthernet[0-9]+/[0-9]+/[0-9]+|BondEthernet[0-9]+'))
|
||||
bondethernets: map(include('bondethernet'),key=str(matches='BondEthernet[0-9]+'))
|
||||
loopbacks: map(include('loopback'),key=str(matches='loop[0-9]+'))
|
||||
---
|
||||
loopback:
|
||||
description: str(exclude='\'"',required=False)
|
||||
lcp: str(max=8,matches='[a-z]+[a-z0-9-]{,7}',required=False)
|
||||
mtu: int(min=128,max=9216)
|
||||
addresses: list(ip_interface(),min=1,max=6,required=False)
|
||||
---
|
||||
bondethernet:
|
||||
description: str(exclude='\'"',required=False)
|
||||
|
@ -4,6 +4,15 @@ class NullHandler(logging.Handler):
|
||||
def emit(self, record):
|
||||
pass
|
||||
|
||||
def exists(yaml, ifname):
|
||||
""" Returns true if ifname exists as a loopback """
|
||||
try:
|
||||
if ifname in yaml['loopbacks']:
|
||||
return True
|
||||
except:
|
||||
pass
|
||||
return False
|
||||
|
||||
|
||||
def loopback(args, yaml):
|
||||
result = True
|
||||
@ -12,4 +21,6 @@ def loopback(args, yaml):
|
||||
logger.addHandler(NullHandler())
|
||||
|
||||
logger.debug("Validating loopbacks...")
|
||||
for ifname, iface in yaml['loopbacks'].items():
|
||||
logger.debug("loopbacks %s" % iface)
|
||||
return result, msgs
|
||||
|
Reference in New Issue
Block a user