(WIP)Fix automation issues due to cli change

Fix several changes due to cli change

Issue-ID: INT-1289
Signed-off-by: Ruoyu Ying <ruoyu.ying@intel.com>
Change-Id: Ib07d9be8ace77270046c8aa02f162a9ad7994370
diff --git a/test/hpa_automation/heat/hpa_automation.py b/test/hpa_automation/heat/hpa_automation.py
index 212b8ad..bd893d7 100755
--- a/test/hpa_automation/heat/hpa_automation.py
+++ b/test/hpa_automation/heat/hpa_automation.py
@@ -33,14 +33,13 @@
 
 def register_cloud_helper(cloud_region, values, parameters):
     #Create Cloud
-    cloud_create_string = 'oclip cloud-create -e {} -b {} -I {{\\\\\\"openstack-region-id\\\\\\":\\\\\\"{}\\\\\\"}} \
-    -x {} -y {} -j {} -w {} -l {} -url {} -n {} -q {} -r {} -Q {} -i {} -g {} -z {} -k {} -c {} -m {} -u {} -p {}'.format(
-      values.get("esr-system-info-id"), values.get("user-name"), cloud_region, parameters["cloud-owner"], \
-      cloud_region, values.get("password"), values.get("cloud-region-version"), values.get("default-tenant"), \
-      values.get("service-url"), parameters["complex_name"], values.get("cloud-type"), parameters["owner-defined-type"], \
-      values.get("system-type"), values.get("identity-url"), parameters["cloud-zone"], values.get("ssl-insecure"), \
-      values.get("system-status"), values.get("cloud-domain"), parameters["aai_url"], parameters["aai_username"], \
-      parameters["aai_password"])
+    cloud_create_string = 'oclip cloud-create -e {} -b {} -x {} -y {} -j {} -w {} -l {} -url {} -n {} -q {} \
+    -r {} -Q {} -i {} -g {} -z {} -k {} -c {} -m {} -u {} -p {}'.format( values.get("esr-system-info-id"), \
+    values.get("user-name"), parameters["cloud-owner"], cloud_region, values.get("password"), \
+    values.get("cloud-region-version"), values.get("default-tenant"), values.get("service-url"), \
+    parameters["complex_name"], values.get("cloud-type"), parameters["owner-defined-type"], values.get("system-type"),\
+    values.get("identity-url"), parameters["cloud-zone"], values.get("ssl-insecure"), values.get("system-status"), \
+    values.get("cloud-domain"), parameters["aai_url"], parameters["aai_username"], parameters["aai_password"])
 
 
     os.system(cloud_create_string)
@@ -102,37 +101,38 @@
     vlm_id = out_list[3]
     vlm_version = out_list[5]
 
-    entitlement_string = "oclip vlm-entitlement-pool-create -x {} -y {} -e {} -z {} -k {} -g {} -l {} -u {} -p {} -m {}".format( \
-      parameters["entitlement-pool-name"], vlm_id, vlm_version, parameters["entitlement-description"], parameters["vendor-name"], \
-      parameters["expiry-date"], parameters["start-date"],  parameters["sdc_creator"], parameters["sdc_password"], \
-      parameters["sdc_onboarding_url"])
+
+    entitlement_string = "oclip vlm-entitlement-pool-create -x {} -y {} -e {} -k {} -g {} -l {} -u {} -p {} -m {}".format( \
+      parameters["entitlement-pool-name"], vlm_id, vlm_version, parameters["vendor-name"], parameters["expiry-date"], \
+      parameters["start-date"],  parameters["sdc_creator"], parameters["sdc_password"], parameters["sdc_onboarding_url"])
     command_out = (os.popen(entitlement_string)).read()
     entitlement_id = (get_out_helper(command_out))[3]
 
