Leverage on Xtesting
[functest.git] / functest / opnfv_tests / openstack / vping / vping_userdata.py
index 4cc8f42..b4e9304 100644 (file)
@@ -1,5 +1,5 @@
 #!/usr/bin/env python
-#
+
 # Copyright (c) 2015 All rights reserved
 # This program and the accompanying materials
 # are made available under the terms of the Apache License, Version 2.0
@@ -7,13 +7,15 @@
 #
 # http://www.apache.org/licenses/LICENSE-2.0
 
+"""vping_userdata testcase."""
+
 import time
 
 from snaps.config.network import PortConfig
 from snaps.config.vm_inst import VmInstanceConfig
 from snaps.openstack.utils import deploy_utils
+from xtesting.core import testcase
 
-from functest.core.testcase import TestCase
 from functest.opnfv_tests.openstack.vping import vping_base
 
 
@@ -27,7 +29,7 @@ class VPingUserdata(vping_base.VPingBase):
             kwargs["case_name"] = "vping_userdata"
         super(VPingUserdata, self).__init__(**kwargs)
 
-    def run(self):
+    def run(self, **kwargs):
         """
         Sets up the OpenStack VM instance objects then executes the ping and
         validates.
@@ -47,8 +49,8 @@ class VPingUserdata(vping_base.VPingBase):
                 port_settings=[port1_settings])
 
             self.logger.info(
-                "Creating VM 1 instance with name: '%s'"
-                instance1_settings.name)
+                "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)
@@ -69,8 +71,8 @@ class VPingUserdata(vping_base.VPingBase):
                     userdata=userdata)
 
                 self.logger.info(
-                    "Creating VM 2 instance with name: '%s'"
-                    instance2_settings.name)
+                    "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)
@@ -88,7 +90,7 @@ class VPingUserdata(vping_base.VPingBase):
         Override from super
         """
         self.logger.info("Waiting for ping...")
-        exit_code = TestCase.EX_TESTCASE_FAILED
+        exit_code = testcase.TestCase.EX_TESTCASE_FAILED
         sec = 0
         tries = 0
 
@@ -97,7 +99,7 @@ class VPingUserdata(vping_base.VPingBase):
             p_console = vm_creator.get_console_output()
             if "vPing OK" in p_console:
                 self.logger.info("vPing detected!")
-                exit_code = TestCase.EX_OK
+                exit_code = testcase.TestCase.EX_OK
                 break
             elif "failed to read iid from metadata" in p_console or tries > 5:
                 self.logger.info("Failed to read iid from metadata")
@@ -113,7 +115,7 @@ class VPingUserdata(vping_base.VPingBase):
                     tries += 1
                 else:
                     self.logger.debug(
-                        "Pinging %s. Waiting for response..." % test_ip)
+                        "Pinging %s. Waiting for response...", test_ip)
             sec += 1
 
         return exit_code