From dadd0e69a24c6a43534086cb04672dc6d4ddc18b Mon Sep 17 00:00:00 2001 From: krzysztof kuzmicki Date: Wed, 31 Jul 2019 20:08:36 +0200 Subject: ROBOT test cases improvements for PnP PNF in El Alto release Issue-ID: INT-1179 Signed-off-by: Krzysztof Kuzmicki Change-Id: I7b840e4fa53c9058d74872cbaf3e1922651b7997 --- .../test_templates/model_test_template.robot | 51 +++++++++++++++--- .../pnf_orchestration_test_template.robot | 32 +++++++++++ .../pnf_registration_without_SO_template.robot | 62 +++++++++++++++++----- 3 files changed, 127 insertions(+), 18 deletions(-) create mode 100644 robot/resources/test_templates/pnf_orchestration_test_template.robot (limited to 'robot/resources/test_templates') 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} -- cgit 1.2.3-korg