From 3e4a1be91d487d4a73fc80f1c3f23ebf78c15953 Mon Sep 17 00:00:00 2001 From: Martin Klozik Date: Thu, 18 Jan 2018 15:22:42 +0000 Subject: ixia: Add support of LISTs in TRAFFIC The control script for Ixia (i.e. Ixia and IxNet classes) is written in TCL and thus VSPERF must translate TRAFFIC dictionary into TCL notation. The method for data type conversion was updated to correctly process new 'capture' settings, which uses python lists for tx and rx capture ports definition. JIRA: VSPERF-556 Change-Id: I639942b11ea11ce1b443a2a2e99c3da6619ba569 Signed-off-by: Martin Klozik Reviewed-by: Al Morton Reviewed-by: Christian Trautman Reviewed-by: Sridhar Rao Reviewed-by: Trevor Cooper Reviewed-by: Richard Elias --- tools/pkt_gen/ixia/ixia.py | 8 ++++++++ tools/pkt_gen/ixnet/ixnet.py | 8 ++++++++ 2 files changed, 16 insertions(+) (limited to 'tools') diff --git a/tools/pkt_gen/ixia/ixia.py b/tools/pkt_gen/ixia/ixia.py index e768be06..d4ca56f2 100755 --- a/tools/pkt_gen/ixia/ixia.py +++ b/tools/pkt_gen/ixia/ixia.py @@ -111,6 +111,11 @@ def _build_set_cmds(values, prefix='dict set'): yield subkey continue + if isinstance(value, list): + value = '{{{}}}'.format(' '.join(str(x) for x in value)) + yield ' '.join([prefix, 'set', key, value]).strip() + continue + # tcl doesn't recognise the strings "True" or "False", only "1" # or "0". Special case to convert them if isinstance(value, bool): @@ -118,6 +123,9 @@ def _build_set_cmds(values, prefix='dict set'): else: value = str(value) + if isinstance(value, str) and not value: + value = '{}' + if prefix: yield ' '.join([prefix, key, value]).strip() else: diff --git a/tools/pkt_gen/ixnet/ixnet.py b/tools/pkt_gen/ixnet/ixnet.py index b8fb1879..d1ba9096 100755 --- a/tools/pkt_gen/ixnet/ixnet.py +++ b/tools/pkt_gen/ixnet/ixnet.py @@ -127,6 +127,11 @@ def _build_set_cmds(values, prefix='dict set'): yield subkey continue + if isinstance(value, list): + value = '{{{}}}'.format(' '.join(str(x) for x in value)) + yield ' '.join([prefix, 'set', key, value]).strip() + continue + # tcl doesn't recognise the strings "True" or "False", only "1" # or "0". Special case to convert them if isinstance(value, bool): @@ -134,6 +139,9 @@ def _build_set_cmds(values, prefix='dict set'): else: value = str(value) + if isinstance(value, str) and not value: + value = '{}' + if prefix: yield ' '.join([prefix, key, value]).strip() else: -- cgit 1.2.3-korg