aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinda Wang <wangwulin@huawei.com>2018-04-02 09:25:14 +0000
committerLinda Wang <wangwulin@huawei.com>2018-04-02 09:25:14 +0000
commit1ca85485f74d09dfd6787b75fb40cb70dce64e4b (patch)
tree37511c06bdf85cc92f04f7342408c997c616d6f3
parent88790b327f7232aa14c11820c6029bf7412bbfed (diff)
Control vping cleanup step via --noclean
Change-Id: Ic43b100348e77fd96aab9abc5a9ec4a0b47a2f87 Signed-off-by: Linda Wang <wangwulin@huawei.com>
-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):
"""