diff options
author | bdfreeman1421 <bf1936@att.com> | 2018-11-25 07:32:19 -0500 |
---|---|---|
committer | bdfreeman1421 <bf1936@att.com> | 2018-11-25 13:09:24 -0500 |
commit | b2a4951b485eeec49366bc58862aa253b2ccc8e7 (patch) | |
tree | 3686815d692fe110f6299814e04bf5cac7674374 /robot | |
parent | 875ab32024851ff9e77b6d4b028d599c62290b1c (diff) |
Add vCPEResCust Model onboarding
Issue-ID: INT-601
Change-Id: I543959a06be9b0a759d6102bcf1352e80b7d5a30
Signed-off-by: bdfreeman1421 <bf1936@att.com>
Diffstat (limited to 'robot')
8 files changed, 413 insertions, 13 deletions
diff --git a/robot/assets/service_mappings.py b/robot/assets/service_mappings.py index 89d25969..15f7d79d 100644 --- a/robot/assets/service_mappings.py +++ b/robot/assets/service_mappings.py @@ -12,6 +12,7 @@ GLOBAL_SERVICE_FOLDER_MAPPING = {"vFW" : ['vFW'], \ "vCPEvBRGEMU" : ['vCPE/vbrgemu'], "vCPEvGMUX" : ['vCPE/vgmux'], "vCPEvGW" : ['vCPE/vgw'], + "vCPEResCust" : ['vCPE/vgw'], } ''' @@ -29,6 +30,7 @@ GLOBAL_SERVICE_VNF_MAPPING = { "vCPEvBRGEMU" : ['vCPEvBRGEMU'], "vCPEvGMUX" : ['vCPEvGMUX'], "vCPEvGW" : ['vCPEvGW'], + "vCPERestCust" : ['vCPEvGW'], } ''' @@ -42,6 +44,7 @@ GLOBAL_SERVICE_GEN_NEUTRON_NETWORK_MAPPING = { "vCPEvGMUX" : ['MUX_GW'], "vCPEvBRGEMU" :[], "vCPEvGW" :[], + "vCPERestCust" :[], "vFW" :[], "vLB" :[], "vVG" :[], @@ -72,6 +75,7 @@ GLOBAL_SERVICE_TEMPLATE_MAPPING = { "vCPEvBRGEMU" : [{"isBase" : "true", "template" : "vcpe_vbrgemu_preload.template", "name_pattern": "base_vbrgemu"}], "vCPEvGMUX" : [{"isBase" : "true", "template" : "vcpe_vgmux_preload.template", "name_pattern": "base_vgmux"}], "vCPEvGW" : [{"isBase" : "true", "template" : "vcpe_vgw_preload.template", "name_pattern": "base_vgw"}], + "vCPEResCust" : [{"isBase" : "true", "template" : "vcpe_vgw_preload.template", "name_pattern": "base_vgw"}], } ''' @@ -82,6 +86,7 @@ GLOBAL_VALIDATE_NAME_MAPPING = {"vFW" : 'vfw_name_0', "vVG" : '', "vCPE" : 'vgw_name_0', "vCPEvGW" : 'vgw_name_0', + "vCPEResCust" : 'vgw_name_0', "vCPEvDNS" : 'vdns_name_0', "vCPEvAAA" : 'vaaa_name_0', "vCPEvWEB" : 'vweb_name_0', diff --git a/robot/assets/templates/asdc/catalog_allotted_inputs.template b/robot/assets/templates/asdc/catalog_allotted_inputs.template new file mode 100644 index 00000000..11074801 --- /dev/null +++ b/robot/assets/templates/asdc/catalog_allotted_inputs.template @@ -0,0 +1,46 @@ +[ + { + "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_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 + } +] diff --git a/robot/assets/templates/asdc/catalog_allotted_properties.template b/robot/assets/templates/asdc/catalog_allotted_properties.template new file mode 100644 index 00000000..023abcfe --- /dev/null +++ b/robot/assets/templates/asdc/catalog_allotted_properties.template @@ -0,0 +1,43 @@ +[{ + "definition": false, + "description": "The depending service invariant uuid in order to map the allotted resource to the specific service version", + "empty": false, + "getInputProperty": false, + "hidden": false, + "immutable": false, + "name": "providing_service_invariant_uuid", + "password": false, + "required": true, + "type": "string", + "value": ${providing_service_invariant_uuid}, + "uniqueId": "${uniqueId}.providing_service_invariant_uuid" + }, + { + "definition": false, + "description": "The depending service uuid in order to map the allotted resource to the specific service version", + "empty": false, + "getInputProperty": false, + "hidden": false, + "immutable": false, + "name": "providing_service_uuid", + "password": false, + "required": true, + "type": "string", + "value": ${providing_service_uuid}, + "uniqueId": "${uniqueId}.providing_service_uuid" + }, + { + "definition": false, + "description": "The depending service name in order to map the allotted resource to the specific service version", + "empty": false, + "getInputProperty": false, + "hidden": false, + "immutable": false, + "name": "providing_service_name", + "password": false, + "required": true, + "type": "string", + "value": ${providing_service_name}, + "uniqueId": "${uniqueId}.providing_service_name" + } +] diff --git a/robot/assets/templates/asdc/catalog_resource_alloted_resource.template b/robot/assets/templates/asdc/catalog_resource_alloted_resource.template new file mode 100644 index 00000000..e3a11ec3 --- /dev/null +++ b/robot/assets/templates/asdc/catalog_resource_alloted_resource.template @@ -0,0 +1,41 @@ +{ + "artifacts": {}, + "toscaArtifacts": {}, + "contactId": "cs0008", + "categories": [ + { + "name": "Allotted Resource", + "normalizedName": "allotted resource", + "uniqueId": "resourceNewCategory.allotted resource", + "subcategories": [ + { + "name": "${subcategory}", + "normalizedName": "${subcategory}", + "uniqueId": "resourceNewCategory.allotted resource.${subcategory}", + "icons": [ + "allotted_resource" + ] + } + ] + } + ], + "description": "Alloted Resource ${subcategory}", + "icon": "defaulticon", + "componentInstancesProperties": {}, + "componentInstancesAttributes": {}, + "name": "${software_product_name}", + "tags": [ + "${software_product_name}" + ], + "capabilities": {}, + "requirements": {}, + "deploymentArtifacts": {}, + "componentType": "RESOURCE", + "vendorName": "${vendor_name}", + "vendorRelease": "1.0", + "componentInstances": [], + "properties": [], + "attributes": [], + "groups": [], + "resourceType": "VF" +} diff --git a/robot/resources/asdc_interface.robot b/robot/resources/asdc_interface.robot index 70727d95..bd882f4e 100644 --- a/robot/resources/asdc_interface.robot +++ b/robot/resources/asdc_interface.robot @@ -6,6 +6,7 @@ Library JSONUtils Library OperatingSystem Library Collections Library ExtendedSelenium2Library +Library HttpLibrary.HTTP Resource global_properties.robot Resource browser_setup.robot Resource json_templater.robot @@ -50,6 +51,9 @@ ${ASDC_RESOURCE_INSTANCE_TEMPLATE} robot/assets/templates/asdc/resource_insta ${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 ${SDC_CATALOG_NET_RESOURCE_INPUT_TEMPLATE} robot/assets/templates/asdc/catalog_net_input_properties.template +${ASDC_ALLOTTED_RESOURCE_CATALOG_RESOURCE_TEMPLATE} robot/assets/templates/asdc/catalog_resource_alloted_resource.template +${SDC_CATALOG_ALLOTTED_RESOURCE_PROPERTIES_TEMPLATE} robot/assets/templates/asdc/catalog_allotted_properties.template +${SDC_CATALOG_ALLOTTED_RESOURCE_INPUTS_TEMPLATE} robot/assets/templates/asdc/catalog_allotted_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} @@ -58,6 +62,7 @@ ${ASDC_BE_ONBOARD_ENDPOINT} ${GLOBAL_ASDC_SERVER_PROTOCOL}://${GLOBAL_INJECT 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}= ${cds}= ${service}= + # For Testing use random service names #${random}= Get Current Date #${catalog_service_id}= Add ASDC Catalog Service ${catalog_service_name}_${random} ${catalog_service_id}= Add ASDC Catalog Service ${catalog_service_name} @@ -81,13 +86,89 @@ Distribute Model From ASDC \ ${loop_catalog_resource_id}= Set Variable ${generic_neutron_net_uuid} \ Append To List ${catalog_resource_ids} ${loop_catalog_resource_id} \ ${loop_catalog_resource_resp}= Get ASDC Catalog Resource ${loop_catalog_resource_id} - # \ ${loop_catalog_resource_id}= Add ASDC Resource Instance ${catalog_service_id} ${loop_catalog_resource_id} ${network} ${xoffset} ${0} \ ${nf_role}= Convert To Lowercase ${network} \ Setup SDC Catalog Resource GenericNeutronNet Properties ${catalog_service_id} ${nf_role} ${loop_catalog_resource_id} \ ${xoffset}= Set Variable ${xoffset+100} \ Set To Dictionary ${catalog_resources} ${loop_catalog_resource_id}=${loop_catalog_resource_resp} + ${catalog_service_resp}= Get ASDC Catalog Service ${catalog_service_id} + Checkin ASDC Catalog Service ${catalog_service_id} + Request Certify ASDC Catalog Service ${catalog_service_id} + Start Certify ASDC Catalog Service ${catalog_service_id} + # on certify it gets a new id + ${catalog_service_id}= Certify ASDC Catalog Service ${catalog_service_id} + Approve ASDC Catalog Service ${catalog_service_id} + : FOR ${DIST_INDEX} IN RANGE 1 + \ Log Distribution Attempt ${DIST_INDEX} + \ Distribute ASDC Catalog Service ${catalog_service_id} + \ ${catalog_service_resp}= Get ASDC Catalog Service ${catalog_service_id} + \ ${status} ${_} = Run Keyword And Ignore Error Loop Over Check Catalog Service Distributed ${catalog_service_resp['uuid']} + \ Exit For Loop If '${status}'=='PASS' + Should Be Equal As Strings ${status} PASS + [Return] ${catalog_service_resp['name']} ${loop_catalog_resource_resp['name']} ${vf_module} ${catalog_resource_ids} ${catalog_service_id} ${catalog_resources} + +Distribute vCPEResCust Model From ASDC + [Documentation] goes end to end creating all the asdc objects for the vCPE ResCust Service 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}= ${cds}= ${service}= + # For testing use random service name + ${random}= Get Current Date + ${catalog_service_id}= Add ASDC Catalog Service ${catalog_service_name}_${random} + Log To Console ${\n}ServiceName: ${catalog_service_name}_${random} + #${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} ${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']} + \ Set To Dictionary ${catalog_resources} ${loop_catalog_resource_id}=${loop_catalog_resource_resp} + # + # do this here because the loop_catalog_resource_resp is different format after adding networks + ${vf_module}= Find Element In Array ${loop_catalog_resource_resp['groups']} type org.openecomp.groups.VfModule + # + # do allottedresource + ${allottedresource_list}= Create List TunnelXConn BRG + # Example data + #${tunnelxconn_dict}= Create Dictionary invariantUUID=8ac029e7-77aa-40d4-b28a-d17c02d5fd82 UUID=2ddc1b37-d7da-4aab-b645-ed7db34a5d03 node_type=org.openecomp.service.Demovcpevgmux + #${brg_dict}= Create Dictionary invariantUUID=ff0337b9-dbe2-4d88-bb74-18bf027ae586 UUID=1b6974f1-4aed-47f4-b962-816aa1261927 node_type=org.openecomp.service.Demovcpevbrgemu + ${vcpe_ar_data_file} Get File /tmp/vcpe_allotted_resource_data.json + ${tunnelxconn_invariant_uuid} Get Json Value ${vcpe_ar_data_file} /tunnelxconn/invariantUUID + ${tunnelxconn_uuid} Get Json Value ${vcpe_ar_data_file} /tunnelxconn/UUID + ${tunnelxconn_node_type} Get Json Value ${vcpe_ar_data_file} /tunnelxconn/node_type + ${brg_invariant_uuid} Get Json Value ${vcpe_ar_data_file} /brg/invariantUUID + ${brg_uuid} Get Json Value ${vcpe_ar_data_file} /brg/UUID + ${brg_node_type} Get Json Value ${vcpe_ar_data_file} /brg/node_type + ${tunnelxconn_dict}= Create Dictionary invariantUUID=${tunnelxconn_invariant_uuid} UUID=${tunnelxconn_uuid} node_type=${tunnelxconn_node_type} + ${brg_dict}= Create Dictionary invariantUUID=${brg_invariant_uuid} UUID=${brg_uuid} node_type=${brg_node_type} + ${xoffset}= Set Variable ${100} + ${allottedresource_uuid}= Get AllottedResource UUID + ${random}= Get Current Date + :FOR ${allottedresource} in @{allottedresource_list} + \ ${loop_catalog_resource_id}= Set Variable ${allottedresource_uuid} + \ Append To List ${catalog_resource_ids} ${loop_catalog_resource_id} + \ ${loop_catalog_resource_id}= Add ASDC Allotted Resource Catalog Resource 00000 ${allottedresource}_${random} ONAP ${loop_catalog_resource_id} ${allottedresource} + \ ${loop_catalog_resource_id2}= Add ASDC Resource Instance To Resource ${loop_catalog_resource_id} ${allottedresource_uuid} ${allottedresource} ${xoffset} ${0} + \ ${loop_catalog_resource_resp}= Get ASDC Catalog Resource ${loop_catalog_resource_id} + # + # Set the properties to relate to the brg and gmux # + \ Run Keyword If '${allottedresource}'=='TunnelXConn' Setup SDC Catalog Resource AllottedResource Properties ${catalog_service_id} ${allottedresource} ${loop_catalog_resource_id} ${tunnelxconn_dict['invariantUUID']} ${tunnelxconn_dict['UUID']} ${tunnelxconn_dict['node_type']} + \ Run Keyword If '${allottedresource}'=='BRG' Setup SDC Catalog Resource AllottedResource Properties ${catalog_service_id} ${allottedresource} ${loop_catalog_resource_id} ${brg_dict['invariantUUID']} ${brg_dict['UUID']} ${brg_dict['node_type']} + # + # Set the nf_role nf_type + # + \ Run Keyword If '${allottedresource}'=='TunnelXConn' Setup SDC Catalog Resource AllottedResource Inputs ${catalog_service_id} ${allottedresource} ${loop_catalog_resource_id} + \ Run Keyword If '${allottedresource}'=='BRG' Setup SDC Catalog Resource AllottedResource Inputs ${catalog_service_id} ${allottedresource} ${loop_catalog_resource_id} + + \ ${loop_catalog_resource_id}= Certify ASDC Catalog Resource ${loop_catalog_resource_id} ${ASDC_DESIGNER_USER_ID} + \ Add ASDC Resource Instance ${catalog_service_id} ${loop_catalog_resource_id} ${loop_catalog_resource_resp['name']} + + + + + + \ Set To Dictionary ${catalog_resources} ${loop_catalog_resource_id}=${loop_catalog_resource_resp} ${catalog_service_resp}= Get ASDC Catalog Service ${catalog_service_id} Checkin ASDC Catalog Service ${catalog_service_id} Request Certify ASDC Catalog Service ${catalog_service_id} @@ -101,9 +182,11 @@ Distribute Model From ASDC \ ${catalog_service_resp}= Get ASDC Catalog Service ${catalog_service_id} \ ${status} ${_} = Run Keyword And Ignore Error Loop Over Check Catalog Service Distributed ${catalog_service_resp['uuid']} \ Exit For Loop If '${status}'=='PASS' + #\ Exit For Loop If '${dist_status}'=='EXIT' Should Be Equal As Strings ${status} PASS [Return] ${catalog_service_resp['name']} ${loop_catalog_resource_resp['name']} ${vf_module} ${catalog_resource_ids} ${catalog_service_id} ${catalog_resources} + Download CSAR [Documentation] Download CSAR [Arguments] ${catalog_service_id} ${save_directory}=/tmp/csar @@ -121,21 +204,27 @@ Download CSAR Get Generic NeutronNet UUID [Documentation] Lookoup the UUID of the Generic NeutronNetwork Resource - # http://137.117.87.170:30205/sdc2/rest/v1/catalog/resources/resourceName/Generic%20NeutronNet/resourceVersion/1.0 - # 411edcfd-c290-41dc-bd2c-5600f9f0af05 ${resp}= Run ASDC Get Request ${ASDC_CATALOG_RESOURCES_QUERY_PATH}/Generic%20NeutronNet/resourceVersion/1.0 ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ENDPOINT} [Return] ${resp.json()['allVersions']['1.0']} +Get AllottedResource UUID + [Documentation] Lookoup the UUID of the Allotted Resource + # if this fails then the AllottedResource template got deleted from SDC by mistake + ${resp}= Run ASDC Get Request ${ASDC_CATALOG_RESOURCES_QUERY_PATH}/AllottedResource/resourceVersion/1.0 ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ENDPOINT} + [Return] ${resp.json()['allVersions']['1.0']} + Loop Over Check Catalog Service Distributed [Arguments] ${catalog_service_id} # SO watchdog timeout is 300 seconds need buffer - ${dist_status}= Set Variable FAIL - : FOR ${CHECK_INDEX} IN RANGE 20 + ${dist_status}= Set Variable CONTINUE + : FOR ${CHECK_INDEX} IN RANGE 20 \ ${status} ${_} = Run Keyword And Ignore Error Check Catalog Service Distributed ${catalog_service_id} ${dist_status} \ Sleep 20s \ Return From Keyword If '${status}'=='PASS' - \ Exit For Loop If '${dist_status}'=='EXIT' - Should Be Equal As Strings ${status} PASS + # need a way to exit the loop early on DISTRIBUTION_COMPLETE_ERROR ${dist_status} doesnt work + #\ Exit For Loop If '${dist_status}'=='EXIT' + Should Be Equal As Strings ${status} PASS + [Return] Setup ASDC Catalog Resource [Documentation] Creates all the steps a vf needs for an asdc catalog resource and returns the id @@ -161,11 +250,9 @@ Setup ASDC Catalog Resource [Return] ${catalog_resource_id} Setup SDC Catalog Resource GenericNeutronNet Properties - [Documentation] Set up GenericNeutronNet properties and inputs + [Documentation] Set up GenericNeutronNet properties and inputs [Arguments] ${catalog_service_id} ${nf_role} ${catalog_parent_service_id} - # Set component instances properties ${resp}= Get ASDC Catalog Resource Component Instances Properties ${catalog_service_id} - #${resp}= Get ASDC Catalog Resource Component Instances ${catalog_service_id} ${componentInstances} Set Variable @{resp['componentInstancesProperties']} # componentInstances can have 1 or more than 1 entry ${passed}= Run Keyword And Return Status Evaluate type(${componentInstances}) @@ -187,11 +274,63 @@ Setup SDC Catalog Resource GenericNeutronNet Properties \ ${ownerId} Set Variable ${comp['ownerId']} \ ${dict}= Create Dictionary parentUniqueId=${parentUniqueId} ownerId=${ownerId} uniqueId=${uniqueId} description=${description} \ Run Keyword If '${name}'=='network_role' Set To Dictionary ${dict} name=${name} value=${nf_role} - \ ${data}= Fill JSON Template File ${SDC_CATALOG_NET_RESOURCE_INPUT_TEMPLATE} ${dict} + \ ${data}= Fill JSON Template File ${SDC_CATALOG_NET_RESOURCE_INPUT_TEMPLATE} ${dict} \ ${response}= Set ASDC Catalog Resource Component Instance Properties ${catalog_parent_service_id} ${catalog_service_id} ${data} #\ Log To Console resp=${response} [Return] + +Setup SDC Catalog Resource AllottedResource Properties + [Documentation] Set up Allotted Resource properties and inputs + [Arguments] ${catalog_service_id} ${nf_role} ${catalog_resource_id} ${invariantUUID} ${UUID} ${node_type} + # Set component instances properties + ${nf_role_lc}= Convert To Lowercase ${nf_role} + ${resp}= Get ASDC Catalog Resource Component Instances Properties For Resource ${catalog_resource_id} + ${componentInstances} Set Variable @{resp['componentInstancesProperties']} + # componentInstances can have 1 or more than 1 entry + ${passed}= Run Keyword And Return Status Evaluate type(${componentInstances}) + ${type}= Run Keyword If ${passed} Evaluate type(${componentInstances}) + ${componentInstancesList}= Run Keyword If "${type}"!="<type 'list'>" Create List ${componentInstances} + ... ELSE Set Variable ${componentInstances} + :FOR ${item} IN @{componentInstancesList} + \ ${test} ${v}= Run Keyword and Ignore Error Should Contain ${item} ${nf_role_lc} + \ Run Keyword If '${test}' == 'FAIL' Continue For Loop + \ ${componentInstance1}= Set Variable ${item} + ${dict}= Create Dictionary + :FOR ${comp} IN @{resp['componentInstancesProperties']["${componentInstance1}"]} + \ ${name} Set Variable ${comp['name']} + \ ${test} ${v}= Run Keyword and Ignore Error Should Contain Any ${name} network_role providing_service_invariant_uuid providing_service_uuid providing_service_name uniqueId + \ Run Keyword If '${test}' == 'FAIL' Continue For Loop + \ ${parentUniqueId} Set Variable ${comp['parentUniqueId']} + \ ${ownerId} Set Variable ${comp['ownerId']} + \ Set To Dictionary ${dict} parentUniqueId=${parentUniqueId} ownerId=${ownerId} + \ Run Keyword If '${name}'=='providing_service_invariant_uuid' Set To Dictionary ${dict} providing_service_invariant_uuid=${invariantUUID} + \ Run Keyword If '${name}'=='providing_service_uuid' Set To Dictionary ${dict} providing_service_uuid=${UUID} + \ Run Keyword If '${name}'=='providing_service_name' Set To Dictionary ${dict} providing_service_name=${node_type} + # Sets it for each loop but should be one + \ ${uniqueId} Set Variable ${comp['uniqueId']} + \ ${uniqueId} Fetch From Left ${uniqueId} . + \ Set To Dictionary ${dict} uniqueId=${uniqueId} + ${data}= Fill JSON Template File ${SDC_CATALOG_ALLOTTED_RESOURCE_PROPERTIES_TEMPLATE} ${dict} + ${response}= Set ASDC Catalog Resource Component Instance Properties For Resource ${catalog_resource_id} ${componentInstance1} ${data} + Log To Console resp=${response} + + +Setup SDC Catalog Resource AllottedResource Inputs + [Documentation] Set up Allotted Resource inputs + [Arguments] ${catalog_service_id} ${nf_role} ${catalog_resource_id} + # 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_type' Set To Dictionary ${dict} nf_type=${nf_role} nf_type_uid=${uid} + \ Run Keyword If '${name}'=='nf_role' Set To Dictionary ${dict} nf_role=${nf_role} nf_role_uid=${uid} + ${data}= Fill JSON Template File ${SDC_CATALOG_ALLOTTED_RESOURCE_INPUTS_TEMPLATE} ${dict} + ${response}= Set ASDC Catalog Resource VNF Inputs ${catalog_resource_id} ${data} + [Return] ${response} + Setup ASDC Catalog Resource CDS Properties [Documentation] Set up vfwng VNF properties and inputs for CDS [Arguments] ${catalog_resource_id} @@ -367,14 +506,25 @@ Get ASDC Software Product [Arguments] ${software_product_id} ${version_id}=0.1 ${resp}= Run ASDC Get Request ${ASDC_VENDOR_SOFTWARE_PRODUCT_PATH}/${software_product_id}/versions/${version_id} ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ONBOARD_ENDPOINT} [Return] ${resp.json()} + Add ASDC Catalog Resource [Documentation] Creates an asdc Catalog Resource and returns its id [Arguments] ${license_agreement_id} ${software_product_name} ${license_model_name} ${software_product_id} ${map}= Create Dictionary software_product_id=${software_product_id} software_product_name=${software_product_name} license_agreement_id=${license_agreement_id} vendor_name=${license_model_name} ${data}= Fill JSON Template File ${ASDC_CATALOG_RESOURCE_TEMPLATE} ${map} - ${resp}= Run ASDC Post Request ${ASDC_CATALOG_RESOURCES_PATH} ${data} ${ASDC_DESIGNER_USER_ID} + ${resp}= Run ASDC Post Request ${ASDC_CATALOG_RESOURCES_PATH} ${data} ${ASDC_DESIGNER_USER_ID} + Should Be Equal As Strings ${resp.status_code} 201 + [Return] ${resp.json()['uniqueId']} + +Add ASDC Allotted Resource Catalog Resource + [Documentation] Creates an asdc Allotted Resource Catalog Resource and returns its id + [Arguments] ${license_agreement_id} ${software_product_name} ${license_model_name} ${software_product_id} ${subcategory} + ${map}= Create Dictionary software_product_id=${software_product_id} software_product_name=${software_product_name} license_agreement_id=${license_agreement_id} vendor_name=${license_model_name} subcategory=${subcategory} + ${data}= Fill JSON Template File ${ASDC_ALLOTTED_RESOURCE_CATALOG_RESOURCE_TEMPLATE} ${map} + ${resp}= Run ASDC Post Request ${ASDC_CATALOG_RESOURCES_PATH} ${data} ${ASDC_DESIGNER_USER_ID} Should Be Equal As Strings ${resp.status_code} 201 [Return] ${resp.json()['uniqueId']} + Mark ASDC Catalog Resource Inactive [Documentation] deletes an asdc Catalog Resource [Arguments] ${catalog_resource_id} @@ -397,6 +547,7 @@ Get ASDC Catalog Resource Component Instances [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 Component Instances Properties [Documentation] gets asdc Catalog Resource Component Instances Properties by its id [Arguments] ${catalog_resource_id} @@ -404,6 +555,11 @@ Get ASDC Catalog Resource Component Instances Properties ${resp}= Run ASDC Get Request ${ASDC_CATALOG_SERVICES_PATH}/${catalog_resource_id}/filteredDataByParams?include=componentInstancesProperties ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ENDPOINT} [Return] ${resp.json()} +Get ASDC Catalog Resource Component Instances Properties For Resource + [Documentation] gets asdc Catalog Resource Component Instances Properties for a Resource (VF) by its id + [Arguments] ${catalog_resource_id} + ${resp}= Run ASDC Get Request ${ASDC_FE_CATALOG_RESOURCES_PATH}/${catalog_resource_id}/filteredDataByParams?include=componentInstancesProperties ${ASDC_DESIGNER_USER_ID} ${ASDC_FE_ENDPOINT} + [Return] ${resp.json()} Get ASDC Catalog Resource Inputs [Documentation] gets asdc Catalog Inputs by its id @@ -416,12 +572,20 @@ Get ASDC Catalog Resource Component Instance Properties [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_parent_service_id} ${data} #${resp}= Run ASDC Post Request ${ASDC_FE_CATALOG_RESOURCES_PATH}/${component_parent_service_id}/resourceInstance/${catalog_resource_id}/inputs ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_FE_ENDPOINT} ${resp}= Run ASDC Post Request ${ASDC_FE_CATALOG_SERVICES_PATH}/${component_parent_service_id}/resourceInstance/${catalog_resource_id}/properties ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_FE_ENDPOINT} - [Return] ${resp.json()} + [Return] ${resp.json()} + +Set ASDC Catalog Resource Component Instance Properties For Resource + [Documentation] sets an asdc Catalog Resource by its id + [Arguments] ${catalog_parent_resource_id} ${catalog_resource_id} ${data} + #${resp}= Run ASDC Post Request ${ASDC_FE_CATALOG_RESOURCES_PATH}/${catalog_parent_resource_id}/resourceInstance/${catalog_resource_id}/inputs ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_FE_ENDPOINT} + ${resp}= Run ASDC Post Request ${ASDC_FE_CATALOG_RESOURCES_PATH}/${catalog_parent_resource_id}/resourceInstance/${catalog_resource_id}/properties ${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 @@ -562,6 +726,7 @@ Distribute ASDC Catalog Service ${resp}= Run ASDC Post Request ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_SERVICE_DISTRIBUTION_ACTIVATE_PATH} ${None} ${ASDC_OPS_USER_ID} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()} + Add ASDC Resource Instance [Documentation] Creates an asdc Resource Instance and returns its id [Arguments] ${catalog_service_id} ${catalog_resource_id} ${catalog_resource_name} ${xoffset}=${0} ${yoffset}=${0} @@ -574,6 +739,18 @@ Add ASDC Resource Instance Should Be Equal As Strings ${resp.status_code} 201 [Return] ${resp.json()['uniqueId']} +Add ASDC Resource Instance To Resource + [Documentation] Creates an asdc Resource Instance in a Resource (VF) and returns its id + [Arguments] ${parent_catalog_resource_id} ${catalog_resource_id} ${catalog_resource_name} ${xoffset}=${0} ${yoffset}=${0} + ${milli_timestamp}= Generate MilliTimestamp UUID + ${xoffset}= Set Variable ${xoffset+306} + ${yoffset}= Set Variable ${yoffset+248} + ${map}= Create Dictionary catalog_resource_id=${catalog_resource_id} catalog_resource_name=${catalog_resource_name} milli_timestamp=${milli_timestamp} posX=${xoffset} posY=${yoffset} + ${data}= Fill JSON Template File ${ASDC_RESOURCE_INSTANCE_TEMPLATE} ${map} + ${resp}= Run ASDC Post Request ${ASDC_CATALOG_RESOURCES_PATH}/${parent_catalog_resource_id}${ASDC_CATALOG_SERVICE_RESOURCE_INSTANCE_PATH} ${data} ${ASDC_DESIGNER_USER_ID} + Should Be Equal As Strings ${resp.status_code} 201 + [Return] ${resp.json()['uniqueId']} + Get Catalog Service Distribution [Documentation] gets an asdc catalog Service distrbution [Arguments] ${catalog_service_uuid} @@ -589,6 +766,8 @@ Check Catalog Service Distributed @{ITEMS}= Copy List ${det_resp['distributionStatusList']} Should Not Be Empty ${ITEMS} ${SO_COMPLETE} Set Variable FALSE + ${dist_status} Set Variable CONTINUE + Should Not Be Empty ${ITEMS} :FOR ${ELEMENT} IN @{ITEMS} \ Log ${ELEMENT['omfComponentID']} \ Log ${ELEMENT['status']} @@ -598,6 +777,8 @@ Check Catalog Service Distributed \ ${dist_status}= Set Variable If (('${ELEMENT['status']}' == 'COMPONENT_DONE_ERROR') and ('${ELEMENT['omfComponentID']}' == 'aai-ml')) EXIT \ Exit For Loop If (('${ELEMENT['status']}' == 'COMPONENT_DONE_ERROR') and ('${ELEMENT['omfComponentID']}' == 'aai-ml')) Should Be True ( '${SO_COMPLETE}'=='TRUE') SO Test + [Return] + Get Catalog Service Distribution Details [Documentation] gets an asdc catalog Service distrbution details [Arguments] ${catalog_service_distribution_id} diff --git a/robot/resources/demo_preload.robot b/robot/resources/demo_preload.robot index ae12bd85..4f937e3b 100644 --- a/robot/resources/demo_preload.robot +++ b/robot/resources/demo_preload.robot @@ -82,6 +82,11 @@ Distribute Model [Arguments] ${service} ${modelName} ${service_model_type} ${vnf_type} ${vf_modules} ${catalog_resources}= Model Distribution For Directory ${service} ${modelName} +Distribute vCPEResCust Model + [Arguments] ${service} ${modelName} + ${service_model_type} ${vnf_type} ${vf_modules} ${catalog_resources}= Model Distribution For vCPEResCust Directory ${service} ${modelName} + + Create Customer For VNF Demo [Documentation] Create demo customer for the demo [Arguments] ${customer_name} ${customer_id} ${customer_type} ${clouder_owner} ${cloud_region_id} ${tenant_id} diff --git a/robot/resources/test_templates/model_test_template_vcperescust.robot b/robot/resources/test_templates/model_test_template_vcperescust.robot new file mode 100644 index 00000000..127decbe --- /dev/null +++ b/robot/resources/test_templates/model_test_template_vcperescust.robot @@ -0,0 +1,63 @@ +*** Settings *** +Documentation The main interface for interacting with ASDC. It handles low level stuff like managing the http request library and DCAE required fields +Library OperatingSystem +Library ArchiveLibrary +Library Collections +Library String +Library DateTime +Resource ../asdc_interface.robot + +Variables ../../assets/service_mappings.py + +*** Variables *** +${ASDC_BASE_PATH} /sdc1 +${ASDC_DESIGNER_PATH} /proxy-designer1#/dashboard +${ASDC_ASSETS_DIRECTORY} ${GLOBAL_HEAT_TEMPLATES_FOLDER} +${ASDC_ZIP_DIRECTORY} ${ASDC_ASSETS_DIRECTORY}/temp + +#***************** Test Case Variables ********************* +${CATALOG_RESOURCE_IDS} +${CATALOG_SERVICE_ID} + +*** Keywords *** + +Model Distribution For vCPEResCust Directory + [Arguments] ${service} ${catalog_service_name}= ${cds}= + ${directory_list}= Get From Dictionary ${GLOBAL_SERVICE_FOLDER_MAPPING} ${service} + ${ziplist}= Create List + ${uuid}= Get Current Date + ${service_name}= Catenate ${service} ${uuid} + ${shortened_uuid}= Evaluate str("${service_name}")[:23] + ${catalog_service_name}= Set Variable If '${catalog_service_name}' =='' ${shortened_uuid} ${catalog_service_name} + :for ${directory} in @{directory_list} + \ ${zipname}= Replace String ${directory} / _ + \ ${zip}= Catenate ${ASDC_ZIP_DIRECTORY}/${zipname}.zip + \ ${folder}= Catenate ${ASDC_ASSETS_DIRECTORY}/${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 vCPEResCust Model From ASDC ${ziplist} ${catalog_service_name} ${cds} ${service} + 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} + Download CSAR ${catalog_service_id} + [Return] ${catalog_service_name} ${catalog_resource_name} ${vf_modules} ${catalog_resources} + + + + +Teardown Model Distribution + [Documentation] Clean up at the end of the test + Log ${CATALOG_SERVICE_ID} ${CATALOG_RESOURCE_IDS} + # Teardown is removing allotted resources for some reason + #Teardown Models ${CATALOG_SERVICE_ID} ${CATALOG_RESOURCE_IDS} + +Teardown Models + [Documentation] Clean up at the end of the test + [Arguments] ${catalog_service_id} ${catalog_resource_ids} + Return From Keyword If '${catalog_service_id}' == '' + :for ${catalog_resource_id} in @{catalog_resource_ids} + \ ${resourece_json}= Mark ASDC Catalog Resource Inactive ${catalog_resource_id} + ${service_json}= Mark ASDC Catalog Service Inactive ${catalog_service_id} + ${services_json}= Delete Inactive ASDC Catalog Services + ${resources_json}= Delete Inactive ASDC Catalog Resources diff --git a/robot/testsuites/model-distribution-vcpe.robot b/robot/testsuites/model-distribution-vcpe.robot new file mode 100644 index 00000000..b0016b23 --- /dev/null +++ b/robot/testsuites/model-distribution-vcpe.robot @@ -0,0 +1,16 @@ +*** Settings *** +Documentation Testing asdc. +Library OperatingSystem +Library RequestsLibrary +Library Collections +Library ExtendedSelenium2Library +Resource ../resources/test_templates/model_test_template_vcperescust.robot + +Test Template Model Distribution For vCPEResCust Directory +#Test Teardown Teardown Model Distribution + +*** Variables *** + +*** Test Cases *** +Distribute vCPEResCust Model vCPEResCust + [Tags] distributevCPEResCust |