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/network_services/vnf_generic/vnf | |
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/network_services/vnf_generic/vnf')
-rw-r--r-- | yardstick/network_services/vnf_generic/vnf/base.py | 14 | ||||
-rw-r--r-- | yardstick/network_services/vnf_generic/vnf/sample_vnf.py | 12 |
2 files changed, 15 insertions, 11 deletions
diff --git a/yardstick/network_services/vnf_generic/vnf/base.py b/yardstick/network_services/vnf_generic/vnf/base.py index c385eb6fd..fb41a4e4a 100644 --- a/yardstick/network_services/vnf_generic/vnf/base.py +++ b/yardstick/network_services/vnf_generic/vnf/base.py @@ -147,9 +147,9 @@ class TrafficGeneratorProducer(producer.MessagingProducer): This message producer must be instantiated in the process created "run_traffic" process. """ - def __init__(self, pid): + def __init__(self, _id): super(TrafficGeneratorProducer, self).__init__(messaging.TOPIC_TG, - pid=pid) + _id=_id) def tg_method_started(self, version=1): """Send a message to inform the traffic generation has started""" @@ -324,9 +324,15 @@ class GenericTrafficGen(GenericVNF): """ pass - def _setup_mq_producer(self, pid): + @staticmethod + def _setup_mq_producer(id): """Setup the TG MQ producer to send messages between processes :return: (derived class from ``MessagingProducer``) MQ producer object """ - return TrafficGeneratorProducer(pid) + return TrafficGeneratorProducer(id) + + def get_mq_producer_id(self): + """Return the MQ producer ID if initialized""" + if self._mq_producer: + return self._mq_producer.get_id() diff --git a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py index a37f4f72d..bc65380d3 100644 --- a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py +++ b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py @@ -918,12 +918,12 @@ class SampleVNFTrafficGen(GenericTrafficGen): LOG.info("%s TG Server is up and running.", self.APP_NAME) return self._tg_process.exitcode - def _traffic_runner(self, traffic_profile, mq_pid): + def _traffic_runner(self, traffic_profile, mq_id): # always drop connections first thing in new processes # so we don't get paramiko errors self.ssh_helper.drop_connection() LOG.info("Starting %s client...", self.APP_NAME) - self._mq_producer = self._setup_mq_producer(mq_pid) + self._mq_producer = self._setup_mq_producer(mq_id) self.resource_helper.run_traffic(traffic_profile, self._mq_producer) def run_traffic(self, traffic_profile): @@ -937,9 +937,9 @@ class SampleVNFTrafficGen(GenericTrafficGen): name = '{}-{}-{}-{}'.format(self.name, self.APP_NAME, traffic_profile.__class__.__name__, os.getpid()) - mq_pid = uuid.uuid1().int - self._traffic_process = Process(name=name, target=self._traffic_runner, - args=(traffic_profile, mq_pid)) + self._traffic_process = Process( + name=name, target=self._traffic_runner, + args=(traffic_profile, uuid.uuid1().int)) self._traffic_process.start() # Wait for traffic process to start while self.resource_helper.client_started.value == 0: @@ -948,8 +948,6 @@ class SampleVNFTrafficGen(GenericTrafficGen): if not self._traffic_process.is_alive(): break - return mq_pid - def collect_kpi(self): # check if the tg processes have exited physical_node = Context.get_physical_node_from_server( |