diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-05-18 05:19:43 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-05-18 05:19:43 +0000 |
| commit | 328cdef68acd5bec8fbd1f619467d090a31486c1 (patch) | |
| tree | e4cc06f06f2143a2807b018254c2f2aaacccc03b | |
| parent | 3788ca3961d6eb3f1bcc9f6c7548c94d87d4ce12 (diff) | |
automatic import of python-snappi-ixnetwork
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-snappi-ixnetwork.spec | 318 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 320 insertions, 0 deletions
@@ -0,0 +1 @@ +/snappi_ixnetwork-0.9.1.tar.gz diff --git a/python-snappi-ixnetwork.spec b/python-snappi-ixnetwork.spec new file mode 100644 index 0000000..cf7909b --- /dev/null +++ b/python-snappi-ixnetwork.spec @@ -0,0 +1,318 @@ +%global _empty_manifest_terminate_build 0 +Name: python-snappi-ixnetwork +Version: 0.9.1 +Release: 1 +Summary: The Snappi IxNetwork Open Traffic Generator Python Package +License: MIT +URL: https://github.com/open-traffic-generator/snappi-ixnetwork +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/f2/c4/75c1e4f2c81a0e93b13ed3e96a758615b645ee1c7e70dff382173e5a7e4a/snappi_ixnetwork-0.9.1.tar.gz +BuildArch: noarch + +Requires: python3-ixnetwork-restpy +Requires: python3-snappi +Requires: python3-snappi-convergence +Requires: python3-pytest +Requires: python3-mock +Requires: python3-dpkt + +%description +# snappi Extension for IxNetwork + +[](https://en.wikipedia.org/wiki/MIT_License) +[](https://www.repostatus.org/#active) +[](https://github.com/open-traffic-generator/snappi-ixnetwork/actions) +[](https://pypi.org/project/snappi_ixnetwork) +[](https://pypi.python.org/pypi/snappi_ixnetwork) +[](https://lgtm.com/projects/g/open-traffic-generator/snappi-ixnetwork/alerts/) +[](https://lgtm.com/projects/g/open-traffic-generator/snappi-ixnetwork/context:python) +[](https://pepy.tech/project/snappi-ixnetwork) + +This extension allows executing test scripts written using [snappi](https://github.com/open-traffic-generator/snappi) against +IxNetwork, (one of) Keysight's implementation of [Open Traffic Generator](https://github.com/open-traffic-generator/models/releases). + +> The repository is under active development. + +To start contributing, please see [contributing.md](contributing.md). + +## Install on a client + +```sh +python -m pip install --upgrade "snappi[ixnetwork]" +``` + +## Start scripting + +```python +""" +Configure a raw TCP flow with, +- tx port as source to rx port as destination +- frame count 10000, each of size 128 bytes +- transmit rate of 1000 packets per second +Validate, +- frames transmitted and received for configured flow is as expected +""" + +import snappi +# host is IxNetwork API Server +api = snappi.api(location='https://localhost:443', ext='ixnetwork') +# new config +config = api.config() +# port location is chassis-ip;card-id;port-id +tx, rx = ( + config.ports + .port(name='tx', location='192.168.0.1;2;1') + .port(name='rx', location='192.168.0.1;2;2') +) +# configure layer 1 properties +ly, = config.layer1.layer1(name='ly') +ly.port_names = [tx.name, rx.name] +ly.speed = ly.SPEED_10_GBPS +ly.media = ly.FIBER +# configure flow properties +flw, = config.flows.flow(name='flw') +# flow endpoints +flw.tx_rx.port.tx_name = tx.name +flw.tx_rx.port.rx_name = rx.name +# enable flow metrics +flw.metrics.enable = True +# configure rate, size, frame count +flw.size.fixed = 128 +flw.rate.pps = 1000 +flw.duration.fixed_packets.packets = 10000 +# configure protocol headers with defaults fields +flw.packet.ethernet().vlan().ipv4().tcp() +# push configuration +api.set_config(config) +# start transmitting configured flows +ts = api.transmit_state() +ts.state = ts.START +api.set_transmit_state(ts) +# create a query for flow metrics +req = api.metrics_request() +req.flow.flow_names = [flw.name] +# wait for flow metrics to be as expected +while True: + res = api.get_metrics(req) + if all([m.frames_tx == 10000 == m.frames_rx for m in res.flow_metrics]): + break +``` + + +%package -n python3-snappi-ixnetwork +Summary: The Snappi IxNetwork Open Traffic Generator Python Package +Provides: python-snappi-ixnetwork +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-snappi-ixnetwork +# snappi Extension for IxNetwork + +[](https://en.wikipedia.org/wiki/MIT_License) +[](https://www.repostatus.org/#active) +[](https://github.com/open-traffic-generator/snappi-ixnetwork/actions) +[](https://pypi.org/project/snappi_ixnetwork) +[](https://pypi.python.org/pypi/snappi_ixnetwork) +[](https://lgtm.com/projects/g/open-traffic-generator/snappi-ixnetwork/alerts/) +[](https://lgtm.com/projects/g/open-traffic-generator/snappi-ixnetwork/context:python) +[](https://pepy.tech/project/snappi-ixnetwork) + +This extension allows executing test scripts written using [snappi](https://github.com/open-traffic-generator/snappi) against +IxNetwork, (one of) Keysight's implementation of [Open Traffic Generator](https://github.com/open-traffic-generator/models/releases). + +> The repository is under active development. + +To start contributing, please see [contributing.md](contributing.md). + +## Install on a client + +```sh +python -m pip install --upgrade "snappi[ixnetwork]" +``` + +## Start scripting + +```python +""" +Configure a raw TCP flow with, +- tx port as source to rx port as destination +- frame count 10000, each of size 128 bytes +- transmit rate of 1000 packets per second +Validate, +- frames transmitted and received for configured flow is as expected +""" + +import snappi +# host is IxNetwork API Server +api = snappi.api(location='https://localhost:443', ext='ixnetwork') +# new config +config = api.config() +# port location is chassis-ip;card-id;port-id +tx, rx = ( + config.ports + .port(name='tx', location='192.168.0.1;2;1') + .port(name='rx', location='192.168.0.1;2;2') +) +# configure layer 1 properties +ly, = config.layer1.layer1(name='ly') +ly.port_names = [tx.name, rx.name] +ly.speed = ly.SPEED_10_GBPS +ly.media = ly.FIBER +# configure flow properties +flw, = config.flows.flow(name='flw') +# flow endpoints +flw.tx_rx.port.tx_name = tx.name +flw.tx_rx.port.rx_name = rx.name +# enable flow metrics +flw.metrics.enable = True +# configure rate, size, frame count +flw.size.fixed = 128 +flw.rate.pps = 1000 +flw.duration.fixed_packets.packets = 10000 +# configure protocol headers with defaults fields +flw.packet.ethernet().vlan().ipv4().tcp() +# push configuration +api.set_config(config) +# start transmitting configured flows +ts = api.transmit_state() +ts.state = ts.START +api.set_transmit_state(ts) +# create a query for flow metrics +req = api.metrics_request() +req.flow.flow_names = [flw.name] +# wait for flow metrics to be as expected +while True: + res = api.get_metrics(req) + if all([m.frames_tx == 10000 == m.frames_rx for m in res.flow_metrics]): + break +``` + + +%package help +Summary: Development documents and examples for snappi-ixnetwork +Provides: python3-snappi-ixnetwork-doc +%description help +# snappi Extension for IxNetwork + +[](https://en.wikipedia.org/wiki/MIT_License) +[](https://www.repostatus.org/#active) +[](https://github.com/open-traffic-generator/snappi-ixnetwork/actions) +[](https://pypi.org/project/snappi_ixnetwork) +[](https://pypi.python.org/pypi/snappi_ixnetwork) +[](https://lgtm.com/projects/g/open-traffic-generator/snappi-ixnetwork/alerts/) +[](https://lgtm.com/projects/g/open-traffic-generator/snappi-ixnetwork/context:python) +[](https://pepy.tech/project/snappi-ixnetwork) + +This extension allows executing test scripts written using [snappi](https://github.com/open-traffic-generator/snappi) against +IxNetwork, (one of) Keysight's implementation of [Open Traffic Generator](https://github.com/open-traffic-generator/models/releases). + +> The repository is under active development. + +To start contributing, please see [contributing.md](contributing.md). + +## Install on a client + +```sh +python -m pip install --upgrade "snappi[ixnetwork]" +``` + +## Start scripting + +```python +""" +Configure a raw TCP flow with, +- tx port as source to rx port as destination +- frame count 10000, each of size 128 bytes +- transmit rate of 1000 packets per second +Validate, +- frames transmitted and received for configured flow is as expected +""" + +import snappi +# host is IxNetwork API Server +api = snappi.api(location='https://localhost:443', ext='ixnetwork') +# new config +config = api.config() +# port location is chassis-ip;card-id;port-id +tx, rx = ( + config.ports + .port(name='tx', location='192.168.0.1;2;1') + .port(name='rx', location='192.168.0.1;2;2') +) +# configure layer 1 properties +ly, = config.layer1.layer1(name='ly') +ly.port_names = [tx.name, rx.name] +ly.speed = ly.SPEED_10_GBPS +ly.media = ly.FIBER +# configure flow properties +flw, = config.flows.flow(name='flw') +# flow endpoints +flw.tx_rx.port.tx_name = tx.name +flw.tx_rx.port.rx_name = rx.name +# enable flow metrics +flw.metrics.enable = True +# configure rate, size, frame count +flw.size.fixed = 128 +flw.rate.pps = 1000 +flw.duration.fixed_packets.packets = 10000 +# configure protocol headers with defaults fields +flw.packet.ethernet().vlan().ipv4().tcp() +# push configuration +api.set_config(config) +# start transmitting configured flows +ts = api.transmit_state() +ts.state = ts.START +api.set_transmit_state(ts) +# create a query for flow metrics +req = api.metrics_request() +req.flow.flow_names = [flw.name] +# wait for flow metrics to be as expected +while True: + res = api.get_metrics(req) + if all([m.frames_tx == 10000 == m.frames_rx for m in res.flow_metrics]): + break +``` + + +%prep +%autosetup -n snappi-ixnetwork-0.9.1 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-snappi-ixnetwork -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Thu May 18 2023 Python_Bot <Python_Bot@openeuler.org> - 0.9.1-1 +- Package Spec generated @@ -0,0 +1 @@ +0131cbd24c6ea95cfc960f0aea4a9f65 snappi_ixnetwork-0.9.1.tar.gz |
