STL console: sort streams in numerical order
authorYaroslav Brustinov <[email protected]>
Sun, 5 Mar 2017 08:21:44 +0000 (10:21 +0200)
committerYaroslav Brustinov <[email protected]>
Sun, 5 Mar 2017 08:21:44 +0000 (10:21 +0200)
https://trex-tgn.cisco.com/youtrack/issue/trex-366

Change-Id: I8691a20c14fb55a66145c64ee1a1a3971e140a76
Signed-off-by: Yaroslav Brustinov <[email protected]>
scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py

index 6565f83..9a2cfc0 100644 (file)
@@ -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 #############