Fix 5g_bulk_PM and pnf_registrate test case errors
[testsuite.git] / robot / resources / test_templates / pnf_registration_without_SO_template.robot
index e872598..fd8aaed 100644 (file)
@@ -1,6 +1,7 @@
 *** Settings ***
 Documentation     PNF Registration Handler (PRH) test cases
 Resource        ../aai/aai_interface.robot
+Resource        ../aai/create_customer.robot
 Resource        ../sdc_interface.robot
 Resource        ../mr_interface.robot
 Resource        ../so/add_service_recipe.robot
@@ -21,8 +22,11 @@ Library         ONAPLibrary.SO    WITH NAME     SO
 ${aai_so_registration_entry_template}=  aai/add_pnf_registration_info.jinja
 ${pnf_ves_integration_request}=  ves/pnf_registration_request.jinja
 ${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_ENDPOINT}    ${GLOBAL_DCAE_VES_HTTPS_PROTOCOL}://${GLOBAL_INJECTED_DCAE_VES_HOST}:${GLOBAL_DCAE_VES_HTTPS_SERVER_PORT}
 ${VES_data_path}   /eventListener/v7
+${tenant_name}    dummy_tenant_for_pnf
+${tenant_id}  dummy_tenant_id_for_pnf
+${region}   RegionForPNF
 
 
 *** Keywords ***
@@ -74,6 +78,14 @@ 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
 
+Check PNF orchestration status in A&AI
+    [Documentation]   Query PNF A&AI updated entry
+    [Arguments]  ${pnf_correlation_id}  ${status}
+    ${get_resp}=    AAI.Run Get Request    ${AAI_FRONTEND_ENDPOINT}    /aai/v19/network/pnfs/pnf/${pnf_correlation_id}    auth=${GLOBAL_AAI_AUTHENTICATION}
+    Should Be Equal As Strings  ${get_resp.status_code}        200
+    ${json_resp}=  Set Variable  ${get_resp.json()}
+    Should Be Equal As Strings  ${status}       ${json_resp['orchestration-status']}
+
 Check VES_PNFREG_OUTPUT topic presence in MR
     [Documentation]   Verify if unauthenticated.VES_PNFREG_OUTPUT topic is present in MR
     ${get_resp}=  Run MR Get Request  ${DMAAP_MESSAGE_ROUTER_UNAUTHENTICATED_VES_PNFREG_OUTPUT_PATH}
@@ -84,7 +96,8 @@ Run VES HTTP Post Request
     [Documentation]    Runs a VES Post request
     [Arguments]     ${data}
     Disable Warnings
-    ${session}=    Create Session       ves     ${VES_ENDPOINT}
+    ${auth}=  Create List   ${GLOBAL_DCAE_VES_USERNAME}    ${GLOBAL_DCAE_VES_PASSWORD}
+    ${session}=    Create Session       ves     ${VES_ENDPOINT}   auth=${auth}
     ${headers}=  Create Dictionary   Accept=application/json    Content-Type=application/json
     ${post_resp}=       Post Request    ves     ${VES_data_path}      data=${data}    headers=${headers}
     Log  PNF integration request ${data}
@@ -108,32 +121,32 @@ Check SO service completition status
     ${so_status}=    Set Variable     ${so_status_request_data['request']['requestStatus']['requestState']}
     Should Be Equal As Strings  ${so_status}     ${so_expected_status}
 
-
 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
-
+    [Arguments]    ${service_name}   ${PNF_entry_dict}   ${pnf_correlation_id}   ${service}=pNF    ${product_family}=pNF  ${customer_name}=ETE_Customer  ${building_block_flow}=false
     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
+    ${catalog_service_name}    ${catalog_resource_name}    ${vf_modules}   ${catalog_resources}    ${catalog_resource_ids}   ${catalog_service_id}  Model Distribution For Directory  ${service}  ${service_name}  cds=False   instantiationType=Macro  resourceType=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}
-    Wait Until Keyword Succeeds   120s  40s  Send and verify VES integration request in SO and A&AI   ${request_id}   ${PNF_entry_dict}
-
+    ${service_recipe_id}=   Run Keyword If  "${building_block_flow}"=='false'  Add Service Recipe  ${UUID}  mso/async/services/CreateVcpeResCustService_simplified
+    Inventory Tenant If Not Exists    CloudOwner   ${region}  SharedNode  OwnerType  v1  CloudZone  ${tenant_id}   ${tenant_name}
+    Load OwningEntity  project  Project-${customer_name}
+    Load OwningEntity  owningEntity  OE-${customer_name}
+    Load OwningEntity  lineOfBusiness  LOB-${customer_name}
+    Load OwningEntity  platform  Platform-${customer_name}
+    ${service_instance_id}  ${request_id}  ${full_customer_name}   Run Keyword If  "${building_block_flow}"=='false'  Orchestrate PNF Macro Flow   ${customer_name}   ${service}    ${product_family}  ${pnf_correlation_id}  ${tenant_id}   ${tenant_name}  ${service_name}  ${region}  Project-${customer_name}   OE-${customer_name}
+        ...  ELSE  Orchestrate PNF Building Block Flow   ${catalog_service_name}  ${customer_name}    ${service}    ${product_family}    ${pnf_correlation_id}   ${region}   project_name=Project-${customer_name}   owning_entity=OE-${customer_name}  lineOfBusinessName=LOB-${customer_name}   platformName=Platform-${customer_name}
+    Wait Until Keyword Succeeds   180s  40s  Send and verify VES integration request in SO and A&AI   ${request_id}   ${PNF_entry_dict}
+    Run Keyword If  "${building_block_flow}"=='true'  Check PNF orchestration status in A&AI  ${pnf_correlation_id}  Active
+    [Teardown]   Instantiate PNF_macro service Teardown      ${catalog_service_id}    ${catalog_resource_ids}  ${PNF_entry_dict}
 
 Send and verify VES integration request in SO and A&AI
     [Documentation]   Gets service status and compares with expected status
     [Arguments]    ${request_id}   ${PNF_entry_dict}
     Send VES integration request  ${PNF_entry_dict}
     Verify PNF Integration Request in A&AI  ${PNF_entry_dict}
-    Wait Until Keyword Succeeds   30s  10s  Check SO service completition status   ${request_id}   COMPLETE
\ No newline at end of file
+    Wait Until Keyword Succeeds   30s  10s  Check SO service completition status   ${request_id}   COMPLETE
+
+Instantiate PNF_macro service Teardown
+    [Arguments]  ${catalog_service_id}    ${catalog_resource_ids}  ${PNF_entry_dict}
+    Teardown Models  ${catalog_service_id}    ${catalog_resource_ids}
+    Cleanup PNF entry in A&AI  ${PNF_entry_dict}
\ No newline at end of file