X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=yardstick%2Fnetwork_services%2Fvnf_generic%2Fvnf%2Fprox_vnf.py;h=2ac6ea412ad19eafbfbba2d5bab5dea2e1ce02a9;hb=02b047ef1496ea23fdb1a8ce15cf4b98f5e5a3a1;hp=cb09b43f65585ac12f763ae055f6a67856b47760;hpb=0a24ca320c46c10a50d38b8eab6336eb0e32f8c9;p=yardstick.git diff --git a/yardstick/network_services/vnf_generic/vnf/prox_vnf.py b/yardstick/network_services/vnf_generic/vnf/prox_vnf.py index cb09b43f6..2ac6ea412 100644 --- a/yardstick/network_services/vnf_generic/vnf/prox_vnf.py +++ b/yardstick/network_services/vnf_generic/vnf/prox_vnf.py @@ -51,9 +51,7 @@ class ProxApproxVnf(SampleVNF): try: return self.resource_helper.execute(cmd, *args, **kwargs) except OSError as e: - if ignore_errors and e.errno in {errno.EPIPE, errno.ESHUTDOWN}: - pass - else: + if not ignore_errors or e.errno not in {errno.EPIPE, errno.ESHUTDOWN}: raise def collect_kpi(self): @@ -66,11 +64,12 @@ class ProxApproxVnf(SampleVNF): } return result - if len(self.vnfd_helper.interfaces) not in {1, 2, 4}: + intf_count = len(self.vnfd_helper.interfaces) + if intf_count not in {1, 2, 4}: raise RuntimeError("Failed ..Invalid no of ports .. " "1, 2 or 4 ports only supported at this time") - port_stats = self.vnf_execute('port_stats', range(len(self.vnfd_helper.interfaces))) + port_stats = self.vnf_execute('port_stats', range(intf_count)) try: rx_total = port_stats[6] tx_total = port_stats[7] @@ -83,14 +82,16 @@ class ProxApproxVnf(SampleVNF): "packets_in": tx_total, "packets_dropped": (tx_total - rx_total), "packets_fwd": rx_total, - "collect_stats": self.resource_helper.collect_kpi(), + # we share ProxResourceHelper with TG, but we want to collect + # collectd KPIs here and not TG KPIs, so use a different method name + "collect_stats": self.resource_helper.collect_collectd_kpi(), } LOG.debug("%s collect KPIs %s", self.APP_NAME, result) return result def _tear_down(self): # this should be standardized for all VNFs or removed - self.setup_helper.rebind_drivers() + self.setup_helper.tear_down() def terminate(self): # try to quit with socket commands @@ -103,10 +104,3 @@ class ProxApproxVnf(SampleVNF): self.setup_helper.kill_vnf() self._tear_down() self.resource_helper.stop_collect() - - def instantiate(self, scenario_cfg, context_cfg): - # build config in parent process so we can access - # config from TG subprocesses - self.scenario_helper.scenario_cfg = scenario_cfg - self.setup_helper.build_config_file() - super(ProxApproxVnf, self).instantiate(scenario_cfg, context_cfg)