aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark/scenarios/networking
diff options
context:
space:
mode:
authorMaciej Skrocki <maciej.skrocki@intel.com>2017-08-28 17:24:05 -0700
committerMaciej Skrocki <maciej.skrocki@intel.com>2017-08-31 17:26:59 -0700
commit378171687bda92d031437b0d8cc90968c1655b9d (patch)
treea7d1c948d5514e94ef66aa1dd6068c960fcfbd31 /yardstick/benchmark/scenarios/networking
parent57b17a2223d8751f2c5eae660b706e2fc736a47c (diff)
Added TC for vFW in heat context with ixia TG
- added common method to get relative paths - added 'Ixia' APP_NAME Change-Id: I7966798bab71af66d3efbeb1e13b07e8fbb41e88 Signed-off-by: Maciej Skrocki <maciej.skrocki@intel.com>
Diffstat (limited to 'yardstick/benchmark/scenarios/networking')
-rw-r--r--yardstick/benchmark/scenarios/networking/vnf_generic.py25
1 files changed, 14 insertions, 11 deletions
diff --git a/yardstick/benchmark/scenarios/networking/vnf_generic.py b/yardstick/benchmark/scenarios/networking/vnf_generic.py
index 4510bcfba..5453c22d6 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):