The IxNetwork Open Traffic Generator Python Package
Project description
Keysight IxNetwork Open Traffic Generator
The Keysight IxNetwork implementation of the open-traffic-generator models.
Getting Started
Install the client
pip install --upgrade ixnetwork-open-traffic-generator
Start scripting
"""A simple test that demonstrates the following:
- A port that transmits an ethernet/vlan/ipv4/tcp flow
for a specified duration and a port that receives the packets.
- While the flow is transmitting the script prints out tx and rx statistics.
- Once all the packets have been transmitted the script will end.
"""
import abstract_open_traffic_generator.port as port
import abstract_open_traffic_generator.flow as flow
import abstract_open_traffic_generator.config as config
import abstract_open_traffic_generator.control as control
import abstract_open_traffic_generator.result as result
from ixnetwork_open_traffic_generator.ixnetworkapi import IxNetworkApi
import pandas
tx_port = port.Port(name='Tx Port', location='10.36.74.26;02;13')
rx_port = port.Port(name='Rx Port', location='10.36.74.26;02;14')
flow = flow.Flow(name='Tx Port to Rx Port Flow',
tx_rx=flow.TxRx(
flow.PortTxRx(tx_port_name=tx_port.name,
rx_port_names=[rx_port.name])),
packet=[
flow.Header(flow.Ethernet()),
flow.Header(flow.Vlan()),
flow.Header(flow.Ipv4()),
flow.Header(flow.Tcp())
],
size=flow.Size(128),
rate=flow.Rate(unit='pps', value=1000),
duration=flow.Duration(flow.FixedPackets(10000)))
config = config.Config(ports=[tx_port, rx_port],
flows=[flow],
options=config.Options(port_options=port.Options(
location_preemption=True)))
api = IxNetworkApi(address='10.36.66.49', port=11009)
api.set_state(control.State(control.ConfigState(config=config, state='set')))
state = control.State(control.FlowTransmitState(state='start'))
api.set_state(state)
request = result.PortRequest(
column_names=['name', 'location', 'frames_tx', 'frames_rx'])
while True:
results = api.get_port_results(request)
df = pandas.DataFrame.from_dict(results)
print(df)
if df.frames_tx.sum() >= config.flows[0].duration.packets.packets:
break
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for ixnetwork_open_traffic_generator-0.0.27.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5dc7b22b42146d3f3b6b6ef26d78133006c8887242d01e5453d8c81b4eebbc1f |
|
MD5 | d9f0dad868caa9be8d6922f681ccb54d |
|
BLAKE2b-256 | d546d174c7d47b9dec59225ce613227dcad1b19ad0c82218561daa2029e5691f |
Close
Hashes for ixnetwork_open_traffic_generator-0.0.27-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0bbe22ea0458e63b6f5bbf4038e5a31c1e83fd715195b102eb5a4c1e8ad346a2 |
|
MD5 | bb685aa648c579c48a77ab674085e3a2 |
|
BLAKE2b-256 | 8d507cb13b62c41a408f87f57241279c21701097ff1625f68656e16c6d432113 |