diff options
author | Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com> | 2018-04-24 10:35:50 +0100 |
---|---|---|
committer | Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com> | 2018-07-05 08:44:05 +0100 |
commit | 1004f2ac1ea0394afdc2d5a8ca20c8c1a6d2cd93 (patch) | |
tree | f23e01cf001fc80577ae70cd03f1a31befb5bdcd /yardstick/tests/unit/network_services | |
parent | 5ca6368e609d9dc8ec19590835d91b36b2d1fa78 (diff) |
Enable traffic generator PID in "NSPerf" scenario setup
Now "NSPerf" scenario will inform about the traffic generator PIDs after
setup process. With this information, IterationIPC runner will be able
to receive the messages sent by those traffic generators and control
the main iteration loop.
The following example, using vFW as VNF and OpenStack as context, makes
use of this new runner implementation:
/samples/vnf_samples/nsut/vfw/
tc_heat_rfc2544_ipv4_1rule_1flow_64B_trex_iterationipc.yaml
JIRA: YARDSTICK-1127
Change-Id: I46b1368bc209680b88ff9fb5c3b9beadf6271ac9
Signed-off-by: Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
Diffstat (limited to 'yardstick/tests/unit/network_services')
-rw-r--r-- | yardstick/tests/unit/network_services/vnf_generic/vnf/test_base.py | 33 | ||||
-rw-r--r-- | yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py | 3 |
2 files changed, 31 insertions, 5 deletions
diff --git a/yardstick/tests/unit/network_services/vnf_generic/vnf/test_base.py b/yardstick/tests/unit/network_services/vnf_generic/vnf/test_base.py index 11cba4d79..43e5ac839 100644 --- a/yardstick/tests/unit/network_services/vnf_generic/vnf/test_base.py +++ b/yardstick/tests/unit/network_services/vnf_generic/vnf/test_base.py @@ -145,6 +145,24 @@ VNFD = { } +class _DummyGenericTrafficGen(base.GenericTrafficGen): # pragma: no cover + + def run_traffic(self, *args): + pass + + def terminate(self): + pass + + def collect_kpi(self): + pass + + def instantiate(self, *args): + pass + + def scale(self, flavor=''): + pass + + class FileAbsPath(object): def __init__(self, module_file): super(FileAbsPath, self).__init__() @@ -240,6 +258,15 @@ class GenericTrafficGenTestCase(unittest.TestCase): "scale, terminate") self.assertEqual(msg, str(exc.exception)) + def test_get_mq_producer_id(self): + vnfd = {'benchmark': {'kpi': mock.ANY}, + 'vdu': [{'external-interface': 'ext_int'}] + } + tg = _DummyGenericTrafficGen('name', vnfd) + tg._mq_producer = mock.Mock() + tg._mq_producer.get_id.return_value = 'fake_id' + self.assertEqual('fake_id', tg.get_mq_producer_id()) + class TrafficGeneratorProducerTestCase(unittest.TestCase): @@ -250,15 +277,15 @@ class TrafficGeneratorProducerTestCase(unittest.TestCase): @mock.patch.object(cfg, 'CONF') def test__init(self, mock_config, mock_transport, mock_rpcclient, mock_target): - pid = uuid.uuid1().int - tg_producer = base.TrafficGeneratorProducer(pid) + _id = uuid.uuid1().int + tg_producer = base.TrafficGeneratorProducer(_id) mock_transport.assert_called_once_with( mock_config, url='rabbit://yardstick:yardstick@localhost:5672/') mock_target.assert_called_once_with(topic=messaging.TOPIC_TG, fanout=True, server=messaging.SERVER) mock_rpcclient.assert_called_once_with('rpc_transport', 'rpc_target') - self.assertEqual(pid, tg_producer._pid) + self.assertEqual(_id, tg_producer._id) self.assertEqual(messaging.TOPIC_TG, tg_producer._topic) @mock.patch.object(oslo_messaging, 'Target', return_value='rpc_target') diff --git a/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py b/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py index 08ae27422..700e910f9 100644 --- a/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py +++ b/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py @@ -454,9 +454,8 @@ class TestTrexTrafficGen(unittest.TestCase): self.sut.ssh_helper.run = mock.Mock() self.sut._traffic_runner = mock.Mock(return_value=0) self.sut.resource_helper.client_started.value = 1 - result = self.sut.run_traffic(mock_traffic_profile) + self.sut.run_traffic(mock_traffic_profile) self.sut._traffic_process.terminate() - self.assertIsNotNone(result) def test_terminate(self): vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0] |