## The IxNetwork Python Client
[![pypi](https://img.shields.io/pypi/v/ixnetwork-restpy.svg)](https://pypi.org/project/ixnetwork-restpy)
[![python](https://img.shields.io/pypi/pyversions/ixnetwork-restpy.svg)](https://pypi.python.org/pypi/ixnetwork-restpy)
[![license](https://img.shields.io/badge/license-MIT-green.svg)](https://en.wikipedia.org/wiki/MIT_License)
[![downloads](https://pepy.tech/badge/ixnetwork-restpy)](https://pepy.tech/project/ixnetwork-restpy)
## Install the client
```
pip install --upgrade ixnetwork-restpy
```
## Import the package
Import a package based on your product:
```python
# The ixnetwork_restpy package is the superset of all IxNetwork products
from ixnetwork_restpy import SessionAssistant
```
```python
# The uhd_restpy package is a subset of the ixnetwork_restpy package for the UHD appliance
from uhd_restpy import SessionAssistant
```
## Start scripting
```python
"""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](https://openixia.github.io/ixnetwork_restpy/#/overview)
* [Samples](https://openixia.github.io/ixnetwork_restpy/#/samples)
* [API Reference](https://openixia.github.io/ixnetwork_restpy/#/reference)
* 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
```python
from ixnetwork_restpy import SessionAssistant
help(SessionAssistant)
```
## Additional Samples
Visit the [OpenIxia ixnetwork-restpy sample site maintained by solution architects](https://github.com/OpenIxia/IxNetwork/tree/master/RestPy) 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](https://github.com/OpenIxia/ixnetwork_restpy/issues).
Raw data
{
"_id": null,
"home_page": "https://github.com/OpenIxia/ixnetwork_restpy",
"name": "ixnetwork-restpy",
"maintainer": null,
"docs_url": null,
"requires_python": "<4,>=2.7",
"maintainer_email": null,
"keywords": "ixnetwork performance traffic generator real world ixia automation",
"author": "Keysight ISG IxNetwork team",
"author_email": "andy.balogh@keysight.com",
"download_url": "https://files.pythonhosted.org/packages/c5/f2/f88447bd33de42814e101ed2dbd3f51eca7f8884aef22c3f3720420e1859/ixnetwork_restpy-1.2.0.tar.gz",
"platform": null,
"description": "## The IxNetwork Python Client \r\n\r\n[![pypi](https://img.shields.io/pypi/v/ixnetwork-restpy.svg)](https://pypi.org/project/ixnetwork-restpy)\r\n[![python](https://img.shields.io/pypi/pyversions/ixnetwork-restpy.svg)](https://pypi.python.org/pypi/ixnetwork-restpy)\r\n[![license](https://img.shields.io/badge/license-MIT-green.svg)](https://en.wikipedia.org/wiki/MIT_License)\r\n[![downloads](https://pepy.tech/badge/ixnetwork-restpy)](https://pepy.tech/project/ixnetwork-restpy)\r\n\r\n\r\n## Install the client\r\n```\r\npip install --upgrade ixnetwork-restpy\r\n```\r\n\r\n\r\n## Import the package\r\nImport a package based on your product:\r\n```python\r\n# The ixnetwork_restpy package is the superset of all IxNetwork products\r\nfrom ixnetwork_restpy import SessionAssistant\r\n```\r\n```python\r\n# The uhd_restpy package is a subset of the ixnetwork_restpy package for the UHD appliance\r\nfrom uhd_restpy import SessionAssistant\r\n```\r\n\r\n\r\n## Start scripting\r\n```python\r\n\"\"\"This script demonstrates how to get started with ixnetwork_restpy scripting.\r\n\r\nThe script demonstrates the following:\r\n - connect to an IxNetwork test platform, authenticate, add a new session and clear the config\r\n - create 1 tx port and 1 rx port\r\n - create traffic from the tx port to the rx port\r\n - start traffic\r\n - print statistics\r\n - stop traffic\r\n\"\"\"\r\nfrom ixnetwork_restpy import SessionAssistant\r\n\r\n\r\n# create a test tool session\r\nsession_assistant = SessionAssistant(IpAddress='127.0.0.1', \r\n LogLevel=SessionAssistant.LOGLEVEL_INFO, \r\n ClearConfig=True)\r\nixnetwork = session_assistant.Ixnetwork\r\n\r\n# create tx and rx port resources\r\nport_map = session_assistant.PortMapAssistant()\r\nport_map.Map('10.36.74.26', 2, 13, Name='Tx')\r\nport_map.Map('10.36.74.26', 2, 14, Name='Rx')\r\n\r\n# create a TrafficItem resource\r\n# TrafficItem acts a a high level container for ConfigElement resources\r\n# ConfigElement is a high level container for individual HighLevelStream resources\r\ntraffic_item = ixnetwork.Traffic.TrafficItem.add(Name='Traffic Test', TrafficType='raw')\r\ntraffic_item.EndpointSet.add(\r\n Sources=ixnetwork.Vport.find(Name='^Tx').Protocols.find(), \r\n Destinations=ixnetwork.Vport.find(Name='^Rx').Protocols.find())\r\n\r\n# using the traffic ConfigElement resource\r\n# update the frame rate\r\n# update the transmission control\r\ntraffic_config = traffic_item.ConfigElement.find()\r\ntraffic_config.FrameRate.update(Type='percentLineRate', Rate='100')\r\ntraffic_config.TransmissionControl.update(Type='continuous')\r\n\r\n# adjust Ethernet stack fields\r\ndestination_mac = traffic_config.Stack.find(StackTypeId='ethernet').Field.find(FieldTypeId='ethernet.header.destinationAddress')\r\ndestination_mac.update(ValueType='valueList', ValueList=['00:00:fa:ce:fa:ce', '00:00:de:ad:be:ef'], TrackingEnabled=True)\r\n\r\n# push ConfigElement settings down to HighLevelStream resources\r\ntraffic_item.Generate()\r\n\r\n# connect ports to hardware test ports\r\n# apply traffic to hardware\r\n# start traffic\r\nport_map.Connect(ForceOwnership=True)\r\nixnetwork.Traffic.Apply()\r\nixnetwork.Traffic.StartStatelessTrafficBlocking()\r\n\r\n# print statistics\r\nprint(session_assistant.StatViewAssistant('Port Statistics'))\r\nprint(session_assistant.StatViewAssistant('Traffic Item Statistics'))\r\nprint(session_assistant.StatViewAssistant('Flow Statistics'))\r\n\r\n# stop traffic\r\nixnetwork.Traffic.StopStatelessTrafficBlocking()\r\n```\r\n\r\n## Supported Server Versions\r\nThis client package supports versions 8.52 and up of the following servers:\r\n* Linux IxNetwork API Server\r\n* Windows IxNetwork GUI\r\n* Windows IxNetwork Connection Manager\r\n\r\n## Documentation\r\nDocumentation is available using the following methods:\r\n* [Online web based documentation](https://openixia.github.io/ixnetwork_restpy/#/overview)\r\n * [Samples](https://openixia.github.io/ixnetwork_restpy/#/samples)\r\n * [API Reference](https://openixia.github.io/ixnetwork_restpy/#/reference)\r\n\r\n* 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\r\n ```python\r\n from ixnetwork_restpy import SessionAssistant\r\n \r\n help(SessionAssistant)\r\n ```\r\n\r\n## Additional Samples\r\nVisit the [OpenIxia ixnetwork-restpy sample site maintained by solution architects](https://github.com/OpenIxia/IxNetwork/tree/master/RestPy) for in-depth end-to-end samples that demonstrate the following:\r\n* building a configuration\r\n * from scratch\r\n * from an existing IxNetwork configuration\r\n* running the configuration\r\n * connecting ports to hardware\r\n * starting protocols\r\n * starting traffic\r\n* getting statistics\r\n * port stats\r\n * traffic stats\r\n\r\n## Contributing\r\nThe purpose of this repository is to allow users to clone the auto generated code. We do not accept pull requests in this repository.\r\n\r\nFeedback such as bugs/enhancements/questions regarding the ixnetwork-restpy package is welcomed by opening a [GitHub issue](https://github.com/OpenIxia/ixnetwork_restpy/issues).\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "The IxNetwork Python Client",
"version": "1.2.0",
"project_urls": {
"Homepage": "https://github.com/OpenIxia/ixnetwork_restpy"
},
"split_keywords": [
"ixnetwork",
"performance",
"traffic",
"generator",
"real",
"world",
"ixia",
"automation"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "48d379bbf5b46316a5b33f6a3a5bea0d3f90a8953fd75b12386a176473657248",
"md5": "8b0cb436c1db1741a80aba83691a4eaf",
"sha256": "da3b3e99ca5e01f9dac4a2a05425f0423d2072418cc43b57680b86ffd9a82205"
},
"downloads": -1,
"filename": "ixnetwork_restpy-1.2.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "8b0cb436c1db1741a80aba83691a4eaf",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": "<4,>=2.7",
"size": 18225579,
"upload_time": "2024-04-22T11:28:42",
"upload_time_iso_8601": "2024-04-22T11:28:42.903292Z",
"url": "https://files.pythonhosted.org/packages/48/d3/79bbf5b46316a5b33f6a3a5bea0d3f90a8953fd75b12386a176473657248/ixnetwork_restpy-1.2.0-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c5f2f88447bd33de42814e101ed2dbd3f51eca7f8884aef22c3f3720420e1859",
"md5": "7d362180875ab88f4016e84dee1c0f41",
"sha256": "cec998ab2a5e5129c5913357a6e273b7a8fcebdc0b6515d5ff5b2d219ba7b5ee"
},
"downloads": -1,
"filename": "ixnetwork_restpy-1.2.0.tar.gz",
"has_sig": false,
"md5_digest": "7d362180875ab88f4016e84dee1c0f41",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4,>=2.7",
"size": 8127242,
"upload_time": "2024-04-22T11:28:51",
"upload_time_iso_8601": "2024-04-22T11:28:51.443295Z",
"url": "https://files.pythonhosted.org/packages/c5/f2/f88447bd33de42814e101ed2dbd3f51eca7f8884aef22c3f3720420e1859/ixnetwork_restpy-1.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-22 11:28:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "OpenIxia",
"github_project": "ixnetwork_restpy",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "ixnetwork-restpy"
}