summaryrefslogtreecommitdiffstats
path: root/testcases/testcase.py
diff options
context:
space:
mode:
authorMartin Klozik <martinx.klozik@intel.com>2017-12-11 13:37:40 +0000
committerMartin Klozik <martinx.klozik@intel.com>2017-12-12 14:50:23 +0000
commitb830a59fc8c05a92b874252cb8f6cb96ded46bb5 (patch)
tree80f2e45bd6cdb3818c29efff097381d78dc25359 /testcases/testcase.py
parentcaabba96ca0efb5e0d21ce5122da4e5fc873f4fe (diff)
teststeps: Improvements of step driven TC
This patch adds support of access to VMs deployed automatically by deployment scenario (e.g. pvp, pvvp4, etc.). It also modifies filter for checking output of executed commands to correctly handle different end of line encodings (i.e. \n vs. \n\r). JIRA: VSPERF-539 Change-Id: Ifc796d992b90e316bad5853aaefce79e439e294d Signed-off-by: Martin Klozik <martinx.klozik@intel.com> Reviewed-by: Al Morton <acmorton@att.com> Reviewed-by: Christian Trautman <ctrautma@redhat.com> Reviewed-by: Sridhar Rao <sridhar.rao@spirent.com> Reviewed-by: Trevor Cooper <trevor.cooper@intel.com>
Diffstat (limited to 'testcases/testcase.py')
-rw-r--r--testcases/testcase.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/testcases/testcase.py b/testcases/testcase.py
index 37cdefa6..b3300b89 100644
--- a/testcases/testcase.py
+++ b/testcases/testcase.py
@@ -78,6 +78,7 @@ class TestCase(object):
self._step_result_mapping = {}
self._step_status = None
self._step_send_traffic = False # indication if send_traffic was called within test steps
+ self._vnf_list = []
self._testcase_run_time = None
S.setValue('VSWITCH', cfg.get('vSwitch', S.getValue('VSWITCH')))
@@ -201,6 +202,8 @@ class TestCase(object):
loader.get_vnf_class(),
len(self._step_vnf_list))
+ self._vnf_list = self._vnf_ctl.get_vnfs()
+
# verify enough hugepages are free to run the testcase
if not self._check_for_enough_hugepages():
raise RuntimeError('Not enough hugepages free to run test.')
@@ -792,10 +795,21 @@ class TestCase(object):
# so it is not sent again after the execution of teststeps
self._step_send_traffic = True
elif step[0].startswith('vnf'):
+ # use vnf started within TestSteps
if not self._step_vnf_list[step[0]]:
# initialize new VM
self._step_vnf_list[step[0]] = loader.get_vnf_class()()
test_object = self._step_vnf_list[step[0]]
+ elif step[0].startswith('VNF'):
+ if step[1] in ('start', 'stop'):
+ raise RuntimeError("Cannot execute start() or stop() method of "
+ "VNF deployed automatically by scenario.")
+ # use vnf started by scenario deployment (e.g. pvp)
+ vnf_index = int(step[0][3:])
+ try:
+ test_object = self._vnf_list[vnf_index]
+ except IndexError:
+ raise RuntimeError("VNF with index {} is not running.".format(vnf_index))
elif step[0] == 'wait':
input(os.linesep + "Step {}: Press Enter to continue with "
"the next step...".format(i) + os.linesep + os.linesep)