|
| 1 | +import sys, traceback |
| 2 | + |
| 3 | +from ixNetworkDataModelConfig import ConfigIxNetworkRestPy |
| 4 | +from keystackEnv import keystackObj |
| 5 | + |
| 6 | +dataModelYamlFile = keystackObj.configParamsFileFullPath |
| 7 | + |
| 8 | +try: |
| 9 | + mainObj = ConfigIxNetworkRestPy(dataModelFile=dataModelYamlFile, |
| 10 | + sessionName=None, sessionId=None, apiKey=None, clearConfig=True, |
| 11 | + logLevel='info', logFilename=None, keystackObj=keystackObj) |
| 12 | + |
| 13 | + mainObj.ports.assignPorts() |
| 14 | + mainObj.portCapture.configure() |
| 15 | + mainObj.closeAllTabs() |
| 16 | + mainObj.ngpf.configure() |
| 17 | + mainObj.ngpf.startAllProtocols() |
| 18 | + mainObj.ngpf.verifyProtocolsUp() |
| 19 | + ngpfMacAddresses = mainObj.ngpf.getNgpfLearnedMacAddresses() |
| 20 | + mainObj.trafficItem.configRawTrafficItems(ngpfMacAddresses=ngpfMacAddresses) |
| 21 | + mainObj.trafficItem.generateAll() |
| 22 | + mainObj.trafficItem.apply() |
| 23 | + mainObj.portCapture.start() |
| 24 | + mainObj.trafficItem.start() |
| 25 | + mainObj.trafficItem.waitForTrafficCompletion(maxCounter=10) |
| 26 | + mainObj.portCapture.stop() |
| 27 | + mainObj.portCapture.getDataPlaneCaptureFile(writeCaptureToFile=False, |
| 28 | + amountOfPacketsToWrite=5, |
| 29 | + captureFileDestPath=keystackObj.moduleProperties['artifactsRepo']) |
| 30 | + |
| 31 | + |
| 32 | + if mainObj.configs['releasePorts']: |
| 33 | + mainObj.ports.releasePorts() |
| 34 | + |
| 35 | + if mainObj.configs['deleteSession']: |
| 36 | + mainObj.deleteSession() |
| 37 | + |
| 38 | +except Exception as errMsg: |
| 39 | + if 'mainObj' in locals(): |
| 40 | + mainObj.logFailed(traceback.format_exc(None, errMsg)) |
| 41 | + |
| 42 | + |
| 43 | + |
0 commit comments