aboutsummaryrefslogtreecommitdiffstats
path: root/test/hpa_automation/tosca/hpa_automation.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/hpa_automation/tosca/hpa_automation.py')
-rwxr-xr-xtest/hpa_automation/tosca/hpa_automation.py44
1 files changed, 22 insertions, 22 deletions
diff --git a/test/hpa_automation/tosca/hpa_automation.py b/test/hpa_automation/tosca/hpa_automation.py
index 93027237c..ac6a161d2 100755
--- a/test/hpa_automation/tosca/hpa_automation.py
+++ b/test/hpa_automation/tosca/hpa_automation.py
@@ -3,7 +3,7 @@
#Prerequisites for machine to run this
#Put in required parameters in hpa_automation_config.json
#Install python-pip (apt install python-pip)
-#Install python mysql.connector (pip install mysql-connector-python)
+#Install python mysql.connector (pip install --no-cache-dir mysql-connector-python)
#Install ONAP CLI
#Must have connectivity to the ONAP, a k8s vm already running is recommended
#Create Preload File, the script will modify the parameters required from serivce model, service instance
@@ -223,16 +223,16 @@ def create_customer(parameters):
def add_customer_subscription(parameters):
subscription_check = 0
for cloud_region, cloud_region_values in (parameters["cloud_region_data"]).iteritems():
- if subscription_check == 0 :
- subscription_string = "oclip subscription-create -x {} -c {} -z {} -e {} -y {} -r {} -m {} -u {} -p {}".format(\
- parameters["customer_name"], cloud_region_values.get("tenant-id"), parameters["cloud-owner"], parameters["service_name"],\
- cloud_region_values.get("default-tenant"), cloud_region, parameters["aai_url"], parameters["aai_username"], parameters["aai_password"] )
- else:
- subscription_string = "oclip subscription-cloud-add -x {} -c {} -z {} -e {} -y {} -r {} -m {} -u {} -p {}".format(\
- parameters["customer_name"], cloud_region_values.get("tenant-id"), parameters["cloud-owner"], parameters["service_name"],\
- cloud_region_values.get("default-tenant"), cloud_region, parameters["aai_url"], parameters["aai_username"], parameters["aai_password"] )
- os.system(subscription_string)
- subscription_check+=1
+ if subscription_check == 0 :
+ subscription_string = "oclip subscription-create -x {} -c {} -z {} -e {} -y {} -r {} -m {} -u {} -p {}".format(\
+ parameters["customer_name"], cloud_region_values.get("tenant-id"), parameters["cloud-owner"], parameters["service_name"],\
+ cloud_region_values.get("default-tenant"), cloud_region, parameters["aai_url"], parameters["aai_username"], parameters["aai_password"] )
+ else:
+ subscription_string = "oclip subscription-cloud-add -x {} -c {} -z {} -e {} -y {} -r {} -m {} -u {} -p {}".format(\
+ parameters["customer_name"], cloud_region_values.get("tenant-id"), parameters["cloud-owner"], parameters["service_name"],\
+ cloud_region_values.get("default-tenant"), cloud_region, parameters["aai_url"], parameters["aai_username"], parameters["aai_password"] )
+ os.system(subscription_string)
+ subscription_check+=1
def register_vnfm_helper(vnfm_key, values, parameters):
#Create vnfm
@@ -249,7 +249,7 @@ def register_vnfm(parameters):
for vnfm_key, vnfm_values in vnfm_params.iteritems():
register_vnfm_helper(vnfm_key, vnfm_values, parameters)
-def add_policy_models(parameters):
+def add_policy_models():
mydb = mysql.connector.connect(
host="policydb",
user="policy_user",
@@ -361,15 +361,15 @@ def add_policy_models(parameters):
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))
- #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"], \
- parameters["policy_config_type"], parameters["policy_onapName"], policy_file))
-
- #Push policy
- os.system("oclip policy-push-outdated -m {} -u {} -p {} -x {} -b {} -c {}".format(parameters["policy_url"], \
+ policy_name = "{}.{}".format(parameters["policy_scope"], os.path.splitext(policy)[0])
+ policy_file = (os.path.join(parameters["policy_directory"], policy))
+ # 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"], \
+ parameters["policy_config_type"], parameters["policy_onapName"], policy_file))
+
+ # Push policy
+ os.system("oclip policy-push-outdated -m {} -u {} -p {} -x {} -b {} -c {}".format(parameters["policy_url"], \
parameters["policy_username"], parameters["policy_password"], policy_name, parameters["policy_config_type"],\
parameters["policy_pdp_group"]))
@@ -521,7 +521,7 @@ else:
print(ns_out)
# 6.add_policies function not currently working, using curl commands
-add_policy_models(parameters)
+add_policy_models()
add_policies(parameters)
# 7. VFC part