Provide average latency results in IXIA KPIs 55/61255/1
authorRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
Wed, 22 Aug 2018 14:43:55 +0000 (15:43 +0100)
committerRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
Wed, 22 Aug 2018 14:44:27 +0000 (15:44 +0100)
IXIA KPIs will provide an average value of all port latency values:
max, min and avg.

JIRA: YARDSTICK-1394

Change-Id: Ib7c7b5300e8343a1af0a20cb4e49c0bd669c1143
Signed-off-by: Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
yardstick/network_services/traffic_profile/ixia_rfc2544.py
yardstick/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py

index 760b1e8..f079733 100644 (file)
@@ -179,10 +179,6 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile):
         except ZeroDivisionError:
             LOG.info('No traffic is flowing')
 
-        samples['TxThroughput'] = tx_throughput
-        samples['RxThroughput'] = rx_throughput
-        samples['DropPercentage'] = drop_percent
-
         if first_run:
             completed = True if drop_percent <= tolerance else False
         if (first_run and
@@ -196,4 +192,21 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile):
         else:
             completed = True
 
+        latency_ns_avg = float(
+            sum([samples[iface]['Store-Forward_Avg_latency_ns']
+            for iface in samples])) / num_ifaces
+        latency_ns_min = float(
+            sum([samples[iface]['Store-Forward_Min_latency_ns']
+            for iface in samples])) / num_ifaces
+        latency_ns_max = float(
+            sum([samples[iface]['Store-Forward_Max_latency_ns']
+            for iface in samples])) / num_ifaces
+
+        samples['TxThroughput'] = tx_throughput
+        samples['RxThroughput'] = rx_throughput
+        samples['DropPercentage'] = drop_percent
+        samples['latency_ns_avg'] = latency_ns_avg
+        samples['latency_ns_min'] = latency_ns_min
+        samples['latency_ns_max'] = latency_ns_max
+
         return completed, samples
index 27ab460..0759ece 100644 (file)
@@ -575,9 +575,15 @@ class TestIXIARFC2544Profile(unittest.TestCase):
 
     def test_get_drop_percentage_completed(self):
         samples = {'iface_name_1':
-                       {'in_packets': 1000, 'out_packets': 1000},
+                       {'in_packets': 1000, 'out_packets': 1000,
+                        'Store-Forward_Avg_latency_ns': 20,
+                        'Store-Forward_Min_latency_ns': 15,
+                        'Store-Forward_Max_latency_ns': 25},
                    'iface_name_2':
-                       {'in_packets': 1005, 'out_packets': 1007}
+                       {'in_packets': 1005, 'out_packets': 1007,
+                        'Store-Forward_Avg_latency_ns': 23,
+                        'Store-Forward_Min_latency_ns': 13,
+                        'Store-Forward_Max_latency_ns': 28}
                    }
         rfc2544_profile = ixia_rfc2544.IXIARFC2544Profile(self.TRAFFIC_PROFILE)
         completed, samples = rfc2544_profile.get_drop_percentage(samples, 0, 1)
@@ -585,12 +591,21 @@ class TestIXIARFC2544Profile(unittest.TestCase):
         self.assertEqual(66.9, samples['TxThroughput'])
         self.assertEqual(66.833, samples['RxThroughput'])
         self.assertEqual(0.099651, samples['DropPercentage'])
+        self.assertEqual(21.5, samples['latency_ns_avg'])
+        self.assertEqual(14.0, samples['latency_ns_min'])
+        self.assertEqual(26.5, samples['latency_ns_max'])
 
     def test_get_drop_percentage_over_drop_percentage(self):
         samples = {'iface_name_1':
-                       {'in_packets': 1000, 'out_packets': 1000},
+                       {'in_packets': 1000, 'out_packets': 1000,
+                        'Store-Forward_Avg_latency_ns': 20,
+                        'Store-Forward_Min_latency_ns': 15,
+                        'Store-Forward_Max_latency_ns': 25},
                    'iface_name_2':
-                       {'in_packets': 1005, 'out_packets': 1007}
+                       {'in_packets': 1005, 'out_packets': 1007,
+                        'Store-Forward_Avg_latency_ns': 20,
+                        'Store-Forward_Min_latency_ns': 15,
+                        'Store-Forward_Max_latency_ns': 25}
                    }
         rfc2544_profile = ixia_rfc2544.IXIARFC2544Profile(self.TRAFFIC_PROFILE)
         rfc2544_profile.rate = 1000
@@ -604,9 +619,15 @@ class TestIXIARFC2544Profile(unittest.TestCase):
 
     def test_get_drop_percentage_under_drop_percentage(self):
         samples = {'iface_name_1':
-                       {'in_packets': 1000, 'out_packets': 1000},
+                       {'in_packets': 1000, 'out_packets': 1000,
+                        'Store-Forward_Avg_latency_ns': 20,
+                        'Store-Forward_Min_latency_ns': 15,
+                        'Store-Forward_Max_latency_ns': 25},
                    'iface_name_2':
-                       {'in_packets': 1005, 'out_packets': 1007}
+                       {'in_packets': 1005, 'out_packets': 1007,
+                        'Store-Forward_Avg_latency_ns': 20,
+                        'Store-Forward_Min_latency_ns': 15,
+                        'Store-Forward_Max_latency_ns': 25}
                    }
         rfc2544_profile = ixia_rfc2544.IXIARFC2544Profile(self.TRAFFIC_PROFILE)
         rfc2544_profile.rate = 1000
@@ -621,9 +642,15 @@ class TestIXIARFC2544Profile(unittest.TestCase):
     @mock.patch.object(ixia_rfc2544.LOG, 'info')
     def test_get_drop_percentage_not_flow(self, *args):
         samples = {'iface_name_1':
-                       {'in_packets': 1000, 'out_packets': 0},
+                       {'in_packets': 1000, 'out_packets': 0,
+                        'Store-Forward_Avg_latency_ns': 20,
+                        'Store-Forward_Min_latency_ns': 15,
+                        'Store-Forward_Max_latency_ns': 25},
                    'iface_name_2':
-                       {'in_packets': 1005, 'out_packets': 0}
+                       {'in_packets': 1005, 'out_packets': 0,
+                        'Store-Forward_Avg_latency_ns': 20,
+                        'Store-Forward_Min_latency_ns': 15,
+                        'Store-Forward_Max_latency_ns': 25}
                    }
         rfc2544_profile = ixia_rfc2544.IXIARFC2544Profile(self.TRAFFIC_PROFILE)
         rfc2544_profile.rate = 1000
@@ -637,9 +664,15 @@ class TestIXIARFC2544Profile(unittest.TestCase):
 
     def test_get_drop_percentage_first_run(self):
         samples = {'iface_name_1':
-                       {'in_packets': 1000, 'out_packets': 1000},
+                       {'in_packets': 1000, 'out_packets': 1000,
+                        'Store-Forward_Avg_latency_ns': 20,
+                        'Store-Forward_Min_latency_ns': 15,
+                        'Store-Forward_Max_latency_ns': 25},
                    'iface_name_2':
-                       {'in_packets': 1005, 'out_packets': 1007}
+                       {'in_packets': 1005, 'out_packets': 1007,
+                        'Store-Forward_Avg_latency_ns': 20,
+                        'Store-Forward_Min_latency_ns': 15,
+                        'Store-Forward_Max_latency_ns': 25}
                    }
         rfc2544_profile = ixia_rfc2544.IXIARFC2544Profile(self.TRAFFIC_PROFILE)
         completed, samples = rfc2544_profile.get_drop_percentage(