From 9218477a913ddab4f01fb1b7754dc2ae69a32898 Mon Sep 17 00:00:00 2001 From: Vyacheslav Ogai Date: Wed, 5 Oct 2016 16:03:37 +0300 Subject: Add instrucitons meta. Delete split_by_field field engine global parameter. Signed-off-by: Vyacheslav Ogai --- .../scapy_server/unit_tests/test_scapy_service.py | 26 +++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'scripts/automation/trex_control_plane/stl/services/scapy_server/unit_tests') diff --git a/scripts/automation/trex_control_plane/stl/services/scapy_server/unit_tests/test_scapy_service.py b/scripts/automation/trex_control_plane/stl/services/scapy_server/unit_tests/test_scapy_service.py index ffc3b2b3..af3bfb43 100644 --- a/scripts/automation/trex_control_plane/stl/services/scapy_server/unit_tests/test_scapy_service.py +++ b/scripts/automation/trex_control_plane/stl/services/scapy_server/unit_tests/test_scapy_service.py @@ -112,11 +112,30 @@ def test_get_all(): def test_get_definitions_all(): get_definitions(None) - def_classnames = [pdef['id'] for pdef in get_definitions(None)['protocols']] + defs = get_definitions(None) + def_classnames = [pdef['id'] for pdef in defs['protocols']] assert("IP" in def_classnames) assert("Dot1Q" in def_classnames) assert("TCP" in def_classnames) + fe_parameter_metas = defs['feInstructionParameters'] + assert(fe_parameter_metas[0]['id'] == "max_value") + assert(fe_parameter_metas[1]['id'] == "min_value") + assert(fe_parameter_metas[2]['id'] == "step") + assert(fe_parameter_metas[3]['id'] == "op") + assert(fe_parameter_metas[4]['id'] == "fv_name") + assert(fe_parameter_metas[5]['id'] == "pkt_offset") + assert(fe_parameter_metas[6]['id'] == "offset") + assert(fe_parameter_metas[7]['id'] == "l3_offset") + assert(fe_parameter_metas[8]['id'] == "l4_offset") + assert(fe_parameter_metas[9]['id'] == "l4_type") + + # All instructions should have a help description. + fe_instructions = defs['feInstructions'] + for instruction in fe_instructions: + print(instruction['help']) + assert("help" in instruction) + def test_get_definitions_ether(): res = get_definitions(["Ether"]) protocols = res['protocols'] @@ -255,8 +274,9 @@ def test_generate_vm_instructions(): layer_def("Ether"), layer_def("IP", src="16.0.0.1", dst="48.0.0.1") ] - ip_instructions_model = {"field_engine":{'global_parameters': {}, 'instructions': [{'id': "IP", 'fields': [{"fieldId": "src", 'parameters': {'min_value': "0", 'max_value': "16.0.0.255", 'step': "1", 'op': "inc"}}, - {"fieldId": "ttl", 'parameters': {'min_value': "1", 'max_value': "17", 'step': "1", 'op': "inc"}}]}]}} + ip_instructions_model = {"field_engine": {'global_parameters': {}, 'instructions': [{'id': "IP", 'fields': [ + {"fieldId": "src", 'parameters': {'min_value': "0", 'max_value': "16.0.0.255", 'step': "1", 'op': "inc"}}, + {"fieldId": "ttl", 'parameters': {'min_value': "1", 'max_value': "17", 'step': "1", 'op': "inc"}}]}]}} res = build_pkt_ex(ip_pkt_model, ip_instructions_model) src_instruction = res['vm_instructions']['instructions'][0] assert(src_instruction['min_value'] == 0) -- cgit 1.2.3-korg