From 7c67ba7242ce919a64551ebb61c7f68f5a97cbd2 Mon Sep 17 00:00:00 2001 From: Yaroslav Brustinov Date: Sun, 5 Mar 2017 10:21:44 +0200 Subject: STL console: sort streams in numerical order https://trex-tgn.cisco.com/youtrack/issue/trex-366 Change-Id: I8691a20c14fb55a66145c64ee1a1a3971e140a76 Signed-off-by: Yaroslav Brustinov --- .../trex_control_plane/stl/trex_stl_lib/trex_stl_port.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 6565f83a..9a2cfc07 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 @@ -1013,8 +1013,9 @@ class Port(object): if sync: self.sync_streams() - data = {} - for id, obj in self.streams.items(): + data = OrderedDict() + for id in sorted(map(int, self.streams.keys())): + obj = self.streams[str(id)] # lazy build scapy repr. if not 'pkt_type' in obj: @@ -1028,7 +1029,7 @@ class Port(object): ('next_stream', obj['next_id'] if not '-1' else 'None') ]) - return {"streams" : OrderedDict(sorted(data.items())) } + return {"streams" : data} ######## attributes are a complex type (dict) that might be manipulated through the async thread ############# -- cgit 1.2.3-korg