From a88db6885843221757f3cfb4bb3b2e74f57395bb Mon Sep 17 00:00:00 2001 From: imarom Date: Thu, 18 Feb 2016 09:49:26 -0500 Subject: deepcopy for stream per port history --- .../trex_control_plane/stl/trex_stl_lib/trex_stl_port.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'scripts/automation/trex_control_plane/stl') diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py index 838a49ed..29bad041 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py @@ -4,6 +4,7 @@ from collections import namedtuple, OrderedDict import trex_stl_stats from trex_stl_types import * import time +import copy StreamOnPort = namedtuple('StreamOnPort', ['compiled_stream', 'metadata']) @@ -160,8 +161,8 @@ class Port(object): return self.err("Please stop port before attempting to add streams") # listify - streams_list = streams_list if isinstance(streams_list, list) else [streams_list] - + streams_list = copy.deepcopy(streams_list if isinstance(streams_list, list) else [streams_list]) + lookup = {} # allocate IDs @@ -171,10 +172,12 @@ class Port(object): lookup[stream.get_name()] = stream.get_id() - # resolve names + batch = [] + + for stream in streams_list: - next_id = -1 + next_id = -1 next = stream.get_next() if next: if not next in lookup: @@ -183,10 +186,7 @@ class Port(object): stream.set_next_id(next_id) - - - batch = [] - for stream in streams_list: + stream_json = stream.to_json() stream_json['next_stream_id'] = stream.get_next_id() -- cgit 1.2.3-korg