The IxNetwork Python Client
Install the client
pip install --upgrade ixnetwork-restpy
Import the package
Import a package based on your product:
# The ixnetwork_restpy package is the superset of all IxNetwork products
from ixnetwork_restpy import SessionAssistant
# The uhd_restpy package is a subset of the ixnetwork_restpy package for the UHD appliance
from uhd_restpy import SessionAssistant
Start 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
"""
from ixnetwork_restpy import SessionAssistant
# create a test tool session
session_assistant = SessionAssistant(IpAddress='127.0.0.1',
LogLevel=SessionAssistant.LOGLEVEL_INFO,
ClearConfig=True)
ixnetwork = session_assistant.Ixnetwork
# create tx and rx port resources
port_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 resources
traffic_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 control
traffic_config = traffic_item.ConfigElement.find()
traffic_config.FrameRate.update(Type='percentLineRate', Rate='100')
traffic_config.TransmissionControl.update(Type='continuous')
# adjust Ethernet stack fields
destination_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 resources
traffic_item.Generate()
# connect ports to hardware test ports
# apply traffic to hardware
# start traffic
port_map.Connect(ForceOwnership=True)
ixnetwork.Traffic.Apply()
ixnetwork.Traffic.StartStatelessTrafficBlocking()
# print statistics
print(session_assistant.StatViewAssistant('Port Statistics'))
print(session_assistant.StatViewAssistant('Traffic Item Statistics'))
print(session_assistant.StatViewAssistant('Flow Statistics'))
# stop traffic
ixnetwork.Traffic.StopStatelessTrafficBlocking()
Supported Server Versions
This client package supports versions 8.52 and up of the following servers:
- Linux IxNetwork API Server
- Windows IxNetwork GUI
- Windows IxNetwork Connection Manager
Documentation
Documentation is available using the following methods:
-
Documentation available in the online doc browser is also inlined in each class, property and method and can be viewed using the python help command
from ixnetwork_restpy import SessionAssistant help(SessionAssistant)
Additional Samples
Visit the OpenIxia ixnetwork-restpy sample site maintained by solution architects for in-depth end-to-end samples that demonstrate the following:
- building a configuration
- from scratch
- from an existing IxNetwork configuration
- running the configuration
- connecting ports to hardware
- starting protocols
- starting traffic
- getting statistics
- port stats
- traffic stats
Contributing
The 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 a GitHub issue.
Metadata
Release files for ixnetwork-restpy 1.12.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ixnetwork_restpy-1.12.2.tar.gz | 8.8 MB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ixnetwork_restpy-1.12.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.4 MB
Release files / ixnetwork_restpy-1.12.2.tar.gz
| Download URL | ixnetwork_restpy-1.12.2.tar.gz |
|---|---|
| Size | 8.8 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7120b8dc91d2b8e685c076e3fe648e62bd07442e3e36a7407b3789484a68d163
|
|
BLAKE2b-256 checksum How to use checksums |
7befc8c20fd74ce07b75240104e7a420b3c499e0500af48d4ba422e867cce010
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.4
|
Release files / ixnetwork_restpy-1.12.2-py3-none-any.whl
| Download URL | ixnetwork_restpy-1.12.2-py3-none-any.whl |
|---|---|
| Size | 19.6 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
049caecc3ba3e4d5df4d921148a804925c7464d06c80862671f9a23d2eedd338
|
|
BLAKE2b-256 checksum How to use checksums |
74fe1a42e26031695f8b19941bfdbd925f0f626841f58295bb37d8eb04359f6a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.4
|
Security for ixnetwork-restpy 1.12.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.