summaryrefslogtreecommitdiffstats
path: root/robot
diff options
context:
space:
mode:
authorYang Xu <yang.xu3@huawei.com>2018-11-01 12:30:37 -0400
committerYang Xu <yang.xu3@huawei.com>2018-11-01 12:31:22 -0400
commit2ec8038ba2535a4fba0744bf7d883e46ebed4b84 (patch)
treecf1526e8642b73f37a384778417d9775b261f0ad /robot
parentac90433f8b6a36d169df563b7ef61405e0f58266 (diff)
Distribute vFWNG model for CDS
Change-Id: I9ed7b7204ab401fb39d6271af2c725315fd1bff3 Issue-ID: INT-708 Signed-off-by: Yang Xu <yang.xu3@huawei.com>
Diffstat (limited to 'robot')
-rw-r--r--robot/assets/service_mappings.py2
-rw-r--r--robot/assets/templates/asdc/catalog_vnf_inputs.template112
-rw-r--r--robot/assets/templates/asdc/catalog_vnf_properties.template29
-rw-r--r--robot/resources/asdc_interface.robot71
-rw-r--r--robot/resources/test_templates/model_test_template.robot4
-rw-r--r--robot/testsuites/demo.robot7
6 files changed, 220 insertions, 5 deletions
diff --git a/robot/assets/service_mappings.py b/robot/assets/service_mappings.py
index ff41fad3..b1ed2d85 100644
--- a/robot/assets/service_mappings.py
+++ b/robot/assets/service_mappings.py
@@ -6,6 +6,7 @@ GLOBAL_SERVICE_FOLDER_MAPPING = {"vFW" : ['vFW'], \
"vVG" : ['vVG'], \
"vCPE" : ['vCPE/infra', 'vCPE/vbng', 'vCPE/vbrgemu', 'vCPE/vgmux', 'vCPE/vgw'],
"vFWCL" : ['vFWCL/vFWSNK', 'vFWCL/vPKG'],
+ "vFWNG" : ['vFW_NextGen/templates'],
}
'''
@@ -17,6 +18,7 @@ GLOBAL_SERVICE_VNF_MAPPING = {
"vVG" : ['vVG'],
"vCPE" : ['vCPE'],
"vFWCL" : ['vFWSNK', 'vPKG'],
+ "vFWNG" : ['vFWNG'],
}
'''
diff --git a/robot/assets/templates/asdc/catalog_vnf_inputs.template b/robot/assets/templates/asdc/catalog_vnf_inputs.template
new file mode 100644
index 00000000..fb5d4940
--- /dev/null
+++ b/robot/assets/templates/asdc/catalog_vnf_inputs.template
@@ -0,0 +1,112 @@
+[
+ {
+ "defaultValue": "${nf_function}",
+ "description": null,
+ "name": "nf_function",
+ "parentUniqueId": "cs0008",
+ "password": false,
+ "required": false,
+ "schema": {
+ "property": {}
+ },
+ "type": "string",
+ "uniqueId": "${nf_function_uid}",
+ "value": null,
+ "definition": false,
+ "getInputValues": null,
+ "instanceUniqueId": null,
+ "propertyId": null,
+ "properties": null,
+ "inputs": null,
+ "ownerId": "cs0008",
+ "inputPath": null
+ },
+ {
+ "defaultValue": "${nf_type}",
+ "description": null,
+ "name": "nf_type",
+ "parentUniqueId": null,
+ "password": false,
+ "required": false,
+ "schema": {
+ "property": {}
+ },
+ "type": "string",
+ "uniqueId": "${nf_type_uid}",
+ "value": null,
+ "definition": false,
+ "getInputValues": null,
+ "instanceUniqueId": null,
+ "propertyId": null,
+ "properties": null,
+ "inputs": null,
+ "ownerId": null,
+ "inputPath": null
+ },
+ {
+ "defaultValue": "${nf_naming_code}",
+ "description": null,
+ "name": "nf_naming_code",
+ "parentUniqueId": null,
+ "password": false,
+ "required": false,
+ "schema": {
+ "property": {}
+ },
+ "type": "string",
+ "uniqueId": "${nf_naming_code_uid}",
+ "value": null,
+ "definition": false,
+ "getInputValues": null,
+ "instanceUniqueId": null,
+ "propertyId": null,
+ "properties": null,
+ "inputs": null,
+ "ownerId": null,
+ "inputPath": null
+ },
+ {
+ "defaultValue": "${nf_role}",
+ "description": null,
+ "name": "nf_role",
+ "parentUniqueId": null,
+ "password": false,
+ "required": false,
+ "schema": {
+ "property": {}
+ },
+ "type": "string",
+ "uniqueId": "${nf_role_uid}",
+ "value": null,
+ "definition": false,
+ "getInputValues": null,
+ "instanceUniqueId": null,
+ "propertyId": null,
+ "properties": null,
+ "inputs": null,
+ "ownerId": null,
+ "inputPath": null
+ },
+ {
+ "defaultValue": "${cloud_env}",
+ "description": "Cloud environment (e.g., openstack, rackspace)",
+ "name": "cloud_env",
+ "parentUniqueId": null,
+ "password": false,
+ "required": false,
+ "schema": {
+ "property": {}
+ },
+ "type": "string",
+ "uniqueId": "${cloud_env_uid}",
+ "value": null,
+ "definition": false,
+ "getInputValues": null,
+ "instanceUniqueId": null,
+ "propertyId": null,
+ "properties": null,
+ "inputs": null,
+ "ownerId": null,
+ "inputPath": null
+ }
+]
diff --git a/robot/assets/templates/asdc/catalog_vnf_properties.template b/robot/assets/templates/asdc/catalog_vnf_properties.template
new file mode 100644
index 00000000..63e85527
--- /dev/null
+++ b/robot/assets/templates/asdc/catalog_vnf_properties.template
@@ -0,0 +1,29 @@
+[
+ {
+ "name": "nfc_function",
+ "parentUniqueId": "${parent_id}",
+ "password": false,
+ "required": false,
+ "schema": {
+ "property": {}
+ },
+ "type": "string",
+ "uniqueId": "${parent_id}.nfc_function",
+ "value": "${nfc_function}",
+ "definition": false
+ },
+ {
+ "description": "vfc naming",
+ "name": "nfc_naming",
+ "parentUniqueId": "${parent_id}",
+ "password": false,
+ "required": false,
+ "schema": {
+ "property": {}
+ },
+ "type": "org.openecomp.datatypes.Naming",
+ "uniqueId": "${parent_id}.nfc_naming",
+ "value": "{\"ecomp_generated_naming\":true,\"naming_policy\":\"${nfc_naming_policy}\"}",
+ "definition": false
+ }
+]
diff --git a/robot/resources/asdc_interface.robot b/robot/resources/asdc_interface.robot
index 38d7c27f..8d61c84b 100644
--- a/robot/resources/asdc_interface.robot
+++ b/robot/resources/asdc_interface.robot
@@ -23,6 +23,7 @@ ${ASDC_VENDOR_FEATURE_GROUP_PATH} /feature-groups
${ASDC_VENDOR_LICENSE_AGREEMENT_PATH} /license-agreements
${ASDC_VENDOR_ACTIONS_PATH} /actions
${ASDC_VENDOR_SOFTWARE_UPLOAD_PATH} /orchestration-template-candidate
+${ASDC_FE_CATALOG_RESOURCES_PATH} /sdc1/feProxy/rest/v1/catalog/resources
${ASDC_CATALOG_RESOURCES_PATH} /sdc2/rest/v1/catalog/resources
${ASDC_CATALOG_SERVICES_PATH} /sdc2/rest/v1/catalog/services
${ASDC_CATALOG_INACTIVE_RESOURCES_PATH} /sdc2/rest/v1/inactiveComponents/resource
@@ -44,6 +45,8 @@ ${ASDC_CATALOG_RESOURCE_TEMPLATE} robot/assets/templates/asdc/catalog_resourc
${ASDC_USER_REMARKS_TEMPLATE} robot/assets/templates/asdc/user_remarks.template
${ASDC_CATALOG_SERVICE_TEMPLATE} robot/assets/templates/asdc/catalog_service.template
${ASDC_RESOURCE_INSTANCE_TEMPLATE} robot/assets/templates/asdc/resource_instance.template
+${ASDC_RESOURCE_INSTANCE_VNF_PROPERTIES_TEMPLATE} robot/assets/templates/asdc/catalog_vnf_properties.template
+${ASDC_RESOURCE_INSTANCE_VNF_INPUTS_TEMPLATE} robot/assets/templates/asdc/catalog_vnf_inputs.template
${ASDC_FE_ENDPOINT} ${GLOBAL_ASDC_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SDC_FE_IP_ADDR}:${GLOBAL_ASDC_FE_PORT}
${ASDC_BE_ENDPOINT} ${GLOBAL_ASDC_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SDC_BE_IP_ADDR}:${GLOBAL_ASDC_BE_PORT}
${ASDC_BE_ONBOARD_ENDPOINT} ${GLOBAL_ASDC_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SDC_BE_ONBOARD_IP_ADDR}:${GLOBAL_ASDC_BE_ONBOARD_PORT}
@@ -51,12 +54,12 @@ ${ASDC_BE_ONBOARD_ENDPOINT} ${GLOBAL_ASDC_SERVER_PROTOCOL}://${GLOBAL_INJECT
*** Keywords ***
Distribute Model From ASDC
[Documentation] goes end to end creating all the asdc objects based ona model and distributing it to the systems. it then returns the service name, vf name and vf module name
- [Arguments] ${model_zip_path} ${catalog_service_name}=
+ [Arguments] ${model_zip_path} ${catalog_service_name}= ${cds}=
${catalog_service_id}= Add ASDC Catalog Service ${catalog_service_name}
${catalog_resource_ids}= Create List
${catalog_resources}= Create Dictionary
: FOR ${zip} IN @{model_zip_path}
- \ ${loop_catalog_resource_id}= Setup ASDC Catalog Resource ${zip}
+ \ ${loop_catalog_resource_id}= Setup ASDC Catalog Resource ${zip} ${cds}
\ Append To List ${catalog_resource_ids} ${loop_catalog_resource_id}
\ ${loop_catalog_resource_resp}= Get ASDC Catalog Resource ${loop_catalog_resource_id}
\ Add ASDC Resource Instance ${catalog_service_id} ${loop_catalog_resource_id} ${loop_catalog_resource_resp['name']}
@@ -91,7 +94,7 @@ Loop Over Check Catalog Service Distributed
Setup ASDC Catalog Resource
[Documentation] Creates all the steps a vf needs for an asdc catalog resource and returns the id
- [Arguments] ${model_zip_path}
+ [Arguments] ${model_zip_path} ${cds}=
${license_model_id} ${license_model_version_id}= Add ASDC License Model
${key_group_id}= Add ASDC License Group ${license_model_id} ${license_model_version_id}
${pool_id}= Add ASDC Entitlement Pool ${license_model_id} ${license_model_version_id}
@@ -106,8 +109,45 @@ Setup ASDC Catalog Resource
Package ASDC Software Product ${software_product_id} ${software_product_version_id}
${software_product_resp}= Get ASDC Software Product ${software_product_id} ${software_product_version_id}
${catalog_resource_id}= Add ASDC Catalog Resource ${license_agreement_id} ${software_product_resp['name']} ${license_model_resp['vendorName']} ${software_product_id}
+ # Check if need to set up CDS properties
+ Run Keyword If '${cds}' == 'vfwng' Setup ASDC Catalog Resource CDS Properties ${catalog_resource_id}
+
${catalog_resource_id}= Certify ASDC Catalog Resource ${catalog_resource_id} ${ASDC_DESIGNER_USER_ID}
[Return] ${catalog_resource_id}
+Setup ASDC Catalog Resource CDS Properties
+ [Documentation] Set up vfwng VNF properties and inputs for CDS
+ [Arguments] ${catalog_resource_id}
+ # Set vnf module properties
+ ${resp}= Get ASDC Catalog Resource Component Instances ${catalog_resource_id}
+ :FOR ${comp} in @{resp['componentInstances']}
+ \ ${name} Set Variable ${comp['name']}
+ \ ${uniqueId} Set Variable ${comp['uniqueId']}
+ \ ${actualComponentUid} Set Variable ${comp['actualComponentUid']}
+ \ ${test} ${v}= Run Keyword and Ignore Error Should Contain ${name} abstract_
+ \ Run Keyword If '${test}' == 'FAIL' Continue For Loop
+ \ ${response}= Get ASDC Catalog Resource Component Instance Properties ${catalog_resource_id} ${uniqueId} ${actualComponentUid}
+ \ ${dict}= Create Dictionary parent_id=${response[6]['parentUniqueId']}
+ \ Run Keyword If '${name}'=='abstract_vfw' Set To Dictionary ${dict} nfc_function=vfw nfc_naming_policy=SDNC_Policy.ONAP_VFW_NAMING_TIMESTAMP
+ \ Run Keyword If '${name}'=='abstract_vpg' Set To Dictionary ${dict} nfc_function=vpg nfc_naming_policy=SDNC_Policy.ONAP_VPG_NAMING_TIMESTAMP
+ \ Run Keyword If '${name}'=='abstract_vsn' Set To Dictionary ${dict} nfc_function=vsn nfc_naming_policy=SDNC_Policy.ONAP_VSN_NAMING_TIMESTAMP
+ \ ${data}= Fill JSON Template File ${ASDC_RESOURCE_INSTANCE_VNF_PROPERTIES_TEMPLATE} ${dict}
+ \ ${response}= Set ASDC Catalog Resource Component Instance Properties ${catalog_resource_id} ${uniqueId} ${data}
+ \ Log To Console resp=${response}
+
+ # Set vnf inputs
+ ${resp}= Get ASDC Catalog Resource Inputs ${catalog_resource_id}
+ ${dict}= Create Dictionary
+ :FOR ${comp} in @{resp['inputs']}
+ \ ${name} Set Variable ${comp['name']}
+ \ ${uid} Set Variable ${comp['uniqueId']}
+ \ Run Keyword If '${name}'=='nf_function' Set To Dictionary ${dict} nf_function=ONAP-FIREWALL nf_function_uid=${uid}
+ \ Run Keyword If '${name}'=='nf_type' Set To Dictionary ${dict} nf_type=FIREWALL nf_type_uid=${uid}
+ \ Run Keyword If '${name}'=='nf_naming_code' Set To Dictionary ${dict} nf_naming_code=vfw nf_naming_code_uid=${uid}
+ \ Run Keyword If '${name}'=='nf_role' Set To Dictionary ${dict} nf_role=vFW nf_role_uid=${uid}
+ \ Run Keyword If '${name}'=='cloud_env' Set To Dictionary ${dict} cloud_env=openstack cloud_env_uid=${uid}
+ ${data}= Fill JSON Template File ${ASDC_RESOURCE_INSTANCE_VNF_INPUTS_TEMPLATE} ${dict}
+ ${response}= Set ASDC Catalog Resource VNF Inputs ${catalog_resource_id} ${data}
+
Add ASDC License Model
[Documentation] Creates an asdc license model and returns its id
${uuid}= Generate UUID
@@ -273,6 +313,31 @@ Get ASDC Catalog Resource
[Arguments] ${catalog_resource_id}
${resp}= Run ASDC Get Request ${ASDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id} ${ASDC_DESIGNER_USER_ID}
[Return] ${resp.json()}
+Get ASDC Catalog Resource Component Instances
+ [Documentation] gets asdc Catalog Resource Component Instances by its id
+ [Arguments] ${catalog_resource_id}
+ ${resp}= Run ASDC Get Request ${ASDC_FE_CATALOG_RESOURCES_PATH}/${catalog_resource_id}/filteredDataByParams?include=componentInstances ${ASDC_DESIGNER_USER_ID} ${ASDC_FE_ENDPOINT}
+ [Return] ${resp.json()}
+Get ASDC Catalog Resource Inputs
+ [Documentation] gets asdc Catalog Inputs by its id
+ [Arguments] ${catalog_resource_id}
+ ${resp}= Run ASDC Get Request ${ASDC_FE_CATALOG_RESOURCES_PATH}/${catalog_resource_id}/filteredDataByParams?include=inputs ${ASDC_DESIGNER_USER_ID} ${ASDC_FE_ENDPOINT}
+ [Return] ${resp.json()}
+Get ASDC Catalog Resource Component Instance Properties
+ [Documentation] gets an asdc Catalog Resource properties by its id
+ [Arguments] ${catalog_resource_id} ${component_instance_id} ${component_id}
+ ${resp}= Run ASDC Get Request ${ASDC_FE_CATALOG_RESOURCES_PATH}/${catalog_resource_id}/componentInstances/${component_instance_id}/${component_id}/inputs ${ASDC_DESIGNER_USER_ID} ${ASDC_FE_ENDPOINT}
+ [Return] ${resp.json()}
+Set ASDC Catalog Resource Component Instance Properties
+ [Documentation] sets an asdc Catalog Resource by its id
+ [Arguments] ${catalog_resource_id} ${component_instance_id} ${data}
+ ${resp}= Run ASDC Post Request ${ASDC_FE_CATALOG_RESOURCES_PATH}/${catalog_resource_id}/resourceInstance/${component_instance_id}/inputs ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_FE_ENDPOINT}
+ [Return] ${resp.json()}
+Set ASDC Catalog Resource VNF Inputs
+ [Documentation] sets an asdc Catalog Resource by its id
+ [Arguments] ${catalog_resource_id} ${data}
+ ${resp}= Run ASDC Post Request ${ASDC_FE_CATALOG_RESOURCES_PATH}/${catalog_resource_id}/update/inputs ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_FE_ENDPOINT}
+ [Return] ${resp.json()}
Checkin ASDC Catalog Resource
[Documentation] checksin an asdc Catalog Resource by its id
[Arguments] ${catalog_resource_id}
diff --git a/robot/resources/test_templates/model_test_template.robot b/robot/resources/test_templates/model_test_template.robot
index bd63d2b7..3fbf7d26 100644
--- a/robot/resources/test_templates/model_test_template.robot
+++ b/robot/resources/test_templates/model_test_template.robot
@@ -22,7 +22,7 @@ ${CATALOG_SERVICE_ID}
*** Keywords ***
Model Distribution For Directory
- [Arguments] ${service} ${catalog_service_name}=
+ [Arguments] ${service} ${catalog_service_name}= ${cds}=
${directory_list}= Get From Dictionary ${GLOBAL_SERVICE_FOLDER_MAPPING} ${service}
${ziplist}= Create List
${uuid}= Get Current Date
@@ -36,7 +36,7 @@ Model Distribution For Directory
\ OperatingSystem.Create Directory ${ASDC_ASSETS_DIRECTORY}/temp
\ Create Zip From Files In Directory ${folder} ${zip}
\ Append To List ${ziplist} ${zip}
- ${catalog_service_name} ${catalog_resource_name} ${vf_modules} ${catalog_resource_ids} ${catalog_service_id} ${catalog_resources} Distribute Model From ASDC ${ziplist} ${catalog_service_name}
+ ${catalog_service_name} ${catalog_resource_name} ${vf_modules} ${catalog_resource_ids} ${catalog_service_id} ${catalog_resources} Distribute Model From ASDC ${ziplist} ${catalog_service_name} ${cds}
Set Test Variable ${CATALOG_RESOURCE_IDS} ${catalog_resource_ids}
Set Test Variable ${CATALOG_SERVICE_ID} ${catalog_service_id}
Set Test Variable ${CATALOG_RESOURCES} ${catalog_resources}
diff --git a/robot/testsuites/demo.robot b/robot/testsuites/demo.robot
index e329671c..54129a3b 100644
--- a/robot/testsuites/demo.robot
+++ b/robot/testsuites/demo.robot
@@ -4,6 +4,7 @@ Documentation Executes the VNF Orchestration Test cases including setup and te
Library Collections
Library HTTPUtils
Resource ../resources/demo_preload.robot
+Resource ../resources/asdc_interface.robot
*** Variables ***
${VNF_NAME} DemoVNF
@@ -71,3 +72,9 @@ Preload APPC CDT GUI
Preload APPC CDT GUI
# Preload APPC CDT GUI demo reference_AllAction_vLoadBalancer_vLoadBalancer-test0_0.0.1V.json ${EXECDIR}/robot/assets/templates/appc/reference_AllAction_vLoadBalancer_vLoadBalancer-test0_0.0.1V.json ${EXECDIR}/robot/assets/templates/appc/template_ConfigScaleOut_vLoadBalancer_vLoadBalancer-test0_0.0.1V_vLB.xml ${EXECDIR}/robot/assets/templates/appc/pd_ConfigScaleOut_vLoadBalancer_vLoadBalancer-test0_0.0.1V_vLB.yaml
+Distribute vFWNG CDS Model
+ [Documentation] Distribute vFWNG for CDS
+ [Tags] DistributeVFWNG
+ [Timeout] 600
+ Model Distribution For Directory service=vFWNG cds=vfwng
+