summaryrefslogtreecommitdiffstats
path: root/testcases
diff options
context:
space:
mode:
Diffstat (limited to 'testcases')
-rw-r--r--testcases/integration.py18
-rw-r--r--testcases/testcase.py45
2 files changed, 46 insertions, 17 deletions
diff --git a/testcases/integration.py b/testcases/integration.py
index f3f684ba..88a6f12c 100644
--- a/testcases/integration.py
+++ b/testcases/integration.py
@@ -114,7 +114,20 @@ class IntegrationTestCase(TestCase):
loader = Loader()
# execute test based on TestSteps definition
if self.test:
+ # initialize list with results
step_result = [None] * len(self.test)
+
+ # count how many VNFs are involved in the test
+ for step in self.test:
+ if step[0].startswith('vnf'):
+ vnf_list[step[0]] = None
+
+ # check/expand GUEST configuration and copy data to shares
+ if len(vnf_list):
+ S.check_vm_settings(len(vnf_list))
+ self._copy_fwd_tools_for_all_guests(len(vnf_list))
+
+ # run test step by step...
for i, step in enumerate(self.test):
step_ok = False
if step[0] == 'vswitch':
@@ -132,10 +145,9 @@ class IntegrationTestCase(TestCase):
tmp_traffic.update(step[2])
step[2] = tmp_traffic
elif step[0].startswith('vnf'):
- if not step[0] in vnf_list:
- # initialize new VM and copy data to its shared dir
+ if not vnf_list[step[0]]:
+ # initialize new VM
vnf_list[step[0]] = loader.get_vnf_class()()
- self._copy_fwd_tools_for_guest(len(vnf_list))
test_object = vnf_list[step[0]]
else:
self._logger.error("Unsupported test object %s", step[0])
diff --git a/testcases/testcase.py b/testcases/testcase.py
index 6e215b46..7f22c18f 100644
--- a/testcases/testcase.py
+++ b/testcases/testcase.py
@@ -61,24 +61,23 @@ class TestCase(object):
self._settings_paths_modified = False
self._testcast_run_time = None
+ # store all GUEST_ specific settings to keep original values before their expansion
+ for key in S.__dict__:
+ if key.startswith('GUEST_'):
+ self._settings_original[key] = S.getValue(key)
+
self._update_settings('VSWITCH', cfg.get('vSwitch', S.getValue('VSWITCH')))
self._update_settings('VNF', cfg.get('VNF', S.getValue('VNF')))
self._update_settings('TRAFFICGEN', cfg.get('Trafficgen', S.getValue('TRAFFICGEN')))
self._update_settings('TEST_PARAMS', cfg.get('Parameters', S.getValue('TEST_PARAMS')))
# update global settings
+ functions.settings_update_paths()
guest_loopback = get_test_param('guest_loopback', None)
if guest_loopback:
# we can put just one item, it'll be expanded automatically for all VMs
self._update_settings('GUEST_LOOPBACK', [guest_loopback])
- if 'VSWITCH' in self._settings_original or 'VNF' in self._settings_original:
- self._settings_original.update({
- 'RTE_SDK' : S.getValue('RTE_SDK'),
- 'OVS_DIR' : S.getValue('OVS_DIR'),
- })
- functions.settings_update_paths()
-
# set test parameters; CLI options take precedence to testcase settings
self._logger = logging.getLogger(__name__)
self.name = cfg['Name']
@@ -196,7 +195,7 @@ class TestCase(object):
# perform guest related handling
if self._vnf_ctl.get_vnfs_number():
# copy sources of l2 forwarding tools into VM shared dir if needed
- self._copy_fwd_tools_for_all_guests()
+ self._copy_fwd_tools_for_all_guests(self._vnf_ctl.get_vnfs_number())
# in case of multi VM in parallel, set the number of streams to the number of VMs
if self.deployment.startswith('pvpv'):
@@ -362,11 +361,11 @@ class TestCase(object):
item[ResultsConstants.TUNNEL_TYPE] = self._tunnel_type
return results
- def _copy_fwd_tools_for_all_guests(self):
+ def _copy_fwd_tools_for_all_guests(self, vm_count):
"""Copy dpdk and l2fwd code to GUEST_SHARE_DIR[s] based on selected deployment.
"""
# consider only VNFs involved in the test
- for guest_dir in set(S.getValue('GUEST_SHARE_DIR')[:self._vnf_ctl.get_vnfs_number()]):
+ for guest_dir in set(S.getValue('GUEST_SHARE_DIR')[:vm_count]):
self._copy_fwd_tools_for_guest(guest_dir)
def _copy_fwd_tools_for_guest(self, guest_dir):
@@ -384,14 +383,31 @@ class TestCase(object):
# copy sources into shared dir only if neccessary
guest_loopback = set(S.getValue('GUEST_LOOPBACK'))
- if 'testpmd' in guest_loopback or 'l2fwd' in guest_loopback:
+ if 'testpmd' in guest_loopback:
try:
- tasks.run_task(['rsync', '-a', '-r', '-l', r'--exclude="\.git"',
- os.path.join(S.getValue('RTE_SDK_USER'), ''),
+ # exclude whole .git/ subdirectory and all o-files;
+ # It is assumed, that the same RTE_TARGET is used in both host
+ # and VMs; This simplification significantly speeds up testpmd
+ # build. If we will need a different RTE_TARGET in VM,
+ # then we have to build whole DPDK from the scratch in VM.
+ # In that case we can copy just DPDK sources (e.g. by excluding
+ # all items obtained by git status -unormal --porcelain).
+ # NOTE: Excluding RTE_TARGET directory won't help on systems,
+ # where DPDK is built for multiple targets (e.g. for gcc & icc)
+ exclude = []
+ exclude.append(r'--exclude=.git/')
+ exclude.append(r'--exclude=*.o')
+ tasks.run_task(['rsync', '-a', '-r', '-l'] + exclude +
+ [os.path.join(S.getValue('TOOLS')['dpdk_src'], ''),
os.path.join(guest_dir, 'DPDK')],
self._logger,
'Copying DPDK to shared directory...',
True)
+ except subprocess.CalledProcessError:
+ self._logger.error('Unable to copy DPDK to shared directory')
+ raise
+ if 'l2fwd' in guest_loopback:
+ try:
tasks.run_task(['rsync', '-a', '-r', '-l',
os.path.join(S.getValue('ROOT_DIR'), 'src/l2fwd/'),
os.path.join(guest_dir, 'l2fwd')],
@@ -399,7 +415,8 @@ class TestCase(object):
'Copying l2fwd to shared directory...',
True)
except subprocess.CalledProcessError:
- self._logger.error('Unable to copy DPDK and l2fwd to shared directory')
+ self._logger.error('Unable to copy l2fwd to shared directory')
+ raise
def _mount_hugepages(self):
"""Mount hugepages if usage of DPDK or Qemu is detected