Allow bondethernet members list to be empty, and omitted from the YAML config
This commit is contained in:
@ -171,6 +171,9 @@ def validate_bondethernets(yaml):
|
||||
msgs.append("bondethernet %s can only have load-balance if in mode XOR or LACP" % (ifname))
|
||||
result = False
|
||||
|
||||
if not 'interfaces' in iface:
|
||||
continue
|
||||
|
||||
for member in iface['interfaces']:
|
||||
if (None, None) == interface.get_by_name(yaml, member):
|
||||
msgs.append("bondethernet %s member %s does not exist" % (ifname, member))
|
||||
|
@ -1,6 +1,8 @@
|
||||
bondethernets:
|
||||
BondEthernet0:
|
||||
interfaces: [ GigabitEthernet3/0/0, GigabitEthernet3/0/1 ]
|
||||
BondEthernet1:
|
||||
mode: xor
|
||||
|
||||
interfaces:
|
||||
GigabitEthernet3/0/0:
|
||||
@ -59,6 +61,10 @@ interfaces:
|
||||
encapsulation:
|
||||
dot1ad: 501
|
||||
exact-match: False
|
||||
|
||||
BondEthernet1:
|
||||
mtu: 1500
|
||||
|
||||
vxlan_tunnel1:
|
||||
mtu: 2000
|
||||
|
||||
|
@ -34,7 +34,7 @@ loopback:
|
||||
---
|
||||
bondethernet:
|
||||
description: str(exclude='\'"',len=64,required=False)
|
||||
interfaces: list(str(matches='.*GigabitEthernet[0-9]+/[0-9]+/[0-9]+'))
|
||||
interfaces: list(str(matches='.*GigabitEthernet[0-9]+/[0-9]+/[0-9]+'),required=False)
|
||||
mode: enum('round-robin','active-backup','broadcast','lacp','xor',required=False)
|
||||
load-balance: enum('l2','l23','l34',required=False)
|
||||
---
|
||||
|
@ -1,5 +1,5 @@
|
||||
test:
|
||||
description: "An example of well formed bondethernet"
|
||||
description: "An example of well formed bondethernets"
|
||||
errors:
|
||||
count: 0
|
||||
---
|
||||
@ -8,6 +8,10 @@ bondethernets:
|
||||
interfaces: [ GigabitEthernet1/0/0, GigabitEthernet1/0/1 ]
|
||||
BondEthernet1:
|
||||
interfaces: [ GigabitEthernet2/0/0, GigabitEthernet2/0/1 ]
|
||||
mode: xor
|
||||
load-balance: l2
|
||||
BondEthernet2:
|
||||
mode: round-robin
|
||||
|
||||
interfaces:
|
||||
GigabitEthernet1/0/0:
|
||||
@ -35,3 +39,6 @@ interfaces:
|
||||
mtu: 2000
|
||||
lcp: "be1.2000"
|
||||
addresses: [ 192.0.2.9/29, 2001:db8:1::1/64 ]
|
||||
|
||||
BondEthernet2:
|
||||
mtu: 1500
|
||||
|
@ -275,7 +275,10 @@ class VPPApiDumper(VPPApi):
|
||||
for idx, iface in self.cache['bondethernets'].items():
|
||||
bond = {"description": ""}
|
||||
if iface.sw_if_index in self.cache['bondethernet_members']:
|
||||
bond['interfaces'] = [self.cache['interfaces'][x].interface_name for x in self.cache['bondethernet_members'][iface.sw_if_index]]
|
||||
members = [self.cache['interfaces'][x].interface_name for x in self.cache['bondethernet_members'][iface.sw_if_index]]
|
||||
if len(members) > 0:
|
||||
bond['interfaces'] = members
|
||||
|
||||
mode = bondethernet.int_to_mode(iface.mode)
|
||||
bond['mode'] = mode
|
||||
if mode in ['xor', 'lacp']:
|
||||
|
Reference in New Issue
Block a user