aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/network_services/vnf_generic/vnf/base.py
diff options
context:
space:
mode:
Diffstat (limited to 'yardstick/network_services/vnf_generic/vnf/base.py')
-rw-r--r--yardstick/network_services/vnf_generic/vnf/base.py57
1 files changed, 3 insertions, 54 deletions
diff --git a/yardstick/network_services/vnf_generic/vnf/base.py b/yardstick/network_services/vnf_generic/vnf/base.py
index 45a6160c2..8ef96b744 100644
--- a/yardstick/network_services/vnf_generic/vnf/base.py
+++ b/yardstick/network_services/vnf_generic/vnf/base.py
@@ -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.
@@ -11,16 +11,12 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-""" Base class implementation for generic vnf implementation """
import abc
import logging
import six
-from yardstick.common import messaging
-from yardstick.common.messaging import payloads
-from yardstick.common.messaging import producer
from yardstick.network_services.helpers.samplevnf_helper import PortPairs
@@ -98,7 +94,7 @@ class VnfdHelper(dict):
for interface in self.interfaces:
virtual_intf = interface["virtual-interface"]
if virtual_intf[key] == value:
- return interface
+ return virtual_intf
raise KeyError()
def find_interface(self, **kwargs):
@@ -141,39 +137,6 @@ class VnfdHelper(dict):
yield port_name, port_num
-class TrafficGeneratorProducer(producer.MessagingProducer):
- """Class implementing the message producer for traffic generators
-
- This message producer must be instantiated in the process created
- "run_traffic" process.
- """
- def __init__(self, _id):
- super(TrafficGeneratorProducer, self).__init__(messaging.TOPIC_TG,
- _id=_id)
-
- def tg_method_started(self, version=1):
- """Send a message to inform the traffic generation has started"""
- self.send_message(
- messaging.TG_METHOD_STARTED,
- payloads.TrafficGeneratorPayload(version=version, iteration=0,
- kpi={}))
-
- def tg_method_finished(self, version=1):
- """Send a message to inform the traffic generation has finished"""
- self.send_message(
- messaging.TG_METHOD_FINISHED,
- payloads.TrafficGeneratorPayload(version=version, iteration=0,
- kpi={}))
-
- def tg_method_iteration(self, iteration, version=1, kpi=None):
- """Send a message, with KPI, once an iteration has finished"""
- kpi = {} if kpi is None else kpi
- self.send_message(
- messaging.TG_METHOD_ITERATION,
- payloads.TrafficGeneratorPayload(version=version,
- iteration=iteration, kpi=kpi))
-
-
@six.add_metaclass(abc.ABCMeta)
class GenericVNF(object):
"""Class providing file-like API for generic VNF implementation
@@ -246,13 +209,12 @@ class GenericVNF(object):
@six.add_metaclass(abc.ABCMeta)
class GenericTrafficGen(GenericVNF):
- """ Class providing file-like API for generic traffic generator """
+ """Class providing file-like API for generic traffic generator"""
def __init__(self, name, vnfd):
super(GenericTrafficGen, self).__init__(name, vnfd)
self.runs_traffic = True
self.traffic_finished = False
- self._mq_producer = None
@abc.abstractmethod
def run_traffic(self, traffic_profile):
@@ -323,16 +285,3 @@ class GenericTrafficGen(GenericVNF):
:return: True/False
"""
pass
-
- @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(id)
-
- def get_mq_producer_id(self):
- """Return the MQ producer ID if initialized"""
- if self._mq_producer:
- return self._mq_producer.id