ixia: Add support of LISTs in TRAFFIC 79/50779/1
authorMartin Klozik <martinx.klozik@intel.com>
Thu, 18 Jan 2018 15:22:42 +0000 (15:22 +0000)
committerMartin Klozik <martinx.klozik@intel.com>
Thu, 18 Jan 2018 15:22:42 +0000 (15:22 +0000)
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 <martinx.klozik@intel.com>
Reviewed-by: Al Morton <acmorton@att.com>
Reviewed-by: Christian Trautman <ctrautma@redhat.com>
Reviewed-by: Sridhar Rao <sridhar.rao@spirent.com>
Reviewed-by: Trevor Cooper <trevor.cooper@intel.com>
Reviewed-by: Richard Elias <richardx.elias@intel.com>
tools/pkt_gen/ixia/ixia.py
tools/pkt_gen/ixnet/ixnet.py

index e768be0..d4ca56f 100755 (executable)
@@ -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:
index b8fb187..d1ba909 100755 (executable)
@@ -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: