Skip to main content

The IxNetwork Open Traffic Generator Python Package

Project description

Keysight IxNetwork Open Traffic Generator

Build pypi python license Total alerts Language grade: Python

The Keysight IxNetwork implementation of the open-traffic-generator models.
To start contributing, please see contributing.md.

Getting Started

Install client package

python -m pip install --upgrade ixnetwork-open-traffic-generator

Start scripting

# for constructing traffic configuration
from abstract_open_traffic_generator import (
    port, flow, config, control, result
)
# for making API calls
from ixnetwork_open_traffic_generator.ixnetworkapi import IxNetworkApi

# provide API server and port addresses
api = IxNetworkApi(address='127.0.0.1', port=11009)
tx = port.Port(name='Tx Port', location='127.0.0.1;2;1')
rx = port.Port(name='Rx Port', location='127.0.0.1;2;2')

# configure one TCP flow (with default protocol headers) to send 10000 packets,
# each of 128 bytes at 10% of max line rate
flw = flow.Flow(
    name='Flow %s->%s' % (tx.name, rx.name),
    tx_rx=flow.TxRx(
        flow.PortTxRx(tx_port_name=tx.name, rx_port_name=rx.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(value=10, unit='line'),
    duration=flow.Duration(flow.FixedPackets(packets=10000))
)

# push configuration and start transmitting flows
cfg = config.Config(ports=[tx, rx], flows=[flw])
api.set_state(control.State(control.ConfigState(config=cfg, state='set')))
api.set_state(control.State(control.FlowTransmitState(state='start')))

# fetch tx port stats and wait until total frames sent is correct or retry
# retry count is 0
retry = 5
request = result.PortRequest(port_names=[tx.name], column_names=['frames_tx'])

while sum([p['frames_tx'] for p in api.get_port_results(request)]) != 10000:
    assert retry > 0
    retry -= 1

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

ixnetwork_open_traffic_generator-0.0.81.tar.gz (44.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ixnetwork_open_traffic_generator-0.0.81-py2.py3-none-any.whl (46.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file ixnetwork_open_traffic_generator-0.0.81.tar.gz.

File metadata

  • Download URL: ixnetwork_open_traffic_generator-0.0.81.tar.gz
  • Upload date:
  • Size: 44.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.6.1 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.5

File hashes

Hashes for ixnetwork_open_traffic_generator-0.0.81.tar.gz
Algorithm Hash digest
SHA256 ef6577d83860a57672831de3bffc4a37b212e8b9a8978fc81f460ec442d0e308
MD5 2ccfdd928858f0129b537e5273e22fd4
BLAKE2b-256 e731a2e64b0d37e98211a546a4df324f0dd2442632745729bff868c39d8a50c6

See more details on using hashes here.

File details

Details for the file ixnetwork_open_traffic_generator-0.0.81-py2.py3-none-any.whl.

File metadata

  • Download URL: ixnetwork_open_traffic_generator-0.0.81-py2.py3-none-any.whl
  • Upload date:
  • Size: 46.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.6.1 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.5

File hashes

Hashes for ixnetwork_open_traffic_generator-0.0.81-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6f5dc621b2dc8e2badaa9794bd64c3bf62a786d7c4b0265fad2431a999c544a5
MD5 f51d208864a9a9ec52fd121f5e48de8b
BLAKE2b-256 63c4a19104ea9e2cfbfdee2795b3f23e2431e0f48d7fc0694d9421e2f09d2364

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page