summaryrefslogtreecommitdiffstats
path: root/scripts/automation/regression
diff options
context:
space:
mode:
authorHanoh Haim <hhaim@cisco.com>2016-04-10 17:23:55 +0300
committerHanoh Haim <hhaim@cisco.com>2016-04-10 17:23:55 +0300
commit4aab694dd856865fd4497cd8249bb68fcf9970dd (patch)
tree63c902775f06f7b7945c675d2fb34186ed3aeb19 /scripts/automation/regression
parent392f47fb7956b108c36d45c37b52cb4b2c91091f (diff)
parentf067afcd24731aca892fa03ec3a5eaf48fe6f68d (diff)
Merge trex-197 bug fix
Diffstat (limited to 'scripts/automation/regression')
-rw-r--r--scripts/automation/regression/functional_tests/stl_basic_tests.py58
-rw-r--r--scripts/automation/regression/setups/kiwi02/benchmark.yaml5
-rw-r--r--scripts/automation/regression/setups/trex-dan/benchmark.yaml2
-rw-r--r--scripts/automation/regression/stateless_tests/stl_client_test.py26
4 files changed, 74 insertions, 17 deletions
diff --git a/scripts/automation/regression/functional_tests/stl_basic_tests.py b/scripts/automation/regression/functional_tests/stl_basic_tests.py
index 2bf97307..ecb7b465 100644
--- a/scripts/automation/regression/functional_tests/stl_basic_tests.py
+++ b/scripts/automation/regression/functional_tests/stl_basic_tests.py
@@ -9,8 +9,16 @@ from nose.plugins.attrib import attr
from trex import CTRexScenario
from trex_stl_lib import trex_stl_sim
from trex_stl_lib.trex_stl_streams import STLProfile
-from trex_stl_lib.trex_stl_packet_builder_scapy import RawPcapReader, RawPcapWriter
+from trex_stl_lib.trex_stl_packet_builder_scapy import RawPcapReader, RawPcapWriter, Ether
+from trex_stl_lib.utils.text_opts import *
+
import sys
+
+if sys.version_info > (3,0):
+ from io import StringIO
+else:
+ from cStringIO import StringIO
+
import os
import subprocess
import shlex
@@ -64,9 +72,18 @@ class CStlBasic_Test(functional_general_test.CGeneralFunctional_Test):
raise Exception("cannot find '{0}'".format(name))
- def compare_caps (self, cap1, cap2, max_diff_sec = 0.01):
- pkts1 = list(RawPcapReader(cap1))
- pkts2 = list(RawPcapReader(cap2))
+ def scapy_pkt_show_to_str (self, scapy_pkt):
+ capture = StringIO()
+ save_stdout = sys.stdout
+ sys.stdout = capture
+ scapy_pkt.show()
+ sys.stdout = save_stdout
+ return capture.getvalue()
+
+
+ def compare_caps (self, output, golden, max_diff_sec = 0.01):
+ pkts1 = list(RawPcapReader(output))
+ pkts2 = list(RawPcapReader(golden))
assert_equal(len(pkts1), len(pkts2))
@@ -75,11 +92,29 @@ class CStlBasic_Test(functional_general_test.CGeneralFunctional_Test):
ts2 = float(pkt2[1][0]) + (float(pkt2[1][1]) / 1e6)
if abs(ts1-ts2) > 0.000005: # 5 nsec
- raise AssertionError("TS error: cap files '{0}', '{1}' differ in cap #{2} - '{3}' vs. '{4}'".format(cap1, cap2, i, ts1, ts2))
+ raise AssertionError("TS error: cap files '{0}', '{1}' differ in cap #{2} - '{3}' vs. '{4}'".format(output, golden, i, ts1, ts2))
if pkt1[0] != pkt2[0]:
- raise AssertionError("RAW error: cap files '{0}', '{1}' differ in cap #{2}".format(cap1, cap2, i))
+ errmsg = "RAW error: output file '{0}', differs from golden '{1}' in cap #{2}".format(output, golden, i)
+ print(errmsg)
+
+ print(format_text("\ndifferent fields for packet #{0}:".format(i), 'underline'))
+ scapy_pkt1_info = self.scapy_pkt_show_to_str(Ether(pkt1[0])).split('\n')
+ scapy_pkt2_info = self.scapy_pkt_show_to_str(Ether(pkt2[0])).split('\n')
+
+ print(format_text("\nGot:\n", 'bold', 'underline'))
+ for line, ref in zip(scapy_pkt1_info, scapy_pkt2_info):
+ if line != ref:
+ print(format_text(line, 'bold'))
+
+ print(format_text("\nExpected:\n", 'bold', 'underline'))
+ for line, ref in zip(scapy_pkt2_info, scapy_pkt1_info):
+ if line != ref:
+ print(format_text(line, 'bold'))
+
+ print("\n")
+ raise AssertionError(errmsg)
def run_sim (self, yaml, output, options = "", silent = False, obj = None):
@@ -262,3 +297,14 @@ class CStlBasic_Test(functional_general_test.CGeneralFunctional_Test):
+ def test_multicore_scheduling (self):
+ mc_tests = ['stl/tests/single_cont.py',
+ 'stl/tests/single_burst.py',
+ 'stl/tests/multi_burst.py',
+ 'stl/tests/many_streams.py',
+ ]
+
+ for mc_test in mc_tests:
+ rc = self.run_sim(mc_test, output = None, options = '--test_multi_core --limit=3840 -m 27kpps', silent = True)
+ assert_equal(rc, True)
+
diff --git a/scripts/automation/regression/setups/kiwi02/benchmark.yaml b/scripts/automation/regression/setups/kiwi02/benchmark.yaml
index 2d47f8f8..60febc8f 100644
--- a/scripts/automation/regression/setups/kiwi02/benchmark.yaml
+++ b/scripts/automation/regression/setups/kiwi02/benchmark.yaml
@@ -122,26 +122,31 @@ test_rx_check_sfr:
multiplier : 25
cores : 4
rx_sample_rate : 32
+ error_tolerance : 0.01
test_rx_check_http:
multiplier : 40000
cores : 2
rx_sample_rate : 32
+ error_tolerance : 0.01
test_rx_check_sfr_ipv6:
multiplier : 25
cores : 4
rx_sample_rate : 32
+ error_tolerance : 0.01
test_rx_check_http_ipv6:
multiplier : 40000
cores : 2
rx_sample_rate : 32
+ error_tolerance : 0.01
test_rx_check_http_negative:
multiplier : 40000
cores : 2
rx_sample_rate : 32
+ error_tolerance : 0.01
test_jumbo:
multiplier : 55
diff --git a/scripts/automation/regression/setups/trex-dan/benchmark.yaml b/scripts/automation/regression/setups/trex-dan/benchmark.yaml
index 4b47bd8e..a31d070c 100644
--- a/scripts/automation/regression/setups/trex-dan/benchmark.yaml
+++ b/scripts/automation/regression/setups/trex-dan/benchmark.yaml
@@ -4,7 +4,7 @@
test_nbar_simple :
multiplier : 1.5
- cores : 1
+ cores : 2
exp_gbps : 0.5
cpu_to_core_ratio : 20800000
cpu2core_custom_dev: YES
diff --git a/scripts/automation/regression/stateless_tests/stl_client_test.py b/scripts/automation/regression/stateless_tests/stl_client_test.py
index 01a90250..3ef4713f 100644
--- a/scripts/automation/regression/stateless_tests/stl_client_test.py
+++ b/scripts/automation/regression/stateless_tests/stl_client_test.py
@@ -240,22 +240,29 @@ class STLClient_Test(CStlGeneral_Test):
def test_all_profiles (self):
- # need promiscious for this one...
- if self.is_virt_nics or not self.is_loopback:
- self.skip('skipping profile tests for virtual NICs')
- return
try:
- self.c.set_port_attr(ports = [self.tx_port, self.rx_port], promiscuous = True)
-
+
for profile in self.profiles:
+
print("now testing profile {0}...\n").format(profile)
p1 = STLProfile.load(profile, port_id = self.tx_port)
p2 = STLProfile.load(profile, port_id = self.rx_port)
+ # if profile contains custom MAC addrs we need promiscuous mode
+ # but virtual NICs does not support promiscuous mode
+ self.c.set_port_attr(ports = [self.tx_port, self.rx_port], promiscuous = False)
+
+ if p1.has_custom_mac_addr():
+ if not self.is_virt_nics:
+ self.c.set_port_attr(ports = [self.tx_port, self.rx_port], promiscuous = True)
+ else:
+ print("\n*** profile needs promiscuous mode but running on virtual NICs - skipping... ***\n")
+ continue
+
if p1.has_flow_stats():
- print("profile needs RX caps - skipping...")
+ print("\n*** profile needs RX caps - skipping... ***\n")
continue
self.c.add_streams(p1, ports = self.tx_port)
@@ -280,9 +287,8 @@ class STLClient_Test(CStlGeneral_Test):
assert self.tx_port in stats, '{0} - no stats for TX port'.format(profile)
assert self.rx_port in stats, '{0} - no stats for RX port'.format(profile)
- assert stats[self.tx_port]['opackets'] == stats[self.rx_port]['ipackets'], '{0} - number of TX packets differ from RX packets'.format(profile)
-
- assert stats[self.rx_port]['opackets'] == stats[self.tx_port]['ipackets'], '{0} - number of TX packets differ from RX packets'.format(profile)
+ self.verify(stats[self.tx_port]['opackets'], stats[self.rx_port]['ipackets'])
+ self.verify(stats[self.rx_port]['opackets'], stats[self.tx_port]['ipackets'])
self.c.remove_all_streams(ports = [self.tx_port, self.rx_port])