diff options
author | 2016-12-01 12:46:03 +0200 | |
---|---|---|
committer | 2016-12-19 16:04:07 +0200 | |
commit | 2adc44476c954507dea90eb690620bd1e5a9292b (patch) | |
tree | 50c633d0cec49d48975d18c1a7185fb797df9338 /scripts/automation/trex_control_plane/stl/services/scapy_server | |
parent | 3b576aafa0e71760741232a57fa3f66573b056e5 (diff) |
Add field engine instructions templates metadata.
Signed-off-by: Vyacheslav Ogai <vyacheslav.ogai@gmail.com>
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/services/scapy_server')
-rw-r--r-- | scripts/automation/trex_control_plane/stl/services/scapy_server/field_engine.json | 14 | ||||
-rwxr-xr-x | scripts/automation/trex_control_plane/stl/services/scapy_server/scapy_service.py | 6 |
2 files changed, 18 insertions, 2 deletions
diff --git a/scripts/automation/trex_control_plane/stl/services/scapy_server/field_engine.json b/scripts/automation/trex_control_plane/stl/services/scapy_server/field_engine.json index b5356eb0..85d10e65 100644 --- a/scripts/automation/trex_control_plane/stl/services/scapy_server/field_engine.json +++ b/scripts/automation/trex_control_plane/stl/services/scapy_server/field_engine.json @@ -99,7 +99,7 @@ "name": "Variable name", "type": "ENUM", "required": true, - "editable": false + "editable": true }, { "id": "pkt_offset", @@ -245,6 +245,18 @@ } ], "supported_protocols": ["IP","TCP","UDP"], + "templates":[ + { + "id": "simple_flow_var", + "name": "Simple variable", + "instructionIds": ["STLVmFlowVar", "STLVmWrFlowVar"] + }, + { + "id": "rep_rand_var", + "name": "Repeatable random", + "instructionIds": ["STLVmFlowVarRepetableRandom", "STLVmWrFlowVar"] + } + ], "global_params_meta":[ { "id": "cache_size", diff --git a/scripts/automation/trex_control_plane/stl/services/scapy_server/scapy_service.py b/scripts/automation/trex_control_plane/stl/services/scapy_server/scapy_service.py index 8212ec8d..63c87643 100755 --- a/scripts/automation/trex_control_plane/stl/services/scapy_server/scapy_service.py +++ b/scripts/automation/trex_control_plane/stl/services/scapy_server/scapy_service.py @@ -416,6 +416,7 @@ class Scapy_service(Scapy_service_api): self.field_engine_supported_protocols = {} self.instruction_parameter_meta_definitions = [] self.field_engine_parameter_meta_definitions = [] + self.field_engine_templates_definitions = [] self.field_engine_instructions_meta = [] self.field_engine_instruction_expressions = [] self._load_definitions_from_json() @@ -435,6 +436,7 @@ class Scapy_service(Scapy_service_api): self.instruction_parameter_meta_definitions = [] self.field_engine_supported_protocols = {} self.field_engine_parameter_meta_definitions = [] + self.field_engine_templates_definitions = [] with open('field_engine.json', 'r') as f: metas = json.load(f) self.instruction_parameter_meta_definitions = metas["instruction_params_meta"] @@ -442,6 +444,7 @@ class Scapy_service(Scapy_service_api): self._append_intructions_help() self.field_engine_supported_protocols = metas["supported_protocols"] self.field_engine_parameter_meta_definitions = metas["global_params_meta"] + self.field_engine_templates_definitions = metas["templates"] def _append_intructions_help(self): @@ -978,7 +981,8 @@ class Scapy_service(Scapy_service_api): res = {"protocols": protocols, "feInstructionParameters": self.instruction_parameter_meta_definitions, "feInstructions": self.field_engine_instructions_meta, - "feParameters": self.field_engine_parameter_meta_definitions} + "feParameters": self.field_engine_parameter_meta_definitions, + "feTemplates": self.field_engine_templates_definitions} return res def get_payload_classes(self,client_v_handler, pkt_model_descriptor): |