From c07bd86f8c0a150f743c985dbef5e2bce857e0d9 Mon Sep 17 00:00:00 2001 From: imarom Date: Tue, 9 Feb 2016 11:11:08 -0500 Subject: minor fixes --- .../regression/stl/golden/basic_imix_golden.cap | Bin 198474 -> 198474 bytes .../regression/stl/golden/basic_imix_vm_golden.cap | Bin 198474 -> 316552 bytes .../stl/golden/basic_tuple_gen_golden.cap | Bin 38024 -> 38024 bytes .../automation/regression/stl/golden/udp_590.cap | Bin 0 -> 630 bytes .../functional_tests/pkt_bld_general_test.py | 1 - .../functional_tests/scapy_pkt_builder_test.py | 13 ++++++++++-- .../unit_tests/functional_tests/stl_basic_tests.py | 12 +++++------ .../trex_control_plane/client/trex_hltapi.py | 23 +++++++++++++++------ .../trex_control_plane/stl/examples/stl_path.py | 2 +- .../stl/trex_stl_lib/__init__.py | 1 + .../trex_control_plane/stl/trex_stl_lib/api.py | 3 --- .../stl/trex_stl_lib/trex_stl_port.py | 2 +- .../stl/trex_stl_lib/trex_stl_streams.py | 2 +- scripts/yaml/imix_3pkt.yaml | 2 ++ scripts/yaml/imix_3pkt_vm.yaml | 13 ++++++------ 15 files changed, 46 insertions(+), 28 deletions(-) create mode 100644 scripts/automation/regression/stl/golden/udp_590.cap diff --git a/scripts/automation/regression/stl/golden/basic_imix_golden.cap b/scripts/automation/regression/stl/golden/basic_imix_golden.cap index c15ee78f..6ca32299 100644 Binary files a/scripts/automation/regression/stl/golden/basic_imix_golden.cap and b/scripts/automation/regression/stl/golden/basic_imix_golden.cap differ diff --git a/scripts/automation/regression/stl/golden/basic_imix_vm_golden.cap b/scripts/automation/regression/stl/golden/basic_imix_vm_golden.cap index c15ee78f..43ae2368 100644 Binary files a/scripts/automation/regression/stl/golden/basic_imix_vm_golden.cap and b/scripts/automation/regression/stl/golden/basic_imix_vm_golden.cap differ diff --git a/scripts/automation/regression/stl/golden/basic_tuple_gen_golden.cap b/scripts/automation/regression/stl/golden/basic_tuple_gen_golden.cap index 4f26336f..7d5e7ec2 100644 Binary files a/scripts/automation/regression/stl/golden/basic_tuple_gen_golden.cap and b/scripts/automation/regression/stl/golden/basic_tuple_gen_golden.cap differ diff --git a/scripts/automation/regression/stl/golden/udp_590.cap b/scripts/automation/regression/stl/golden/udp_590.cap new file mode 100644 index 00000000..29302f22 Binary files /dev/null and b/scripts/automation/regression/stl/golden/udp_590.cap differ 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 e8777fd1..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 @@ -258,7 +267,7 @@ class CTRexPktBuilderSanitySCapy_Test(pkt_bld_general_test.CGeneralPktBld_Test): def test_simple_pkt_loader1(self): - pkt_builder = CScapyTRexPktBuilder(pkt = "stl/golden/basic_imix_golden.cap"); + pkt_builder = CScapyTRexPktBuilder(pkt = "stl/golden/udp_590.cap"); print "" pkt_builder.dump_as_hex() r = pkt_builder.pkt_raw 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..f23a4469 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, "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') diff --git a/scripts/automation/trex_control_plane/client/trex_hltapi.py b/scripts/automation/trex_control_plane/client/trex_hltapi.py index 5d3f506c..c2a08306 100755 --- a/scripts/automation/trex_control_plane/client/trex_hltapi.py +++ b/scripts/automation/trex_control_plane/client/trex_hltapi.py @@ -108,11 +108,22 @@ traffic_stats_kwargs = { } -#import trex_root_path -import client_utils.scapy_packet_builder as pkt_bld -from client_utils.scapy_packet_builder import CTRexVmDescFlowVar, CTRexVmDescWrFlowVar -from trex_stateless_client import STLClient -from common.trex_streams 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, '../stl/')) +#HACK FIX ME END + +from trex_stl_lib.api import * +import trex_stl_lib.api as pkt_bld +#import trex_stl_lib.trex_stl_packet_builder_scapy as pkt_bld +#from trex_stl_lib.trex_stl_packet_builder_scapy import import CTRexVmDescFlowVar, CTRexVmDescWrFlowVar +#from trex_stl_lib.trex_stl_client import STLClient +#from common.trex_streams import * + +import trex_root_path from client_utils.general_utils import get_integer import socket import copy @@ -523,7 +534,7 @@ class CTRexHltApiPktBuilder: debug_filename = kwargs.get('save_to_yaml') if type(debug_filename) is str: - stream_obj.dump_to_yaml(debug_filename, stream_obj) + STLProfile(stream_obj).dump_to_yaml(debug_filename) return stream_obj @staticmethod diff --git a/scripts/automation/trex_control_plane/stl/examples/stl_path.py b/scripts/automation/trex_control_plane/stl/examples/stl_path.py index 17a8bddf..8f400d23 100644 --- a/scripts/automation/trex_control_plane/stl/examples/stl_path.py +++ b/scripts/automation/trex_control_plane/stl/examples/stl_path.py @@ -1,4 +1,4 @@ import sys -# FIXME to the write path for trex_control_plane +# FIXME to the write path for trex_stl_lib sys.path.insert(0, "../") diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/__init__.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/__init__.py index e69de29b..60bf7be8 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/__init__.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/__init__.py @@ -0,0 +1 @@ +import trex_stl_ext diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/api.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/api.py index 4c0c10fa..a9e99178 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/api.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/api.py @@ -1,7 +1,4 @@ -# get external libs -import trex_stl_ext - # client and exceptions from trex_stl_exceptions import * from trex_stl_client import STLClient, LoggerApi diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py index b2cf1c90..732cfc1e 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py @@ -519,7 +519,7 @@ class Port(object): meta_dict['stream_sum'] = OrderedDict([("id", stream.get_id()), ("packet_type", "FIXME!!!"), - ("length", "FIXME!!!"), + ("L2 len", "FIXME!!! +++4"), ("mode", "FIXME!!!"), ("rate_pps", "FIXME!!!"), ("next_stream", "FIXME!!!") diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py index 9c190dad..abfa32cd 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py @@ -372,7 +372,7 @@ class STLProfile(object): return profile - def to_yaml (self, yaml_file = None): + def dump_to_yaml (self, yaml_file = None): yaml_list = [stream.to_yaml() for stream in self.streams] yaml_str = yaml.dump(yaml_list, default_flow_style = False) diff --git a/scripts/yaml/imix_3pkt.yaml b/scripts/yaml/imix_3pkt.yaml index 82d91935..d8c3ea44 100644 --- a/scripts/yaml/imix_3pkt.yaml +++ b/scripts/yaml/imix_3pkt.yaml @@ -10,6 +10,7 @@ pps: 28 - name: udp_594B stream: + isg: 50.0 self_start: True packet: pcap: udp_594B_no_crc.pcap # pcap should not include CRC @@ -18,6 +19,7 @@ pps: 20 - name: udp_1518B stream: + isg: 100.0 self_start: True packet: pcap: udp_1518B_no_crc.pcap # pcap should not include CRC diff --git a/scripts/yaml/imix_3pkt_vm.yaml b/scripts/yaml/imix_3pkt_vm.yaml index d812634c..6ba2c40c 100644 --- a/scripts/yaml/imix_3pkt_vm.yaml +++ b/scripts/yaml/imix_3pkt_vm.yaml @@ -4,12 +4,11 @@ stream: self_start: True packet: - binary: stl/udp_64B_no_crc.pcap # pcap should not include CRC + pcap: udp_64B_no_crc.pcap # pcap should not include CRC mode: type: single_burst total_pkts: 100 pps: 100 - rx_stats: [] vm: instructions: [ @@ -34,13 +33,13 @@ - name: udp_594B stream: + isg: 50.0 self_start: True packet: - binary: stl/udp_594B_no_crc.pcap # pcap should not include CRC + pcap: udp_594B_no_crc.pcap # pcap should not include CRC mode: type: continuous pps: 20 - rx_stats: [] vm: instructions: [ { @@ -64,14 +63,14 @@ - name: udp_1518B stream: + isg: 100.0 self_start: True packet: - binary: stl/udp_1518B_no_crc.pcap # pcap should not include CRC + pcap: udp_1518B_no_crc.pcap # pcap should not include CRC mode: type: single_burst total_pkts: 100 pps: 4 - rx_stats: [] vm: instructions: [ { @@ -91,4 +90,4 @@ "type" : "write_flow_var" } ] - split_by_var: "l3_src" \ No newline at end of file + split_by_var: "l3_src" -- cgit 1.2.3-korg