def enableAnalyzerOnPorts(connection, sessionUrl, communityPortIdTuple): ''' This method is used to enable Analyzer for a specific port on a specific community. Args: - connection is the connection object that manages the HTTP data transfers between the client and the REST API - communityPortIdTuple is a tuple composed of (communityID and portName) - communityID is the id of the community list for which captures should be retrieved. - portName is the name of the port for which capture will be enabled (in format '1.5.1', not 'Port 1.5.1') - sessionUrl is the address of the session on which the test was ran. ''' communityObjectID, portID = communityPortIdTuple portObjectID = getPortObjectId(connection, sessionUrl, communityPortIdTuple) if portObjectID is None: log("ObjectID could not be found for the supplied tuple") return 1 patchUrl = sessionUrl + "/ixload/test/activeTest/communityList/%s/network/portList/%s" % (communityObjectID, portObjectID) performGenericPatch(connection, patchUrl, {'enableCapture': "true"}) return 0