Package: ixnetwork-restpy
The IxNetwork Python ClientInstall the clientpip install --upgrade ixnetwork-restpyImport the packageImport a package based on your product:# The ixnetwork_restpy package is the superset of all IxNetwork productsfromixnetwork_restpyimportSessionAssistant# The uhd_restpy package is a subset of the ixnetwork_restpy package for the UHD appliancefromuhd_restpyimportSessionAssistantStart scripting"""This script demonstrates how to get started with ixnetwork_restpy scripting.The script demonstrates the following:- connect to an IxNetwork test platform, authenticate, add a new session and clear the config- create 1 tx port and 1 rx port- create traffic from the tx port to the rx port- start traffic- print statistics- stop traffic"""fromixnetwork_restpyimportSessionAssistant# create a test tool sessionsession_assistant=SessionAssistant(IpAddress='127.0.0.1',LogLevel=SessionAssistant.LOGLEVEL_INFO,ClearConfig=True)ixnetwork=session_assistant.Ixnetwork# create tx and rx port resourcesport_map=session_assistant.PortMapAssistant()port_map.Map('10.36.74.26',2,13,Name='Tx')port_map.Map('10.36.74.26',2,14,Name='Rx')# create a TrafficItem resource# TrafficItem acts a a high level container for ConfigElement resources# ConfigElement is a high level container for individual HighLevelStream resourcestraffic_item=ixnetwork.Traffic.TrafficItem.add(Name='Traffic Test',TrafficType='raw')traffic_item.EndpointSet.add(Sources=ixnetwork.Vport.find(Name='^Tx').Protocols.find(),Destinations=ixnetwork.Vport.find(Name='^Rx').Protocols.find())# using the traffic ConfigElement resource# update the frame rate# update the transmission controltraffic_config=traffic_item.ConfigElement.find()traffic_config.FrameRate.update(Type='percentLineRate',Rate='100')traffic_config.TransmissionControl.update(Type='continuous')# adjust Ethernet stack fieldsdestination_mac=traffic_config.Stack.find(StackTypeId='ethernet').Field.find(FieldTypeId='ethernet.header.destinationAddress')destination_mac.update(ValueType='valueList',ValueList=['00:00:fa:ce:fa:ce','00:00:de:ad:be:ef'],TrackingEnabled=True)# push ConfigElement settings down to HighLevelStream resourcestraffic_item.Generate()# connect ports to hardware test ports# apply traffic to hardware# start trafficport_map.Connect(ForceOwnership=True)ixnetwork.Traffic.Apply()ixnetwork.Traffic.StartStatelessTrafficBlocking()# print statisticsprint(session_assistant.StatViewAssistant('Port Statistics'))print(session_assistant.StatViewAssistant('Traffic Item Statistics'))print(session_assistant.StatViewAssistant('Flow Statistics'))# stop trafficixnetwork.Traffic.StopStatelessTrafficBlocking()Supported Server VersionsThis client package supports versions 8.52 and up of the following servers:Linux IxNetwork API ServerWindows IxNetwork GUIWindows IxNetwork Connection ManagerDocumentationDocumentation is available using the following methods:Online web based documentationSamplesAPI ReferenceDocumentation available in the online doc browser is also inlined in each class, property and method and can be viewed using the python help commandfromixnetwork_restpyimportSessionAssistanthelp(SessionAssistant)Additional SamplesVisit theOpenIxia ixnetwork-restpy sample site maintained by solution architectsfor in-depth end-to-end samples that demonstrate the following:building a configurationfrom scratchfrom an existing IxNetwork configurationrunning the configurationconnecting ports to hardwarestarting protocolsstarting trafficgetting statisticsport statstraffic statsContributingThe purpose of this repository is to allow users to clone the auto generated code. We do not accept pull requests in this repository.Feedback such as bugs/enhancements/questions regarding the ixnetwork-restpy package is welcomed by opening aGitHub issue.