From 4d000298119c0de055e012e27e76f54327df2251 Mon Sep 17 00:00:00 2001 From: Oleksandr Naumets Date: Fri, 8 Feb 2019 15:32:07 +0000 Subject: Add IXIA Tx/Rx Bytes stats into results Add IXIA "Bytes Rx" and "Bytes Tx" ports stats into collected results. This stats allows to calculate the throughput when running IMIX traffic. JIRA: YARDSTICK-1592 Change-Id: I1db678d410b37e7a0f64dc743e6e620e495115ed Signed-off-by: Oleksandr Naumets --- .../libs/ixia_libs/ixnet/ixnet_api.py | 2 ++ .../traffic_profile/ixia_rfc2544.py | 20 +++++++++++++++++ .../network_services/traffic_profile/rfc2544.py | 8 +++++++ .../vnf_generic/vnf/tg_rfc2544_ixia.py | 8 +++++++ .../network_services/vnf_generic/vnf/tg_trex.py | 2 ++ .../traffic_profile/test_ixia_rfc2544.py | 26 ++++++++++++++++++++++ .../traffic_profile/test_rfc2544.py | 10 +++++++++ .../vnf_generic/vnf/test_tg_rfc2544_ixia.py | 22 ++++++++++++++++++ 8 files changed, 98 insertions(+) (limited to 'yardstick') diff --git a/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py b/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py index cb462f79c..33ac70d21 100644 --- a/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py +++ b/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py @@ -100,6 +100,8 @@ class IxNextgen(object): # pragma: no cover "Rx_Rate_Kbps": 'Rx. Rate (Kbps)', "Tx_Rate_Mbps": 'Tx. Rate (Mbps)', "Rx_Rate_Mbps": 'Rx. Rate (Mbps)', + "Bytes_Tx": 'Bytes Tx.', + "Bytes_Rx": 'Bytes Rx.' } LATENCY_NAME_MAP = { diff --git a/yardstick/network_services/traffic_profile/ixia_rfc2544.py b/yardstick/network_services/traffic_profile/ixia_rfc2544.py index c4664a36a..aded2d347 100644 --- a/yardstick/network_services/traffic_profile/ixia_rfc2544.py +++ b/yardstick/network_services/traffic_profile/ixia_rfc2544.py @@ -209,8 +209,16 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile): [samples[iface]['in_packets'] for iface in samples]) out_packets_sum = sum( [samples[iface]['out_packets'] for iface in samples]) + in_bytes_sum = sum( + [samples[iface]['in_bytes'] for iface in samples]) + out_bytes_sum = sum( + [samples[iface]['out_bytes'] for iface in samples]) rx_throughput = round(float(in_packets_sum) / duration, 3) tx_throughput = round(float(out_packets_sum) / duration, 3) + # Rx throughput in Bps + rx_throughput_bps = round(float(in_bytes_sum) / duration, 3) + # Tx throughput in Bps + tx_throughput_bps = round(float(out_bytes_sum) / duration, 3) packet_drop = abs(out_packets_sum - in_packets_sum) try: @@ -262,6 +270,8 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile): samples['TxThroughput'] = tx_throughput samples['RxThroughput'] = rx_throughput + samples['TxThroughputBps'] = tx_throughput_bps + samples['RxThroughputBps'] = rx_throughput_bps samples['DropPercentage'] = drop_percent samples['latency_ns_avg'] = latency_ns_avg samples['latency_ns_min'] = latency_ns_min @@ -351,8 +361,16 @@ class IXIARFC2544PppoeScenarioProfile(IXIARFC2544Profile): [samples[iface]['in_packets'] for iface in samples]) out_packets_sum = sum( [samples[iface]['out_packets'] for iface in samples]) + in_bytes_sum = sum( + [samples[iface]['in_bytes'] for iface in samples]) + out_bytes_sum = sum( + [samples[iface]['out_bytes'] for iface in samples]) rx_throughput = round(float(in_packets_sum) / duration, 3) tx_throughput = round(float(out_packets_sum) / duration, 3) + # Rx throughput in Bps + rx_throughput_bps = round(float(in_bytes_sum) / duration, 3) + # Tx throughput in Bps + tx_throughput_bps = round(float(out_bytes_sum) / duration, 3) sum_packet_drop = abs(out_packets_sum - in_packets_sum) try: @@ -374,6 +392,8 @@ class IXIARFC2544PppoeScenarioProfile(IXIARFC2544Profile): samples['TxThroughput'] = tx_throughput samples['RxThroughput'] = rx_throughput + samples['TxThroughputBps'] = tx_throughput_bps + samples['RxThroughputBps'] = rx_throughput_bps samples['DropPercentage'] = sum_drop_percent samples['latency_ns_avg'] = latency_ns_avg samples['latency_ns_min'] = latency_ns_min diff --git a/yardstick/network_services/traffic_profile/rfc2544.py b/yardstick/network_services/traffic_profile/rfc2544.py index 86ef0db5e..b838bf814 100644 --- a/yardstick/network_services/traffic_profile/rfc2544.py +++ b/yardstick/network_services/traffic_profile/rfc2544.py @@ -278,10 +278,16 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile): in_pkt_end = sum(port['in_packets'] for port in samples[-1].values()) out_pkt_ini = sum(port['out_packets'] for port in samples[0].values()) in_pkt_ini = sum(port['in_packets'] for port in samples[0].values()) + in_bytes_ini = sum(port['in_bytes'] for port in samples[0].values()) + out_bytes_ini = sum(port['out_bytes'] for port in samples[0].values()) + in_bytes_end = sum(port['in_bytes'] for port in samples[-1].values()) + out_bytes_end = sum(port['out_bytes'] for port in samples[-1].values()) time_diff = (list(samples[-1].values())[0]['timestamp'] - list(samples[0].values())[0]['timestamp']).total_seconds() out_packets = out_pkt_end - out_pkt_ini in_packets = in_pkt_end - in_pkt_ini + out_bytes = out_bytes_end - out_bytes_ini + in_bytes = in_bytes_end - in_bytes_ini tx_rate_fps = float(out_packets) / time_diff rx_rate_fps = float(in_packets) / time_diff drop_percent = 100.0 @@ -320,6 +326,8 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile): output = { 'TxThroughput': tx_rate_fps, 'RxThroughput': rx_rate_fps, + 'RxThroughputBps': round(float(in_bytes) / time_diff, 3), + 'TxThroughputBps': round(float(out_bytes) / time_diff, 3), 'CurrentDropPercentage': drop_percent, 'Throughput': throughput, 'DropPercentage': self.drop_percent_max, diff --git a/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py b/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py index 2f9eb3f0d..62f14b6b6 100644 --- a/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py +++ b/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py @@ -84,8 +84,12 @@ class IxiaBasicScenario(object): 'tx_throughput_kps': float(stats['Tx_Rate_Kbps'][port_num]), 'rx_throughput_mbps': float(stats['Rx_Rate_Mbps'][port_num]), 'tx_throughput_mbps': float(stats['Tx_Rate_Mbps'][port_num]), + 'RxThroughputBps': float(stats['Bytes_Rx'][port_num]) / duration, + 'TxThroughputBps': float(stats['Bytes_Tx'][port_num]) / duration, 'in_packets': int(stats['Valid_Frames_Rx'][port_num]), 'out_packets': int(stats['Frames_Tx'][port_num]), + 'in_bytes': int(stats['Bytes_Rx'][port_num]), + 'out_bytes': int(stats['Bytes_Tx'][port_num]), 'RxThroughput': float(stats['Valid_Frames_Rx'][port_num]) / duration, 'TxThroughput': float(stats['Frames_Tx'][port_num]) / duration, 'Store-Forward_Avg_latency_ns': utils.safe_cast(avg_latency, int, 0), @@ -608,8 +612,12 @@ class IxiaPppoeClientScenario(object): 'tx_throughput_kps': float(ports_stats[port_num]['Tx_Rate_Kbps']), 'rx_throughput_mbps': float(ports_stats[port_num]['Rx_Rate_Mbps']), 'tx_throughput_mbps': float(ports_stats[port_num]['Tx_Rate_Mbps']), + 'RxThroughputBps': float(ports_stats[port_num]['Bytes_Rx']) / duration, + 'TxThroughputBps': float(ports_stats[port_num]['Bytes_Tx']) / duration, 'in_packets': int(ports_stats[port_num]['Valid_Frames_Rx']), 'out_packets': int(ports_stats[port_num]['Frames_Tx']), + 'in_bytes': int(ports_stats[port_num]['Bytes_Rx']), + 'out_bytes': int(ports_stats[port_num]['Bytes_Tx']), 'RxThroughput': float(ports_stats[port_num]['Valid_Frames_Rx']) / duration, 'TxThroughput': float(ports_stats[port_num]['Frames_Tx']) / duration, 'Store-Forward_Avg_latency_ns': utils.safe_cast(avg_latency, int, 0), diff --git a/yardstick/network_services/vnf_generic/vnf/tg_trex.py b/yardstick/network_services/vnf_generic/vnf/tg_trex.py index 3011c60a3..0cb66a714 100644 --- a/yardstick/network_services/vnf_generic/vnf/tg_trex.py +++ b/yardstick/network_services/vnf_generic/vnf/tg_trex.py @@ -179,6 +179,8 @@ class TrexResourceHelper(ClientResourceHelper): 'tx_throughput_bps': float(port_stats.get('tx_bps', 0.0)), 'in_packets': int(port_stats.get('ipackets', 0)), 'out_packets': int(port_stats.get('opackets', 0)), + 'in_bytes': int(port_stats.get('ibytes', 0)), + 'out_bytes': int(port_stats.get('obytes', 0)), 'timestamp': timestamp } diff --git a/yardstick/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py b/yardstick/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py index 169e47a28..7b5165c39 100644 --- a/yardstick/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py +++ b/yardstick/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py @@ -630,11 +630,13 @@ class TestIXIARFC2544Profile(unittest.TestCase): def test_get_drop_percentage_completed(self): samples = {'iface_name_1': {'in_packets': 1000, 'out_packets': 1000, + 'in_bytes': 64000, 'out_bytes': 64000, '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_bytes': 64320, 'out_bytes': 64448, 'Store-Forward_Avg_latency_ns': 23, 'Store-Forward_Min_latency_ns': 13, 'Store-Forward_Max_latency_ns': 28} @@ -658,11 +660,13 @@ class TestIXIARFC2544Profile(unittest.TestCase): def test_get_drop_percentage_over_drop_percentage(self): samples = {'iface_name_1': {'in_packets': 1000, 'out_packets': 1000, + 'in_bytes': 64000, 'out_bytes': 64000, '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_bytes': 64320, 'out_bytes': 64448, 'Store-Forward_Avg_latency_ns': 20, 'Store-Forward_Min_latency_ns': 15, 'Store-Forward_Max_latency_ns': 25} @@ -681,11 +685,13 @@ class TestIXIARFC2544Profile(unittest.TestCase): def test_get_drop_percentage_under_drop_percentage(self): samples = {'iface_name_1': {'in_packets': 1000, 'out_packets': 1000, + 'in_bytes': 64000, 'out_bytes': 64000, '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_bytes': 64320, 'out_bytes': 64448, 'Store-Forward_Avg_latency_ns': 20, 'Store-Forward_Min_latency_ns': 15, 'Store-Forward_Max_latency_ns': 25} @@ -705,11 +711,13 @@ class TestIXIARFC2544Profile(unittest.TestCase): def test_get_drop_percentage_not_flow(self, *args): samples = {'iface_name_1': {'in_packets': 1000, 'out_packets': 0, + 'in_bytes': 64000, 'out_bytes': 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_bytes': 64320, 'out_bytes': 0, 'Store-Forward_Avg_latency_ns': 20, 'Store-Forward_Min_latency_ns': 15, 'Store-Forward_Max_latency_ns': 25} @@ -728,11 +736,13 @@ class TestIXIARFC2544Profile(unittest.TestCase): def test_get_drop_percentage_first_run(self): samples = {'iface_name_1': {'in_packets': 1000, 'out_packets': 1000, + 'in_bytes': 64000, 'out_bytes': 64000, '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_bytes': 64320, 'out_bytes': 64448, 'Store-Forward_Avg_latency_ns': 20, 'Store-Forward_Min_latency_ns': 15, 'Store-Forward_Max_latency_ns': 25} @@ -752,11 +762,13 @@ class TestIXIARFC2544Profile(unittest.TestCase): rfc2544_profile._get_next_rate = mock.Mock(return_value=0.1) samples = {'iface_name_1': {'in_packets': 1000, 'out_packets': 1000, + 'in_bytes': 64000, 'out_bytes': 64000, '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_bytes': 64320, 'out_bytes': 64448, 'Store-Forward_Avg_latency_ns': 20, 'Store-Forward_Min_latency_ns': 15, 'Store-Forward_Max_latency_ns': 25} @@ -768,11 +780,13 @@ class TestIXIARFC2544Profile(unittest.TestCase): samples = {'iface_name_1': {'in_packets': 1000, 'out_packets': 1000, + 'in_bytes': 64000, 'out_bytes': 64000, '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_bytes': 64320, 'out_bytes': 64448, 'Store-Forward_Avg_latency_ns': 20, 'Store-Forward_Min_latency_ns': 15, 'Store-Forward_Max_latency_ns': 25} @@ -899,12 +913,16 @@ class TestIXIARFC2544PppoeScenarioProfile(unittest.TestCase): '0': { 'in_packets': 100, 'out_packets': 100, + 'in_bytes': 6400, + 'out_bytes': 6400, 'Store-Forward_Avg_latency_ns': 10, 'Store-Forward_Min_latency_ns': 10, 'Store-Forward_Max_latency_ns': 10}}, 'xe0': { 'in_packets': 100, 'out_packets': 100, + 'in_bytes': 6400, + 'out_bytes': 6400, 'Store-Forward_Avg_latency_ns': 10, 'Store-Forward_Min_latency_ns': 10, 'Store-Forward_Max_latency_ns': 10}} @@ -937,12 +955,16 @@ class TestIXIARFC2544PppoeScenarioProfile(unittest.TestCase): '0': { 'in_packets': 90, 'out_packets': 100, + 'in_bytes': 5760, + 'out_bytes': 6400, 'Store-Forward_Avg_latency_ns': 10, 'Store-Forward_Min_latency_ns': 10, 'Store-Forward_Max_latency_ns': 10}}, 'xe0': { 'in_packets': 90, 'out_packets': 100, + 'in_bytes': 5760, + 'out_bytes': 6400, 'Store-Forward_Avg_latency_ns': 10, 'Store-Forward_Min_latency_ns': 10, 'Store-Forward_Max_latency_ns': 10}} @@ -972,12 +994,16 @@ class TestIXIARFC2544PppoeScenarioProfile(unittest.TestCase): '0': { 'in_packets': 100, 'out_packets': 100, + 'in_bytes': 6400, + 'out_bytes': 6400, 'Store-Forward_Avg_latency_ns': 10, 'Store-Forward_Min_latency_ns': 10, 'Store-Forward_Max_latency_ns': 10}}, 'xe0': { 'in_packets': 90, 'out_packets': 100, + 'in_bytes': 5760, + 'out_bytes': 6400, 'Store-Forward_Avg_latency_ns': 10, 'Store-Forward_Min_latency_ns': 10, 'Store-Forward_Max_latency_ns': 10 diff --git a/yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py b/yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py index fdcd36f0e..c72a72d3d 100644 --- a/yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py +++ b/yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py @@ -255,22 +255,30 @@ class TestRFC2544Profile(base.BaseUnitTestCase): 'rx_throughput_fps': 101, 'out_packets': 2100, 'in_packets': 2010, + 'out_bytes': 134400, + 'in_bytes': 128640, 'timestamp': datetime.datetime(2000, 1, 1, 1, 1, 1, 1)}, 'xe2': {'tx_throughput_fps': 210, 'rx_throughput_fps': 201, 'out_packets': 4100, 'in_packets': 4010, + 'out_bytes': 262400, + 'in_bytes': 256640, 'timestamp': datetime.datetime(2000, 1, 1, 1, 1, 1, 1)}}, {'xe1': {'tx_throughput_fps': 156, 'rx_throughput_fps': 108, 'out_packets': 2110, 'in_packets': 2040, + 'out_bytes': 135040, + 'in_bytes': 130560, 'latency': 'Latency1', 'timestamp': datetime.datetime(2000, 1, 1, 1, 1, 1, 31)}, 'xe2': {'tx_throughput_fps': 253, 'rx_throughput_fps': 215, 'out_packets': 4150, 'in_packets': 4010, + 'out_bytes': 265600, + 'in_bytes': 256640, 'latency': 'Latency2', 'timestamp': datetime.datetime(2000, 1, 1, 1, 1, 1, 31)}} ] @@ -280,6 +288,8 @@ class TestRFC2544Profile(base.BaseUnitTestCase): 'Latency': {'xe1': 'Latency1', 'xe2': 'Latency2'}, 'RxThroughput': 1000000.0, 'TxThroughput': 2000000.0, + 'RxThroughputBps': 64000000.0, + 'TxThroughputBps': 128000000.0, 'CurrentDropPercentage': 50.0, 'Rate': 100.0, 'Throughput': 1000000.0} diff --git a/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py b/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py index ccf077220..6d29d7258 100644 --- a/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py +++ b/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py @@ -501,6 +501,8 @@ class TestIxiaBasicScenario(unittest.TestCase): 'Valid_Frames_Rx': ['150', '150'], 'Frames_Tx_Rate': ['0.0', '0.0'], 'Valid_Frames_Rx_Rate': ['0.0', '0.0'], + 'Bytes_Rx': ['9600', '9600'], + 'Bytes_Tx': ['9600', '9600'], 'Tx_Rate_Kbps': ['0.0', '0.0'], 'Rx_Rate_Mbps': ['0.0', '0.0'], 'Tx_Rate_Mbps': ['0.0', '0.0'], @@ -551,10 +553,14 @@ class TestIxiaBasicScenario(unittest.TestCase): expected_samples = {'xe0': { 'in_packets': 150, 'out_packets': 150, + 'in_bytes': 9600, + 'out_bytes': 9600, 'rx_throughput_mbps': 0.0, 'rx_throughput_kps': 0.0, 'RxThroughput': 5.0, 'TxThroughput': 5.0, + 'RxThroughputBps': 320.0, + 'TxThroughputBps': 320.0, 'tx_throughput_mbps': 0.0, 'tx_throughput_kps': 0.0, 'Store-Forward_Max_latency_ns': 100, @@ -563,10 +569,14 @@ class TestIxiaBasicScenario(unittest.TestCase): 'xe1': { 'in_packets': 150, 'out_packets': 150, + 'in_bytes': 9600, + 'out_bytes': 9600, 'rx_throughput_mbps': 0.0, 'rx_throughput_kps': 0.0, 'RxThroughput': 5.0, 'TxThroughput': 5.0, + 'RxThroughputBps': 320.0, + 'TxThroughputBps': 320.0, 'tx_throughput_mbps': 0.0, 'tx_throughput_kps': 0.0, 'Store-Forward_Max_latency_ns': 200, @@ -1169,6 +1179,8 @@ class TestIxiaPppoeClientScenario(unittest.TestCase): 'port_statistics': [ {'Frames_Tx': '3000', 'Valid_Frames_Rx': '3000', + 'Bytes_Rx': '192000', + 'Bytes_Tx': '192000', 'Rx_Rate_Kbps': '0.0', 'Tx_Rate_Kbps': '0.0', 'Rx_Rate_Mbps': '0.0', @@ -1176,6 +1188,8 @@ class TestIxiaPppoeClientScenario(unittest.TestCase): 'port_name': 'Ethernet - 001'}, {'Frames_Tx': '3000', 'Valid_Frames_Rx': '3000', + 'Bytes_Rx': '192000', + 'Bytes_Tx': '192000', 'Rx_Rate_Kbps': '0.0', 'Tx_Rate_Kbps': '0.0', 'Rx_Rate_Mbps': '0.0', @@ -1215,6 +1229,10 @@ class TestIxiaPppoeClientScenario(unittest.TestCase): 'TxThroughput': 100.0, 'in_packets': 3000, 'out_packets': 3000, + 'in_bytes': 192000, + 'out_bytes': 192000, + 'RxThroughputBps': 6400.0, + 'TxThroughputBps': 6400.0, 'rx_throughput_kps': 0.0, 'rx_throughput_mbps': 0.0, 'sessions_down': 0, @@ -1230,6 +1248,10 @@ class TestIxiaPppoeClientScenario(unittest.TestCase): 'TxThroughput': 100.0, 'in_packets': 3000, 'out_packets': 3000, + 'in_bytes': 192000, + 'out_bytes': 192000, + 'RxThroughputBps': 6400.0, + 'TxThroughputBps': 6400.0, 'rx_throughput_kps': 0.0, 'rx_throughput_mbps': 0.0, 'tx_throughput_kps': 0.0, -- cgit 1.2.3-korg