The Snappi Open Traffic Generator Python Package
Project description
snappi
Create test case scripts once using the snappi client and run them using a
traffic generator that conforms to the Open Traffic Generator API.
Install the client
pip install snappi
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 snappi
api = snappi.Api()
config = api.config()
tx_port, rx_port = config.ports \
.port(name='Tx Port', location='10.36.74.26;02;13')
.port(name='Rx Port', location='10.36.74.26;02;14')
flow = config.flows.flow(name='Tx -> Rx Flow')
flow.tx_rx.port.tx_name = tx_port.name
flow.tx_rx.port.tx_name = rx_port.name
flow.packet.ethernet().vlan().ipv4().tcp()
flow.size.fixed = 128
flow.rate.pps = 1000
flow.duration.fixed_packets.packets = 10000
api.set_config(config)
tx_state = api.transmit_state(state='start')
api.set_transmit(tx_state)
while True:
results = api.get_port_results(api.result_portrequest)
df = pandas.DataFrame.from_dict(results)
print(df)
if df.frames_tx.sum() >= flow.duration.fixed_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
snappi-0.1.5.tar.gz
(45.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file snappi-0.1.5.tar.gz.
File metadata
- Download URL: snappi-0.1.5.tar.gz
- Upload date:
- Size: 45.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c46508e3e8d9d288100fa6210391f60bb1f88998c0009597fa133675e0071d7
|
|
| MD5 |
9532f6a660d56048a544afcc2780fb7c
|
|
| BLAKE2b-256 |
896d2c7bcfba87e947ea5a0eb52977a32252dc357a2c4f0c939497c6e1a8e36d
|
File details
Details for the file snappi-0.1.5-py2.py3-none-any.whl.
File metadata
- Download URL: snappi-0.1.5-py2.py3-none-any.whl
- Upload date:
- Size: 82.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74c71b3ebbe727b396d21e6240f92d792c8d469a68af2b8b12e81012866f73f8
|
|
| MD5 |
8aa0741ba1076f3bb8c856261f93d11c
|
|
| BLAKE2b-256 |
c5638ec32ecaf52a380dba7ed3f1ed45793c91ada9aa712e6f44d9f57d02f747
|