Skip to main content

The IxNetwork Python Client

Project description

The IxNetwork Python Client

pypi python license downloads

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:

  • Online web based documentation

  • 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.

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_restpy-1.1.8.tar.gz (7.8 MB view details)

Uploaded Source

Built Distribution

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

ixnetwork_restpy-1.1.8-py2.py3-none-any.whl (17.7 MB view details)

Uploaded Python 2Python 3

File details

Details for the file ixnetwork_restpy-1.1.8.tar.gz.

File metadata

  • Download URL: ixnetwork_restpy-1.1.8.tar.gz
  • Upload date:
  • Size: 7.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.2rc1

File hashes

Hashes for ixnetwork_restpy-1.1.8.tar.gz
Algorithm Hash digest
SHA256 3fd36f6ee5c3ca943156bb963125a1f1d505ec3a9c808022da3473983dca9ea6
MD5 032a1c3524af2acb1c7a5849b16f8629
BLAKE2b-256 2e73bd66c25684e2fdde0952dd8ada329c11fab9864384e90a3a1770bc6f4ef6

See more details on using hashes here.

File details

Details for the file ixnetwork_restpy-1.1.8-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for ixnetwork_restpy-1.1.8-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 23d3ffe9295dbf2adab0d0086fd5975a68723ffa02c758d8a63ede52a9315fc6
MD5 9beca79a371dc52066cb8cff85406608
BLAKE2b-256 6bd56dbc0c987140d312c73b90a02052a45b17c652a0ba057dd45f94fcb7a978

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