""" PLEASE READ DISCLAIMER This is a sample script for demo and reference purpose only. It is subject to change for content updates without warning. REQUIREMENTS - Python modules: requests SUPPORTS - Python 2.7 and 3+ - IxNetwork API servers: Windows, WindowsConnectionMgr and Linux DESCRIPTION Capturing packets. This script assumes that a configuration exist already. For Linux API server connection, provide the sessionID and apiKey. Enable data plane and/or control plane capturing. Saved the .cap files (dataPlane and/or controlPlane) to local filesystem. Save packet capturing in wireshark style with header details. Set traffic to send at continuous mode. Tested on Windows and Linux API server. SYNTAXES PATCH: /api/v1/sessions/5/ixnetwork/vport/2 DATA: {'rxMode': 'captureAndMeasure'} PATCH: /api/v1/sessions/5/ixnetwork/vport/2/capture DATA: {'softwareEnabled': False, 'hardwareEnabled': True} # Set traffic item to send continuous packets PATCH: /api/v1/sessions/5/ixnetwork/traffic/trafficItem/1/configElement/1/transmissionControl DATA: {'type': 'continuous'} POST: /api/v1/sessions/5/ixnetwork/traffic/trafficItem/operations/generate DATA: {"arg1": ["/api/v1/sessions/5/ixnetwork/traffic/trafficItem/1"]} POST: /api/v1/sessions/5/ixnetwork/traffic/operations/apply DATA: {"arg1": "/api/v1/sessions/5/ixnetwork/traffic"} POST: /api/v1/sessions/5/ixnetwork/traffic/operations/start DATA: {"arg1": "https://192.168.70.12/api/v1/sessions/5/ixnetwork/traffic"} Start continuous traffic POST: /api/v1/sessions/4/ixnetwork/operations/startcapture POST: /api/v1/sessions/4/ixnetwork/operations/stopcapture POST: /api/v1/sessions/4/ixnetwork/operations/savecapturefiles DATA: {"arg1": "packetCaptureFolder"} <-- This could be any name. Just a temporary folder to store the captured file. Wait for the /operations/savecapturefiles to complete. May take up to a minute. For Windows API server: POST: /ixnetwork/operations/copyfile DATA: {"arg1": "c:\\Results\\port2_HW.cap", "arg2": "/api/v1/sessions/1/ixnetwork/files/port2_HW.cap"} GET: /ixnetwork/files?filename=port2_HW.cap For Linux API server: POST: /ixnetwork/operations/copyfile DATA: {"arg1": "captures/packetCaptureFolder/port2_HW.cap", "arg2": "/api/v1/sessions//ixnetwork/files/port2_HW.cap"} GET: /ixnetwork/files?filename=captures/packetCaptureFolder/port2_HW.cap USAGE python