From 866ff95c483ae422995c5beabcbd4d8e522592f3 Mon Sep 17 00:00:00 2001 From: Rahul Rahul Date: Mon, 25 Jul 2016 15:13:40 -0700 Subject: [PATCH] autotests: utility: fix helper functions --- autotests/utility/utility.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/autotests/utility/utility.py b/autotests/utility/utility.py index 32c3b675..46e0282b 100755 --- a/autotests/utility/utility.py +++ b/autotests/utility/utility.py @@ -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