From ecd1ebd52a0201ba3ab356cc23235e382a5419d8 Mon Sep 17 00:00:00 2001 From: Itohan Date: Wed, 5 Jun 2019 20:18:48 +0000 Subject: [PATCH] Fixed Bugs in automtion script Issue-ID: INT-905 INT-904 INT-794 Signed-off-by: Itohan Ukponmwan Change-Id: I45e5e09940378c8223ae36b8af3fc5e1b8b836bc --- test/hpa_automation/heat/README.md | 2 +- test/hpa_automation/heat/hpa_automation.py | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/test/hpa_automation/heat/README.md b/test/hpa_automation/heat/README.md index 4dd2abf2b..404ddbea1 100644 --- a/test/hpa_automation/heat/README.md +++ b/test/hpa_automation/heat/README.md @@ -7,7 +7,7 @@ These guide describes how to run the hpa_automation.py script. It can be used to - Install ONAP CLI. See [link](https://onap.readthedocs.io/en/dublin/submodules/cli.git/docs/installation_guide.html) - Install python mysql.connector (pip install mysql-connector-python) - Must have connectivity to the ONAP, a k8s vm already running is recommended as connectivity to the ONAP k8s network is required for the SDC onboarding section. - - Create policies for homing using the temp_resource_module_name specified in hpa_automation_config.json. Sample policies can be seen in the sample_vfw_policies directory. Be sure to specify the right path to the directory in hpa_automation_config.json + - Create policies for homing using the temp_resource_module_name specified in hpa_automation_config.json. Sample policies can be seen in the sample_vfw_policies directory. Be sure to specify the right path to the directory in hpa_automation_config.json, only policies should exist in the directory - Create Nodeport for Policy pdp using the pdp_service_expose.yaml file (copy pdp_service_expose.yaml in hpa_automation/heat to rancher and run kubectl apply -f pdp_expose.yaml) - Put in the CSAR file to be used to create service models and specify its path in hpa_automation_config.json - Modify the SO bpmn configmap to change the SO vnf adapter endpoint to v2. See step 4 [here](https://onap.readthedocs.io/en/casablanca/submodules/integration.git/docs/docs_vfwHPA.html#docs-vfw-hpa) diff --git a/test/hpa_automation/heat/hpa_automation.py b/test/hpa_automation/heat/hpa_automation.py index 5ac65b4f5..86c908adf 100755 --- a/test/hpa_automation/heat/hpa_automation.py +++ b/test/hpa_automation/heat/hpa_automation.py @@ -244,9 +244,16 @@ def add_policies(parameters): #Loop through policy, put in resource_model_name and create policies for policy in os.listdir(parameters["policy_directory"]): - policy_name = "{}.{}".format(parameters["policy_scope"], os.path.splitext(policy)[0]) + policy_file = (os.path.join(parameters["policy_directory"], policy)) + #Get policy name from policy file + policy_contents = open(policy_file, 'r').read() + start_string = '"policyName\\":\\"' + end_string = '\\",\\"ver' + policy_name = policy_contents[policy_contents.find(start_string)+len(start_string):policy_contents.rfind(end_string)] + + #Create policy os.system("oclip policy-create-outdated -m {} -u {} -p {} -x {} -S {} -T {} -o {} -b $(cat {})".format(parameters["policy_url"],\ parameters["policy_username"], parameters["policy_password"], policy_name, parameters["policy_scope"], \ @@ -449,7 +456,9 @@ set_open_cli_env(parameters) create_complex(parameters) register_all_clouds(parameters) + create_service_type(parameters) + create_customer(parameters) add_customer_subscription(parameters) @@ -470,10 +479,10 @@ print "service model parameters={}".format(service_model_list) upload_policy_models(parameters) add_policies(parameters) +#Create Service Instance service_dict = create_service_instance(parameters, service_model_list) print "service instance parameters={}".format(service_dict) service_model_uuid = service_dict["service_uuid"] - db_dict = query_db(parameters, service_model_uuid, vf_id) #Wait for Service instance to be created then create VNF Instance @@ -494,3 +503,5 @@ while True: #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" -- 2.16.6