Merge "Improve "get_server" function in Kubernetes context"
[yardstick.git] / yardstick / network_services / vnf_generic / vnf / vpe_vnf.py
index 077ce23..bfff45c 100644 (file)
@@ -28,10 +28,11 @@ from yardstick.common.process import check_if_process_failed
 from yardstick.network_services.helpers.samplevnf_helper import PortPairs
 from yardstick.network_services.pipeline import PipelineRules
 from yardstick.network_services.vnf_generic.vnf.sample_vnf import SampleVNF, DpdkVnfSetupEnvHelper
+from yardstick.benchmark.contexts import base as ctx_base
 
 LOG = logging.getLogger(__name__)
 
-VPE_PIPELINE_COMMAND = """sudo {tool_path} -p {port_mask_hex} -f {cfg_file} -s {script}"""
+VPE_PIPELINE_COMMAND = "sudo {tool_path} -p {port_mask_hex} -f {cfg_file} -s {script} {hwlb}"
 
 VPE_COLLECT_KPI = """\
 Pkts in:\\s(\\d+)\r\n\
@@ -115,7 +116,8 @@ class ConfigCreate(object):
         pktq = "SWQ{0}{1}".format(self.sw_q, sink)
         return pktq
 
-    def vpe_upstream(self, vnf_cfg, index=0):
+    def vpe_upstream(self, vnf_cfg, index=0):  # pragma: no cover
+        # NOTE(ralonsoh): this function must be covered in UTs.
         parser = configparser.ConfigParser()
         parser.read(os.path.join(vnf_cfg, 'vpe_upstream'))
 
@@ -147,7 +149,8 @@ class ConfigCreate(object):
             self.n_pipeline += 1
         return parser
 
-    def vpe_downstream(self, vnf_cfg, index):
+    def vpe_downstream(self, vnf_cfg, index):  # pragma: no cover
+        # NOTE(ralonsoh): this function must be covered in UTs.
         parser = configparser.ConfigParser()
         parser.read(os.path.join(vnf_cfg, 'vpe_downstream'))
         for pipeline in parser.sections():
@@ -300,7 +303,11 @@ class VpeApproxVnf(SampleVNF):
     def collect_kpi(self):
         # we can't get KPIs if the VNF is down
         check_if_process_failed(self._vnf_process)
+        physical_node = ctx_base.Context.get_physical_node_from_server(
+            self.scenario_helper.nodes[self.name])
+
         result = {
+            "physical_node": physical_node,
             'pkt_in_up_stream': 0,
             'pkt_drop_up_stream': 0,
             'pkt_in_down_stream': 0,