summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--functest/opnfv_tests/openstack/vping/vping_base.py2
-rw-r--r--functest/opnfv_tests/openstack/vping/vping_ssh.py2
-rw-r--r--functest/opnfv_tests/openstack/vping/vping_userdata.py82
3 files changed, 40 insertions, 46 deletions
diff --git a/functest/opnfv_tests/openstack/vping/vping_base.py b/functest/opnfv_tests/openstack/vping/vping_base.py
index 152f69da6..05fe9b453 100644
--- a/functest/opnfv_tests/openstack/vping/vping_base.py
+++ b/functest/opnfv_tests/openstack/vping/vping_base.py
@@ -178,7 +178,7 @@ class VPingBase(testcase.TestCase):
self.result = 100
return testcase.TestCase.EX_OK
- def _cleanup(self):
+ def clean(self):
"""
Cleanup all OpenStack objects. Should be called on completion
:return:
diff --git a/functest/opnfv_tests/openstack/vping/vping_ssh.py b/functest/opnfv_tests/openstack/vping/vping_ssh.py
index 19d47f57f..7cdcd2576 100644
--- a/functest/opnfv_tests/openstack/vping/vping_ssh.py
+++ b/functest/opnfv_tests/openstack/vping/vping_ssh.py
@@ -123,8 +123,6 @@ class VPingSSH(vping_base.VPingBase):
except Exception as exc: # pylint: disable=broad-except
self.logger.error('Unexpected error running test - ' + exc.message)
return testcase.TestCase.EX_RUN_ERROR
- finally:
- self._cleanup()
def _do_vping(self, vm_creator, test_ip):
"""
diff --git a/functest/opnfv_tests/openstack/vping/vping_userdata.py b/functest/opnfv_tests/openstack/vping/vping_userdata.py
index b4e9304be..7d9a57c93 100644
--- a/functest/opnfv_tests/openstack/vping/vping_userdata.py
+++ b/functest/opnfv_tests/openstack/vping/vping_userdata.py
@@ -35,55 +35,51 @@ class VPingUserdata(vping_base.VPingBase):
validates.
:return: the exit code from the super.execute() method
"""
- try:
- super(VPingUserdata, self).run()
-
- # Creating Instance 1
- port1_settings = PortConfig(
- name=self.vm1_name + '-vPingPort',
+ super(VPingUserdata, self).run()
+
+ # Creating Instance 1
+ port1_settings = PortConfig(
+ name=self.vm1_name + '-vPingPort',
+ network_name=self.network_creator.network_settings.name)
+ instance1_settings = VmInstanceConfig(
+ name=self.vm1_name,
+ flavor=self.flavor_name,
+ vm_boot_timeout=self.vm_boot_timeout,
+ port_settings=[port1_settings])
+
+ self.logger.info(
+ "Creating VM 1 instance with name: '%s'",
+ instance1_settings.name)
+ self.vm1_creator = deploy_utils.create_vm_instance(
+ self.os_creds, instance1_settings,
+ self.image_creator.image_settings)
+ self.creators.append(self.vm1_creator)
+
+ userdata = _get_userdata(
+ self.vm1_creator.get_port_ip(port1_settings.name))
+ if userdata:
+ # Creating Instance 2
+ port2_settings = PortConfig(
+ name=self.vm2_name + '-vPingPort',
network_name=self.network_creator.network_settings.name)
- instance1_settings = VmInstanceConfig(
- name=self.vm1_name,
+ instance2_settings = VmInstanceConfig(
+ name=self.vm2_name,
flavor=self.flavor_name,
vm_boot_timeout=self.vm_boot_timeout,
- port_settings=[port1_settings])
+ port_settings=[port2_settings],
+ userdata=userdata)
self.logger.info(
- "Creating VM 1 instance with name: '%s'",
- instance1_settings.name)
- self.vm1_creator = deploy_utils.create_vm_instance(
- self.os_creds, instance1_settings,
+ "Creating VM 2 instance with name: '%s'",
+ instance2_settings.name)
+ self.vm2_creator = deploy_utils.create_vm_instance(
+ self.os_creds, instance2_settings,
self.image_creator.image_settings)
- self.creators.append(self.vm1_creator)
-
- userdata = _get_userdata(
- self.vm1_creator.get_port_ip(port1_settings.name))
- if userdata:
- # Creating Instance 2
- port2_settings = PortConfig(
- name=self.vm2_name + '-vPingPort',
- network_name=self.network_creator.network_settings.name)
- instance2_settings = VmInstanceConfig(
- name=self.vm2_name,
- flavor=self.flavor_name,
- vm_boot_timeout=self.vm_boot_timeout,
- port_settings=[port2_settings],
- userdata=userdata)
-
- self.logger.info(
- "Creating VM 2 instance with name: '%s'",
- instance2_settings.name)
- self.vm2_creator = deploy_utils.create_vm_instance(
- self.os_creds, instance2_settings,
- self.image_creator.image_settings)
- self.creators.append(self.vm2_creator)
- else:
- raise Exception('Userdata is None')
-
- return self._execute()
-
- finally:
- self._cleanup()
+ self.creators.append(self.vm2_creator)
+ else:
+ raise Exception('Userdata is None')
+
+ return self._execute()
def _do_vping(self, vm_creator, test_ip):
"""