autotests: utility: fix helper functions

This commit is contained in:
Rahul Rahul 2016-07-25 15:13:40 -07:00 committed by Denis Kenzior
parent eb605d9105
commit 866ff95c48
1 changed files with 7 additions and 2 deletions

View File

@ -65,13 +65,18 @@ def disconnect(deviceToDisconnect, mainloop, bus):
return True
# get the 1st network found to connect to
def getNetworkToConnectTo(objects):
def getNetworkToConnectTo(objects, networkNameToMatch):
logger.debug(sys._getframe().f_code.co_name)
networkList = []
for path in objects:
if IWD_NETWORK_INTERFACE not in objects[path]:
continue
return path
if not networkNameToMatch:
return path
else:
network = objects[path][IWD_NETWORK_INTERFACE]
if network["Name"] == networkNameToMatch:
return path
return ""
# return the current connection status