Add unit tests for bondethernet

This commit is contained in:
Pim van Pelt
2022-03-20 22:17:41 +00:00
parent 31c3d13c12
commit 1f07f7eadf
4 changed files with 51 additions and 13 deletions

View File

@ -29,6 +29,19 @@ def get_by_name(yaml, ifname):
return None
def is_bond_member(yaml, ifname):
""" Returns True if this interface is a member of a BondEthernet """
if not 'bondethernets' in yaml:
return False
for bond, iface in yaml['bondethernets'].items():
if not 'interfaces' in iface:
continue
if ifname in iface['interfaces']:
return True
return False
def validate_bondethernets(yaml):
result = True
msgs = []