diff options
author | Gary Wu <gary.i.wu@huawei.com> | 2019-05-07 01:33:09 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-05-07 01:33:09 +0000 |
commit | 4b58c7a1389d9f0eef1f092b161b7c3a353cc174 (patch) | |
tree | 6207f52dc47a6c1177676612d95c64c5162743d2 | |
parent | 3c8f6df1035c11f2cd0136a744a97c35083bb7bb (diff) | |
parent | 454b279501c501922c0a16e00b69c76d68d7973d (diff) |
Merge "Fixed Bugs in hpa automation script"
-rw-r--r-- | test/hpa_automation/hpa_automation.py | 30 | ||||
-rw-r--r-- | test/hpa_automation/hpa_automation_config.json | 3 |
2 files changed, 23 insertions, 10 deletions
diff --git a/test/hpa_automation/hpa_automation.py b/test/hpa_automation/hpa_automation.py index a5b8b4d0c..1bbf3a40d 100644 --- a/test/hpa_automation/hpa_automation.py +++ b/test/hpa_automation/hpa_automation.py @@ -177,14 +177,21 @@ def create_vf_model(parameters, vsp_id): parameters["sdc_creator"], parameters["sdc_password"], parameters["vf-name"]))).read() output = (get_out_helper_2(output)) - vf_id = output[0] vf_unique_id = output[1] - vf_model_invariant_uuid = output[2] - vf_model_version = output[4] os.system("oclip vf-model-certify -b {} -r {} -u {} -p {} -m {}".format(vf_unique_id, parameters["vf-remarks"], \ parameters["sdc_creator"], parameters["sdc_password"], parameters["sdc_catalog_url"])) + #Check for new parameters after certification + output = (os.popen("oclip vf-model-list -m {} -u {} -p {} | grep {}".format(parameters["sdc_catalog_url"], \ + parameters["sdc_creator"], parameters["sdc_password"], parameters["vf-name"]))).read() + output = (get_out_helper_2(output)) + + vf_id = output[0] + vf_unique_id = output[1] + vf_model_invariant_uuid = output[2] + vf_model_version = output[4] + out_dict = {} out_dict["vf_id"] = vf_id out_dict["vf_unique_id"] = vf_unique_id @@ -237,15 +244,20 @@ def add_policies(parameters): parameters["service-model-name"] ))).read() resource_module_name = (get_out_helper_2(resource_string))[1] - #Upload policy models + #Put in the right resource module name in all policies located in parameters["policy_directory"] + os.system("find {}/ -type f -exec sed -i 's/{}/{}/g' {{}} \;".format( + parameters["policy_directory"], parameters["temp_resource_module_name"], resource_module_name)) + + #Upload policy models for model in os.listdir(parameters["policy_models_directory"]): os.system("oclip policy-type-create -x {} -u {} -p {} -m {}".format(model, parameters["policy_username"], \ parameters["policy_password"], parameters["policy_url"])) time.sleep(0.5) - print("Put in the resourceModuleName {} in your policy files in {}. ".format(resource_module_name, \ - (parameters["policy_directory"]))) - raw_input("Press Enter to continue...") + #print("Put in the resourceModuleName {} in your policy files in {}. ".format(resource_module_name, \ + #(parameters["policy_directory"]))) + #raw_input("Press Enter to continue...") + #Loop through policy, put in resource_model_name and create policies for policy in os.listdir(parameters["policy_directory"]): @@ -430,12 +442,12 @@ def create_vf_module(parameters, service_dict, vnf_dict, db_dict): os.system("oclip vf-module-create -w {} -mn '{}' -x {} -l {} -sv {} -vc {} -vm {} -mv {} -i {} -vf {} -vi {} -r {} \ - -mc {} -api {} -mi {} -vid {} -y {} -R {} -si {} -up {} -sd {} -z {} -vn {} -vv {} -u {} -p {} -m {}".format(tenant_id, \ + -mc {} -api {} -mi {} -vid {} -y {} -R {} -si {} -up {} -sd {} -z {} -vn {} -vv {} -co {} -u {} -p {} -m {}".format(tenant_id, \ vf_model_customization_name, service_instance_id, cloud_region, service_version, vf_module_customization_id, vf_module_model_version,\ vf_model_version, parameters["vf-module-name"], parameters["vf-name"], vf_module_model_invariant_id, parameters["supress-rollback"], \ vf_model_customization_id, parameters["test-api"], vf_model_invariant_uuid, vf_model_id, vnf_instance_id, parameters["requestor-id"], \ service_uuid, parameters["use-preload"], service_invariant_uuid, parameters["service-model-name"], vf_module_model_name, \ - vf_module_model_version_id, parameters["so_username"], parameters["so_password"], parameters["so_url"])) + vf_module_model_version_id, parameters["cloud-owner"], parameters["so_username"], parameters["so_password"], parameters["so_url"])) diff --git a/test/hpa_automation/hpa_automation_config.json b/test/hpa_automation/hpa_automation_config.json index 4c062a6da..ff21bfe89 100644 --- a/test/hpa_automation/hpa_automation_config.json +++ b/test/hpa_automation/hpa_automation_config.json @@ -34,7 +34,8 @@ "policy_onapName" : "SampleDemo", "policy_config_type": "MicroService", "policy_pdp_group" : "default", - +"//" : "Put in a temp resource module name, should be the same in policy files, script will replace it in policies", +"temp_resource_module_name" : "resource_name", "//" : "#Parameters required to create cloud complex", "complex_name" : "clli1", |