aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
diff options
context:
space:
mode:
authorabhijitsinha <abhijit.sinha@intel.com>2017-08-28 20:35:46 +0100
committerRoss Brattain <ross.b.brattain@intel.com>2017-09-04 14:49:45 -0700
commita1722f91ac250e2a021b7a1cc4e4f99f11ff41e0 (patch)
tree75e9b060dca5e2e96734bc1e026b76fd3cc4296c /yardstick/network_services/vnf_generic/vnf/sample_vnf.py
parentc19115bafe0141326b189f317a684bf4681c8bd0 (diff)
Addition of Prox NSB changes in yardstick
JIRA: YARDSTICK-802 Addition of Prox L2Fwd, MPLS test cases for BM and Heat. updates: Most of tg_prox and prox_vnf were absorbed into the base classes. delete most of ProxDpdkVnfSetupEnvHelper, it is handled by DpdkVnfSetupEnvHelper baseclass use standard _build_pipeline_kwargs methods don't use terminate() use baseclass version add new method kill_vnf that runs pkill -x replace resource_helper.execute() with vnf_execture for dumping stats In order to share code between tg_prox and vnf_prox refactor to have tg_prox hold and wrap a ProxApproxVnf instance and call methods on that class. Do this instead of multiple-inheritance. Implement ProxApproxVnf.terminate() using prox socket command based exit, (stop_all, quit, force_quit). vnf_execute calls resource_helper.execute() which calls socket methods on the sut object. Since tg_prox wraps the VNF object, we can call terminate on the VNF object and it should work correctly. move prox config generation to parent process we need to get core number info from config file inside the TG processes, so we need to generate the config in the parent process so the data is copied to the child during the fork. moved more config file methods to the setup_helper class. we run force_quit after quit, so the socket should already be closed this will trigger socket error, so add _ignore_errors option for vnf_execute to ignore socket errors Fixed the terminate issue. Added MPLS tests. Added TG Stats in_packet/out_packet Fixed compile (pep8) issues Fixed MPLS TG port stats, in/out packets Added Grafana dashboards for L2FWD and MPLS Traffic profiles modified for tolerated loss and precision as per DATS tests. Added unit test case for Mpls Single port test stats collection support. Change-Id: Idd9493f597c668a3bb7d90e167e6a418546106e8 Signed-off-by: Abhijit Sinha <abhijit.sinha@intel.com> Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
Diffstat (limited to 'yardstick/network_services/vnf_generic/vnf/sample_vnf.py')
-rw-r--r--yardstick/network_services/vnf_generic/vnf/sample_vnf.py35
1 files changed, 26 insertions, 9 deletions
diff --git a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
index f41994814..9a7d39913 100644
--- a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
+++ b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
@@ -115,7 +115,9 @@ class SetupEnvHelper(object):
def setup_vnf_environment(self):
pass
- # raise NotImplementedError
+
+ def kill_vnf(self):
+ pass
def tear_down(self):
raise NotImplementedError
@@ -297,12 +299,13 @@ class DpdkVnfSetupEnvHelper(SetupEnvHelper):
def setup_vnf_environment(self):
self._setup_dpdk()
resource = self._setup_resources()
- self._kill_vnf()
- self._detect_drivers()
+ self.kill_vnf()
+ self._detect_and_bind_drivers()
return resource
- def _kill_vnf(self):
- self.ssh_helper.execute("sudo pkill %s" % self.APP_NAME)
+ def kill_vnf(self):
+ # have to use exact match
+ self.ssh_helper.execute("sudo pkill -x %s" % self.APP_NAME)
def _setup_dpdk(self):
""" setup dpdk environment needed for vnf to run """
@@ -335,7 +338,7 @@ class DpdkVnfSetupEnvHelper(SetupEnvHelper):
return ResourceProfile(self.vnfd_helper.mgmt_interface,
interfaces=self.vnfd_helper.interfaces, cores=cores)
- def _detect_drivers(self):
+ def _detect_and_bind_drivers(self):
interfaces = self.vnfd_helper.interfaces
self._find_used_drivers()
@@ -351,6 +354,15 @@ class DpdkVnfSetupEnvHelper(SetupEnvHelper):
self._bind_dpdk('igb_uio', vpci)
time.sleep(2)
+ # debug dump after binding
+ self.ssh_helper.execute("sudo {} -s".format(self.dpdk_nic_bind))
+
+ def rebind_drivers(self, force=True):
+ if not self.used_drivers:
+ self._find_used_drivers()
+ for vpci, (_, driver) in self.used_drivers.items():
+ self._bind_dpdk(driver, vpci, force)
+
def _bind_dpdk(self, driver, vpci, force=True):
if force:
force = '--force '
@@ -376,6 +388,7 @@ class DpdkVnfSetupEnvHelper(SetupEnvHelper):
return stdout
def _bind_kernel_devices(self):
+ # only used by PingSetupEnvHelper?
for intf in self.vnfd_helper.interfaces:
vi = intf["virtual-interface"]
stdout = self._detect_and_bind_dpdk(vi["vpci"], vi["driver"])
@@ -533,7 +546,8 @@ class ClientResourceHelper(ResourceHelper):
if not self._queue.empty():
kpi = self._queue.get()
self._result.update(kpi)
- LOG.debug("Collect {0} KPIs {1}".format(self.RESOURCE_WORD, self._result))
+ LOG.debug("Got KPIs from _queue for {0} {1}".format(
+ self.scenario_helper.name, self.RESOURCE_WORD))
return self._result
def _connect(self, client=None):
@@ -829,7 +843,7 @@ class SampleVNF(GenericVNF):
self.ssh_helper.drop_connection()
cmd = self._build_config()
# kill before starting
- self.ssh_helper.execute("pkill {}".format(self.APP_NAME))
+ self.setup_helper.kill_vnf()
LOG.debug(cmd)
self._build_run_kwargs()
@@ -853,7 +867,7 @@ class SampleVNF(GenericVNF):
self.vnf_execute("quit")
if self._vnf_process:
self._vnf_process.terminate()
- self.ssh_helper.execute("sudo pkill %s" % self.APP_NAME)
+ self.setup_helper.kill_vnf()
self._tear_down()
self.resource_helper.stop_collect()
@@ -949,6 +963,9 @@ class SampleVNFTrafficGen(GenericTrafficGen):
return self._tg_process.exitcode
def _traffic_runner(self, traffic_profile):
+ # 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.resource_helper.run_traffic(traffic_profile)