Add teardown to pnf_registrate test cases 83/100683/1
authorKrzysztof Kuzmicki <krzysztof.kuzmicki@nokia.com>
Thu, 23 Jan 2020 13:37:30 +0000 (14:37 +0100)
committerKrzysztof Kuzmicki <krzysztof.kuzmicki@nokia.com>
Thu, 23 Jan 2020 13:37:30 +0000 (14:37 +0100)
Issue-ID: INT-1407

Signed-off-by: Krzysztof Kuzmicki <krzysztof.kuzmicki@nokia.com>
Change-Id: I65836640e554237d3ac5adfcfa1d9d0f502329d4

robot/resources/so/add_service_recipe.robot
robot/resources/test_templates/pnf_orchestration_test_template.robot
robot/resources/test_templates/pnf_registration_without_SO_template.robot
robot/testsuites/pnf-registration.robot

index 6d7fa03..a5dca69 100644 (file)
@@ -26,7 +26,7 @@ Add Service Recipe
     ${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()}
+    [Return]  ${id}
 
 Get Service Recipe
     [Documentation]    Gets service recipe/s in SO
@@ -50,3 +50,10 @@ Get First Free Service Recipe Id
     ${biggest_id}=  Get From List  ${ids}  -1
     Log  Biggest id is ${biggest_id} first free is ${biggest_id+1}
     [Return]  ${biggest_id+1}
+
+Delete Service Recipe
+     [Documentation]    Deletes service recipe/s in SO
+     [Arguments]    ${service_id}
+     ${auth}=  Create List  ${GLOBAL_SO_CATDB_USERNAME}    ${GLOBAL_SO_PASSWORD}
+     ${get_resp}=   SO.Run Delete Request   ${GLOBAL_SO_CATDB_ENDPOINT}    ${SERVICE_RECIPE_PATH}/${service_id}      auth=${auth}
+     Should Be Equal As Strings  ${get_resp.status_code}     201
\ No newline at end of file
index bb3f181..6877441 100644 (file)
@@ -31,7 +31,7 @@ Orchestrate PNF
     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}
     Wait Until Keyword Succeeds   60s   20s       Validate Service Instance    ${service_instance_id}    ${service}    ${full_customer_name}
-    [Return]     ${service}  ${request_id}  ${full_customer_name}
+    [Return]     ${service_instance_id}  ${request_id}  ${full_customer_name}
 
 
 Create Customer For PNF
index 0f36adc..63131b8 100644 (file)
@@ -115,27 +115,17 @@ Check SO service completition 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}=pNF  ${customer_name}=ETE_Customer
-
     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
+    ${service_recipe_id}=   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  lineOfBusiness  LOB-${customer_name}
-    Load OwningEntity  platform  Platform-${customer_name}
     Load OwningEntity  project  Project-${customer_name}
     Load OwningEntity  owningEntity  OE-${customer_name}
-    ${service}  ${request_id}  ${full_customer_name}   Orchestrate PNF   ${customer_name}   ${service}    ${product_family}  ${pnf_correlation_id}  ${tenant_id}   ${tenant_name}  ${service_name}   Project-${customer_name}   OE-${customer_name}
+    ${service_instance_id}  ${request_id}  ${full_customer_name}   Orchestrate PNF   ${customer_name}   ${service}    ${product_family}  ${pnf_correlation_id}  ${tenant_id}   ${tenant_name}  ${service_name}   Project-${customer_name}   OE-${customer_name}
     Wait Until Keyword Succeeds   120s  40s  Send and verify VES integration request in SO and A&AI   ${request_id}   ${PNF_entry_dict}
+    [Teardown]   Instantiate PNF_macro service Teardown      ${catalog_service_id}    ${catalog_resource_ids}  ${PNF_entry_dict}  ${service_instance_id}  ${service_recipe_id}
 
 
 Send and verify VES integration request in SO and A&AI
@@ -143,4 +133,10 @@ Send and verify VES integration request in SO and A&AI
     [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}  ${service_instance_id}  ${service_recipe_id}
+    Teardown Models  ${catalog_service_id}    ${catalog_resource_ids}
+    Delete Service Recipe  ${service_recipe_id}
+    Cleanup PNF entry in A&AI  ${PNF_entry_dict}
\ No newline at end of file
index ef299a5..1d3f899 100644 (file)
@@ -35,4 +35,5 @@ Instantiate PNF_macro service and succesfully registrate PNF
      [Tags]   pnf_registrate   ete
      ${pnf_correlation_id}=    Generate Random String  20  [LETTERS][NUMBERS]
      ${PNF_entry_dict}=  Create Dictionary  correlation_id=${pnf_correlation_id}  PNF_IPv4_address=13.13.13.13  PNF_IPv6_address=2001:0db8:0:0:0:0:1428:57ab
-     Instantiate PNF_macro service and succesfully registrate PNF template   Demo_pNF   ${PNF_entry_dict}   ${pnf_correlation_id}
+     ${PNF_service_model}=  Set Variable  Demo_pNF_${pnf_correlation_id}
+     Instantiate PNF_macro service and succesfully registrate PNF template   ${PNF_service_model}   ${PNF_entry_dict}   ${pnf_correlation_id}