Supercharge Your pyATS Testing with IxNetwork Traffic Validation
Hey Fellow Network Automators / Developers / Solution Engineers,
Supercharge Your pyATS Testing with IxNetwork Traffic Validation
Hey Fellow Network Automators / Developers / Solution Engineers,
You’ve mastered pyATS for automated network validation — parsing outputs, validating state, building robust test pipelines. But when it comes to validating real traffic behavior between your devices and an IxNetwork traffic generator, things can feel less straightforward.
What if you could seamlessly integrate IxNetwork (Ixia TGEN) into your pyATS workflow and execute end-to-end traffic tests directly from the same framework you already trust?
Let’s bridge that gap — and turn functional validation into full traffic-driven verification. 🚀
pyATS lib for IxNetwork RestPy: https://developer.cisco.com/docs/genie-trafficgen/
Here is a quick rundown for it.
> Assumption: Ixia Chassis and Cisco XR devices are connected.
> What we doing in script: Connecting to alredy created session and running some IxNetwork commands.
Create a sample “testbed.yaml “ with cisco device and Ixia API Server = Ixia Test Manager testing sessions.
testbed:
name: SandboxXR
credentials:
default:
username: admin
password: password123
devices:
xr1:
type: router
platform: iosxr
alias: SandboxXR
os: iosxr
credentials:
default:
username: ashwinjosh
password: XXXXXXXXXX
connections:
cli:
protocol: ssh
ip: sandbox-iosxr-1.cisco.com
port: 22
ixnetwork-01:
type: tgen
os: ixiarestpy # Genie TrafficGen IxNetwork REST API
connections:
tgn:
class: genie.trafficgen.TrafficGen
ip: 10.36.236.121 # IxNetwork API Server
port: 443
session_id: 1. # Remove config this if you want to create a new sessions
clear_config: false # Set true/false based on what you want. This is similar to args you pass in SessionAssistant
credentials:
default:
username: admin
password: XXXXXX!
Now, that you have the testebed file, lets see how to interact with the tgen using “ixnetwork_interaction.py” pyATS library
import sys
from pathlib import Path
from pyats.topology import loader
testbed = loader.load("testbed_sandbox_xr.yaml")
tgn = testbed.devices["ixnetwork-01"]
tgn.instantiate(via="tgn")
tgn.connect(via="tgn")
# The following objects are available to interact with:
print(tgn.session)
print("--------------------------------")# Created via SessionAssistant
print(tgn.ixnetwork.Traffic.TrafficItem.find()[0])
print("--------------------------------")#
#tgn.disconnect() <== Uncomment this when you want to delete the session once done with the testing
"""
pyats_env) ubuntusand@ubuntusand:~/100DaysOfPyATS$ python3 Day009_Run_ixnetwork_pyats/ixnetwork_interaction.py
ixnetwork_version not defined for device Device ixnetwork-01, type tgen via tgn
2026-02-13 21:27:51 [ixnetwork_restpy.connection tid:137571318435840] [INFO] using python version 3.10.12 (main, Jan 26 2026, 14:55:28) [GCC 11.4.0]
2026-02-13 21:27:51 [ixnetwork_restpy.connection tid:137571318435840] [INFO] using ixnetwork-restpy version 1.9.0
2026-02-13 21:27:51 [ixnetwork_restpy.connection tid:137571318435840] [WARNING] Verification of certificates is disabled
2026-02-13 21:27:51 [ixnetwork_restpy.connection tid:137571318435840] [INFO] Determining the platform and rest_port using the 10.36.236.121 address...
2026-02-13 21:27:51 [ixnetwork_restpy.connection tid:137571318435840] [WARNING] Unable to connect to http://10.36.236.121:443.
2026-02-13 21:27:51 [ixnetwork_restpy.connection tid:137571318435840] [INFO] Connection established to `https://10.36.236.121:443 on linux`
2026-02-13 21:27:52 [ixnetwork_restpy.connection tid:137571318435840] [INFO] Using IxNetwork api server version 11.00.2504.10
2026-02-13 21:27:52 [ixnetwork_restpy.connection tid:137571318435840] [INFO] User info IxNetwork/ixnetworkweb/admin-1-19727
<ixnetwork_restpy.assistants.sessions.sessionassistant.SessionAssistant object at 0x7d1ecc7df910>
--------------------------------
TrafficItem[0]: /api/v1/sessions/1/ixnetwork/traffic/trafficItem/1
AllowSelfDestined: False
BgpEpeOrdinalValue: 0
BgpEpeSidType: nodeSID
BiDirectional: False
EgressEnabled: False
EnableDynamicMplsLabelValues: False
EnableMacsecEgressOnlyAutoConfig: True
EnableMacsecSwChecksumCalc: False
Enabled: True
Errors: []
EvpnNextHopOrdinalValue: 0
FlowGroupCount: 1
FrerDuplicateElimination: False
HasOpenFlow: False
HostsPerNetwork: 1
InterAsBgpPreference: one
InterAsLdpPreference: two
LabelPreferences: []
MaxNumberOfVpnLabelStack: 2
MergeDestinations: True
MulticastForwardingMode: replication
Name: Traffic Item 1
NumVlansForMulticastReplication: 1
OrdinalNo: 0
OriginatorType: endUser
RawTrafficRxPortsBehavior: replicated
RegenerateCount: 0
RoundRobinPacketOrdering: False
RouteMesh: oneToOne
SrcDestMesh: oneToOne
State: stopped
Suspend: False
TrafficItemType: l2L3
TrafficType: ipv4
TransmitMode: interleaved
TransportLdpPreference: two
TransportRsvpTePreference: one
UseControlPlaneFrameSize: True
UseControlPlaneRate: True
Warnings: []
--------------------------------
"""
python3 ixnetwork_interaction.py
I hope this was helpful. I will update you as and how I do more experiments on it.
메타데이터
- post_id
- f667927fd2c8
- slug
- supercharge-your-pyats-testing-with-ixnetwork-traffic-validation-f667927fd2c8
- url
- https://medium.com/@ashwinjosh/supercharge-your-pyats-testing-with-ixnetwork-traffic-validation-f667927fd2c8
- canonical_url
- https://medium.com/@ashwinjosh/supercharge-your-pyats-testing-with-ixnetwork-traffic-validation-f667927fd2c8
- author_url
- https://medium.com/@ashwinjosh
- status
- ok
- fetched_at
- 2026-07-13 06:23:13