Add get_by_lcp_name() + tests
This commit is contained in:
@ -26,6 +26,16 @@ def get_bridgedomains(yaml):
|
||||
return ret
|
||||
|
||||
|
||||
def get_by_lcp_name(yaml, lcpname):
|
||||
""" Returns the bridgedomain by a given lcp name, or None,None if it does not exist """
|
||||
if not 'bridgedomains' in yaml:
|
||||
return None,None
|
||||
for ifname, iface in yaml['bridgedomains'].items():
|
||||
if 'lcp' in iface and iface['lcp'] == lcpname:
|
||||
return ifname, iface
|
||||
return None,None
|
||||
|
||||
|
||||
def get_by_name(yaml, ifname):
|
||||
""" Return the BridgeDomain by name, if it exists. Return None,None otherwise. """
|
||||
try:
|
||||
|
Reference in New Issue
Block a user