diff options
author | 2016-02-09 11:18:47 -0500 | |
---|---|---|
committer | 2016-02-09 11:18:47 -0500 | |
commit | ede68c669fde984d6095e9313d49a8af295ae885 (patch) | |
tree | 3c3d52457bc94475f413a04b82f6e4e80b48b64f /scripts/automation/regression | |
parent | 1ab9a175ca7d49f7ae843d46a76c36baa16ff39d (diff) | |
parent | 59d48a12d2c2f1e7a42e44265c4a3a4c1c8651fd (diff) |
Merge branch 'refactor'
Diffstat (limited to 'scripts/automation/regression')
-rw-r--r-- | scripts/automation/regression/stl/golden/basic_imix_golden.cap | bin | 198474 -> 198474 bytes | |||
-rw-r--r-- | scripts/automation/regression/stl/golden/basic_imix_vm_golden.cap | bin | 198474 -> 316552 bytes | |||
-rw-r--r-- | scripts/automation/regression/stl/golden/basic_tuple_gen_golden.cap | bin | 38024 -> 38024 bytes | |||
-rw-r--r-- | scripts/automation/regression/stl/golden/udp_590.cap | bin | 0 -> 630 bytes | |||
-rwxr-xr-x | scripts/automation/regression/unit_tests/functional_tests/pkt_bld_general_test.py | 1 | ||||
-rw-r--r-- | scripts/automation/regression/unit_tests/functional_tests/scapy_pkt_builder_test.py | 59 | ||||
-rw-r--r-- | scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py | 12 |
7 files changed, 64 insertions, 8 deletions
diff --git a/scripts/automation/regression/stl/golden/basic_imix_golden.cap b/scripts/automation/regression/stl/golden/basic_imix_golden.cap Binary files differindex c15ee78f..6ca32299 100644 --- a/scripts/automation/regression/stl/golden/basic_imix_golden.cap +++ b/scripts/automation/regression/stl/golden/basic_imix_golden.cap diff --git a/scripts/automation/regression/stl/golden/basic_imix_vm_golden.cap b/scripts/automation/regression/stl/golden/basic_imix_vm_golden.cap Binary files differindex c15ee78f..43ae2368 100644 --- a/scripts/automation/regression/stl/golden/basic_imix_vm_golden.cap +++ b/scripts/automation/regression/stl/golden/basic_imix_vm_golden.cap diff --git a/scripts/automation/regression/stl/golden/basic_tuple_gen_golden.cap b/scripts/automation/regression/stl/golden/basic_tuple_gen_golden.cap Binary files differindex 4f26336f..7d5e7ec2 100644 --- a/scripts/automation/regression/stl/golden/basic_tuple_gen_golden.cap +++ b/scripts/automation/regression/stl/golden/basic_tuple_gen_golden.cap diff --git a/scripts/automation/regression/stl/golden/udp_590.cap b/scripts/automation/regression/stl/golden/udp_590.cap Binary files differnew file mode 100644 index 00000000..29302f22 --- /dev/null +++ b/scripts/automation/regression/stl/golden/udp_590.cap diff --git a/scripts/automation/regression/unit_tests/functional_tests/pkt_bld_general_test.py b/scripts/automation/regression/unit_tests/functional_tests/pkt_bld_general_test.py index b630147b..5f89eaff 100755 --- a/scripts/automation/regression/unit_tests/functional_tests/pkt_bld_general_test.py +++ b/scripts/automation/regression/unit_tests/functional_tests/pkt_bld_general_test.py @@ -6,7 +6,6 @@ from nose.tools import assert_raises from nose.tools import raises import sys import outer_packages -from client_utils.packet_builder import * class CGeneralPktBld_Test(object): diff --git a/scripts/automation/regression/unit_tests/functional_tests/scapy_pkt_builder_test.py b/scripts/automation/regression/unit_tests/functional_tests/scapy_pkt_builder_test.py index 6b4c9002..dcebecdb 100644 --- a/scripts/automation/regression/unit_tests/functional_tests/scapy_pkt_builder_test.py +++ b/scripts/automation/regression/unit_tests/functional_tests/scapy_pkt_builder_test.py @@ -1,7 +1,16 @@ #!/router/bin/python import pkt_bld_general_test -from client_utils.scapy_packet_builder import * + +#HACK FIX ME START +import sys +import os + +CURRENT_PATH = os.path.dirname(os.path.realpath(__file__)) +sys.path.append(os.path.join(CURRENT_PATH, '../../../trex_control_plane/stl/')) +#HACK FIX ME END +from trex_stl_lib.trex_stl_packet_builder_scapy import * + from scapy.all import * from nose.tools import assert_equal from nose.tools import assert_not_equal @@ -248,6 +257,54 @@ class CTRexPktBuilderSanitySCapy_Test(pkt_bld_general_test.CGeneralPktBld_Test): assert_equal(d['instructions'][2]['pkt_offset'],16) assert_equal(d['instructions'][4]['pkt_offset'],38) + def test_simple_pkt_loader(self): + p=RawPcapReader("stl/golden/basic_imix_golden.cap") + print "" + for pkt in p: + print pkt[1] + print hexdump(str(pkt[0])) + break; + + def test_simple_pkt_loader1(self): + + pkt_builder = CScapyTRexPktBuilder(pkt = "stl/golden/udp_590.cap"); + print "" + pkt_builder.dump_as_hex() + r = pkt_builder.pkt_raw + assert_equal(ord(r[1]),0x50) + assert_equal(ord(r[0]),0x00) + assert_equal(ord(r[0x240]),0x16) + assert_equal(ord(r[0x24d]),0x79) + assert_equal(len(r),590) + + print len(r) + + def test_simple_pkt_loader2(self): + + pkt_builder = CScapyTRexPktBuilder(pkt = "stl/golden/basic_imix_golden.cap"); + assert_equal(pkt_builder.pkt_layers_desc (), "Ethernet:IP:UDP:Raw"); + + def test_simple_pkt_loader3(self): + + #pkt_builder = CScapyTRexPktBuilder(pkt = "stl/golden/basic_imix_golden.cap"); + #r = pkt_builder.pkt_raw + #print "" + #hexdump(str(r)) + + + #print pkt_builder.pkt_layers_desc () + + + #pkt_builder.set_packet(pkt); + + py='\x55'*(64) + + p=Ether()/IP()/UDP(dport=12,sport=1025)/py + pkt_str = str(p); + print "" + hexdump(pkt_str); + scapy_pkt = Ether(pkt_str); + scapy_pkt.show2(); def tearDown(self): pass diff --git a/scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py b/scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py index 51dccd98..0a25c0ac 100644 --- a/scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py +++ b/scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py @@ -22,14 +22,15 @@ class CStlBasic_Test(functional_general_test.CGeneralFunctional_Test): self.verify_exists(os.path.join(self.scripts_path, "bp-sim-64-debug")) - self.stl_sim = os.path.join(self.scripts_path, "automation/trex_control_plane/client/trex_stateless_sim.py") + self.stl_sim = os.path.join(self.scripts_path, "stl-sim") + self.verify_exists(self.stl_sim) - self.profiles_path = os.path.join(self.scripts_path, "stl/") + self.profiles_path = os.path.join(self.scripts_path, "stl/yaml/") self.profiles = {} self.profiles['imix_3pkt'] = os.path.join(self.profiles_path, "imix_3pkt.yaml") - self.profiles['imix_3pkt_vm'] = os.path.join(self.profiles_path, "imix_3pkt.yaml") + self.profiles['imix_3pkt_vm'] = os.path.join(self.profiles_path, "imix_3pkt_vm.yaml") self.profiles['random_size'] = os.path.join(self.profiles_path, "udp_rand_size.yaml") self.profiles['random_size_9k'] = os.path.join(self.profiles_path, "udp_rand_size_9k.yaml") self.profiles['imix_tuple_gen'] = os.path.join(self.profiles_path, "imix_1pkt_tuple_gen.yaml") @@ -88,9 +89,8 @@ class CStlBasic_Test(functional_general_test.CGeneralFunctional_Test): else: user_cmd = "-f {0} {1}".format(yaml, options) - cmd = "{0} {1} {2}".format(sys.executable, - self.stl_sim, - user_cmd) + cmd = "{0} {1}".format(self.stl_sim, + user_cmd) if silent: devnull = open('/dev/null', 'w') |