aboutsummaryrefslogtreecommitdiffstats
path: root/test/hpa_automation/heat
diff options
context:
space:
mode:
Diffstat (limited to 'test/hpa_automation/heat')
-rw-r--r--test/hpa_automation/heat/README.md33
-rwxr-xr-xtest/hpa_automation/heat/hpa_automation.py47
2 files changed, 63 insertions, 17 deletions
diff --git a/test/hpa_automation/heat/README.md b/test/hpa_automation/heat/README.md
index 93c6b5b59..4dd2abf2b 100644
--- a/test/hpa_automation/heat/README.md
+++ b/test/hpa_automation/heat/README.md
@@ -4,13 +4,26 @@ These guide describes how to run the hpa_automation.py script. It can be used to
## Prerequisites
- 1. Install ONAP CLI. See [link](https://onap.readthedocs.io/en/dublin/submodules/cli.git/docs/installation_guide.html)
- 2. Install python mysql.connector (pip install mysql-connector-python)
- 3. 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.
- 4. 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
- 5. 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)
- 6. Put in the CSAR file to be used to create service models and specify its path in hpa_automation_config.json
- 7. 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)
- 8. Prepare sdnc_preload file and put in the right path to its location in hpa_automation_config.json
- 9. Put in the right parameters for automation in hpa_automation_config.json
- 10. Ensure the insert_policy_models_heat.py script is in the same location as the hpa_automation.py script as the automation scripts calls the insert_policy_models_heat.py script.
+ - 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 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)
+ - Prepare sdnc_preload file and put in the right path to its location in hpa_automation_config.json
+ - Put in the right parameters for automation in hpa_automation_config.json
+ - Ensure the insert_policy_models_heat.py script is in the same location as the hpa_automation.py script as the automation scripts calls the insert_policy_models_heat.py script.
+
+**Points to Note:**
+ - The hpa_automation.py runs end to end. It does the following;
+ - Create cloud complex
+ - Register cloud regions
+ - Create service type
+ - Create customer and adds customer subscription
+ - SDC Onboarding (Create VLM, VSP, VF Model, and service model)
+ - Upload policy models and adds policies
+ - Create Service Instance and VNF Instance
+ - SDNC Preload and Creates VF module
+
+ - There are well named functions that do the above items every time the script is run. If you do not wish to run any part of that, you can go into the script and comment out the section at the bottom that handles that portion.
diff --git a/test/hpa_automation/heat/hpa_automation.py b/test/hpa_automation/heat/hpa_automation.py
index cc6dc68b0..5ac65b4f5 100755
--- a/test/hpa_automation/heat/hpa_automation.py
+++ b/test/hpa_automation/heat/hpa_automation.py
@@ -228,6 +228,9 @@ def create_service_model(parameters, vf_unique_id):
#VNF Deployment Section
+def upload_policy_models(parameters):
+ os.system("python insert_policy_models.py {} {} {}".format(parameters["policy_db_ip"], \
+ parameters["policy_db_user"], parameters["policy_db_password"]))
def add_policies(parameters):
resource_string = (os.popen("oclip get-resource-module-name -u {} -p {} -m {} |grep {}".format(\
@@ -239,10 +242,6 @@ def add_policies(parameters):
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
- os.system("python insert_policy_models.py {} {} {}".format(parameters["policy_db_ip"], parameters["policy_db_user"], \
- parameters["policy_db_password"]))
-
#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])
@@ -441,23 +440,57 @@ def create_vf_module(parameters, service_dict, vnf_dict, db_dict):
config_file_path = "/root/automation_stuff/hpa_automation_config.json"
config_file = open(config_file_path)
+
+#Get required parameters from hpa config file
parameters = get_parameters(config_file)
+
+#Set CLI env variables
set_open_cli_env(parameters)
+
create_complex(parameters)
register_all_clouds(parameters)
create_service_type(parameters)
create_customer(parameters)
add_customer_subscription(parameters)
-output = create_vlm(parameters)
-vsp_id = create_vsp(parameters, output)
+
+vlm_output = create_vlm(parameters)
+print "vlm parameters={}".format(vlm_output)
+
+vsp_id = create_vsp(parameters, vlm_output)
+print "vsp id={}".format(vsp_id)
+
vf_model_dict = create_vf_model(parameters, vsp_id)
+print "vf model parameters={}".format(vf_model_dict)
vf_id = vf_model_dict["vf_id"]
vf_unique_id = vf_model_dict["vf_unique_id"]
+
service_model_list = create_service_model(parameters, vf_unique_id)
+print "service model parameters={}".format(service_model_list)
+
+upload_policy_models(parameters)
add_policies(parameters)
+
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)
-vnf_dict = create_vnf(parameters, service_dict, db_dict, vf_model_dict)
+
+#Wait for Service instance to be created then create VNF Instance
+while True:
+ #Check if service instance has been created"
+ check_service_instance = os.popen("oclip service-instance-list -u {} -p {} -m {} |grep {}".format(parameters["aai_username"], \
+ parameters["aai_password"], parameters["aai_url"], parameters["instance-name"])).read()
+ if check_service_instance:
+ print "service instance created successfully"
+ #Create VNF Instance
+ vnf_dict = create_vnf(parameters, service_dict, db_dict, vf_model_dict)
+ time.sleep(10)
+ print "vnf instance parameters={}".format(vnf_dict)
+ break
+ print "service instance create in progress"
+ time.sleep(30)
+
+#Preload VF module and create VF module
sdnc_preload(parameters, db_dict, service_dict)
create_vf_module(parameters, service_dict, vnf_dict, db_dict)