RX stats API/TUI refinement
authorimarom <[email protected]>
Sun, 13 Mar 2016 13:11:15 +0000 (15:11 +0200)
committerimarom <[email protected]>
Sun, 13 Mar 2016 13:11:15 +0000 (15:11 +0200)
scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py

index bb87758..12bf881 100644 (file)
@@ -828,8 +828,8 @@ class CRxStats(CTRexStats):
         # copy timestamp field
         output['ts'] = current['ts']
 
-        # aggregate all the PG ids (previous and current)
-        pg_ids = filter(is_intable, set(prev.keys() + current.keys()))
+        # we care only about the current active keys
+        pg_ids = filter(is_intable, current.keys())
 
         for pg_id in pg_ids:
 
@@ -854,6 +854,13 @@ class CRxStats(CTRexStats):
                 self.calculate_bw_for_pg(output[pg_id], prev_pg, diff_sec)
 
 
+        # cleanp old reference values - they are dead
+        ref_pg_ids = filter(is_intable, self.reference_stats.keys())
+
+        deleted_pg_ids = set(ref_pg_ids).difference(pg_ids)
+        for d_pg_id in deleted_pg_ids:
+            del self.reference_stats[d_pg_id]
+
         return output