aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick
diff options
context:
space:
mode:
authorRoss Brattain <ross.b.brattain@intel.com>2017-09-01 03:16:33 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-09-01 03:16:33 +0000
commita87c0902f957beaf93e62f3aeb48584caf871a27 (patch)
tree8cd57783a7af4314d6cb8eee1825deb38ca87daf /yardstick
parent4f797e46089c51bd73d1a61bd8130c8bdf526f9d (diff)
parent378171687bda92d031437b0d8cc90968c1655b9d (diff)
Merge "Added TC for vFW in heat context with ixia TG"
Diffstat (limited to 'yardstick')
-rw-r--r--yardstick/benchmark/scenarios/networking/vnf_generic.py25
-rw-r--r--yardstick/network_services/vnf_generic/vnf/tg_ixload.py5
-rw-r--r--yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py11
3 files changed, 27 insertions, 14 deletions
diff --git a/yardstick/benchmark/scenarios/networking/vnf_generic.py b/yardstick/benchmark/scenarios/networking/vnf_generic.py
index 7ae6f08c2..aaf850c1d 100644
--- a/yardstick/benchmark/scenarios/networking/vnf_generic.py
+++ b/yardstick/benchmark/scenarios/networking/vnf_generic.py
@@ -87,19 +87,22 @@ class SshManager(object):
def find_relative_file(path, task_path):
+ """
+ Find file in one of places: in abs of path or
+ relative to TC scenario file. In this order.
+
+ :param path:
+ :param task_path:
+ :return str: full path to file
+ """
# fixme: create schema to validate all fields have been provided
- try:
- with open(path):
+ for lookup in [os.path.abspath(path), os.path.join(task_path, path)]:
+ try:
+ with open(lookup):
+ return lookup
+ except IOError:
pass
- return path
- except IOError as e:
- if e.errno != errno.ENOENT:
- raise
- else:
- rel_path = os.path.join(task_path, path)
- with open(rel_path):
- pass
- return rel_path
+ raise IOError(errno.ENOENT, 'Unable to find {} file'.format(path))
def open_relative_file(path, task_path):
diff --git a/yardstick/network_services/vnf_generic/vnf/tg_ixload.py b/yardstick/network_services/vnf_generic/vnf/tg_ixload.py
index 353d31fc6..6be2b58e1 100644
--- a/yardstick/network_services/vnf_generic/vnf/tg_ixload.py
+++ b/yardstick/network_services/vnf_generic/vnf/tg_ixload.py
@@ -27,6 +27,7 @@ import six
from yardstick.common.utils import makedirs
from yardstick.network_services.vnf_generic.vnf.sample_vnf import SampleVNFTrafficGen
from yardstick.network_services.vnf_generic.vnf.sample_vnf import ClientResourceHelper
+from yardstick.benchmark.scenarios.networking.vnf_generic import find_relative_file
LOG = logging.getLogger(__name__)
@@ -92,7 +93,9 @@ class IxLoadResourceHelper(ClientResourceHelper):
def setup(self):
# TODO: fixupt scenario_helper to hanlde ixia
- self.resource_file_name = str(self.scenario_helper.scenario_cfg['ixia_profile'])
+ self.resource_file_name = \
+ find_relative_file(self.scenario_helper.scenario_cfg['ixia_profile'],
+ self.scenario_helper.scenario_cfg["task_path"])
makedirs(self.RESULTS_MOUNT)
cmd = MOUNT_CMD.format(self.vnfd_helper.mgmt_interface, self)
LOG.debug(cmd)
diff --git a/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py b/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py
index 78d2bd8ba..c758baa4c 100644
--- a/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py
+++ b/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py
@@ -22,6 +22,7 @@ from yardstick.common.utils import ErrorClass
from yardstick.network_services.vnf_generic.vnf.sample_vnf import SampleVNFTrafficGen
from yardstick.network_services.vnf_generic.vnf.sample_vnf import ClientResourceHelper
from yardstick.network_services.vnf_generic.vnf.sample_vnf import Rfc2544ResourceHelper
+from yardstick.benchmark.scenarios.networking.vnf_generic import find_relative_file
LOG = logging.getLogger(__name__)
@@ -102,7 +103,9 @@ class IxiaResourceHelper(ClientResourceHelper):
self._connect()
# we don't know client_file_name until runtime as instantiate
- client_file_name = self.scenario_helper.scenario_cfg['ixia_profile']
+ client_file_name = \
+ find_relative_file(self.scenario_helper.scenario_cfg['ixia_profile'],
+ self.scenario_helper.scenario_cfg["task_path"])
self.client.ix_load_config(client_file_name)
time.sleep(WAIT_AFTER_CFG_LOAD)
@@ -117,7 +120,9 @@ class IxiaResourceHelper(ClientResourceHelper):
})
samples = {}
- ixia_file = os.path.join(os.getcwd(), "ixia_traffic.cfg")
+
+ ixia_file = find_relative_file("ixia_traffic.cfg",
+ self.scenario_helper.scenario_cfg["task_path"])
# Generate ixia traffic config...
while not self._terminated.value:
traffic_profile.execute(self, self.client, mac, ixia_file)
@@ -140,6 +145,8 @@ class IxiaResourceHelper(ClientResourceHelper):
class IxiaTrafficGen(SampleVNFTrafficGen):
+ APP_NAME = 'Ixia'
+
def __init__(self, name, vnfd, setup_env_helper_type=None, resource_helper_type=None):
if resource_helper_type is None:
resource_helper_type = IxiaResourceHelper