DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation The main interface for interacting with VID. It handles low level stuff like managing the selenium request library and VID required steps |
DR695H | 910097e | 2019-05-08 13:55:32 -0400 | [diff] [blame] | 3 | Library SeleniumLibrary |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 4 | Library Collections |
| 5 | Library String |
| 6 | Library StringTemplater |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 7 | Library UUID |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 8 | Resource vid_interface.robot |
| 9 | Resource create_vid_vnf.robot |
| 10 | Resource create_service_instance.robot |
DR695H | 910097e | 2019-05-08 13:55:32 -0400 | [diff] [blame] | 11 | Resource ../heatbridge.robot |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 12 | |
| 13 | *** Variables *** |
| 14 | ${VID_ENV} /vid |
DR695H | bf5a3a3 | 2017-06-30 13:09:57 -0400 | [diff] [blame] | 15 | ${VID_SERVICE_MODELS_SEARCH_URL} ${GLOBAL_VID_SERVER_PROTOCOL}://${GLOBAL_INJECTED_VID_IP_ADDR}:${GLOBAL_VID_SERVER_PORT}${VID_ENV}/serviceModels.htm#/instances/services |
Jerry Flood | fe79d7f | 2017-11-22 17:32:18 -0500 | [diff] [blame] | 16 | ${TEARDOWN_STATUS} FAIL |
| 17 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 18 | *** Keywords *** |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 19 | |
| 20 | Teardown VID |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 21 | [Documentation] Teardown the VID This assumes that the any runnign stacks have been torn down |
Jerry Flood | fe79d7f | 2017-11-22 17:32:18 -0500 | [diff] [blame] | 22 | [Arguments] ${service_instance_id} ${lcp_region} ${tenant} ${customer} |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 23 | Return From Keyword If len('${service_instance_id}') == 0 |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 24 | # Keep going to the VID service instance until we get the pop-up alert that there is no service instance |
Jerry Flood | fe79d7f | 2017-11-22 17:32:18 -0500 | [diff] [blame] | 25 | Set Test Variable ${TEARDOWN_STATUS} FAIL |
| 26 | Wait Until Keyword Succeeds 300s 1s Delete VID ${service_instance_id} ${lcp_region} ${tenant} ${customer} |
| 27 | Return From Keyword If '${TEARDOWN_STATUS}' == 'PASS' |
| 28 | Fail ${TEARDOWN_STATUS} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 29 | |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 30 | |
| 31 | Delete VID |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 32 | [Documentation] Teardown the next VID entity that has a Remove icon. |
Jerry Flood | fe79d7f | 2017-11-22 17:32:18 -0500 | [diff] [blame] | 33 | [Arguments] ${service_instance_id} ${lcp_region} ${tenant} ${customer} |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 34 | # For vLB closed loop, we may have 2 vf modules and the vDNS one needs to be removed first. |
Brian Freeman | a62644f | 2018-05-13 12:47:38 -0500 | [diff] [blame] | 35 | ${remove_order}= Create List vDNS_Ete vPKG Vfmodule_Ete |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 36 | |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 37 | # FAIL status is returned in ${vfmodule} because FAIL are ignored during teardown |
Jerry Flood | fe79d7f | 2017-11-22 17:32:18 -0500 | [diff] [blame] | 38 | ${status} ${vfmodule}= Run Keyword and Ignore Error Delete Next VID Entity ${service_instance_id} ${lcp_region} ${tenant} ${remove_order} ${customer} |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 39 | Return From Keyword If '${status}' == 'FAIL' |
| 40 | Return From Keyword If '${vfmodule}' == 'FAIL' |
| 41 | # After tearing down a VF module, execute the reverse HB for it to remove the references from A&AI |
| 42 | Run Keyword If 'Vfmodule_Ete' in '${vfmodule}' Execute Reverse Heatbridge |
| 43 | Fail Continue with Next Remove |
| 44 | |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 45 | Delete Next VID Entity |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 46 | [Documentation] Teardown the next VID entity that has a Remove icon. |
Jerry Flood | fe79d7f | 2017-11-22 17:32:18 -0500 | [diff] [blame] | 47 | [Arguments] ${service_instance_id} ${lcp_region} ${tenant} ${remove_order} ${customer} |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 48 | ${vfmodule}= Catenate |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 49 | Go To ${VID_SERVICE_MODELS_SEARCH_URL} |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 50 | Wait Until Page Contains Please search by timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM} |
| 51 | Wait Until Page Contains Element xpath=//div[@class='statusLine aaiHidden'] timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM} |
| 52 | Wait Until Element Is Not Visible xpath=//div[@class='statusLine aaiHidden'] timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM} |
| 53 | |
| 54 | # If we don't wait for this control to be enabled, the submit results in a 'not found' pop-up (UnexpectedAlertPresentException) |
Jerry Flood | fe79d7f | 2017-11-22 17:32:18 -0500 | [diff] [blame] | 55 | Select From List By Label //select[@ng-model='selectedCustomer'] ${customer} |
| 56 | Click Button button=Submit |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 57 | |
DR695H | 910097e | 2019-05-08 13:55:32 -0400 | [diff] [blame] | 58 | # When Handle VID Alert detects a pop-up. it will return FAIL and we are done |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 59 | # Return from Keyword is required because FAIL is inored during teardown |
Jerry Flood | fe79d7f | 2017-11-22 17:32:18 -0500 | [diff] [blame] | 60 | Set Test Variable ${TEARDOWN_STATUS} PASS |
DR695H | 910097e | 2019-05-08 13:55:32 -0400 | [diff] [blame] | 61 | ${status} ${value} Run Keyword And Ignore Error Handle VID Alert |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 62 | Return From Keyword If '${status}' == 'FAIL' ${status} |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 63 | ${status} ${value} Run Keyword And Ignore Error Wait Until Page Contains Element link=View/Edit timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM} |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 64 | Return From Keyword If '${status}' == 'FAIL' ${status} |
Jerry Flood | fe79d7f | 2017-11-22 17:32:18 -0500 | [diff] [blame] | 65 | Set Test Variable ${TEARDOWN_STATUS} FAIL |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 66 | |
| 67 | |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 68 | Click Element link=View/Edit |
| 69 | Wait Until Page Contains View/Edit Service Instance timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM} |
| 70 | Wait Until Element Is Visible xpath=//a/span[@class='glyphicon glyphicon-remove'] timeout=${GLOBAL_VID_UI_TIMEOUT_LONG} |
| 71 | |
DR695H | 910097e | 2019-05-08 13:55:32 -0400 | [diff] [blame] | 72 | :FOR ${remove_first} IN @{remove_order} |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 73 | \ ${remove_xpath}= Set Variable //li/div[contains(.,'${remove_first}')]/a/span[@class='glyphicon glyphicon-remove'] |
| 74 | \ ${status} ${data}= Run Keyword And Ignore Error Page Should Contain Element xpath=${remove_xpath} |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 75 | \ Exit For Loop If '${status}' == 'PASS' |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 76 | \ ${remove_xpath}= Set Variable //li/div/a/span[@class='glyphicon glyphicon-remove'] |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 77 | Click On Element When Visible xpath=${remove_xpath} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 78 | |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 79 | ${status} ${value}= Run Keyword and Ignore Error Wait Until Page Contains Element xpath=//select[@parameter-id='lcpRegion'] |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 80 | Run Keyword If '${status}'=='PASS' Select From List By Label xpath=//select[@parameter-id='lcpRegion'] ${lcp_region} |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 81 | Run Keyword If '${status}'=='PASS' Select From List By Label xpath=//select[@parameter-id='tenant'] ${tenant} |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 82 | ${status} ${vfmodule}= Run Keyword And Ignore Error Get Text xpath=//td[contains(text(), 'Vf Module Name')]/../td[2] |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 83 | Click Element xpath=//div[@class='buttonRow']/button[@ngx-enabled='true'] |
| 84 | #//*[@id="mContent"]/div/div/div/div/table/tbody/tr/td/div/div[2]/div/div[1]/div[5]/button[1] |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 85 | Wait Until Page Contains 100 % 300s |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 86 | ${response text}= Get Text xpath=//div[@ng-controller='deletionDialogController']//div[@ng-controller= 'msoCommitController']/pre[@class = 'log ng-binding'] |
| 87 | ${request_id}= Parse Request Id ${response text} |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 88 | Click Element xpath=//div[@class='ng-scope']/div[@class = 'buttonRow']/button[text() = 'Close'] |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 89 | Poll MSO Get Request ${GLOBAL_MSO_STATUS_PATH}${request_id} COMPLETE |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 90 | [Return] ${vfmodule} |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 91 | |
DR695H | 910097e | 2019-05-08 13:55:32 -0400 | [diff] [blame] | 92 | Handle VID Alert |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 93 | [Documentation] When service instance has been deleted, an alert will be triggered on the search to end the loop |
| 94 | ... The various Alert keywords did not prevent the alert exception on the Click ELement, hence this roundabout way of handling the alert |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 95 | Run Keyword And Ignore Error Click Element button=Submit |
DR695H | 910097e | 2019-05-08 13:55:32 -0400 | [diff] [blame] | 96 | ${status} ${t}= Run Keyword And Ignore Error Handle Alert |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 97 | Return From Keyword If '${status}' == 'FAIL' |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 98 | Fail ${t} |