Report test failure when Delete VNF fails

Issue-ID: TEST-54
Change-Id: Id92f2bbdcc967f44024c8f3aa53d45f82616ea9f
Signed-off-by: Jerry Flood <jf9860@att.com>
diff --git a/robot/resources/aai/service_instance.robot b/robot/resources/aai/service_instance.robot
index 34ab1ea..31a4a61 100644
--- a/robot/resources/aai/service_instance.robot
+++ b/robot/resources/aai/service_instance.robot
@@ -50,6 +50,8 @@
     Dictionary Should Contain Value	${generic_vnf.json()}    ${vnf_name}
     ${returned_vnf_type}=    Get From Dictionary    ${generic_vnf.json()}    vnf-type
     Should Contain	${returned_vnf_type}    ${vnf_type}
+    ${vnf_id}=    Get From Dictionary    ${generic_vnf.json()}    vnf-id
+    ${generic_vnf}=    Run A&AI Get Request      ${INDEX PATH}/network/generic-vnfs/generic-vnf/${vnf_id}?depth=all
     [Return]    ${generic_vnf.json()}
 
 VLB Closed Loop Hack
diff --git a/robot/resources/test_templates/vnf_orchestration_test_template.robot b/robot/resources/test_templates/vnf_orchestration_test_template.robot
index 1d53da1..1e3bd76 100644
--- a/robot/resources/test_templates/vnf_orchestration_test_template.robot
+++ b/robot/resources/test_templates/vnf_orchestration_test_template.robot
@@ -135,7 +135,7 @@
     ${lcp_region}=   Get Openstack Region
     Teardown VVG Server
     Teardown VLB Closed Loop Hack
-    Teardown VID   ${SERVICE_INSTANCE_ID}   ${lcp_region}   ${TENANT_ID}
+    Teardown VID   ${SERVICE_INSTANCE_ID}   ${lcp_region}   ${TENANT_NAME}   ${CUSTOMER_NAME}
     Log    VNF Deleted
 
 Teardown VNF
diff --git a/robot/resources/vid/teardown_vid.robot b/robot/resources/vid/teardown_vid.robot
index df40b9e..3a0697e 100644
--- a/robot/resources/vid/teardown_vid.robot
+++ b/robot/resources/vid/teardown_vid.robot
@@ -12,24 +12,29 @@
 *** Variables ***
 ${VID_ENV}            /vid
 ${VID_SERVICE_MODELS_SEARCH_URL}  ${GLOBAL_VID_SERVER_PROTOCOL}://${GLOBAL_INJECTED_VID_IP_ADDR}:${GLOBAL_VID_SERVER_PORT}${VID_ENV}/serviceModels.htm#/instances/services
+${TEARDOWN_STATUS}   FAIL
+
 *** Keywords ***
 
 Teardown VID
     [Documentation]   Teardown the VID This assumes that the any runnign stacks have been torn down
-    [Arguments]    ${service_instance_id}    ${lcp_region}    ${tenant}
+    [Arguments]    ${service_instance_id}    ${lcp_region}    ${tenant}   ${customer}
     Return From Keyword If   len('${service_instance_id}') == 0
     # Keep going to the VID service instance until we get the pop-up alert that there is no service instance
-    Wait Until Keyword Succeeds    300s    1s    Delete VID    ${service_instance_id}    ${lcp_region}    ${tenant}
+    Set Test Variable    ${TEARDOWN_STATUS}    FAIL
+    Wait Until Keyword Succeeds    300s    1s    Delete VID    ${service_instance_id}    ${lcp_region}    ${tenant}   ${customer}
+    Return From Keyword If   '${TEARDOWN_STATUS}' == 'PASS'
+    Fail   ${TEARDOWN_STATUS}
 
 
 Delete VID
     [Documentation]    Teardown the next VID entity that has a Remove icon.
-    [Arguments]    ${service_instance_id}    ${lcp_region}    ${tenant}
+    [Arguments]    ${service_instance_id}    ${lcp_region}    ${tenant}   ${customer}
     # For vLB closed loop, we may have 2 vf modules and the vDNS one needs to be removed first.
     ${remove_order}=    Create List    vDNS_Ete   Vfmodule_Ete
 
     # FAIL status is returned in ${vfmodule} because FAIL are ignored during teardown
-    ${status}    ${vfmodule}=   Run Keyword and Ignore Error   Delete Next VID Entity    ${service_instance_id}    ${lcp_region}    ${tenant}   ${remove_order}
+    ${status}    ${vfmodule}=   Run Keyword and Ignore Error   Delete Next VID Entity    ${service_instance_id}    ${lcp_region}    ${tenant}   ${remove_order}   ${customer}
     Return From Keyword If    '${status}' == 'FAIL'
     Return From Keyword If    '${vfmodule}' == 'FAIL'
     # After tearing down a VF module, execute the reverse HB for it to remove the references from A&AI
@@ -38,7 +43,7 @@
 
 Delete Next VID Entity
     [Documentation]    Teardown the next VID entity that has a Remove icon.
-    [Arguments]    ${service_instance_id}    ${lcp_region}    ${tenant}   ${remove_order}
+    [Arguments]    ${service_instance_id}    ${lcp_region}    ${tenant}   ${remove_order}   ${customer}
     ${vfmodule}=    Catenate
     Go To    ${VID_SERVICE_MODELS_SEARCH_URL}
     Wait Until Page Contains    Please search by    timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
@@ -46,14 +51,17 @@
     Wait Until Element Is Not Visible    xpath=//div[@class='statusLine aaiHidden']    timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
 
     # If we don't wait for this control to be enabled, the submit results in a 'not found' pop-up (UnexpectedAlertPresentException)
-    Input Text When Enabled    //input[@name='selectedServiceInstance']    ${service_instance_id}
+    Select From List By Label    //select[@ng-model='selectedCustomer']    ${customer}
+    Click Button    button=Submit
 
     # When Handle alert detects a pop-up. it will return FAIL and we are done
     # Return from Keyword is required because FAIL is inored during teardown
+    Set Test Variable   ${TEARDOWN_STATUS}   PASS
     ${status}   ${value}   Run Keyword And Ignore Error    Handle Alert
     Return From Keyword If   '${status}' == 'FAIL'   ${status}
     ${status}   ${value}   Run Keyword And Ignore Error    Wait Until Page Contains Element    link=View/Edit    timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
     Return From Keyword If   '${status}' == 'FAIL'   ${status}
+    Set Test Variable   ${TEARDOWN_STATUS}   FAIL
 
 
     Click Element     link=View/Edit