diff options
author | krzysztof kuzmicki <krzysztof.kuzmicki@nokia.com> | 2019-07-31 20:08:36 +0200 |
---|---|---|
committer | Daniel Rose <dr695h@att.com> | 2019-08-02 19:23:00 +0000 |
commit | dadd0e69a24c6a43534086cb04672dc6d4ddc18b (patch) | |
tree | 83ba7fac3fe3367da96642ab5289a01d2eaa0097 /robot/resources | |
parent | e971ed9437e004b415b4321edc75883d69eca3e5 (diff) |
ROBOT test cases improvements for PnP PNF in El Alto release
Issue-ID: INT-1179
Signed-off-by: Krzysztof Kuzmicki <krzysztof.kuzmicki@nokia.com>
Change-Id: I7b840e4fa53c9058d74872cbaf3e1922651b7997
Diffstat (limited to 'robot/resources')
-rw-r--r-- | robot/resources/demo_preload.robot | 4 | ||||
-rw-r--r-- | robot/resources/global_properties.robot | 3 | ||||
-rw-r--r-- | robot/resources/sdc_interface.robot | 56 | ||||
-rw-r--r-- | robot/resources/so/add_service_recipe.robot | 52 | ||||
-rw-r--r-- | robot/resources/test_templates/model_test_template.robot | 51 | ||||
-rw-r--r-- | robot/resources/test_templates/pnf_orchestration_test_template.robot | 32 | ||||
-rw-r--r-- | robot/resources/test_templates/pnf_registration_without_SO_template.robot | 62 | ||||
-rw-r--r-- | robot/resources/vid/create_service_instance.robot | 43 |
8 files changed, 259 insertions, 44 deletions
diff --git a/robot/resources/demo_preload.robot b/robot/resources/demo_preload.robot index bf994f14..1d1671ac 100644 --- a/robot/resources/demo_preload.robot +++ b/robot/resources/demo_preload.robot @@ -83,8 +83,8 @@ Load Models ${status} ${value}= Run Keyword And Ignore Error Distribute Model vCPEvGW ${DEMO_PREFIX}VCPEvGW Distribute Model - [Arguments] ${service} ${modelName} ${cds}= - Model Distribution For Directory ${service} ${modelName} ${cds} + [Arguments] ${service} ${modelName} ${cds}=False ${instantiationType}=A-la-carte ${resourceType}=VF + Model Distribution For Directory ${service} ${modelName} ${cds} ${instantiationType} ${resourceType} Distribute vCPEResCust Model [Arguments] ${service} ${modelName} diff --git a/robot/resources/global_properties.robot b/robot/resources/global_properties.robot index ff56b031..9b2f130e 100644 --- a/robot/resources/global_properties.robot +++ b/robot/resources/global_properties.robot @@ -47,4 +47,5 @@ ${GLOBAL_SO_VFC_ENDPOINT} ${GLOBAL_SO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_S ${GLOBAL_SO_VNFM_ENDPOINT} ${GLOBAL_SO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_VNFM_IP_ADDR}:${GLOBAL_SO_VNFM_SERVER_PORT} ${GLOBAL_SO_HEALTH_CHECK_PATH} /manage/health ${GLOBAL_SO_CLOUD_CONFIG_PATH} /cloudSite -${GLOBAL_SO_CLOUD_CONFIG_TEMPLATE} robot/assets/templates/so/create_cloud_config.jinja
\ No newline at end of file +${GLOBAL_SO_CLOUD_CONFIG_TEMPLATE} robot/assets/templates/so/create_cloud_config.jinja +${GLOBAL_SO_CLOUD_CONFIG_PATH} /serviceRecipe
\ No newline at end of file diff --git a/robot/resources/sdc_interface.robot b/robot/resources/sdc_interface.robot index 9d1daacb..97084672 100644 --- a/robot/resources/sdc_interface.robot +++ b/robot/resources/sdc_interface.robot @@ -69,12 +69,12 @@ ${SDC_BE_ONBOARD_ENDPOINT} ${GLOBAL_SDC_SERVER_PROTOCOL}://${GLOBAL_INJECTED *** Keywords *** Distribute Model From SDC - [Documentation] Goes end to end creating all the SDC objects based ONAP 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}=False ${service}= + [Documentation] Goes end to end creating all the SDC objects based ONAP model and distributing it to the systems. It then returns the service name, VF/PNF name and VF module name + [Arguments] ${model_zip_path} ${catalog_service_name}= ${cds}=False ${service}= ${instantiationType}=A-la-carte ${resourceType}=VF # For Testing use random service names #${random}= Get Current Date #${catalog_service_id}= Add SDC Catalog Service ${catalog_service_name}_${random} - ${catalog_service_id}= Add SDC Catalog Service ${catalog_service_name} + ${catalog_service_id}= Add SDC Catalog Service ${catalog_service_name} ${instantiationType} ${catalog_resource_ids}= Create List ${catalog_resources}= Create Dictionary ##### TODO: Support for Multiple resources of one type in a service ###### @@ -87,9 +87,10 @@ Distribute Model From SDC ${resource_types}= Create Dictionary :FOR ${zip} IN @{model_zip_path} - \ ${loop_catalog_resource_id}= Setup SDC Catalog Resource ${zip} ${cds} + \ ${loop_catalog_resource_id}= Setup SDC Catalog Resource ${zip} ${cds} ${resourceType} # zip can be vFW.zip or vFWDT_VFWSNK.zip - \ ${resource_type_match}= Get Regexp Matches ${zip} ${service}_(.*)\.zip 1 + \ ${resource_type_match}= Run Keyword If "${resourceType}"=='PNF' Get Regexp Matches ${zip} ${service}_(.*)\.csar 1 + \ ... ELSE Get Regexp Matches ${zip} ${service}_(.*)\.zip 1 # Need to be able to distribute preload for vFWCL vFWSNK and vFWDT vFWSNK to prepend service to vnf_type \ ${resource_type_string}= Set Variable If len(${resource_type_match})==0 ${service} ${service}${resource_type_match[0]} \ Set To Dictionary ${resource_types} ${resource_type_string} ${loop_catalog_resource_id} @@ -104,11 +105,12 @@ Distribute Model From SDC :FOR ${vnf} IN @{vnflist} \ ${loop_catalog_resource_resp}= Get SDC Catalog Resource ${resource_types['${vnf}']} \ Set To Dictionary ${catalog_resources} ${resource_types['${vnf}']}=${loop_catalog_resource_resp} - \ ${catalog_resource_unique_name}= Add SDC Resource Instance ${catalog_service_id} ${resource_types['${vnf}']} ${loop_catalog_resource_resp['name']} ${xoffset} + \ ${catalog_resource_unique_name}= Add SDC Resource Instance ${catalog_service_id} ${resource_types['${vnf}']} ${loop_catalog_resource_resp['name']} ${xoffset} resourceType=${resourceType} \ ${xoffset}= Set Variable ${xoffset+100} # # 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 + ${vf_module}= Run Keyword If "${resourceType}"=='PNF' Set Variable It is PNF + ... ELSE Find Element In Array ${loop_catalog_resource_resp['groups']} type org.openecomp.groups.VfModule # # do network ${networklist}= ServiceMapping.Get Service Neutron Mapping default ${service} @@ -286,8 +288,8 @@ Loop Over Check Catalog Service Distributed Should Be Equal As Strings ${status} PASS Setup SDC Catalog Resource - [Documentation] Creates all the steps a VF needs for an SDC Catalog Resource and returns the id - [Arguments] ${model_zip_path} ${cds}=None + [Documentation] Creates all the steps a VF/PNF needs for an SDC Catalog Resource and returns the id + [Arguments] ${model_zip_path} ${cds}=None ${resourceType}=VF ${license_model_id} ${license_model_version_id}= Add SDC License Model @@ -296,12 +298,12 @@ Setup SDC Catalog Resource ${license_end_date}= Add Time To Date ${license_temp_date} 365 days result_format=%m/%d/%Y ${key_group_id}= Add SDC License Group ${license_model_id} ${license_model_version_id} ${license_start_date} ${license_end_date} ${pool_id}= Add SDC Entitlement Pool ${license_model_id} ${license_model_version_id} ${license_start_date} ${license_end_date} - ${feature_group_id}= Add SDC Feature Group ${license_model_id} ${key_group_id} ${pool_id} ${license_model_version_id} ${license_agreement_id}= Add SDC License Agreement ${license_model_id} ${feature_group_id} ${license_model_version_id} Submit SDC License Model ${license_model_id} ${license_model_version_id} ${license_model_resp}= Get SDC License Model ${license_model_id} ${license_model_version_id} - ${matches}= Get Regexp Matches ${model_zip_path} temp/(.*)\.zip 1 + ${matches}= Run Keyword If '${resourceType}'=='PNF' Get Regexp Matches ${model_zip_path} temp/(.*)\.csar 1 + ... ELSE Get Regexp Matches ${model_zip_path} temp/(.*)\.zip 1 ${software_product_name_prefix}= Set Variable ${matches[0]} ${software_product_id} ${software_product_version_id}= Add SDC Software Product ${license_agreement_id} ${feature_group_id} ${license_model_resp['vendorName']} ${license_model_id} ${license_model_version_id} ${software_product_name_prefix} Upload SDC Heat Package ${software_product_id} ${model_zip_path} ${software_product_version_id} @@ -309,14 +311,13 @@ Setup SDC Catalog Resource Submit SDC Software Product ${software_product_id} ${software_product_version_id} Package SDC Software Product ${software_product_id} ${software_product_version_id} ${software_product_resp}= Get SDC Software Product ${software_product_id} ${software_product_version_id} - ${catalog_resource_id}= Add SDC Catalog Resource ${license_agreement_id} ${software_product_resp['name']} ${license_model_resp['vendorName']} ${software_product_id} + ${catalog_resource_id}= Add SDC Catalog Resource ${license_agreement_id} ${software_product_resp['name']} ${license_model_resp['vendorName']} ${software_product_id} ${resourceType} # Check if need to set up CDS properties Run Keyword If '${cds}' == 'vfwng' Setup SDC Catalog Resource CDS Properties ${catalog_resource_id} ${catalog_resource_id}= Certify SDC Catalog Resource ${catalog_resource_id} ${SDC_DESIGNER_USER_ID} [Return] ${catalog_resource_id} - Setup SDC Catalog Resource Deployment Artifact Properties [Documentation] Set up Deployment Artiface properties [Arguments] ${catalog_service_id} ${catalog_parent_service_id} ${catalog_resource_unique_id} ${blueprint_file} @@ -624,8 +625,8 @@ Get SDC Software Product Add SDC Catalog Resource [Documentation] Creates an SDC 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} + [Arguments] ${license_agreement_id} ${software_product_name} ${license_model_name} ${software_product_id} ${resourceType}=VF + ${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} resource_type=${resourceType} Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER} ${data}= Templating.Apply Template sdc ${SDC_CATALOG_RESOURCE_TEMPLATE} ${map} ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_RESOURCES_PATH} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION} @@ -794,11 +795,11 @@ Upload SDC Heat Package Add SDC Catalog Service [Documentation] Creates an SDC Catalog Service and returns its id - [Arguments] ${catalog_service_name} + [Arguments] ${catalog_service_name} ${instantiationType}=A-la-carte ${uuid}= Generate UUID4 ${shortened_uuid}= Evaluate str("${uuid}")[:23] ${catalog_service_name}= Set Variable If '${catalog_service_name}' =='' ${shortened_uuid} ${catalog_service_name} - ${map}= Create Dictionary service_name=${catalog_service_name} + ${map}= Create Dictionary service_name=${catalog_service_name} instantiation_type=${instantiationType} Templating.Create Environment sdc ${GLOBAL_TEMPLATE_FOLDER} ${data}= Templating.Apply Template sdc ${SDC_CATALOG_SERVICE_TEMPLATE} ${map} ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH} ${data} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION} @@ -974,8 +975,8 @@ Create Multi Part Set To Dictionary ${addTo} ${partName}=${partData} -Add CDS Parameters - [Arguments] ${catalog_service_name} +Add CDS Parameters + [Arguments] ${catalog_service_name} ${resp}= SDC.Run Get Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/serviceName/${catalog_service_name}/serviceVersion/0.1 ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION} #${resp_json}= To Json ${resp} ${service_uuid}= Set Variable ${resp.json()['uniqueId']} @@ -986,9 +987,18 @@ Add CDS Parameters ... ELSE IF '${input['name']}' == "sdnc_model_name" Set Input Parameter ${service_uuid} ${component_uuid} ${input} string test ... ELSE IF '${input['name']}' == "sdnc_model_version" Set Input Parameter ${service_uuid} ${component_uuid} ${input} string 1.0.0 ... ELSE IF '${input['name']}' == "skip_post_instantiation_configuration" Set Input Parameter ${service_uuid} ${component_uuid} ${input} boolean false - -Set Input Parameter - [Arguments] ${service_uuid} ${component_uuid} ${input} ${input_type} ${input_value} - ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${service_uuid}/resourceInstance/${component_uuid}/inputs {"constraints":[],"name":"${input['name']}","parentUniqueId":"${input['parentUniqueId']}","password":false,"required":false,"schema":{"property":{}},"type":"${input_type}","uniqueId":"${input['uniqueId']}","value":"${input_value}","definition":false,"toscaPresentation":{"ownerId":"${input['ownerId']}"}} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION} + +Set Input Parameter + [Arguments] ${service_uuid} ${component_uuid} ${input} ${input_type} ${input_value} + ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${service_uuid}/resourceInstance/${component_uuid}/inputs {"constraints":[],"name":"${input['name']}","parentUniqueId":"${input['parentUniqueId']}","password":false,"required":false,"schema":{"property":{}},"type":"${input_type}","uniqueId":"${input['uniqueId']}","value":"${input_value}","definition":false,"toscaPresentation":{"ownerId":"${input['ownerId']}"}} ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION} Should Be Equal As Strings ${resp.status_code} 200 + + +Get Service Model Parameter from SDC Service Catalog + [Documentation] Returns Service Model UUID + [Arguments] ${service_name} ${parameter_name} + ${resp}= SDC.Run Get Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/serviceName/${service_name}/serviceVersion/1.0 ${SDC_DESIGNER_USER_ID} auth=${GLOBAL_SDC_AUTHENTICATION} + ${json_resp}= Set Variable ${resp.json()} + ${parameter_value}= Set Variable ${json_resp["${parameter_name}"]} + [Return] ${parameter_value}
\ No newline at end of file diff --git a/robot/resources/so/add_service_recipe.robot b/robot/resources/so/add_service_recipe.robot new file mode 100644 index 00000000..bd999cbd --- /dev/null +++ b/robot/resources/so/add_service_recipe.robot @@ -0,0 +1,52 @@ +*** Settings *** +Documentation Creates a macro service recipe in SO Catalog DB + +Library OperatingSystem +Library Collections +Library ONAPLibrary.SO WITH NAME SO +Library ONAPLibrary.Templating WITH NAME Templating + + +*** Variables *** +${SERVICE_RECIPE_PATH} /serviceRecipe + +${SYSTEM USER} robot-ete +${SO_ADD_SERVICE_RECIPE} so/service_recipe.jinja + + + +*** Keywords *** +Add Service Recipe + [Documentation] Creates a macro service recipe in SO Catalog DB + [Arguments] ${service_model_UUID} ${orchestrationUri} + ${id}= Get First Free Service Recipe Id + ${arguments}= Create Dictionary service_model_UUID=${service_model_UUID} orchestrationUri=${orchestrationUri} id=${id} + Templating.Create Environment so ${GLOBAL_TEMPLATE_FOLDER} + ${data}= Templating.Apply Template so ${SO_ADD_SERVICE_RECIPE} ${arguments} + ${auth}= Create List ${GLOBAL_SO_CATDB_USERNAME} ${GLOBAL_SO_PASSWORD} + ${get_resp}= SO.Run Post Request ${GLOBAL_SO_CATDB_ENDPOINT} ${SERVICE_RECIPE_PATH} ${data} auth=${auth} + Should Be Equal As Strings ${get_resp.status_code} 201 + [Return] ${get_resp.status_code} ${get_resp.json()} + +Get Service Recipe + [Documentation] Gets service recipe/s in SO + [Arguments] ${service_id}= + ${auth}= Create List ${GLOBAL_SO_CATDB_USERNAME} ${GLOBAL_SO_PASSWORD} + ${get_resp}= SO.Run Get Request ${GLOBAL_SO_CATDB_ENDPOINT} ${SERVICE_RECIPE_PATH}/${service_id} auth=${auth} + Should Be Equal As Strings ${get_resp.status_code} 200 + [Return] ${get_resp} + +Get First Free Service Recipe Id + [Documentation] Gets first free service recipe id in SO + ${get_resp}= Get Service Recipe + ${source data}= Set Variable ${get_resp.json()} + Log ${source data} + ${serviceRecipes}= Set Variable ${source data['_embedded']['serviceRecipe']} + ${ids}= Create List + :FOR ${recipe} IN @{serviceRecipes} + \ ${id}= Get From Dictionary ${recipe} id + \ Append To List ${ids} ${id} + Sort list ${ids} + ${biggest_id}= Get From List ${ids} -1 + Log Biggest id is ${biggest_id} first free is ${biggest_id+1} + [Return] ${biggest_id+1} diff --git a/robot/resources/test_templates/model_test_template.robot b/robot/resources/test_templates/model_test_template.robot index 8cfecc25..7c40e496 100644 --- a/robot/resources/test_templates/model_test_template.robot +++ b/robot/resources/test_templates/model_test_template.robot @@ -11,15 +11,17 @@ Resource ../sdc_interface.robot *** Variables *** ${SDC_ASSETS_DIRECTORY} ${GLOBAL_HEAT_TEMPLATES_FOLDER} ${SDC_ZIP_DIRECTORY} ${SDC_ASSETS_DIRECTORY}/temp +${SDC_TOSCA_ONBOARDING_PACKAGES_DIRECTORY} ${GLOBAL_TOSCA_ONBOARDING_PACKAGES_FOLDER} +${SDC_CSAR_DIRECTORY} ${SDC_TOSCA_ONBOARDING_PACKAGES_DIRECTORY}/temp *** Keywords *** Model Distribution For Directory With Teardown - [Arguments] ${service} ${catalog_service_name}= ${cds}=None + [Arguments] ${service} ${catalog_service_name}= ${cds}=False ${catalog_service_name} ${catalog_resource_name} ${vf_modules} ${catalog_resources} ${catalog_resource_ids} ${catalog_service_id}= Model Distribution For Directory ${service} ${catalog_service_name} ${cds} [Teardown] Teardown Models ${catalog_service_id} ${catalog_resource_ids} - + Model Distribution For Directory - [Arguments] ${service} ${catalog_service_name}= ${cds}=None + [Arguments] ${service} ${catalog_service_name}= ${cds}=False ${instantiationType}=A-la-carte ${resourceType}=VF ServiceMapping.Set Directory default ${GLOBAL_SERVICE_MAPPING_DIRECTORY} ${directory_list}= ServiceMapping.Get Service Folder Mapping default ${service} ${ziplist}= Create List @@ -27,6 +29,14 @@ Model Distribution For Directory ${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} + Run Keyword If '${resourceType}'=='PNF' Create CSARSs in SDC Onboarding Packages Directory ${directory_list} ${ziplist} + ... ELSE Create ZIPs in SDC ZIP Directory ${directory_list} ${ziplist} + ${catalog_service_name} ${catalog_resource_name} ${vf_modules} ${catalog_resource_ids} ${catalog_service_id} ${catalog_resources} Distribute Model From SDC ${ziplist} ${catalog_service_name} ${cds} ${service} instantiationType=${instantiationType} resourceType=${resourceType} + Download CSAR ${catalog_service_id} + [Return] ${catalog_service_name} ${catalog_resource_name} ${vf_modules} ${catalog_resources} ${catalog_resource_ids} ${catalog_service_id} + +Create ZIPs in SDC ZIP Directory + [Arguments] ${directory_list} ${ziplist} :FOR ${directory} IN @{directory_list} \ ${zipname}= Replace String ${directory} / _ \ ${zip}= Catenate ${SDC_ZIP_DIRECTORY}/${zipname}.zip @@ -34,9 +44,38 @@ Model Distribution For Directory \ OperatingSystem.Create Directory ${SDC_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 SDC ${ziplist} ${catalog_service_name} ${cds} ${service} - Download CSAR ${catalog_service_id} - [Return] ${catalog_service_name} ${catalog_resource_name} ${vf_modules} ${catalog_resources} ${catalog_resource_ids} ${catalog_service_id} + [Return] ${ziplist} + +Create CSARSs in SDC Onboarding Packages Directory + [Arguments] ${directory_list} ${ziplist} + :FOR ${directory} IN @{directory_list} + \ ${zipname}= Replace String ${directory} / _ + \ ${csar}= Catenate ${SDC_CSAR_DIRECTORY}/${zipname}.csar + \ ${folder}= Catenate ${SDC_TOSCA_ONBOARDING_PACKAGES_DIRECTORY}/${directory} + \ OperatingSystem.Create Directory ${SDC_TOSCA_ONBOARDING_PACKAGES_DIRECTORY}/temp + \ Create Zip From Files In Directory ${folder} ${csar} sub_directories=${true} + \ Append To List ${ziplist} ${csar} + [Return] ${ziplist} + +TOSCA Based PNF Model Distribution For Directory + [Arguments] ${service} ${catalog_service_name}= + ServiceMapping.Set Directory default ${GLOBAL_SERVICE_MAPPING_DIRECTORY} + ${directory_list}= ServiceMapping.Get Service Folder Mapping default ${service} + ${csarlist}= 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} / _ + \ ${csar}= Catenate ${SDC_CSAR_DIRECTORY}/${zipname}.csar + \ ${folder}= Catenate ${SDC_TOSCA_ONBOARDING_PACKAGES_DIRECTORY}/${directory} + \ OperatingSystem.Create Directory ${SDC_TOSCA_ONBOARDING_PACKAGES_DIRECTORY}/temp + \ Create Zip From Files In Directory ${folder} ${csar} sub_directories=${true} + \ Append To List ${csarlist} ${csar} + ${catalog_service_name} ${catalog_resource_name} ${catalog_resource_ids} ${catalog_service_id} ${catalog_resources} Distribute TOSCA Model From SDC ${csarlist} ${catalog_service_name} ${service} + Download CSAR ${catalog_service_id} + [Return] ${catalog_service_name} ${catalog_resource_name} ${catalog_resources} Teardown Models [Documentation] Clean up at the end of the test diff --git a/robot/resources/test_templates/pnf_orchestration_test_template.robot b/robot/resources/test_templates/pnf_orchestration_test_template.robot new file mode 100644 index 00000000..0e7d9025 --- /dev/null +++ b/robot/resources/test_templates/pnf_orchestration_test_template.robot @@ -0,0 +1,32 @@ +*** Settings *** +Documentation This test template encapsulates the VNF Orchestration use case. + +Resource ../vid/create_service_instance.robot +Resource ../vid/vid_interface.robot +Resource ../aai/service_instance.robot +Resource model_test_template.robot +Resource ../openstack/neutron_interface.robot + + +Library ONAPLibrary.Openstack +Library SeleniumLibrary +Library Collections +Library ONAPLibrary.Utilities + +*** Keywords *** + +Orchestrate PNF + [Documentation] Use ONPA to Orchestrate a PNF Macro service. + [Arguments] ${customer_name} ${service} ${product_family} ${pnf_correlation_id} ${tenant_id} ${tenant_name} ${service_model_type} ${project_name}=Project-Demonstration ${owning_entity}=OE-Demonstration + ${lcp_region}= Get Openstack Region + ${uuid}= Generate UUID4 + ${full_customer_name}= Catenate ${customer_name}_${uuid} + ${list}= Create List + ${service_name}= Catenate Service_Ete_Name${uuid} + ${service_type}= Set Variable ${service} + Create Customer For VNF ${full_customer_name} ${full_customer_name} INFRA ${service_type} ${GLOBAL_AAI_CLOUD_OWNER} ${tenant_id} + Setup Browser + Login To VID GUI + ${service_instance_id} ${request_id}= Wait Until Keyword Succeeds 300s 5s Create VID PNF Service Instance ${full_customer_name} ${service_model_type} ${service} ${service_name} ${project_name} ${owning_entity} ${product_family} ${lcp_region} ${tenant_name} ${pnf_correlation_id} + Validate Service Instance ${service_instance_id} ${service} ${full_customer_name} + [Return] ${service} ${request_id} ${full_customer_name} diff --git a/robot/resources/test_templates/pnf_registration_without_SO_template.robot b/robot/resources/test_templates/pnf_registration_without_SO_template.robot index c33a94a2..6da031f5 100644 --- a/robot/resources/test_templates/pnf_registration_without_SO_template.robot +++ b/robot/resources/test_templates/pnf_registration_without_SO_template.robot @@ -1,7 +1,11 @@ *** Settings *** Documentation PNF Registration Handler (PRH) test cases Resource ../aai/aai_interface.robot +Resource ../sdc_interface.robot Resource ../mr_interface.robot +Resource ../so/add_service_recipe.robot +Resource ../test_templates/pnf_orchestration_test_template.robot +Resource ../demo_preload.robot Library ONAPLibrary.Openstack Library OperatingSystem Library RequestsLibrary @@ -10,19 +14,24 @@ Library ONAPLibrary.JSON Library ONAPLibrary.Utilities Library ONAPLibrary.Templating WITH NAME Templating Library ONAPLibrary.AAI WITH NAME AAI +Library ONAPLibrary.SDC WITH NAME SDC *** Variables *** ${aai_so_registration_entry_template}= aai/add_pnf_registration_info.jinja ${pnf_ves_integration_request}= ves/pnf_registration_request.jinja -${DMAAP_MESSAGE_ROUTER_UNAUTHENTICATED_PNF_PATH} /events/unauthenticated.PNF_READY/2/1 +${DMAAP_MESSAGE_ROUTER_UNAUTHENTICATED_VES_PNFREG_OUTPUT_PATH} /events/unauthenticated.VES_PNFREG_OUTPUT/2/1 ${VES_ENDPOINT} ${GLOBAL_DCAE_VES_PROTOCOL}://${GLOBAL_INJECTED_DCAE_VES_HOST}:${GLOBAL_DCAE_VES_SERVER_PORT} ${VES_data_path} /eventListener/v7 +${SDC_CATALOG_SERVICES_PATH} /sdc2/rest/v1/catalog/services +${SDC_DESIGNER_USER_ID} cs0008 *** Keywords *** Create A&AI antry without SO and succesfully registrate PNF [Documentation] Test case template for create A&AI antry without SO and succesfully registrate PNF [Arguments] ${PNF_entry_dict} + Send VES integration request ${PNF_entry_dict} + Wait Until Keyword Succeeds 10x 5s Check VES_PNFREG_OUTPUT topic presence in MR Create PNF initial entry in A&AI ${PNF_entry_dict} Send VES integration request ${PNF_entry_dict} Verify PNF Integration Request in A&AI ${PNF_entry_dict} @@ -72,18 +81,12 @@ Query PNF A&AI updated entry Should Be Equal As Strings ${json_resp["pnf-name"]} ${PNF_entry_dict.correlation_id} Log PNF integration request in A&AI has been verified and contains all necessary entries -Query PNF MR entry - [Documentation] Query PNF MR updated entry - [Arguments] ${PNF_entry_dict} - ${get_resp}= Run MR Get Request ${DMAAP_MESSAGE_ROUTER_UNAUTHENTICATED_PNF_PATH} +Check VES_PNFREG_OUTPUT topic presence in MR + [Documentation] Verify if unauthenticated.VES_PNFREG_OUTPUT topic is present in MR + [Arguments] + ${get_resp}= Run MR Get Request ${DMAAP_MESSAGE_ROUTER_UNAUTHENTICATED_VES_PNFREG_OUTPUT_PATH} Should Be Equal As Strings ${get_resp.status_code} 200 - ${json_resp_item}= Get From List ${get_resp.json()} 0 - ${json}= evaluate json.loads('${json_resp_item}') json - Log JSON recieved from MR ${DMAAP_MESSAGE_ROUTER_UNAUTHENTICATED_PNF_PATH} endpoint ${json} - Should Be Equal As Strings ${json["ipaddress-v4-oam"]} ${PNF_entry_dict.PNF_IPv4_address} - Should Be Equal As Strings ${json["ipaddress-v6-oam"]} ${PNF_entry_dict.PNF_IPv6_address} - Should Be Equal As Strings ${json["correlationId"]} ${PNF_entry_dict.correlation_id} - Log PNF integration request in MR has been verified and contains all necessary entries + Log unauthenticated.VES_PNFREG_OUTPUT topic is present in MR Run VES HTTP Post Request [Documentation] Runs a VES Post request @@ -102,3 +105,38 @@ Cleanup PNF entry in A&AI [Arguments] ${PNF_entry_dict} ${del_resp}= Delete A&AI Entity /network/pnfs/pnf/${PNF_entry_dict.correlation_id} Log Teardown complete + + +Check SO service completition status + [Documentation] Gets service status and compares with expected status + [Arguments] ${request_id} ${so_expected_status} + ${auth}= Create List ${GLOBAL_SO_USERNAME} ${GLOBAL_SO_PASSWORD} + ${so_status_request}= SO.Run Get Request ${GLOBAL_SO_ENDPOINT} ${request_id} auth=${auth} + ${so_status_request_data}= Set Variable ${so_status_request.json()} + ${so_status}= Set Variable ${so_status_request_data['request']['requestStatus']['requestState']} + Should Be Equal As Strings ${so_status} ${so_expected_status} + + +Design, create, instantiate PNF/macro service and succesfully registrate PNF template + [Documentation] Test case template for design, create, instantiate PNF/macro service and succesfully registrate PNF + [Arguments] ${service_name} ${PNF_entry_dict} ${pnf_correlation_id} ${service}=pNF ${product_family}=gNB + + Log To Console \nDistributing TOSCA Based PNF Model + ${status} ${value}= Run Keyword And Ignore Error Distribute Model ${service} ${service_name} cds=False instantiationType=Macro resourceType=PNF + ${distribution_status_value} Get Service Model Parameter from SDC Service Catalog ${service_name} distributionStatus + Run Keyword If "${value}"=='409 != 201' Log To Console TOSCA Based PNF Model is already distributed with status ${distribution_status_value} + ... ELSE IF "${status}"=='PASS' Log To Console TOSCA Based PNF Model has been distributed + ... ELSE Log To Console Check Model Distribution for PNF + ${UUID}= Get Service Model Parameter from SDC Service Catalog ${service_name} uuid + Get First Free Service Recipe Id + Log To Console Creating Service Recipe for TOSCA Based PNF Model + ${status} ${value}= Run Keyword And Ignore Error Add Service Recipe ${UUID} mso/async/services/CreateVcpeResCustService_simplified + Run Keyword If "${value}"=='409 != 201' Log To Console Service Recipe for TOSCA Based PNF Model is already assigned + ... ELSE IF "${status}"=='PASS' Log To Console Service Recipe for TOSCA Based PNF Model has been assigned + ... ELSE Log To Console Check Service Recipe for TOSCA Based PNF Model assignmenta + ${tenant_id} ${tenant_name}= Setup Orchestrate VNF ${GLOBAL_AAI_CLOUD_OWNER} SharedNode OwnerType v1 CloudZone + ${service} ${request_id} ${full_customer_name} Orchestrate PNF ETE_Customer ${service} ${product_family} ${pnf_correlation_id} ${tenant_id} ${tenant_name} ${service_name} + Send VES integration request ${PNF_entry_dict} + Verify PNF Integration Request in A&AI ${PNF_entry_dict} + Wait Until Keyword Succeeds 30s 5s Check SO service completition status ${request_id} COMPLETE + ${auth}= Create List ${GLOBAL_SO_USERNAME} ${GLOBAL_SO_PASSWORD} diff --git a/robot/resources/vid/create_service_instance.robot b/robot/resources/vid/create_service_instance.robot index 46a142b7..6bb19f49 100644 --- a/robot/resources/vid/create_service_instance.robot +++ b/robot/resources/vid/create_service_instance.robot @@ -40,6 +40,49 @@ Create VID Service Instance SO.Run Polling Get Request ${GLOBAL_SO_ENDPOINT} ${GLOBAL_SO_STATUS_PATH}${request_id} auth=${auth} [return] ${service_instance_id} +Create VID PNF Service Instance + [Documentation] Creates a PNF/macro service instance using VID + [Arguments] ${customer_name} ${service_model_type} ${service_type} ${service_name} ${project_name} ${owning_entity} ${product_family} ${lcp_region} ${tenant} ${pnf_correlation_id} + Wait Until Keyword Succeeds 180s 15s Wait For Model ${service_model_type} + Press Key xpath=//tr[td/span/text() = '${service_model_type}']/td/button[text() = 'Deploy' and not(@disabled)] \\13 + ${uuid}= Generate UUID4 + Wait Until Page Contains Element xpath=//input[@parameter-name='PNF (Correlation) ID'] ${GLOBAL_VID_UI_TIMEOUT_LONG} + Wait Until Element Is Visible xpath=//input[@parameter-name='PNF (Correlation) ID'] ${GLOBAL_VID_UI_TIMEOUT_LONG} + Click On Element When Visible //select[@prompt='Select Subscriber Name'] + Select From List When Enabled //select[@prompt='Select Subscriber Name'] ${customer_name} timeout=${GLOBAL_VID_UI_TIMEOUT_LONG} + Wait Until Keyword Succeeds 10s 5s Select From List By Label xpath=//select[@parameter-id='productFamily'] ${product_family} + Wait Until Keyword Succeeds 10s 5s Select From List When Enabled //select[@parameter-id='serviceType'] ${service_type} timeout=${GLOBAL_VID_UI_TIMEOUT_LONG} + ${cloud_owner_uc}= Convert To Uppercase ${GLOBAL_AAI_CLOUD_OWNER} + Wait Until Keyword Succeeds 10s 5s Select From List By Label xpath=//select[@parameter-id='lcpRegion'] ${lcp_region} (${cloud_owner_uc}) + Wait Until Keyword Succeeds 10s 5s Select From List By Label xpath=//select[@parameter-id='tenant'] ${tenant} + Wait Until Keyword Succeeds 10s 5s Select From List When Enabled //select[@prompt='Select Project Name'] ${project_name} timeout=${GLOBAL_VID_UI_TIMEOUT_LONG} + Wait Until Keyword Succeeds 10s 5s Select From List By Label xpath=//select[@parameter-id='owningEntity'] ${owning_entity} + Capture Page Screenshot + Page Should Contain Element //input[@parameter-name='PNF (Correlation) ID'] limit=1 + Set Focus To Element //input[@parameter-name='PNF (Correlation) ID'] + Wait Until Keyword Succeeds 120s 5s Input Text When Enabled //input[@parameter-name='PNF (Correlation) ID'] ${pnf_correlation_id} timeout=${GLOBAL_VID_UI_TIMEOUT_LONG} + Capture Page Screenshot + Click On Button When Enabled //div[@class = 'buttonRow']/button[text() = 'Confirm'] + Capture Page Screenshot + Wait Until Element Contains xpath=//pre[@class= 'log ng-binding'] requestState timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM} + Capture Page Screenshot + Wait Until Page Contains "requestState": "IN_PROGRESS" timeout= ${GLOBAL_VID_UI_TIMEOUT_LONG} + Capture Page Screenshot + ${response text}= Get Text xpath=//pre[@class = 'log ng-binding'] + Click On Button When Enabled //div[@class = 'buttonRow']/button[text() = 'Close'] + Sleep 10 + Capture Page Screenshot + ${request_id}= Parse Request Id ${response text} + ${service_instance_id}= Parse Instance Id ${response text} + ${auth}= Create List ${GLOBAL_SO_USERNAME} ${GLOBAL_SO_PASSWORD} + ${so_status_request}= SO.Run Get Request ${GLOBAL_SO_ENDPOINT} ${GLOBAL_SO_STATUS_PATH}${request_id} auth=${auth} + ${so_status_request_data}= Set Variable ${so_status_request.json()} + Log ${so_status_request_data} + ${so_status}= Set Variable ${so_status_request_data['request']['requestStatus']['requestState']} + Should Be Equal As Strings ${so_status} IN_PROGRESS + [return] ${service_instance_id} ${GLOBAL_SO_STATUS_PATH}${request_id} + + Wait For Model [Documentation] Distributed model may not yet be available. Kepp trying until it shows up. [Arguments] ${service_model_type} |