def getCommandListUrlForAgentName(connection, sessionUrl, agentName): ''' This method is used to get the commandList url for a provided agent name. Args: - connection is the connection object that manages the HTTP data transfers between the client and the REST API - sessionUrl is the address of the session that should run the test - agentName is the agent name for which the commandList address is provided ''' communityListUrl = "%s/ixload/test/activeTest/communityList" % sessionUrl communityList = connection.httpGet(url=communityListUrl) for community in communityList: activityListUrl = "%s/%s/activityList" % (communityListUrl, community.objectID) activityList = connection.httpGet(url=activityListUrl) for activity in activityList: if activity.name == agentName: #agentActionListUrl = "%s/%s/agent/actionList" % (activityListUrl, activity.objectID) agentUrl = "%s/%s/agent" % (activityListUrl, activity.objectID) agent = connection.httpGet(agentUrl) for link in agent.links: if link.rel in ['actionList', 'commandList']: commandListUrl = normalizeLink(link.href) return commandListUrl