summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl/trex_stl_lib
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-03-17 10:56:38 +0200
committerimarom <imarom@cisco.com>2016-03-17 10:57:06 +0200
commit11425470921de652bc6849666562d4bc4045229b (patch)
treea9e719d828ead0022ae7f2b00db4647e716ccd24 /scripts/automation/trex_control_plane/stl/trex_stl_lib
parent7b1d18627b1fa9f76938dac291befbba0367bac2 (diff)
'port_id' paramter for profiles
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib')
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py9
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py11
2 files changed, 11 insertions, 9 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py
index de07e9e4..33a2cd21 100644
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py
@@ -1978,11 +1978,10 @@ class STLClient(object):
try:
for port, t in zip(opts.ports, tunables):
- # give priority to the user configuration over default direction
- if not 'direction' in t:
- t['direction'] = (port % 2)
-
- profile = STLProfile.load(opts.file[0], **t)
+ profile = STLProfile.load(opts.file[0],
+ direction = t.get('direction', port % 2),
+ port_id = port,
+ **t)
self.add_streams(profile.get_streams(), ports = port)
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py
index 8a42145d..b14353f4 100644
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py
@@ -856,7 +856,7 @@ class STLProfile(object):
@staticmethod
- def load_py (python_file, direction = 0, **kwargs):
+ def load_py (python_file, direction = 0, port_id = 0, **kwargs):
""" load from Python profile """
# check filename
@@ -876,7 +876,9 @@ class STLProfile(object):
if not arg in t:
raise STLError("profile {0} does not support tunable '{1}' - supported tunables are: '{2}'".format(python_file, arg, t))
- streams = module.register().get_streams(direction = direction, **kwargs)
+ streams = module.register().get_streams(direction = direction,
+ port_id = port_id,
+ **kwargs)
profile = STLProfile(streams)
profile.meta = {'type': 'python',
@@ -975,7 +977,7 @@ class STLProfile(object):
@staticmethod
- def load (filename, direction = 0, **kwargs):
+ def load (filename, direction = 0, port_id = 0, **kwargs):
""" load a profile by its type supported type are
* py
* yaml
@@ -984,6 +986,7 @@ class STLProfile(object):
:parameters:
filename : string as filename
direction : profile's direction (if supported by the profile)
+ port_id : which port ID this profile is being loaded to
kwargs : forward those key-value pairs to the profile
"""
@@ -992,7 +995,7 @@ class STLProfile(object):
suffix = x[1] if (len(x) == 2) else None
if suffix == 'py':
- profile = STLProfile.load_py(filename, direction, **kwargs)
+ profile = STLProfile.load_py(filename, direction, port_id, **kwargs)
elif suffix == 'yaml':
profile = STLProfile.load_yaml(filename)