summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl/services/scapy_server/unit_tests/test_scapy_service.py
diff options
context:
space:
mode:
authorVyacheslav Ogai <vyacheslav.ogai@gmail.com>2016-10-05 16:03:37 +0300
committerHanoh Haim <hhaim@cisco.com>2016-12-19 16:04:07 +0200
commit9218477a913ddab4f01fb1b7754dc2ae69a32898 (patch)
tree1b69be930809828edd959f9982472c31c1860cc1 /scripts/automation/trex_control_plane/stl/services/scapy_server/unit_tests/test_scapy_service.py
parent82a9911f91c5190b3e76ab161d51a1b780fcbbb8 (diff)
Add instrucitons meta. Delete split_by_field field engine global parameter.
Signed-off-by: Vyacheslav Ogai <vyacheslav.ogai@gmail.com>
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/services/scapy_server/unit_tests/test_scapy_service.py')
-rw-r--r--scripts/automation/trex_control_plane/stl/services/scapy_server/unit_tests/test_scapy_service.py26
1 files changed, 23 insertions, 3 deletions
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)