aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
diff options
context:
space:
mode:
Diffstat (limited to 'yardstick/network_services/vnf_generic/vnf/sample_vnf.py')
-rw-r--r--yardstick/network_services/vnf_generic/vnf/sample_vnf.py36
1 files changed, 26 insertions, 10 deletions
diff --git a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
index 20e5895ee..5eeb6c889 100644
--- a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
+++ b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
@@ -28,6 +28,7 @@ from six.moves import cStringIO
from yardstick.benchmark.contexts.base import Context
from yardstick.benchmark.scenarios.networking.vnf_generic import find_relative_file
+from yardstick.common import exceptions as y_exceptions
from yardstick.common.process import check_if_process_failed
from yardstick.network_services.helpers.samplevnf_helper import PortPairs
from yardstick.network_services.helpers.samplevnf_helper import MultiPortConfig
@@ -308,7 +309,7 @@ class DpdkVnfSetupEnvHelper(SetupEnvHelper):
if vpci == v['virtual-interface']['vpci'])
# force to int
intf['virtual-interface']['dpdk_port_num'] = int(dpdk_port_num)
- except:
+ except: # pylint: disable=bare-except
pass
time.sleep(2)
@@ -472,6 +473,11 @@ class ClientResourceHelper(ResourceHelper):
self.client.clear_stats(ports=ports)
def start(self, ports=None, *args, **kwargs):
+ # pylint: disable=keyword-arg-before-vararg
+ # NOTE(ralonsoh): defining keyworded arguments before variable
+ # positional arguments is a bug. This function definition doesn't work
+ # in Python 2, although it works in Python 3. Reference:
+ # https://www.python.org/dev/peps/pep-3102/
if ports is None:
ports = self.all_ports
self.client.start(ports=ports, *args, **kwargs)
@@ -480,8 +486,8 @@ class ClientResourceHelper(ResourceHelper):
if not self._queue.empty():
kpi = self._queue.get()
self._result.update(kpi)
- LOG.debug("Got KPIs from _queue for {0} {1}".format(
- self.scenario_helper.name, self.RESOURCE_WORD))
+ LOG.debug('Got KPIs from _queue for %s %s',
+ self.scenario_helper.name, self.RESOURCE_WORD)
return self._result
def _connect(self, client=None):
@@ -670,7 +676,7 @@ class SampleVNF(GenericVNF):
self.pipeline_kwargs = {}
self.uplink_ports = None
self.downlink_ports = None
- # TODO(esm): make QueueFileWrapper invert-able so that we
+ # NOTE(esm): make QueueFileWrapper invert-able so that we
# never have to manage the queues
self.q_in = Queue()
self.q_out = Queue()
@@ -751,7 +757,7 @@ class SampleVNF(GenericVNF):
if not self._vnf_process.is_alive():
raise RuntimeError("%s VNF process died." % self.APP_NAME)
- # TODO(esm): move to QueueFileWrapper
+ # NOTE(esm): move to QueueFileWrapper
while self.q_out.qsize() > 0:
buf.append(self.q_out.get())
message = ''.join(buf)
@@ -821,12 +827,12 @@ class SampleVNF(GenericVNF):
self._vnf_process.terminate()
# no terminate children here because we share processes with tg
- def get_stats(self, *args, **kwargs):
- """
- Method for checking the statistics
+ def get_stats(self, *args, **kwargs): # pylint: disable=unused-argument
+ """Method for checking the statistics
+
+ This method could be overridden in children classes.
- :return:
- VNF statistics
+ :return: VNF statistics
"""
cmd = 'p {0} stats'.format(self.APP_WORD)
out = self.vnf_execute(cmd)
@@ -849,6 +855,11 @@ class SampleVNF(GenericVNF):
LOG.debug("%s collect KPIs %s", self.APP_NAME, result)
return result
+ def scale(self, flavor=""):
+ """The SampleVNF base class doesn't provide the 'scale' feature"""
+ raise y_exceptions.FunctionNotImplemented(
+ function_name='scale', class_name='SampleVNFTrafficGen')
+
class SampleVNFTrafficGen(GenericTrafficGen):
""" Class providing file-like API for generic traffic generator """
@@ -964,3 +975,8 @@ class SampleVNFTrafficGen(GenericTrafficGen):
self._tg_process.join(PROCESS_JOIN_TIMEOUT)
self._tg_process.terminate()
# no terminate children here because we share processes with vnf
+
+ def scale(self, flavor=""):
+ """A traffic generator VFN doesn't provide the 'scale' feature"""
+ raise y_exceptions.FunctionNotImplemented(
+ function_name='scale', class_name='SampleVNFTrafficGen')