Implement a get VM IP function in utils to be used within test cases
[sdnvpn.git] / sdnvpn / test / functest / testcase_7.py
index fa50888..3bc9afb 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/python
 #
-# Copyright (c) 2015 All rights reserved
+# Copyright (c) 2017 All rights reserved
 # This program and the accompanying materials
 # are made available under the terms of the Apache License, Version 2.0
 # which accompanies this distribution, and is available at
@@ -57,7 +57,7 @@ def main():
                                             COMMON_CONFIG.image_path,
                                             disk=COMMON_CONFIG.image_format,
                                             container="bare",
-                                            public=True)
+                                            public='public')
     network_1_id, _, _ = test_utils.create_network(
         neutron_client,
         TESTCASE_CONFIG.net_1_name,
@@ -82,7 +82,7 @@ def main():
         network_2_id,
         sg_id,
         secgroup_name=TESTCASE_CONFIG.secgroup_name)
-    vm_2_ip = vm_2.networks.itervalues().next()[0]
+    vm_2_ip = test_utils.get_instance_ip(vm_2)
 
     u1 = test_utils.generate_ping_userdata([vm_2_ip])
     vm_1 = test_utils.create_instance(
@@ -132,8 +132,9 @@ def main():
     results.get_ping_status(vm_1, vm_2, expected="PASS", timeout=200)
     results.add_to_summary(0, "=")
 
-    msg = "Assign a Floating IP to %s" % vm_2.name
+    msg = "Assign a Floating IP to %s and ping it" % vm_2.name
     results.record_action(msg)
+    results.add_to_summary(0, '-')
 
     fip = os_utils.create_floating_ip(neutron_client)
     fip_added = os_utils.add_floating_ip(nova_client, vm_2.id, fip['fip_addr'])
@@ -142,12 +143,9 @@ def main():
     else:
         results.add_failure(msg)
 
-    msg = "Ping %s via Floating IP" % vm_2.name
-    results.record_action(msg)
-    results.add_to_summary(0, "-")
     results.ping_ip_test(fip['fip_addr'])
 
-    return results.compile_summary(TESTCASE_CONFIG.success_criteria)
+    return results.compile_summary()
 
 
 if __name__ == '__main__':