diff options
Diffstat (limited to 'yardstick/tests/unit')
7 files changed, 286 insertions, 294 deletions
diff --git a/yardstick/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py b/yardstick/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py index ff8ce5796..ecc9e1249 100644 --- a/yardstick/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py +++ b/yardstick/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py @@ -159,7 +159,7 @@ TRAFFIC_PROFILE = { class TestNetworkServiceTestCase(unittest.TestCase): def setUp(self): - self.tg__1 = { + self.tg__0 = { 'name': 'trafficgen_1.yardstick', 'ip': '10.10.10.11', 'role': 'TrafficGen', @@ -185,7 +185,7 @@ class TestNetworkServiceTestCase(unittest.TestCase): }, } - self.vnf__1 = { + self.vnf__0 = { 'name': 'vnf.yardstick', 'ip': '10.10.10.12', 'host': '10.223.197.164', @@ -242,8 +242,8 @@ class TestNetworkServiceTestCase(unittest.TestCase): self.context_cfg = { 'nodes': { - 'tg__1': self.tg__1, - 'vnf__1': self.vnf__1, + 'tg__0': self.tg__0, + 'vnf__0': self.vnf__0, }, 'networks': { GenericVNF.UPLINK: { @@ -270,7 +270,7 @@ class TestNetworkServiceTestCase(unittest.TestCase): ], 'type': 'ELAN', 'id': GenericVNF.UPLINK, - 'name': 'tg__1 to vnf__1 link 1' + 'name': 'tg__0 to vnf__0 link 1' } self.vld1 = { @@ -288,7 +288,7 @@ class TestNetworkServiceTestCase(unittest.TestCase): ], 'type': 'ELAN', 'id': GenericVNF.DOWNLINK, - 'name': 'vnf__1 to tg__1 link 2' + 'name': 'vnf__0 to tg__0 link 2' } self.topology = { @@ -300,12 +300,12 @@ class TestNetworkServiceTestCase(unittest.TestCase): { 'member-vnf-index': '1', 'VNF model': 'tg_trex_tpl.yaml', - 'vnfd-id-ref': 'tg__1', + 'vnfd-id-ref': 'tg__0', }, { 'member-vnf-index': '2', 'VNF model': 'tg_trex_tpl.yaml', - 'vnfd-id-ref': 'vnf__1', + 'vnfd-id-ref': 'vnf__0', }, ], 'vld': [self.vld0, self.vld1], @@ -343,8 +343,8 @@ class TestNetworkServiceTestCase(unittest.TestCase): }, 'nodes': { 'tg__2': 'trafficgen_2.yardstick', - 'tg__1': 'trafficgen_1.yardstick', - 'vnf__1': 'vnf.yardstick', + 'tg__0': 'trafficgen_1.yardstick', + 'vnf__0': 'vnf.yardstick', }, } @@ -411,12 +411,12 @@ class TestNetworkServiceTestCase(unittest.TestCase): 'flow': { 'src_ip': [ { - 'tg__1': 'xe0', + 'tg__0': 'xe0', }, ], 'dst_ip': [ { - 'tg__1': 'xe1', + 'tg__0': 'xe1', }, ], 'public_ip': ['1.1.1.1'], @@ -446,9 +446,9 @@ class TestNetworkServiceTestCase(unittest.TestCase): self.assertIn('found in', exc_str) def test_load_vnf_models_invalid(self): - self.context_cfg["nodes"]['tg__1']['VNF model'] = \ + self.context_cfg["nodes"]['tg__0']['VNF model'] = \ self._get_file_abspath("tg_trex_tpl.yaml") - self.context_cfg["nodes"]['vnf__1']['VNF model'] = \ + self.context_cfg["nodes"]['vnf__0']['VNF model'] = \ self._get_file_abspath("tg_trex_tpl.yaml") vnf = mock.Mock(autospec=GenericVNF) @@ -469,13 +469,13 @@ class TestNetworkServiceTestCase(unittest.TestCase): nodes = self.context_cfg["nodes"] self.assertEqual('../../vnf_descriptors/tg_rfc2544_tpl.yaml', - nodes['tg__1']['VNF model']) + nodes['tg__0']['VNF model']) self.assertEqual('../../vnf_descriptors/vpe_vnf.yaml', - nodes['vnf__1']['VNF model']) + nodes['vnf__0']['VNF model']) def test_map_topology_to_infrastructure_insufficient_nodes(self): cfg = deepcopy(self.context_cfg) - del cfg['nodes']['vnf__1'] + del cfg['nodes']['vnf__0'] cfg_patch = mock.patch.object(self.s, 'context_cfg', cfg) with cfg_patch: @@ -489,10 +489,10 @@ class TestNetworkServiceTestCase(unittest.TestCase): cfg = deepcopy(self.s.context_cfg) # delete all, we don't know which will come first - del cfg['nodes']['vnf__1']['interfaces']['xe0']['local_mac'] - del cfg['nodes']['vnf__1']['interfaces']['xe1']['local_mac'] - del cfg['nodes']['tg__1']['interfaces']['xe0']['local_mac'] - del cfg['nodes']['tg__1']['interfaces']['xe1']['local_mac'] + del cfg['nodes']['vnf__0']['interfaces']['xe0']['local_mac'] + del cfg['nodes']['vnf__0']['interfaces']['xe1']['local_mac'] + del cfg['nodes']['tg__0']['interfaces']['xe0']['local_mac'] + del cfg['nodes']['tg__0']['interfaces']['xe1']['local_mac'] config_patch = mock.patch.object(self.s, 'context_cfg', cfg) with config_patch: @@ -507,7 +507,7 @@ class TestNetworkServiceTestCase(unittest.TestCase): ssh.from_node.return_value = ssh_mock # purge an important key from the data structure - for interface in self.tg__1['interfaces'].values(): + for interface in self.tg__0['interfaces'].values(): del interface['local_mac'] with self.assertRaises(exceptions.IncorrectConfig) as raised: @@ -516,7 +516,7 @@ class TestNetworkServiceTestCase(unittest.TestCase): self.assertIn('not found', str(raised.exception)) # restore local_mac - for index, interface in enumerate(self.tg__1['interfaces'].values()): + for index, interface in enumerate(self.tg__0['interfaces'].values()): interface['local_mac'] = '00:00:00:00:00:{:2x}'.format(index) # make a connection point ref with 3 points diff --git a/yardstick/tests/unit/benchmark/scenarios/networking/vpe_vnf_topology.yaml b/yardstick/tests/unit/benchmark/scenarios/networking/vpe_vnf_topology.yaml index 1ac6c1f89..aaf84bb5e 100644 --- a/yardstick/tests/unit/benchmark/scenarios/networking/vpe_vnf_topology.yaml +++ b/yardstick/tests/unit/benchmark/scenarios/networking/vpe_vnf_topology.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2016-2017 Intel Corporation +# Copyright (c) 2016-2019 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,31 +20,31 @@ nsd:nsd-catalog: description: scenario with VPE,L3fwd and VNF constituent-vnfd: - member-vnf-index: '1' - vnfd-id-ref: tg__1 - VNF model: ../../vnf_descriptors/tg_rfc2544_tpl.yaml #tg_vpe_upstream.yaml #VPE VNF + vnfd-id-ref: tg__0 + VNF model: ../../vnf_descriptors/tg_rfc2544_tpl.yaml #tg_trex_tpl.yaml #TREX - member-vnf-index: '2' - vnfd-id-ref: vnf__1 - VNF model: ../../vnf_descriptors/vpe_vnf.yaml #tg_l3fwd.yaml #tg_trex_tpl.yaml #TREX + vnfd-id-ref: vnf__0 + VNF model: ../../vnf_descriptors/vpe_vnf.yaml #VPE VNF vld: - id: uplink - name: tg__1 to vnf__1 link 1 + name: tg__0 to vnf__0 link 1 type: ELAN vnfd-connection-point-ref: - member-vnf-index-ref: '1' vnfd-connection-point-ref: xe0 - vnfd-id-ref: tg__1 #TREX + vnfd-id-ref: tg__0 - member-vnf-index-ref: '2' vnfd-connection-point-ref: xe0 - vnfd-id-ref: vnf__1 #VNF + vnfd-id-ref: vnf__0 - id: downlink - name: vnf__1 to tg__1 link 2 + name: vnf__0 to tg__0 link 2 type: ELAN vnfd-connection-point-ref: - member-vnf-index-ref: '2' vnfd-connection-point-ref: xe1 - vnfd-id-ref: vnf__1 #L3fwd + vnfd-id-ref: vnf__0 - member-vnf-index-ref: '1' vnfd-connection-point-ref: xe1 - vnfd-id-ref: tg__1 #VPE VNF + vnfd-id-ref: tg__0 diff --git a/yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py b/yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py index 270d342fd..a20592dc7 100644 --- a/yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py +++ b/yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py @@ -589,12 +589,15 @@ class TestIxNextgen(unittest.TestCase): mock__create_traffic_item): uplink_topologies = ['up1', 'up3'] downlink_topologies = ['down2', 'down4'] + traffic_profile = 'fake_profile' self.ixnet_gen.create_ipv4_traffic_model(uplink_topologies, - downlink_topologies) + downlink_topologies, + traffic_profile) mock__create_traffic_item.assert_called_once_with('ipv4') mock__create_flow_groups.assert_called_once_with(uplink_topologies, downlink_topologies) - mock__setup_config_elements.assert_called_once_with(False) + mock__setup_config_elements.assert_called_once_with( + traffic_profile='fake_profile', add_default_proto=False) def test_flows_settings(self): cfg = {'uplink_0': { 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 7b5165c39..ddd1828ae 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 @@ -517,60 +517,56 @@ class TestIXIARFC2544Profile(unittest.TestCase): def test__get_framesize(self): traffic_profile = { - 'uplink_0': {'outer_l2': {'framesize': {'64B': 100}}}, - 'downlink_0': {'outer_l2': {'framesize': {'64B': 100}}}, - 'uplink_1': {'outer_l2': {'framesize': {'64B': 100}}}, - 'downlink_1': {'outer_l2': {'framesize': {'64B': 100}}} + 'uplink_0': {'ipv4': {'outer_l2': {'framesize': {'64B': 100}}}}, + 'downlink_0': {'ipv4': {'outer_l2': {'framesize': {'64B': 100}}}}, + 'uplink_1': {'ipv4': {'outer_l2': {'framesize': {'64B': 100}}}}, + 'downlink_1': {'ipv4': {'outer_l2': {'framesize': {'64B': 100}}}} } rfc2544_profile = ixia_rfc2544.IXIARFC2544Profile(self.TRAFFIC_PROFILE) - with mock.patch.object(rfc2544_profile, '_get_ixia_traffic_profile') \ - as mock_get_tp: - mock_get_tp.return_value = traffic_profile - result = rfc2544_profile._get_framesize() + rfc2544_profile.params = traffic_profile + result = rfc2544_profile._get_framesize() self.assertEqual(result, '64B') def test__get_framesize_IMIX_traffic(self): traffic_profile = { - 'uplink_0': {'outer_l2': {'framesize': {'64B': 50, - '128B': 50}}}, - 'downlink_0': {'outer_l2': {'framesize': {'64B': 50, - '128B': 50}}}, - 'uplink_1': {'outer_l2': {'framesize': {'64B': 50, - '128B': 50}}}, - 'downlink_1': {'outer_l2': {'framesize': {'64B': 50, - '128B': 50}}} + 'uplink_0': {'ipv4': {'outer_l2': {'framesize': {'64B': 50, + '128B': 50}}}}, + 'downlink_0': {'ipv4': {'outer_l2': {'framesize': {'64B': 50, + '128B': 50}}}}, + 'uplink_1': {'ipv4': {'outer_l2': {'framesize': {'64B': 50, + '128B': 50}}}}, + 'downlink_1': {'ipv4': {'outer_l2': {'framesize': {'64B': 50, + '128B': 50}}}} } rfc2544_profile = ixia_rfc2544.IXIARFC2544Profile(self.TRAFFIC_PROFILE) - with mock.patch.object(rfc2544_profile, '_get_ixia_traffic_profile') \ - as mock_get_tp: - mock_get_tp.return_value = traffic_profile - result = rfc2544_profile._get_framesize() + rfc2544_profile.params = traffic_profile + result = rfc2544_profile._get_framesize() self.assertEqual(result, 'IMIX') def test__get_framesize_zero_pkt_size_weight(self): traffic_profile = { - 'uplink_0': {'outer_l2': {'framesize': {'64B': 0}}}, - 'downlink_0': {'outer_l2': {'framesize': {'64B': 0}}}, - 'uplink_1': {'outer_l2': {'framesize': {'64B': 0}}}, - 'downlink_1': {'outer_l2': {'framesize': {'64B': 0}}} + 'uplink_0': {'ipv4': {'outer_l2': {'framesize': {'64B': 0}}}}, + 'downlink_0': {'ipv4': {'outer_l2': {'framesize': {'64B': 0}}}}, + 'uplink_1': {'ipv4': {'outer_l2': {'framesize': {'64B': 0}}}}, + 'downlink_1': {'ipv4': {'outer_l2': {'framesize': {'64B': 0}}}} } rfc2544_profile = ixia_rfc2544.IXIARFC2544Profile(self.TRAFFIC_PROFILE) - with mock.patch.object(rfc2544_profile, '_get_ixia_traffic_profile') \ - as mock_get_tp: - mock_get_tp.return_value = traffic_profile - result = rfc2544_profile._get_framesize() + rfc2544_profile.params = traffic_profile + result = rfc2544_profile._get_framesize() self.assertEqual(result, '') def test_execute_traffic_first_run(self): rfc2544_profile = ixia_rfc2544.IXIARFC2544Profile(self.TRAFFIC_PROFILE) rfc2544_profile.first_run = True rfc2544_profile.rate = 50 + traffic_gen = mock.Mock() + traffic_gen.rfc_helper.iteration.value = 0 with mock.patch.object(rfc2544_profile, '_get_ixia_traffic_profile') \ as mock_get_tp, \ mock.patch.object(rfc2544_profile, '_ixia_traffic_generate') \ as mock_tgenerate: mock_get_tp.return_value = 'fake_tprofile' - output = rfc2544_profile.execute_traffic(mock.ANY, + output = rfc2544_profile.execute_traffic(traffic_gen, ixia_obj=mock.ANY) self.assertTrue(output) @@ -585,13 +581,15 @@ class TestIXIARFC2544Profile(unittest.TestCase): rfc2544_profile.first_run = False rfc2544_profile.max_rate = 70 rfc2544_profile.min_rate = 0 + traffic_gen = mock.Mock() + traffic_gen.rfc_helper.iteration.value = 0 with mock.patch.object(rfc2544_profile, '_get_ixia_traffic_profile') \ as mock_get_tp, \ mock.patch.object(rfc2544_profile, '_ixia_traffic_generate') \ as mock_tgenerate: mock_get_tp.return_value = 'fake_tprofile' rfc2544_profile.full_profile = mock.ANY - output = rfc2544_profile.execute_traffic(mock.ANY, + output = rfc2544_profile.execute_traffic(traffic_gen, ixia_obj=mock.ANY) self.assertFalse(output) @@ -629,17 +627,17 @@ 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}, + {'InPackets': 1000, 'OutPackets': 1000, + 'InBytes': 64000, 'OutBytes': 64000, + 'LatencyAvg': 20, + 'LatencyMin': 15, + 'LatencyMax': 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} + {'InPackets': 1005, 'OutPackets': 1007, + 'InBytes': 64320, 'OutBytes': 64448, + 'LatencyAvg': 23, + 'LatencyMin': 13, + 'LatencyMax': 28} } rfc2544_profile = ixia_rfc2544.IXIARFC2544Profile(self.TRAFFIC_PROFILE) rfc2544_profile.rate = 100.0 @@ -651,25 +649,25 @@ 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']) + self.assertEqual(21.5, samples['LatencyAvg']) + self.assertEqual(13.0, samples['LatencyMin']) + self.assertEqual(28.0, samples['LatencyMax']) self.assertEqual(100.0, samples['Rate']) self.assertEqual('64B', samples['PktSize']) 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}, + {'InPackets': 1000, 'OutPackets': 1000, + 'InBytes': 64000, 'OutBytes': 64000, + 'LatencyAvg': 20, + 'LatencyMin': 15, + 'LatencyMax': 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} + {'InPackets': 1005, 'OutPackets': 1007, + 'InBytes': 64320, 'OutBytes': 64448, + 'LatencyAvg': 20, + 'LatencyMin': 15, + 'LatencyMax': 25} } rfc2544_profile = ixia_rfc2544.IXIARFC2544Profile(self.TRAFFIC_PROFILE) rfc2544_profile.rate = 1000 @@ -684,17 +682,17 @@ 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}, + {'InPackets': 1000, 'OutPackets': 1000, + 'InBytes': 64000, 'OutBytes': 64000, + 'LatencyAvg': 20, + 'LatencyMin': 15, + 'LatencyMax': 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} + {'InPackets': 1005, 'OutPackets': 1007, + 'InBytes': 64320, 'OutBytes': 64448, + 'LatencyAvg': 20, + 'LatencyMin': 15, + 'LatencyMax': 25} } rfc2544_profile = ixia_rfc2544.IXIARFC2544Profile(self.TRAFFIC_PROFILE) rfc2544_profile.rate = 1000 @@ -710,17 +708,17 @@ 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_bytes': 64000, 'out_bytes': 0, - 'Store-Forward_Avg_latency_ns': 20, - 'Store-Forward_Min_latency_ns': 15, - 'Store-Forward_Max_latency_ns': 25}, + {'InPackets': 1000, 'OutPackets': 0, + 'InBytes': 64000, 'OutBytes': 0, + 'LatencyAvg': 20, + 'LatencyMin': 15, + 'LatencyMax': 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} + {'InPackets': 1005, 'OutPackets': 0, + 'InBytes': 64320, 'OutBytes': 0, + 'LatencyAvg': 20, + 'LatencyMin': 15, + 'LatencyMax': 25} } rfc2544_profile = ixia_rfc2544.IXIARFC2544Profile(self.TRAFFIC_PROFILE) rfc2544_profile.rate = 1000 @@ -735,17 +733,17 @@ 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}, + {'InPackets': 1000, 'OutPackets': 1000, + 'InBytes': 64000, 'OutBytes': 64000, + 'LatencyAvg': 20, + 'LatencyMin': 15, + 'LatencyMax': 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} + {'InPackets': 1005, 'OutPackets': 1007, + 'InBytes': 64320, 'OutBytes': 64448, + 'LatencyAvg': 20, + 'LatencyMin': 15, + 'LatencyMax': 25} } rfc2544_profile = ixia_rfc2544.IXIARFC2544Profile(self.TRAFFIC_PROFILE) rfc2544_profile._get_next_rate = mock.Mock(return_value=50.0) @@ -761,17 +759,17 @@ class TestIXIARFC2544Profile(unittest.TestCase): rfc2544_profile = ixia_rfc2544.IXIARFC2544Profile(self.TRAFFIC_PROFILE) 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}, + {'InPackets': 1000, 'OutPackets': 1000, + 'InBytes': 64000, 'OutBytes': 64000, + 'LatencyAvg': 20, + 'LatencyMin': 15, + 'LatencyMax': 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} + {'InPackets': 1005, 'OutPackets': 1007, + 'InBytes': 64320, 'OutBytes': 64448, + 'LatencyAvg': 20, + 'LatencyMin': 15, + 'LatencyMax': 25} } rfc2544_profile.rate = 0.19 completed, _ = rfc2544_profile.get_drop_percentage( @@ -779,17 +777,17 @@ class TestIXIARFC2544Profile(unittest.TestCase): self.assertTrue(completed) 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}, + {'InPackets': 1000, 'OutPackets': 1000, + 'InBytes': 64000, 'OutBytes': 64000, + 'LatencyAvg': 20, + 'LatencyMin': 15, + 'LatencyMax': 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} + {'InPackets': 1005, 'OutPackets': 1007, + 'InBytes': 64320, 'OutBytes': 64448, + 'LatencyAvg': 20, + 'LatencyMin': 15, + 'LatencyMax': 25} } rfc2544_profile.rate = 0.5 completed, _ = rfc2544_profile.get_drop_percentage( @@ -817,6 +815,7 @@ class TestIXIARFC2544PppoeScenarioProfile(unittest.TestCase): self.TRAFFIC_PROFILE) self.ixia_tp.rate = 100.0 self.ixia_tp._get_next_rate = mock.Mock(return_value=50.0) + self.ixia_tp._get_framesize = mock.Mock(return_value='64B') def test___init__(self): self.assertIsInstance(self.ixia_tp.full_profile, @@ -853,8 +852,8 @@ class TestIXIARFC2544PppoeScenarioProfile(unittest.TestCase): input_stats = { '0': { - 'in_packets': 50, - 'out_packets': 100, + 'InPackets': 50, + 'OutPackets': 100, 'Store-Forward_Avg_latency_ns': 10, 'Store-Forward_Min_latency_ns': 10, 'Store-Forward_Max_latency_ns': 10}} @@ -866,8 +865,8 @@ class TestIXIARFC2544PppoeScenarioProfile(unittest.TestCase): def test__get_prio_flows_drop_percentage_traffic_not_flowing(self): input_stats = { '0': { - 'in_packets': 0, - 'out_packets': 0, + 'InPackets': 0, + 'OutPackets': 0, 'Store-Forward_Avg_latency_ns': 0, 'Store-Forward_Min_latency_ns': 0, 'Store-Forward_Max_latency_ns': 0}} @@ -879,24 +878,24 @@ class TestIXIARFC2544PppoeScenarioProfile(unittest.TestCase): def test__get_summary_pppoe_subs_counters(self): input_stats = { 'xe0': { - 'out_packets': 100, - 'sessions_up': 4, - 'sessions_down': 0, - 'sessions_not_started': 0, - 'sessions_total': 4}, + 'OutPackets': 100, + 'SessionsUp': 4, + 'SessionsDown': 0, + 'SessionsNotStarted': 0, + 'SessionsTotal': 4}, 'xe1': { - 'out_packets': 100, - 'sessions_up': 4, - 'sessions_down': 0, - 'sessions_not_started': 0, - 'sessions_total': 4} + 'OutPackets': 100, + 'SessionsUp': 4, + 'SessionsDown': 0, + 'SessionsNotStarted': 0, + 'SessionsTotal': 4} } expected_stats = { - 'sessions_up': 8, - 'sessions_down': 0, - 'sessions_not_started': 0, - 'sessions_total': 8 + 'SessionsUp': 8, + 'SessionsDown': 0, + 'SessionsNotStarted': 0, + 'SessionsTotal': 8 } res = self.ixia_tp._get_summary_pppoe_subs_counters(input_stats) @@ -911,23 +910,23 @@ class TestIXIARFC2544PppoeScenarioProfile(unittest.TestCase): samples = { 'priority_stats': { '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}}, + 'InPackets': 100, + 'OutPackets': 100, + 'InBytes': 6400, + 'OutBytes': 6400, + 'LatencyAvg': 10, + 'LatencyMin': 10, + 'LatencyMax': 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}} - - mock_get_pppoe_subs.return_value = {'sessions_up': 1} + 'InPackets': 100, + 'OutPackets': 100, + 'InBytes': 6400, + 'OutBytes': 6400, + 'LatencyAvg': 10, + 'LatencyMin': 10, + 'LatencyMax': 10}} + + mock_get_pppoe_subs.return_value = {'SessionsUp': 1} mock_sum_prio_drop_rate.return_value = {'0': {'DropPercentage': 0.0}} self.ixia_tp._get_framesize = mock.Mock(return_value='64B') @@ -935,8 +934,8 @@ class TestIXIARFC2544PppoeScenarioProfile(unittest.TestCase): samples, tol_min=0.0, tolerance=0.0001, precision=0, resolution=0.1, first_run=True) self.assertIsNotNone(res.get('DropPercentage')) - self.assertIsNotNone(res.get('priority')) - self.assertIsNotNone(res.get('sessions_up')) + self.assertIsNotNone(res.get('Priority')) + self.assertIsNotNone(res.get('SessionsUp')) self.assertEqual(res['DropPercentage'], 0.0) self.assertEqual(res['Rate'], 100.0) self.assertEqual(res['PktSize'], '64B') @@ -953,31 +952,31 @@ class TestIXIARFC2544PppoeScenarioProfile(unittest.TestCase): samples = { 'priority_stats': { '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}}, + 'InPackets': 90, + 'OutPackets': 100, + 'InBytes': 5760, + 'OutBytes': 6400, + 'LatencyAvg': 10, + 'LatencyMin': 10, + 'LatencyMax': 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}} - - mock_get_pppoe_subs.return_value = {'sessions_up': 1} + 'InPackets': 90, + 'OutPackets': 100, + 'InBytes': 5760, + 'OutBytes': 6400, + 'LatencyAvg': 10, + 'LatencyMin': 10, + 'LatencyMax': 10}} + + mock_get_pppoe_subs.return_value = {'SessionsUp': 1} mock_sum_prio_drop_rate.return_value = {'0': {'DropPercentage': 0.0}} status, res = self.ixia_tp.get_drop_percentage( samples, tol_min=0.0, tolerance=0.0001, precision=0, resolution=0.1, first_run=True) self.assertIsNotNone(res.get('DropPercentage')) - self.assertIsNotNone(res.get('priority')) - self.assertIsNotNone(res.get('sessions_up')) + self.assertIsNotNone(res.get('Priority')) + self.assertIsNotNone(res.get('SessionsUp')) self.assertEqual(res['DropPercentage'], 10.0) self.assertFalse(status) mock_sum_prio_drop_rate.assert_called_once() @@ -992,24 +991,24 @@ class TestIXIARFC2544PppoeScenarioProfile(unittest.TestCase): samples = { 'priority_stats': { '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}}, + 'InPackets': 100, + 'OutPackets': 100, + 'InBytes': 6400, + 'OutBytes': 6400, + 'LatencyAvg': 10, + 'LatencyMin': 10, + 'LatencyMax': 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 + 'InPackets': 90, + 'OutPackets': 100, + 'InBytes': 5760, + 'OutBytes': 6400, + 'LatencyAvg': 10, + 'LatencyMin': 10, + 'LatencyMax': 10 }} - mock_get_pppoe_subs.return_value = {'sessions_up': 1} + mock_get_pppoe_subs.return_value = {'SessionsUp': 1} mock_sum_prio_drop_rate.return_value = {'0': {'DropPercentage': 0.0}} tc_rfc2544_opts = {'priority': '0', @@ -1018,8 +1017,8 @@ class TestIXIARFC2544PppoeScenarioProfile(unittest.TestCase): samples, tol_min=15.0000, tolerance=15.0001, precision=0, resolution=0.1, first_run=True, tc_rfc2544_opts=tc_rfc2544_opts) self.assertIsNotNone(res.get('DropPercentage')) - self.assertIsNotNone(res.get('priority')) - self.assertIsNotNone(res.get('sessions_up')) + self.assertIsNotNone(res.get('Priority')) + self.assertIsNotNone(res.get('SessionsUp')) self.assertTrue(status) mock_sum_prio_drop_rate.assert_called_once() mock_get_pppoe_subs.assert_called_once() 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 88eaaef28..febcfe5da 100644 --- a/yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py +++ b/yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py @@ -248,34 +248,30 @@ class TestRFC2544Profile(base.BaseUnitTestCase): mock.call(percentage=float(25 * 35) / 100), mock.call(percentage=float(75 * 35) / 100)], any_order=True) - def test_get_drop_percentage(self): + @mock.patch.object(rfc2544.RFC2544Profile, '_get_framesize') + def test_get_drop_percentage(self, mock_get_framesize): rfc2544_profile = rfc2544.RFC2544Profile(self.TRAFFIC_PROFILE) + rfc2544_profile.iteration = 1 + mock_get_framesize.return_value = '64B' + samples = [ - {'xe1': {'tx_throughput_fps': 110, - 'rx_throughput_fps': 101, - 'out_packets': 2100, + {'xe1': {'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, + 'xe2': {'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, + {'xe1': {'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, + 'xe2': {'out_packets': 4150, 'in_packets': 4010, 'out_bytes': 265600, 'in_bytes': 256640, @@ -284,15 +280,23 @@ class TestRFC2544Profile(base.BaseUnitTestCase): ] completed, output = rfc2544_profile.get_drop_percentage( samples, 0, 0, False, 0.1) - expected = {'DropPercentage': 50.0, - 'Latency': {'xe1': 'Latency1', 'xe2': 'Latency2'}, + expected = {'xe1': {'OutPackets': 10, + 'InPackets': 30, + 'OutBytes': 640, + 'InBytes': 1920}, + 'xe2': {'OutPackets': 50, + 'InPackets': 0, + 'OutBytes': 3200, + 'InBytes': 0}, + 'DropPercentage': 50.0, 'RxThroughput': 1000000.0, 'TxThroughput': 2000000.0, 'RxThroughputBps': 64000000.0, 'TxThroughputBps': 128000000.0, - 'CurrentDropPercentage': 50.0, 'Rate': 100.0, - 'Throughput': 1000000.0} + 'Iteration': 1, + 'PktSize': '64B', + 'Status': 'Failure'} self.assertEqual(expected, output) self.assertFalse(completed) diff --git a/yardstick/tests/unit/network_services/vnf_generic/vnf/tc_baremetal_rfc2544_ipv4_1flow_64B.yaml b/yardstick/tests/unit/network_services/vnf_generic/vnf/tc_baremetal_rfc2544_ipv4_1flow_64B.yaml index fb1be35c1..09c22ad9e 100644 --- a/yardstick/tests/unit/network_services/vnf_generic/vnf/tc_baremetal_rfc2544_ipv4_1flow_64B.yaml +++ b/yardstick/tests/unit/network_services/vnf_generic/vnf/tc_baremetal_rfc2544_ipv4_1flow_64B.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2016-2017 Intel Corporation +# Copyright (c) 2016-2019 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,8 +19,8 @@ scenarios: traffic_profile: "../../traffic_profiles/ipv4_throughput_vpe.yaml" topology: vpe_vnf_topology.yaml nodes: - tg__1: trafficgen_1.yardstick - vnf__1: vnf.yardstick + tg__0: trafficgen_0.yardstick + vnf__0: vnf_0.yardstick tc_options: rfc2544: allowed_drop_rate: 0.8 - 1 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 d84fda789..c3f3e5f67 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 @@ -115,7 +115,7 @@ class TestIxiaResourceHelper(unittest.TestCase): mock_tprofile = mock.Mock() mock_tprofile.config.duration = 10 mock_tprofile.get_drop_percentage.return_value = \ - True, {'test': 'fake_samples'} + True, {'test': 'fake_samples', 'Iteration': 1} ixia_rhelper = tg_rfc2544_ixia.IxiaResourceHelper(mock.Mock()) tasks_queue = mock.Mock() tasks_queue.get.return_value = 'RUN_TRAFFIC' @@ -556,37 +556,29 @@ class TestIxiaBasicScenario(unittest.TestCase): def test_generate_samples(self, mock_get_stats): 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, + 'InPackets': 150, + 'OutPackets': 150, + 'InBytes': 9600, + 'OutBytes': 9600, '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, - 'Store-Forward_Min_latency_ns': 100, - 'Store-Forward_Avg_latency_ns': 100}, + 'LatencyMax': 100, + 'LatencyMin': 100, + 'LatencyAvg': 100}, 'xe1': { - 'in_packets': 150, - 'out_packets': 150, - 'in_bytes': 9600, - 'out_bytes': 9600, - 'rx_throughput_mbps': 0.0, - 'rx_throughput_kps': 0.0, + 'InPackets': 150, + 'OutPackets': 150, + 'InBytes': 9600, + 'OutBytes': 9600, '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, - 'Store-Forward_Min_latency_ns': 200, - 'Store-Forward_Avg_latency_ns': 200}} + 'LatencyMax': 200, + 'LatencyMin': 200, + 'LatencyAvg': 200}} res_helper = mock.Mock() res_helper.vnfd_helper.find_interface_by_port.side_effect = \ @@ -649,11 +641,13 @@ class TestIxiaL3Scenario(TestIxiaBasicScenario): def test_create_traffic_model(self): self.mock_IxNextgen.get_vports.return_value = ['1', '2'] - self.scenario.create_traffic_model() + traffic_profile = 'fake_profile' + self.scenario.create_traffic_model(traffic_profile) self.scenario.client.get_vports.assert_called_once() self.scenario.client.create_ipv4_traffic_model.\ assert_called_once_with(['1/protocols/static'], - ['2/protocols/static']) + ['2/protocols/static'], + 'fake_profile') def test_apply_config(self): self.scenario._add_interfaces = mock.Mock() @@ -772,7 +766,7 @@ class TestIxiaPppoeClientScenario(unittest.TestCase): mock_id_pairs.assert_called_once_with(mock_tp.full_profile) mock_obj_pairs.assert_called_once_with(['xe0', 'xe1', 'xe0', 'xe1']) self.scenario.client.create_ipv4_traffic_model.assert_called_once_with( - uplink_endpoints, downlink_endpoints) + uplink_endpoints, downlink_endpoints, mock_tp) @mock.patch.object(tg_rfc2544_ixia.IxiaPppoeClientScenario, '_get_endpoints_src_dst_id_pairs') @@ -796,7 +790,7 @@ class TestIxiaPppoeClientScenario(unittest.TestCase): mock_id_pairs.assert_called_once_with(mock_tp.full_profile) mock_obj_pairs.assert_called_once_with([]) self.scenario.client.create_ipv4_traffic_model.assert_called_once_with( - uplink_topologies, downlink_topologies) + uplink_topologies, downlink_topologies, mock_tp) def test__get_endpoints_src_dst_id_pairs(self): full_tp = OrderedDict([ @@ -1209,58 +1203,50 @@ class TestIxiaPppoeClientScenario(unittest.TestCase): prio_flows_stats = { '0': { - 'in_packets': 6000, - 'out_packets': 6000, + 'InPackets': 6000, + 'OutPackets': 6000, 'RxThroughput': 200.0, 'TxThroughput': 200.0, - 'avg_latency_ns': 2, - 'max_latency_ns': 2, - 'min_latency_ns': 2 + 'LatencyAvg': 2, + 'LatencyMax': 2, + 'LatencyMin': 2 } } expected_result = {'priority_stats': { '0': {'RxThroughput': 200.0, 'TxThroughput': 200.0, - 'avg_latency_ns': 2, - 'max_latency_ns': 2, - 'min_latency_ns': 2, - 'in_packets': 6000, - 'out_packets': 6000}}, + 'LatencyAvg': 2, + 'LatencyMax': 2, + 'LatencyMin': 2, + 'InPackets': 6000, + 'OutPackets': 6000}}, 'xe0': {'RxThroughput': 100.0, - 'Store-Forward_Avg_latency_ns': 2, - 'Store-Forward_Max_latency_ns': 2, - 'Store-Forward_Min_latency_ns': 2, + 'LatencyAvg': 2, + 'LatencyMax': 2, + 'LatencyMin': 2, 'TxThroughput': 100.0, - 'in_packets': 3000, - 'out_packets': 3000, - 'in_bytes': 192000, - 'out_bytes': 192000, + 'InPackets': 3000, + 'OutPackets': 3000, + 'InBytes': 192000, + 'OutBytes': 192000, 'RxThroughputBps': 6400.0, 'TxThroughputBps': 6400.0, - 'rx_throughput_kps': 0.0, - 'rx_throughput_mbps': 0.0, - 'sessions_down': 0, - 'sessions_not_started': 0, - 'sessions_total': 1, - 'sessions_up': 1, - 'tx_throughput_kps': 0.0, - 'tx_throughput_mbps': 0.0}, + 'SessionsDown': 0, + 'SessionsNotStarted': 0, + 'SessionsTotal': 1, + 'SessionsUp': 1}, 'xe1': {'RxThroughput': 100.0, - 'Store-Forward_Avg_latency_ns': 2, - 'Store-Forward_Max_latency_ns': 2, - 'Store-Forward_Min_latency_ns': 2, + 'LatencyAvg': 2, + 'LatencyMax': 2, + 'LatencyMin': 2, 'TxThroughput': 100.0, - 'in_packets': 3000, - 'out_packets': 3000, - 'in_bytes': 192000, - 'out_bytes': 192000, + 'InPackets': 3000, + 'OutPackets': 3000, + 'InBytes': 192000, + 'OutBytes': 192000, 'RxThroughputBps': 6400.0, - 'TxThroughputBps': 6400.0, - 'rx_throughput_kps': 0.0, - 'rx_throughput_mbps': 0.0, - 'tx_throughput_kps': 0.0, - 'tx_throughput_mbps': 0.0}} + 'TxThroughputBps': 6400.0}} mock_get_stats.return_value = ixia_stats mock_prio_flow_statistics.return_value = prio_flows_stats |