def startTraffic(self, regenerateTraffic=True, applyTraffic=True, blocking=False): """ Description Start traffic and verify traffic is started. This function will also give you the option to regenerate and apply traffic. Parameter regenerateTraffic: applyTraffic: In a situation like packet capturing, you cannot apply traffic after starting packet capture because this will stop packet capturing. You need to set applyTraffic to False in this case. blocking: If True, API server doesn't return until it has started traffic and ready for stats. Unblocking is the opposite. Syntax For blocking state: POST: /api/v1/sessions/{id}/ixnetwork/traffic/operations/startstatelesstrafficblocking' DATA: {arg1: ['/api/v1/sessions/{id}/ixnetwork/traffic/trafficItem/{id}' ...]} For non blocking state: POST: /api/v1/sessions/1/ixnetwork/traffic/operations/start DATA: {arg1: '/api/v1/sessions/{id}/ixnetwork/traffic'} Requirements: For non blocking state only: # You need to check the traffic state before getting stats. # Note: Use the configElementObj returned by configTrafficItem() if trafficObj.getTransmissionType(configElementObj) == "fixedFrameCount": trafficObj.checkTrafficState(expectedState=['stopped', 'stoppedWaitingForStats'], timeout=45) if trafficObj.getTransmissionType(configElementObj) == "continuous": trafficObj.checkTrafficState(expectedState=['started', 'startedWaitingForStats'], timeout=45) """ if regenerateTraffic: self.regenerateTrafficItems() if applyTraffic: self.applyTraffic() if blocking == False: url = self.ixnObj.sessionUrl+'/traffic/operations/start' response = self.ixnObj.post(url, data={'arg1': self.ixnObj.sessionUrl+'/traffic'}) self.ixnObj.waitForComplete(response, url + '/' + response.json()['id'], timeout=120) # Server will go into blocking state until it is ready to accept the next api command. if blocking == True: enabledTrafficItemList = self.getAllTrafficItemObjects(getEnabledTrafficItemsOnly=True) url = self.ixnObj.sessionUrl+'/traffic/trafficItem/operations/startstatelesstrafficblocking' response = self.ixnObj.post(url, data={'arg1': enabledTrafficItemList}) self.ixnObj.waitForComplete(response, url + '/' + response.json()['id'], timeout=120)