summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2016-04-14 23:46:39 +0300
committerYaroslav Brustinov <ybrustin@cisco.com>2016-04-14 23:46:39 +0300
commitb577ba683afb5d31858b95bd0a9a9c479752c498 (patch)
treebce0389d22eda9c117bb96e0aa22cc2c8413ee6b
parent94ce0dcd7f93fe82e667f38d805f56d6d828f824 (diff)
regression: add --python2 and --python3 to run_regression, if nothing provided, use python2.
hltapi: fix bug of not reducing 4 bytes from produced packets because of fcs. doc: add trex_client package stl/stf example of running examples :)
-rwxr-xr-xscripts/automation/regression/stateful_tests/trex_imix_test.py10
-rwxr-xr-xscripts/automation/trex_control_plane/doc/index.rst45
-rw-r--r--scripts/automation/trex_control_plane/doc_stl/index.rst26
-rwxr-xr-xscripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_hltapi.py4
-rw-r--r--scripts/exp/hlt_4vlans.pcapbin2344 -> 2264 bytes
-rw-r--r--scripts/exp/hlt_david1.pcapbin8140 -> 8060 bytes
-rw-r--r--scripts/exp/hlt_david2.pcapbin8118 -> 8038 bytes
-rw-r--r--scripts/exp/hlt_david3.pcapbin10264 -> 10184 bytes
-rw-r--r--scripts/exp/hlt_david4.pcapbin1624 -> 1544 bytes
-rw-r--r--scripts/exp/hlt_framesize_vm.pcapbin8296 -> 8216 bytes
-rw-r--r--scripts/exp/hlt_imix_4rates.pcapbin27224 -> 27176 bytes
-rw-r--r--scripts/exp/hlt_imix_default.pcapbin8074 -> 7994 bytes
-rw-r--r--scripts/exp/hlt_ip_ranges.pcapbin1624 -> 1544 bytes
-rw-r--r--scripts/exp/hlt_ipv6_default.pcapbin3624 -> 3544 bytes
-rw-r--r--scripts/exp/hlt_ipv6_ranges.pcapbin3624 -> 3544 bytes
-rw-r--r--scripts/exp/hlt_l3_length_vm.pcapbin31624 -> 31544 bytes
-rw-r--r--scripts/exp/hlt_mac_ranges.pcapbin1624 -> 1544 bytes
-rw-r--r--scripts/exp/hlt_tcp_ranges.pcapbin1624 -> 1544 bytes
-rw-r--r--scripts/exp/hlt_udp_inc_dec_len_9k.pcapbin93144 -> 93064 bytes
-rw-r--r--scripts/exp/hlt_udp_ports.pcapbin1624 -> 1544 bytes
-rw-r--r--scripts/exp/hlt_udp_random_ports.pcapbin1624 -> 1544 bytes
-rw-r--r--scripts/exp/hlt_vlan_default.pcapbin1624 -> 1544 bytes
-rw-r--r--scripts/exp/hlt_vlans_vm.pcapbin2344 -> 2264 bytes
-rw-r--r--scripts/exp/hlt_wentong1.pcapbin2904 -> 2824 bytes
-rw-r--r--scripts/exp/hlt_wentong2.pcapbin4704 -> 4624 bytes
-rwxr-xr-xscripts/run_regression37
26 files changed, 113 insertions, 9 deletions
diff --git a/scripts/automation/regression/stateful_tests/trex_imix_test.py b/scripts/automation/regression/stateful_tests/trex_imix_test.py
index e7c27cc7..95a5471d 100755
--- a/scripts/automation/regression/stateful_tests/trex_imix_test.py
+++ b/scripts/automation/regression/stateful_tests/trex_imix_test.py
@@ -164,7 +164,7 @@ class CTRexIMIX_Test(CTRexGeneral_Test):
self.check_CPU_benchmark(trex_res)
- def test_jumbo(self, duration = 100):
+ def test_jumbo(self, duration = 100, **kwargs):
if not self.is_loopback:
self.router.configure_basic_interfaces(mtu = 9216)
self.router.config_pbr(mode = "config")
@@ -179,7 +179,8 @@ class CTRexIMIX_Test(CTRexGeneral_Test):
nc = True,
d = duration,
f = 'cap2/imix_9k.yaml',
- l = 1000)
+ l = 1000,
+ **kwargs)
trex_res = self.trex.sample_to_run_finish()
@@ -196,9 +197,12 @@ class CTRexIMIX_Test(CTRexGeneral_Test):
def test_warm_up(self):
try:
self._testMethodName = 'test_jumbo'
- self.test_jumbo(duration = 30)
+ self.test_jumbo(duration = 5, trex_development = True)
except Exception as e:
print('Ignoring this error: %s' % e)
+ if self.fail_reasons:
+ print('Ignoring this error(s):\n%s' % '\n'.join(self.fail_reasons))
+ self.fail_reasons = []
def tearDown(self):
CTRexGeneral_Test.tearDown(self)
diff --git a/scripts/automation/trex_control_plane/doc/index.rst b/scripts/automation/trex_control_plane/doc/index.rst
index 62fd9975..041a17c2 100755
--- a/scripts/automation/trex_control_plane/doc/index.rst
+++ b/scripts/automation/trex_control_plane/doc/index.rst
@@ -18,6 +18,49 @@ To understand the entirely how the API works and how to set up the server side,
**Use the table of contents below or the menu to your left to navigate through the site**
+Client Package
+==============
+
+| Starting from version v1.99 TRex has separated client package included in main directory.
+| Put it at any place you like, preferably same place as your scripts.
+| (If it's not at same place as your scripts, you will need to ensure trex_client directory is in sys.path)
+
+Un-pack it using command:::
+
+ tar -xzf trex_client_<TRex version>.tar.gz
+
+| The client assumes stateful daemon is running.
+| After un-tarring the client package, you can verify basic tests in examples directory out of the box:
+
+.. code-block:: bash
+
+ cd trex_client/stf/examples
+ python stf_example.py -s <server address>
+
+You can verify that the traffic was sent and arrives properly if you see something like this:::
+
+ Connecting to 127.0.0.1
+ Connected, start TRex
+ Sample until end
+ Test results:
+ Is valid history? True
+ Done warmup? True
+ Expected tx rate: {u'm_tx_expected_pps': 71898.4, u'm_tx_expected_bps': 535157280.0, u'm_tx_expected_cps': 1943.2}
+ Current tx rate: {u'm_tx_bps': 542338368.0, u'm_tx_cps': 1945.4, u'm_tx_pps': 79993.4}
+ Maximum latency: {u'max-4': 55, u'max-5': 30, u'max-6': 50, u'max-7': 30, u'max-0': 55, u'max-1': 40, u'max-2': 55, u'max-3': 30}
+ Average latency: {'all': 32.913, u'port6': 35.9, u'port7': 30.0, u'port4': 35.8, u'port5': 30.0, u'port2': 35.8, u'port3': 30.0, u'port0': 35.8, u'port1': 30.0}
+ Average window latency: {'all': 31.543, u'port6': 32.871, u'port7': 28.929, u'port4': 33.886, u'port5': 28.929, u'port2': 33.843, u'port3': 28.929, u'port0': 33.871, u'port1': 31.086}
+ Total drops: -3
+ Drop rate: 0.0
+ History size so far: 7
+
+ TX by ports:
+ 0: 230579 | 1: 359435 | 2: 230578 | 3: 359430 | 4: 230570 | 5: 359415 | 6: 230564 | 7: 359410
+ RX by ports:
+ 0: 359434 | 1: 230580 | 2: 359415 | 3: 230571 | 4: 359429 | 5: 230579 | 6: 359411 | 7: 230565
+ CPU utilization:
+ [0.0, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8]
+
API Reference
=============
.. toctree::
@@ -50,4 +93,4 @@ Indices and tables
.. rubric:: Footnotes
-.. [#f1] For more information on JSON-RPC, check out the `official site <http://www.jsonrpc.org/>`_ \ No newline at end of file
+.. [#f1] For more information on JSON-RPC, check out the `official site <http://www.jsonrpc.org/>`_
diff --git a/scripts/automation/trex_control_plane/doc_stl/index.rst b/scripts/automation/trex_control_plane/doc_stl/index.rst
index aa2abd75..8a2fc4b0 100644
--- a/scripts/automation/trex_control_plane/doc_stl/index.rst
+++ b/scripts/automation/trex_control_plane/doc_stl/index.rst
@@ -24,6 +24,32 @@ Un-pack it using command::
tar -xzf trex_client.tar.gz
+How to use
+==================
+
+| The client assumes server is running.
+| After un-tarring the client package, you can verify basic tests in examples directory out of the box:
+
+.. code-block:: bash
+
+ cd trex_client/stl/examples
+ python stl_imix.py -s <server address>
+
+You can verify that the traffic was sent and arrives properly if you see something like this:::
+
+ Mapped ports to sides [0, 2] <--> [1, 3]
+ Injecting [0, 2] <--> [1, 3] on total rate of '30%' for 10 seconds
+
+ Packets injected from [0, 2]: 473,856
+ Packets injected from [1, 3]: 473,856
+
+ packets lost from [0, 2] --> [0, 2]: 0 pkts
+ packets lost from [1, 3] --> [1, 3]: 0 pkts
+
+ Test has passed :-)
+
+
+Also, in the stl folder there are directories with profiles that define streams and the console (with which you can easily send the profiles)
How to pyATS
==================
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_hltapi.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_hltapi.py
index 45f3dd45..0afeff20 100755
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_hltapi.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_hltapi.py
@@ -1584,7 +1584,7 @@ def correct_direction(user_kwargs, kwargs):
# we produce packets without fcs, so need to reduce produced sizes
def correct_sizes(kwargs):
- for arg in kwargs.keys():
- if is_integer(arg):
+ for arg, value in kwargs.items():
+ if is_integer(value):
if arg.endswith(('_length', '_size', '_size_min', '_size_max', '_length_min', '_length_max')):
kwargs[arg] -= 4
diff --git a/scripts/exp/hlt_4vlans.pcap b/scripts/exp/hlt_4vlans.pcap
index 642bbee5..59d4622d 100644
--- a/scripts/exp/hlt_4vlans.pcap
+++ b/scripts/exp/hlt_4vlans.pcap
Binary files differ
diff --git a/scripts/exp/hlt_david1.pcap b/scripts/exp/hlt_david1.pcap
index 45b0671a..6b3e9173 100644
--- a/scripts/exp/hlt_david1.pcap
+++ b/scripts/exp/hlt_david1.pcap
Binary files differ
diff --git a/scripts/exp/hlt_david2.pcap b/scripts/exp/hlt_david2.pcap
index 358bed2e..0b59be8c 100644
--- a/scripts/exp/hlt_david2.pcap
+++ b/scripts/exp/hlt_david2.pcap
Binary files differ
diff --git a/scripts/exp/hlt_david3.pcap b/scripts/exp/hlt_david3.pcap
index ce492579..d1543136 100644
--- a/scripts/exp/hlt_david3.pcap
+++ b/scripts/exp/hlt_david3.pcap
Binary files differ
diff --git a/scripts/exp/hlt_david4.pcap b/scripts/exp/hlt_david4.pcap
index f03cbd7a..eb451260 100644
--- a/scripts/exp/hlt_david4.pcap
+++ b/scripts/exp/hlt_david4.pcap
Binary files differ
diff --git a/scripts/exp/hlt_framesize_vm.pcap b/scripts/exp/hlt_framesize_vm.pcap
index 69c2e7d9..b46c0209 100644
--- a/scripts/exp/hlt_framesize_vm.pcap
+++ b/scripts/exp/hlt_framesize_vm.pcap
Binary files differ
diff --git a/scripts/exp/hlt_imix_4rates.pcap b/scripts/exp/hlt_imix_4rates.pcap
index e5b355ae..0c1fffd3 100644
--- a/scripts/exp/hlt_imix_4rates.pcap
+++ b/scripts/exp/hlt_imix_4rates.pcap
Binary files differ
diff --git a/scripts/exp/hlt_imix_default.pcap b/scripts/exp/hlt_imix_default.pcap
index 1e34149a..bffff1c6 100644
--- a/scripts/exp/hlt_imix_default.pcap
+++ b/scripts/exp/hlt_imix_default.pcap
Binary files differ
diff --git a/scripts/exp/hlt_ip_ranges.pcap b/scripts/exp/hlt_ip_ranges.pcap
index 5781df4a..490e3355 100644
--- a/scripts/exp/hlt_ip_ranges.pcap
+++ b/scripts/exp/hlt_ip_ranges.pcap
Binary files differ
diff --git a/scripts/exp/hlt_ipv6_default.pcap b/scripts/exp/hlt_ipv6_default.pcap
index 9ca1cd81..483d26d2 100644
--- a/scripts/exp/hlt_ipv6_default.pcap
+++ b/scripts/exp/hlt_ipv6_default.pcap
Binary files differ
diff --git a/scripts/exp/hlt_ipv6_ranges.pcap b/scripts/exp/hlt_ipv6_ranges.pcap
index a05aca32..8f7cf108 100644
--- a/scripts/exp/hlt_ipv6_ranges.pcap
+++ b/scripts/exp/hlt_ipv6_ranges.pcap
Binary files differ
diff --git a/scripts/exp/hlt_l3_length_vm.pcap b/scripts/exp/hlt_l3_length_vm.pcap
index fd028414..7b87caab 100644
--- a/scripts/exp/hlt_l3_length_vm.pcap
+++ b/scripts/exp/hlt_l3_length_vm.pcap
Binary files differ
diff --git a/scripts/exp/hlt_mac_ranges.pcap b/scripts/exp/hlt_mac_ranges.pcap
index 4b5d09c6..98059a2c 100644
--- a/scripts/exp/hlt_mac_ranges.pcap
+++ b/scripts/exp/hlt_mac_ranges.pcap
Binary files differ
diff --git a/scripts/exp/hlt_tcp_ranges.pcap b/scripts/exp/hlt_tcp_ranges.pcap
index 0dd0d83a..dc81f30c 100644
--- a/scripts/exp/hlt_tcp_ranges.pcap
+++ b/scripts/exp/hlt_tcp_ranges.pcap
Binary files differ
diff --git a/scripts/exp/hlt_udp_inc_dec_len_9k.pcap b/scripts/exp/hlt_udp_inc_dec_len_9k.pcap
index 3ceead39..3a92a390 100644
--- a/scripts/exp/hlt_udp_inc_dec_len_9k.pcap
+++ b/scripts/exp/hlt_udp_inc_dec_len_9k.pcap
Binary files differ
diff --git a/scripts/exp/hlt_udp_ports.pcap b/scripts/exp/hlt_udp_ports.pcap
index 91905f39..ca595282 100644
--- a/scripts/exp/hlt_udp_ports.pcap
+++ b/scripts/exp/hlt_udp_ports.pcap
Binary files differ
diff --git a/scripts/exp/hlt_udp_random_ports.pcap b/scripts/exp/hlt_udp_random_ports.pcap
index 86c09468..5a9eb522 100644
--- a/scripts/exp/hlt_udp_random_ports.pcap
+++ b/scripts/exp/hlt_udp_random_ports.pcap
Binary files differ
diff --git a/scripts/exp/hlt_vlan_default.pcap b/scripts/exp/hlt_vlan_default.pcap
index fd4d3bda..bac42a5a 100644
--- a/scripts/exp/hlt_vlan_default.pcap
+++ b/scripts/exp/hlt_vlan_default.pcap
Binary files differ
diff --git a/scripts/exp/hlt_vlans_vm.pcap b/scripts/exp/hlt_vlans_vm.pcap
index b5107639..609d8aa2 100644
--- a/scripts/exp/hlt_vlans_vm.pcap
+++ b/scripts/exp/hlt_vlans_vm.pcap
Binary files differ
diff --git a/scripts/exp/hlt_wentong1.pcap b/scripts/exp/hlt_wentong1.pcap
index cd87f2f4..70f9f005 100644
--- a/scripts/exp/hlt_wentong1.pcap
+++ b/scripts/exp/hlt_wentong1.pcap
Binary files differ
diff --git a/scripts/exp/hlt_wentong2.pcap b/scripts/exp/hlt_wentong2.pcap
index ff161a31..55f59622 100644
--- a/scripts/exp/hlt_wentong2.pcap
+++ b/scripts/exp/hlt_wentong2.pcap
Binary files differ
diff --git a/scripts/run_regression b/scripts/run_regression
index 02746bab..bdc2f185 100755
--- a/scripts/run_regression
+++ b/scripts/run_regression
@@ -1,6 +1,37 @@
#!/bin/bash
-source find_python.sh --python2
-cd automation/regression
-$PYTHON trex_unit_test.py --exclude functional $@
+INPUT_ARGS=${@//--python[23]/}
+
+if [[ $@ =~ '--python2' || ! $@ =~ '--python3' ]]; then
+ source find_python.sh --python2
+ cd automation/regression
+
+ # Python 2
+ echo Python2 test
+ $PYTHON trex_unit_test.py $INPUT_ARGS
+ if [ $? -eq 0 ]; then
+ printf "\n$PYTHON test succeeded\n\n"
+ else
+ printf "\n*** $PYTHON test failed\n\n"
+ exit -1
+ fi
+ cd -
+fi
+
+if [[ $@ =~ '--python3' ]]; then
+ source find_python.sh --python3
+ cd automation/regression
+
+ # Python 3
+ echo Python3 test
+ $PYTHON trex_unit_test.py $INPUT_ARGS
+ if [ $? -eq 0 ]; then
+ printf "\n$PYTHON test succeeded\n\n"
+ else
+ printf "\n*** $PYTHON test failed\n\n"
+ exit -1
+ fi
+ cd -
+fi
+