From 11425470921de652bc6849666562d4bc4045229b Mon Sep 17 00:00:00 2001 From: imarom Date: Thu, 17 Mar 2016 10:56:38 +0200 Subject: 'port_id' paramter for profiles --- .../trex_control_plane/stl/trex_stl_lib/trex_stl_client.py | 9 ++++----- .../trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py | 11 +++++++---- 2 files changed, 11 insertions(+), 9 deletions(-) (limited to 'scripts/automation/trex_control_plane') 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) -- cgit 1.2.3-korg