diff options
Diffstat (limited to 'test/hpa_automation')
-rw-r--r-- | test/hpa_automation/tosca/README | 44 | ||||
-rwxr-xr-x | test/hpa_automation/tosca/hpa_automation.py | 46 | ||||
-rw-r--r-- | test/hpa_automation/tosca/pdp_service_expose.yaml | 36 | ||||
-rwxr-xr-x | test/hpa_automation/tosca/vcpe_config.json | 38 | ||||
-rwxr-xr-x | test/hpa_automation/tosca/vcpe_vgw_config.json | 169 |
5 files changed, 289 insertions, 44 deletions
diff --git a/test/hpa_automation/tosca/README b/test/hpa_automation/tosca/README new file mode 100644 index 000000000..72e394b03 --- /dev/null +++ b/test/hpa_automation/tosca/README @@ -0,0 +1,44 @@ +## Guide for hpa_automation.py script in tosca + +These guide describes how to run the hpa_automation.py script. It can be used to run the vCPE end to end +use cases. + +## Prerequisites + + - Login in your CLI container. + - Install python mysql.connector in CLI container (pip install mysql-connector-python) + - Create Nodeport for Policy pdp using the pdp_service_expose.yaml file (copy pdp_service_expose.yaml + in hpa_automation/tosca to rancher and run kubectl apply -f pdp_expose.yaml) + - Design vCPE in SDC, you can refer to https://wiki.onap.org/display/DW/vCPE+with+Tosca+VNF+Test+Guide. + - Put in the CSAR file to be used to create service models and specify its path in vcpe_config.json + - Put in the right parameters for automation in vcpe_config.json or vcpe_vgw_config.json + you must change below params: + - aai_url: https://<node-ip>:30233 + - sdc_onboarding_url: http://<cluster-ip>:8081 + - sdc_catalog_url: http://<node-ip>:30205 + - multicloud_url: http://<node-ip>:30280 + - policy_url: https://<node-ip>:30694 + - vfc-url: http://<node-ip>:30280 + - cloud_region_data + - vnfs path + - ns path + - You can run the following commands. + vcpe_config.json including all vnfs. + vcpe_vgw_config.json including vgw vnf, we can use it to test VF-C and do simple integration test. + - Use local package which is submitted by local file system. + # python hpa_automation.py -f vcpe_vgw_config.json -t "local" + - Use sdc package which is distributed from SDC. + # python hpa_automation.py -f vcpe_config.json -t "sdc" + +**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 + - 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/tosca/hpa_automation.py b/test/hpa_automation/tosca/hpa_automation.py index b7b8eb7e3..a969913b5 100755 --- a/test/hpa_automation/tosca/hpa_automation.py +++ b/test/hpa_automation/tosca/hpa_automation.py @@ -211,6 +211,30 @@ def register_all_clouds(parameters): for cloud_region, cloud_region_values in cloud_dictionary.iteritems(): register_cloud_helper(cloud_region, cloud_region_values, parameters) +def create_service_type(parameters): + create_string = "oclip service-type-create -x {} -m {} -u {} -p {}".format( parameters["service_name"], \ + parameters["aai_url"], parameters["aai_username"], parameters["aai_password"]) + os.system(create_string) + +def create_customer(parameters): + create_string = "oclip customer-create -x {} -y {} -m {} -u {} -p {}".format( parameters["customer_name"], \ + parameters["subscriber_name"], parameters["aai_url"], parameters["aai_username"], parameters["aai_password"]) + os.system(create_string) + +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 + def register_vnfm_helper(vnfm_key, values, parameters): #Create vnfm vnfm_create_string = 'oclip vnfm-create -b {} -c {} -e {} -v {} -g {} -x {} -i {} -j {} -q {} \ @@ -366,8 +390,8 @@ def onboard_ns(parameters): def create_ns(parameters, csar_id): ns = parameters["ns"] - ns_create_string = 'oclip vfc-nslcm-create -m {} -c {} -n {}'.format(parameters["vfc-url"], \ - csar_id, ns.get("name")) + ns_create_string = 'oclip vfc-nslcm-create -m {} -c {} -n {} -q {} -S {}'.format(parameters["vfc-url"], \ + csar_id, ns.get("name"), parameters["customer_name"], parameters["service_name"]) print ns_create_string ns_create_out = (os.popen(ns_create_string)).read() print ns_create_out @@ -442,9 +466,14 @@ set_open_cli_env(parameters) # 2.Create cloud complex create_complex(parameters) -# 3.Register all clouds +# 3.1 Register all clouds register_all_clouds(parameters) +# 3.2 create service and customer +create_service_type(parameters) +create_customer(parameters) +add_customer_subscription(parameters) + # 4.Register vnfm register_vnfm(parameters) @@ -457,11 +486,11 @@ ns_package_output = "" if model == "sdc": print "use csar file is distributed by sdc" - output = create_vlm(parameters) - vsp_dict = create_vsp(parameters, output) - vf_dict = create_vf_model(parameters, vsp_dict) - service_model_list = create_service_model(parameters, vf_dict) - # + # output = create_vlm(parameters) + # vsp_dict = create_vsp(parameters, output) + # vf_dict = create_vf_model(parameters, vsp_dict) + # service_model_list = create_service_model(parameters, vf_dict) + vnf_onboard_output = onboard_vnf(parameters) print vnf_onboard_output ns_onboard_out = onboard_ns(parameters) @@ -483,7 +512,6 @@ add_policies(parameters) # 7. VFC part ns_instance_id = create_ns(parameters, ns_package_output) -ns_instance_id = "d0ecc83f-339f-4621-b565-07eb9090a379" print ns_instance_id instantiate_ns_output = instantiate_ns(parameters, ns_instance_id) print instantiate_ns_output diff --git a/test/hpa_automation/tosca/pdp_service_expose.yaml b/test/hpa_automation/tosca/pdp_service_expose.yaml new file mode 100644 index 000000000..11ccf26ee --- /dev/null +++ b/test/hpa_automation/tosca/pdp_service_expose.yaml @@ -0,0 +1,36 @@ +# Please edit the object below. Lines beginning with a '#' will be ignored, +# and an empty file will abort the edit. If an error occurs while saving this file will be +# reopened with the relevant failures. +# +apiVersion: v1 +kind: Service +metadata: + annotations: + msb.onap.org/service-info: '[ { "serviceName": "pdp", "version": "v1", "url": + "/pdp", "protocol": "REST", "port": "8081", "visualRange":"1" }, ]' + creationTimestamp: 2019-04-17T18:49:51Z + labels: + app: pdp + chart: pdp-4.0.0 + heritage: Tiller + release: dev-policy + name: policy-pdp + namespace: onap + resourceVersion: "15043" + selfLink: /api/v1/namespaces/onap/services/pdp + uid: 95215ada-6141-11e9-a5ab-0201c4470b4f +spec: + clusterIP: 10.43.200.169 + ports: + - name: pdp + port: 8081 + nodePort: 30694 + protocol: TCP + targetPort: 8081 + selector: + app: pdp + release: dev-policy + sessionAffinity: None + type: NodePort +status: + loadBalancer: {} diff --git a/test/hpa_automation/tosca/vcpe_config.json b/test/hpa_automation/tosca/vcpe_config.json index 0300f7c8a..5f306883c 100755 --- a/test/hpa_automation/tosca/vcpe_config.json +++ b/test/hpa_automation/tosca/vcpe_config.json @@ -5,7 +5,7 @@ "aai_username" : "AAI", "aai_password" : "AAI", "sdc_onboarding_url" : "http://10.43.89.129:8081", - "sdc_catalog_url" : "http://10.12.5.180:30205", + "sdc_catalog_url" : "http://10.12.5.224:30205", "sdc_password" : "demo123456!", "sdc_creator" : "cs0008", "sdc_tester" : "jm0007", @@ -13,7 +13,7 @@ "sdc_operator" : "op0001", "multicloud_url" : "http://10.12.5.224:30280", - "policy_url" : "https://10.42.9.13:8081", + "policy_url" : "https://10.12.5.224:30694", "policy_username" : "testpdp", "policy_password" : "alpha123", "policy_directory" : "/opt/oclip/dublin/vcpe_policies", @@ -129,7 +129,7 @@ "service-approve-remarks" : "approved", "//" : "#Parameters to vfc", - "vfc-url": "http://10.12.6.88:30280", + "vfc-url": "http://10.12.5.224:30280", "vnfs":{ "infra":{ "path": "/opt/oclip/dublin/infra.csar", @@ -205,38 +205,6 @@ "name": "vcpe1" }, "location": "CloudOwner_ONAP-POD-01-Rail-07", - "location-constraints":[ - { - "vnfProfileId": "3fca3543-07f5-492f-812c-ed462e4f94f4", - "locationConstraints": { - "vimId": "INTEL_ONAP-POD-01-Rail-07" - } - }, - { - "vnfProfileId": "0408f076-e6c0-4c82-9940-272fddbb82de", - "locationConstraints": { - "vimId": "INTEL_ONAP-POD-01-Rail-07" - } - }, - { - "vnfProfileId": "b1bb0ce7-2222-4fa7-95ed-4840d70a1100", - "locationConstraints": { - "vimId": "INTEL_ONAP-POD-01-Rail-07" - } - }, - { - "vnfProfileId": "b1bb0ce7-2222-4fa7-95ed-4840d70a1101", - "locationConstraints": { - "vimId": "INTEL_ONAP-POD-01-Rail-07" - } - }, - { - "vnfProfileId": "b1bb0ce7-2222-4fa7-95ed-4840d70a1102", - "locationConstraints": { - "vimId": "INTEL_ONAP-POD-01-Rail-07" - } - } - ], "vnfm_params":{ "GVNFMDRIVER":{ "type": "gvnfmdriver", diff --git a/test/hpa_automation/tosca/vcpe_vgw_config.json b/test/hpa_automation/tosca/vcpe_vgw_config.json new file mode 100755 index 000000000..c13f1d946 --- /dev/null +++ b/test/hpa_automation/tosca/vcpe_vgw_config.json @@ -0,0 +1,169 @@ +{ + "open_cli_product" : "onap-dublin", + "open_cli_home" : "/opt/oclip", + "aai_url" : "https://10.12.5.224:30233", + "aai_username" : "AAI", + "aai_password" : "AAI", + "sdc_onboarding_url" : "http://10.43.89.129:8081", + "sdc_catalog_url" : "http://10.12.5.224:30205", + "sdc_password" : "demo123456!", + "sdc_creator" : "cs0008", + "sdc_tester" : "jm0007", + "sdc_governor" : "gv0001", + "sdc_operator" : "op0001", + + "multicloud_url" : "http://10.12.5.224:30280", + "policy_url" : "https://10.12.5.224:30694", + "policy_username" : "testpdp", + "policy_password" : "alpha123", + "policy_directory" : "/opt/oclip/dublin/vcpe_policies", + "policy_scope" : "OSDF_DUBLIN", + "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", + "street1" : "street1", + "street2" : "street2", + "physical_location" : "phy_type", + "data_center_code" : "code1", + "latitude" : "32.89948", + "longitude" : "97.045443", + "lata" : "example-lata-val-28399", + "elevation" : "example-elevation-val-28399", + "region" : "northwest", + "state" : "oregon", + "city" : "hillsboro", + "postal-code" : "00000", + "country" : "USA", + "identity_url" : "example-identity-url-val-56898", + "service-model-name" : "vfw-hpa", + "//" : "#Dictionary containing cloud regions and their Parameters", + + "cloud_region_data":{ + "ONAP-POD-01-Rail-05":{ + "cloud-region-version" : "titanium_cloud", + "esr-system-info-id":"5c85ce1f-aa78-4ebf-8d6f-4b62784e9bc7", + "service-url": "http://10.12.11.1:5000/v3", + "user-name":"${cloud-username}", + "password":"${cloud-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-06":{ + "cloud-region-version" : "titanium_cloud", + "esr-system-info-id":"5c85ce1f-aa78-4ebf-8d6f-4b62773e9bc7", + "service-url": "http://10.12.11.1:5000/v3", + "user-name":"${cloud-username}", + "password":"${cloud-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-07":{ + "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}", + "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" + } + }, + + "//" : "#Parameters to register cloud region", + "cloud-owner" : "CloudOwner", + "owner-defined-type" : "t1", + "cloud-zone" : "CloudZone", + + "service_name" : "vCPE", + "customer_name" : "hpa_cust", + "subscriber_name" : "hpa_cust", + + "//" : "Onboarding parameters", + "vendor-name" : "Intel", + "entitlement-pool-name" : "hpa-pool", + "entitlement-description" : "hpa-pool", + "start-date" : "04/23/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", + + "//" : "Be sure to include single quotes in parameters that have spaces", + "project-code" : "000000", + "service-model-name" : "vcpe-hpa", + "service-model-desc" : "'hpa service model'", + "icon-id" : "network_l_1-3", + "category-display" : "'Network L1-3'", + "category" : "'network l1-3'", + + "service-test-remarks" : "test", + "service-accept-remarks" : "accepted", + "service-approve-remarks" : "approved", + + "//" : "#Parameters to vfc", + "vfc-url": "http://10.12.5.224:30280", + "vnfs":{ + "vgw":{ + "path": "/opt/oclip/dublin/vgw.csar", + "csar-id": "You need change it", + "vsp-name" : "vgw-hpa-vsp", + "vsp-desc" : "vgw-hpa-vsp-desc", + "vsp-version" : "1.0", + "vf-name" : "vgw-hpa-vf", + "vf-description" : "vgw-hpa-vf", + "vf-remarks" :"remarkss", + "vf-version" : "1.0", + "key": "key2", + "value": "value2" + } + }, + "ns":{ + "csar-id": "You need change it", + "key": "key1", + "value": "value1", + "path": "/opt/oclip/dublin/ns_vgw.csar", + "name": "vcpe1" + }, + "location": "CloudOwner_ONAP-POD-01-Rail-07", + "vnfm_params":{ + "GVNFMDRIVER":{ + "type": "gvnfmdriver", + "vendor": "vfc", + "version": "v1.0", + "url": "http://msb-iag:80/", + "vim-id": "CloudOwner_ONAP-POD-01-Rail-07", + "user-name": "admin", + "user-password": "admin", + "vnfm-version": "v1.0" + } + }, + "sdc-controller-id": "2" +} |