Fix userdata issue for vping and orchestra 77/43777/1
authorLinda Wang <wangwulin@huawei.com>
Sat, 30 Sep 2017 02:29:30 +0000 (02:29 +0000)
committerCedric Ollivier <cedric.ollivier@orange.com>
Sat, 30 Sep 2017 11:23:02 +0000 (11:23 +0000)
1. When creating VM, the type of the param userdata should be str, to
   conform with that in snaps [1].
2. Remove the infinite loop for vping in userdata
3. Fix the criteria for vping_userdata and vping_ssh

[1]: https://git.opnfv.org/snaps/tree/snaps/openstack/utils/nova_utils.py#n92

Change-Id: I262a7ebb93ec90bb6f8f3acb5d564f210abcfc4b
Signed-off-by: Linda Wang <wangwulin@huawei.com>
(cherry picked from commit 5a24cb4a7db33e693a063f5c2a66406283aa5cfb)

functest/opnfv_tests/openstack/vping/vping_ssh.py
functest/opnfv_tests/openstack/vping/vping_userdata.py
functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py
functest/opnfv_tests/vnf/ims/orchestra_openims.py

index 5cacddb..f94d20b 100644 (file)
@@ -160,7 +160,7 @@ class VPingSSH(vping_base.VPingBase):
                 return TestCase.EX_RUN_ERROR
             return self._do_vping_ssh(ssh, test_ip)
         else:
-            return -1
+            return TestCase.EX_RUN_ERROR
 
     def _transfer_ping_script(self, ssh):
         """
index 8088a4d..deaacfc 100644 (file)
@@ -88,7 +88,7 @@ class VPingUserdata(vping_base.VPingBase):
         Override from super
         """
         self.logger.info("Waiting for ping...")
-        exit_code = -1
+        exit_code = TestCase.EX_TESTCASE_FAILED
         sec = 0
         tries = 0
 
@@ -100,7 +100,7 @@ class VPingUserdata(vping_base.VPingBase):
                 exit_code = TestCase.EX_OK
                 break
             elif "failed to read iid from metadata" in p_console or tries > 5:
-                exit_code = TestCase.EX_TESTCASE_FAILED
+                self.logger.info("Failed to read iid from metadata")
                 break
             elif sec == self.ping_timeout:
                 self.logger.info("Timeout reached.")
@@ -137,5 +137,5 @@ def _get_userdata(test_ip):
                 "  echo 'vPing KO'\n"
                 " fi\n"
                 " sleep 1\n"
-                "done\n" % test_ip)
+                "done\n" % str(test_ip))
     return None
index 6a11160..944d50a 100644 (file)
@@ -466,7 +466,7 @@ class ClearwaterImsVnf(vnf.VnfOnBoarding):
             flavor=self.mano['details']['flavor']['name'],
             port_settings=[port_settings],
             security_group_names=[self.mano['details']['sec_group']],
-            userdata=userdata)
+            userdata=str(userdata))
         orchestra_vm = OpenStackVmInstance(self.snaps_creds,
                                            orchestra_settings,
                                            image_settings)
index 0821e42..7754154 100644 (file)
@@ -460,7 +460,7 @@ class OpenImsVnf(vnf.VnfOnBoarding):
             flavor=self.mano['details']['flavor']['name'],
             port_settings=[port_settings],
             security_group_names=[self.mano['details']['sec_group']],
-            userdata=userdata)
+            userdata=str(userdata))
         orchestra_vm = OpenStackVmInstance(self.snaps_creds,
                                            orchestra_settings,
                                            image_settings)