From 720a1fa8295271a8445c6698ace31443aaf9214f Mon Sep 17 00:00:00 2001 From: Vyacheslav Ogai Date: Wed, 30 Nov 2016 12:08:27 +0200 Subject: Update _existed_flow_var_names. Now it returns all Flow var names. Signed-off-by: Vyacheslav Ogai --- .../stl/services/scapy_server/field_engine.json | 2 +- .../stl/services/scapy_server/scapy_service.py | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'scripts/automation/trex_control_plane/stl') 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 30c8dc15..b5356eb0 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 @@ -181,7 +181,7 @@ "name": "L4 offset", "type": "STRING", "required": true, - "defaultValue": "0" + "defaultValue": "TCP" }, { "id": "ip_min", 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 9e617a81..9598ea94 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 @@ -807,7 +807,14 @@ class Scapy_service(Scapy_service_api): return {} def _existed_flow_var_names(self, instructions): - return {"map": dict((instruction['parameters']['name'], instruction['parameters']['name']) for instruction in instructions if instruction['id'] == "STLVmFlowVar")} + return {"map": dict((instruction['parameters']['name'], instruction['parameters']['name']) for instruction in instructions if self._nameParamterExist(instruction))} + + def _nameParamterExist(self, instruction): + try: + instruction['parameters']['name'] + return True + except KeyError: + return False def _curent_pkt_protocol_fields(self, given_protocol_ids, delimiter): given_protocol_classes = [c for c in Packet.__subclasses__() if c.__name__ in given_protocol_ids and c.__name__ != "Ether"] -- cgit 1.2.3-korg