Registry / http-networking / ixnetwork-restpy

ixnetwork-restpy

JSON →
library1.10.0pypypiunverified

The ixnetwork-restpy library is the official Python client for automating Keysight's IxNetwork via its REST API. It provides an object-oriented interface to programmatically control test platforms, configure network topologies, generate traffic, and collect statistics. The library is actively maintained, with frequent minor releases (typically monthly or bi-monthly) to support new IxNetwork features and address bug fixes, currently at version 1.9.0.

pip install --upgrade ixnetwork-restpy
INSTALL
IMPORT
SIG · IXNETWORK-RESTPY
I
ixnetwork-restpy
http-networkingpythonv1.10.0
Install
11.3s avg
Import
680ms
Disk
293MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.10.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.700s · 275.8MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 11.3s · import 0.659s · 276MB
293MB installed
● package 293MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SessionAssistant
from ixnetwork_restpy import SessionAssistant
SessionAssistant is the recommended entry point for general scripting, providing simplified session management and access to the IxNetwork object.
TestPlatform
from ixnetwork_restpy.testplatform.testplatform import TestPlatform
from ixnetwork_restpy import TestPlatform
While functional, SessionAssistant is generally preferred for its consolidated features. If using TestPlatform, ensure to import from the full path `ixnetwork_restpy.testplatform.testplatform`. Older examples might show a direct import that is now incorrect.

This quickstart demonstrates how to connect to an IxNetwork API server, authenticate, map physical ports, create a basic traffic item, start/stop traffic, and retrieve statistics. Replace '10.0.0.1' with your IxNetwork chassis IP, and ensure the `IXNET_SERVER_IP`, `IXNET_USERNAME`, and `IXNET_PASSWORD` environment variables are set or updated in the script. It uses `SessionAssistant` for simplified workflow and `PortMapAssistant` for port management.

import os from ixnetwork_restpy import SessionAssistant, Files # Configure connection parameters IXNETWORK_API_SERVER_IP = os.environ.get('IXNET_SERVER_IP', '127.0.0.1') IXNETWORK_USERNAME = os.environ.get('IXNET_USERNAME', 'admin') IXNETWORK_PASSWORD = os.environ.get('IXNET_PASSWORD', 'admin') # Create a session and connect to IxNetwork try: session_assistant = SessionAssistant( IpAddress=IXNETWORK_API_SERVER_IP, UserName=IXNETWORK_USERNAME, Password=IXNETWORK_PASSWORD, ClearConfig=True, # Clears any existing configuration on the server LogLevel=SessionAssistant.LOGLEVEL_INFO ) ixnetwork = session_assistant.Ixnetwork print(f"Connected to IxNetwork API Server at {IXNETWORK_API_SERVER_IP}") # Example: Create a simple configuration (e.g., two ports, basic traffic) # These IPs and ports must match your physical setup port_map = session_assistant.PortMapAssistant() port_map.Map('10.0.0.1', 1, 1, Name='TxPort') # Chassis IP, Card ID, Port ID port_map.Map('10.0.0.1', 1, 2, Name='RxPort') # Chassis IP, Card ID, Port ID port_map.Connect(ForceOwnership=True) print("Ports mapped and connected.") # Add a traffic item traffic_item = ixnetwork.Traffic.TrafficItem.add(Name='Simple Traffic', TrafficType='raw') traffic_item.EndpointSet.add( Sources=ixnetwork.Vport.find(Name='^TxPort$').Protocols.find(), Destinations=ixnetwork.Vport.find(Name='^RxPort$').Protocols.find() ) traffic_config = traffic_item.ConfigElement.find() traffic_config.FrameRate.update(Type='percentLineRate', Rate='10') traffic_config.TransmissionControl.update(Type='continuous') print("Traffic item configured.") # Apply and start traffic ixnetwork.Traffic.Apply() ixnetwork.Traffic.StartStatelessTrafficBlocking() print("Traffic started. Waiting for stats...") # Get and print statistics port_stats = session_assistant.StatViewAssistant('Port Statistics') traffic_item_stats = session_assistant.StatViewAssistant('Traffic Item Statistics') print("\n--- Port Statistics ---") print(port_stats) print("\n--- Traffic Item Statistics ---") print(traffic_item_stats) # Stop traffic and clear config ixnetwork.Traffic.StopStatelessTrafficBlocking() session_assistant.ClearConfig() print("Traffic stopped and configuration cleared.") except Exception as e: print(f"An error occurred: {e}") finally: if 'session_assistant' in locals() and session_assistant.Is</span>Connected: # Ensure the session is properly closed if it was opened session_assistant.Session.delete() print("Session deleted.")
Debug
Known issues
breakingIntroduction of `slots` support in version 1.0.41 (September 2019) causes `AttributeError` when accessing non-existent properties.
fix
Review existing scripts and update property access to match the official API. Use `help()` on objects or consult online documentation to verify valid properties.
affects: >=1.0.41
gotchaIxNetwork saved configuration files (`.ixncfg`) are generally forward-compatible but not backward-compatible. A configuration saved with a newer IxNetwork server version will not load on an older server version.
fix
Always use a configuration file saved with a version of IxNetwork that is equal to or older than the target IxNetwork API server version.
affects: All versions
deprecatedThe older `IxNetRestApi` library is deprecated in favor of `ixnetwork-restpy`. The `IxNetRestApi` is no longer maintained, and new features/enhancements will not be added to it.
fix
Migrate any scripts using `IxNetRestApi` to `ixnetwork-restpy` for continued support and access to new features.
affects: All versions (deprecation announced starting around 2021)
Upgrade
Version history
1.10.0latest on PyPI · released Apr 30, 2026
Audit
Dependencies
requestsrequiredUsed for underlying HTTP REST communication with the IxNetwork API server.
Agent activity
25 hits · last 30 days
node
22
Resources
ixnetwork-restpy — pip install ixnetwork-restpy · libregistry