diff options
-rw-r--r-- | testcases/integration.py | 18 | ||||
-rw-r--r-- | testcases/testcase.py | 11 |
2 files changed, 23 insertions, 6 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 ccd65785..7f22c18f 100644 --- a/testcases/testcase.py +++ b/testcases/testcase.py @@ -61,6 +61,11 @@ 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'))) @@ -190,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'): @@ -356,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): |