-
     key_group_string = "oclip vlm-key-group-create -c {} -e {} -x {} -y {} -u {} -p {} -m {}".format(vlm_id, vlm_version, \
       parameters["key-group-name"], parameters["key-group-type"],  parameters["sdc_creator"], parameters["sdc_password"], \
       parameters["sdc_onboarding_url"])
     command_out = (os.popen(key_group_string)).read()
     key_group_id = (get_out_helper(command_out))[3]
 
-    feature_group_string = "oclip vlm-feature-group-create -x {} -y {} -e {} -z {} -g {} -b {} -c {} -u {} -p {} -m {}".format(
-      parameters["feature-grp-name"], vlm_id, vlm_version, parameters["feature-grp-desc"], key_group_id, entitlement_id, \
+    feature_group_string = "oclip vlm-feature-group-create -x {} -y {} -e {} -g {} -b {} -c {} -u {} -p {} -m {}".format(
+      parameters["feature-grp-name"], vlm_id, vlm_version, key_group_id, entitlement_id, \
       parameters["part-no"], parameters["sdc_creator"], parameters["sdc_password"], parameters["sdc_onboarding_url"])
     command_out = (os.popen(feature_group_string)).read()
     feature_group_id = (get_out_helper(command_out))[3]
 
-    agreement_string = "oclip vlm-aggreement-create -x {} -y {} -e {} -z {} -g {} -u {} -p {} -m {}".format(parameters["agreement-name"], \
-      vlm_id, vlm_version, parameters["agreement-desc"], feature_group_id, parameters["sdc_creator"], parameters["sdc_password"], \
+    agreement_string = "oclip vlm-aggreement-create -x {} -y {} -e {} -g {} -u {} -p {} -m {}".format(parameters["agreement-name"], \
+      vlm_id, vlm_version, feature_group_id, parameters["sdc_creator"], parameters["sdc_password"], \
       parameters["sdc_onboarding_url"])
     command_out = (os.popen(agreement_string)).read()
     agreement_id = (get_out_helper(command_out))[3]
 
+
     submit_string = "oclip vlm-submit -x {} -y {} -u {} -p {} -m {}".format(vlm_id, vlm_version, parameters["sdc_creator"], \
       parameters["sdc_password"], parameters["sdc_onboarding_url"])
     os.system(submit_string)
 
     output = [feature_group_id, agreement_id, vlm_version, vlm_id ]
+
     return output
 
 def create_vsp(parameters, in_list):
@@ -142,7 +142,7 @@
     command_out = (os.popen(create_string)).read()
     out_list = get_out_helper(command_out)
     vsp_id = out_list[3]
-    vsp_version = out_list[5]
+    vsp_version = out_list[7]
 
     os.system("oclip vsp-add-artifact -x {} -y {} -z {} -u {} -p {} -m {}".format(vsp_id, vsp_version, parameters["csar-file-path"], \
       parameters["sdc_creator"], parameters["sdc_password"], parameters["sdc_onboarding_url"]))
@@ -156,6 +156,7 @@
     os.system("oclip vsp-package -x {} -y {} -u {} -p {} -m {}".format(vsp_id, vsp_version, parameters["sdc_creator"], \
       parameters["sdc_password"], parameters["sdc_onboarding_url"]))
 
+
     return vsp_id
 
 
@@ -194,7 +195,7 @@
 
 
 def create_service_model(parameters, vf_unique_id):
-    create_string = "oclip service-model-create -z {} -y {} -e {} -x {} -c {} -b {} -u {} -p {} -m {} |grep ID".format(parameters["project-code"], \
+    create_string = "oclip service-model-create -z {} -y {} -e {} -x {} -c {} -b {} -u {} -p {} -m {} |grep -i ID".format(parameters["project-code"], \
     parameters["service-model-desc"], parameters["icon-id"], parameters["service-model-name"], parameters["category-display"], \
     parameters["category"],parameters["sdc_creator"], parameters["sdc_password"], parameters["sdc_catalog_url"])
 
@@ -299,7 +300,7 @@
 
     out_dictionary = {}
     #Query DB Certain parameters required
-    mariadb_connection = mariadb.connect(user='{}'.format(parameters["so_mariadb_user"]), host='{}'.format(parameters["so_mariadb_host"]),
+    mariadb_connection = mariadb.connect(user='{}'.format(parameters["so_mariadb_user"]), host='{}'.format(parameters["mariadb_host"]),
                          password='{}'.format(parameters["so_mariadb_password"]), database='{}'.format(parameters["so_mariadb_db"]))
     values = mariadb_connection.cursor()
 
@@ -445,7 +446,7 @@
 
 #Run Functions
 
-config_file_path = "/root/automation_stuff/hpa_automation_config.json"
+config_file_path = "/root/integration/test/hpa_automation/heat/hpa_automation_config.json"
 config_file = open(config_file_path)
 
 #Get required parameters from hpa config file
@@ -453,7 +454,6 @@
 
 #Set CLI env variables
 set_open_cli_env(parameters)
-
 create_complex(parameters)
 register_all_clouds(parameters)
 
@@ -503,5 +503,4 @@
 #Preload VF module and create VF module
 sdnc_preload(parameters, db_dict, service_dict)
 create_vf_module(parameters, service_dict, vnf_dict, db_dict)
-
 print "Deployment complete!!!, check cloud to confirm that vf module has been created"
diff --git a/test/hpa_automation/heat/hpa_automation_config.json b/test/hpa_automation/heat/hpa_automation_config.json
index 0ae1063..70ec268 100755
--- a/test/hpa_automation/heat/hpa_automation_config.json
+++ b/test/hpa_automation/heat/hpa_automation_config.json
@@ -1,31 +1,31 @@
 {
 
-"open_cli_product" : "onap-dublin",
+"open_cli_product" : "onap-elalto",
 "open_cli_home" : "/opt/oclip",
-"aai_url" : "https://10.12.6.235:30233",
+"aai_url" : "https://10.12.5.110:30233",
 "aai_username" : "AAI",
 "aai_password" : "AAI",
-"sdc_onboarding_url" : "http://10.43.246.144:8081",
-"sdc_catalog_url" : "http://10.12.6.235:30205",
+"sdc_onboarding_url" : "https://10.12.5.110:30207/sdc1/feProxy",
+"sdc_catalog_url" : "https://10.12.5.110:30204",
 "sdc_password" : "demo123456!",
 "sdc_creator" : "cs0008",
 "sdc_tester" : "jm0007",
 "sdc_governor" : "gv0001",
 "sdc_operator" : "op0001",
-"csar-file-path" : "/root/automation_stuff/hpa_zip_files/vfw_hpa.zip",
-"sdnc_url" : "http://10.12.6.235:30208",
+"csar-file-path" : "/root/vfw_hpa.zip",
+"sdnc_url" : "http://10.12.5.110:30208",
 "sdnc_user" : "admin",
 "sdnc_password" : "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U",
 "sdnc_preload_file" : "/root/integration/test/hpa_automation/heat/sample_vfw_hpa_preload.txt",
-"so_url" : "http://10.12.6.235:30277",
+"so_url" : "http://10.12.5.110:30277",
 "so_username" : "InfraPortalClient",
 "so_password" : "password1$",
-"so_mariadb_host" : "10.42.6.13",
+"mariadb_host" : "10.42.8.3",
 "so_mariadb_user" : "root",
 "so_mariadb_password" : "secretpassword",
 "so_mariadb_db" : "catalogdb",
-"multicloud_url" : "http://10.12.6.235:30280",
-"policy_url" : "https://10.12.6.235:30694",
+"multicloud_url" : "http://10.12.5.110:30280",
+"policy_url" : "https://10.12.5.110:30694",
 "policy_username" : "testpdp",
 "policy_password" : "alpha123",
 "policy_directory" : "/root/integration/test/hpa_automation/heat/sample_vfw_policies",
@@ -33,7 +33,7 @@
 "policy_onapName" : "SampleDemo",
 "policy_config_type": "MicroService",
 "policy_pdp_group" : "default",
-"policy_db_ip" : "10.42.5.60",
+"policy_db_ip" : "10.42.10.14",
 "policy_db_user" : "root",
 "policy_db_password" : "secret",
 "//" : "Put in a temp resource module name, should be the same in policy files, script will replace it in policies",
@@ -60,12 +60,27 @@
 
 
  "cloud_region_data":{
+        "ONAP-POD-01-Rail-04":{
+            "cloud-region-version" : "titanium_cloud",
+            "esr-system-info-id":"8c85ce1f-aa78-45bf-8d6f-4b62784e9bc7",
+             "service-url": "http://10.12.11.1:5000/v3",
+             "user-name":"PUT IN OPENSTACK USERNAME",
+             "password":"PUT IN OPENSTACK PASSWORD",
+             "system-type": "VIM",
+             "ssl-insecure":true,
+             "cloud-domain":"Default",
+             "default-tenant":"Integration-HPA",
+             "tenant-id" : "709ba629fe194f8699b12f9d6ffd86a0",
+             "cloud-type" : "openstack",
+             "identity-url": "WillBeUpdatedByMultiCloud",
+             "system-status":"active"
+        },
         "ONAP-POD-01-Rail-05":{
             "cloud-region-version" : "titanium_cloud",
-            "esr-system-info-id":"5c85ce1f-aa78-4ebf-8d6f-4b62784e9bc7",
+            "esr-system-info-id":"5c85ce1f-aa78-44bf-8d6f-4b62784e9bc7",
              "service-url": "http://10.12.11.1:5000/v3",
-             "user-name":"${cloud-username}",
-             "password":"${cloud-password}",
+             "user-name":"PUT IN OPENSTACK USERNAME",
+             "password":"PUT IN OPENSTACK PASSWORD",
              "system-type": "VIM",
              "ssl-insecure":true,
              "cloud-domain":"Default",
@@ -78,10 +93,10 @@
 
         "ONAP-POD-01-Rail-06":{
             "cloud-region-version" : "titanium_cloud",
-            "esr-system-info-id":"5c85ce1f-aa78-4ebf-8d6f-4b62773e9bc7",
+            "esr-system-info-id":"5c85ce1f-ab77-4ebf-8d6f-4b62773e9bc7",
              "service-url": "http://10.12.11.1:5000/v3",
-             "user-name":"${cloud-username}",
-             "password":"${cloud-password}",
+             "user-name":"PUT IN OPENSTACK USERNAME",
+             "password":"PUT IN OPENSTACK PASSWORD",
              "system-type": "VIM",
              "ssl-insecure":true,
              "cloud-domain":"Default",
@@ -96,8 +111,8 @@
             "cloud-region-version" : "titanium_cloud",
             "esr-system-info-id":"4c85ce1f-aa78-4ebf-8d6f-4b62773e9bc7",
              "service-url": "http://10.12.11.1:5000/v3",
-             "user-name":"${cloud-username}",
-             "password":"${cloud-password}",
+             "user-name":"PUT IN OPENSTACK USERNAME",
+             "password":"PUT IN OPENSTACK PASSWORD",
              "system-type": "VIM",
              "ssl-insecure":true,
              "cloud-domain":"Default",
@@ -122,16 +137,13 @@
 "//" : "Onboarding parameters",
 "vendor-name" : "hpa-vendor",
 "entitlement-pool-name" : "hpa-pool",
-"entitlement-description" : "hpa-pool",
-"start-date" : "04/23/2019",
+"start-date" : "09/30/2019",
 "expiry-date" : "12/31/2040",
 "key-group-name" : "hpa-key",
 "key-group-type" : "Universal",
 "feature-grp-name" : "hpa-feature",
-"feature-grp-desc" : "hpa-feature",
 "part-no" : "hpa-part",
 "agreement-name" : "hpa-agreement",
-"agreement-desc" : "hpa-agreement",
 
 "onboarding-method" : "NetworkPackage",
 "vsp-name" : "hpa-vsp",