Add suport for fuel installer
[sdnvpn.git] / sdnvpn / test / functest / testcase_1bis.py
index f33d247..30a0abf 100644 (file)
@@ -33,7 +33,7 @@ def main():
     results.add_to_summary(2, "STATUS", "SUBTEST")
     results.add_to_summary(0, "=")
 
-    heat_client = os_utils.get_heat_client()
+    conn = os_utils.get_os_connection()
     # neutron client is needed as long as bgpvpn heat module
     # is not yet installed by default in apex (APEX-618)
     neutron_client = os_utils.get_neutron_client()
@@ -54,38 +54,32 @@ def main():
         az_2 = "nova:" + compute_nodes[1]
 
         file_path = pkg_resources.resource_filename(
-                    'sdnvpn', TESTCASE_CONFIG.hot_file_name)
+            'sdnvpn', TESTCASE_CONFIG.hot_file_name)
         templ = open(file_path, 'r').read()
         logger.debug("Template is read: '%s'" % templ)
         env = test_utils.get_heat_environment(TESTCASE_CONFIG, COMMON_CONFIG)
         logger.debug("Environment is read: '%s'" % env)
 
-        kwargs = {
-            "stack_name": TESTCASE_CONFIG.stack_name,
-            "template": templ,
-            "environment": env,
-            "parameters": {
-                "image_n": TESTCASE_CONFIG.image_name,
-                "av_zone_1": az_1,
-                "av_zone_2": az_2
-            }
-        }
-        stack_id = os_utils.create_stack(heat_client, **kwargs)
+        env['name'] = TESTCASE_CONFIG.stack_name
+        env['template'] = templ
+        env['parameters']['image_n'] = TESTCASE_CONFIG.image_name
+        env['parameters']['av_zone_1'] = az_1
+        env['parameters']['av_zone_2'] = az_2
+
+        stack_id = os_utils.create_stack(conn, **env)
         if stack_id is None:
             logger.error("Stack create start failed")
             raise SystemError("Stack create start failed")
 
-        test_utils.wait_stack_for_status(heat_client,
-                                         stack_id, 'CREATE_COMPLETE')
+        test_utils.wait_stack_for_status(conn, stack_id, 'CREATE_COMPLETE')
 
-        net_1_output = os_utils.get_output(heat_client, stack_id, 'net_1_o')
-        network_1_id = net_1_output['output']['output_value']
-        net_2_output = os_utils.get_output(heat_client, stack_id, 'net_2_o')
-        network_2_id = net_2_output['output']['output_value']
+        net_1_output = os_utils.get_output(conn, stack_id, 'net_1_o')
+        network_1_id = net_1_output['output_value']
+        net_2_output = os_utils.get_output(conn, stack_id, 'net_2_o')
+        network_2_id = net_2_output['output_value']
 
         vm_stack_output_keys = ['vm1_o', 'vm2_o', 'vm3_o', 'vm4_o', 'vm5_o']
-        vms = test_utils.get_vms_from_stack_outputs(heat_client,
-                                                    conn,
+        vms = test_utils.get_vms_from_stack_outputs(conn,
                                                     stack_id,
                                                     vm_stack_output_keys)
 
@@ -203,10 +197,10 @@ def main():
                                    [], [], [], [])
 
         try:
-            test_utils.delete_stack_and_wait(heat_client, stack_id)
+            test_utils.delete_stack_and_wait(conn, stack_id)
         except Exception as e:
             logger.error(
-                   "exception occurred while executing testcase_1bis: %s", e)
+                "exception occurred while executing testcase_1bis: %s", e)
 
     return results.compile_summary()