blob: 80365a32e3723337f51b41d4d300d0b06f0c01b3 [file] [log] [blame]
DR695Hccff30b2017-02-17 18:44:24 -05001*** Settings ***
2Documentation The main interface for interacting with VID. It handles low level stuff like managing the selenium request library and VID required steps
DR695H910097e2019-05-08 13:55:32 -04003Library SeleniumLibrary
DR695Hccff30b2017-02-17 18:44:24 -05004Library Collections
5Library String
6Library StringTemplater
Jerry Floodf67ce0e2017-03-20 16:59:23 -04007Library UUID
DR695Hccff30b2017-02-17 18:44:24 -05008Resource vid_interface.robot
9Resource create_vid_vnf.robot
10Resource create_service_instance.robot
DR695H910097e2019-05-08 13:55:32 -040011Resource ../heatbridge.robot
DR695Hccff30b2017-02-17 18:44:24 -050012
13*** Variables ***
14${VID_ENV} /vid
DR695Hbf5a3a32017-06-30 13:09:57 -040015${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 Floodfe79d7f2017-11-22 17:32:18 -050016${TEARDOWN_STATUS} FAIL
17
DR695Hccff30b2017-02-17 18:44:24 -050018*** Keywords ***
Jerry Floodf67ce0e2017-03-20 16:59:23 -040019
20Teardown VID
DR695Hccff30b2017-02-17 18:44:24 -050021 [Documentation] Teardown the VID This assumes that the any runnign stacks have been torn down
Jerry Floodfe79d7f2017-11-22 17:32:18 -050022 [Arguments] ${service_instance_id} ${lcp_region} ${tenant} ${customer}
Jerry Floodf67ce0e2017-03-20 16:59:23 -040023 Return From Keyword If len('${service_instance_id}') == 0
jf986075010a42017-02-22 16:52:54 -050024 # Keep going to the VID service instance until we get the pop-up alert that there is no service instance
Jerry Floodfe79d7f2017-11-22 17:32:18 -050025 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}
DR695Hccff30b2017-02-17 18:44:24 -050029
Jerry Floodf67ce0e2017-03-20 16:59:23 -040030
31Delete VID
DR695Hccff30b2017-02-17 18:44:24 -050032 [Documentation] Teardown the next VID entity that has a Remove icon.
Jerry Floodfe79d7f2017-11-22 17:32:18 -050033 [Arguments] ${service_instance_id} ${lcp_region} ${tenant} ${customer}
Jerry Floodf67ce0e2017-03-20 16:59:23 -040034 # For vLB closed loop, we may have 2 vf modules and the vDNS one needs to be removed first.
Brian Freemana62644f2018-05-13 12:47:38 -050035 ${remove_order}= Create List vDNS_Ete vPKG Vfmodule_Ete
Jerry Floodf67ce0e2017-03-20 16:59:23 -040036
jf986075010a42017-02-22 16:52:54 -050037 # FAIL status is returned in ${vfmodule} because FAIL are ignored during teardown
Jerry Floodfe79d7f2017-11-22 17:32:18 -050038 ${status} ${vfmodule}= Run Keyword and Ignore Error Delete Next VID Entity ${service_instance_id} ${lcp_region} ${tenant} ${remove_order} ${customer}
jf986075010a42017-02-22 16:52:54 -050039 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 Floodf67ce0e2017-03-20 16:59:23 -040045Delete Next VID Entity
jf986075010a42017-02-22 16:52:54 -050046 [Documentation] Teardown the next VID entity that has a Remove icon.
Jerry Floodfe79d7f2017-11-22 17:32:18 -050047 [Arguments] ${service_instance_id} ${lcp_region} ${tenant} ${remove_order} ${customer}
jf986075010a42017-02-22 16:52:54 -050048 ${vfmodule}= Catenate
DR695Hccff30b2017-02-17 18:44:24 -050049 Go To ${VID_SERVICE_MODELS_SEARCH_URL}
Jerry Floodf67ce0e2017-03-20 16:59:23 -040050 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 Floodfe79d7f2017-11-22 17:32:18 -050055 Select From List By Label //select[@ng-model='selectedCustomer'] ${customer}
56 Click Button button=Submit
jf986075010a42017-02-22 16:52:54 -050057
DR695H910097e2019-05-08 13:55:32 -040058 # When Handle VID Alert detects a pop-up. it will return FAIL and we are done
jf986075010a42017-02-22 16:52:54 -050059 # Return from Keyword is required because FAIL is inored during teardown
Jerry Floodfe79d7f2017-11-22 17:32:18 -050060 Set Test Variable ${TEARDOWN_STATUS} PASS
DR695H910097e2019-05-08 13:55:32 -040061 ${status} ${value} Run Keyword And Ignore Error Handle VID Alert
jf986075010a42017-02-22 16:52:54 -050062 Return From Keyword If '${status}' == 'FAIL' ${status}
Jerry Floodf67ce0e2017-03-20 16:59:23 -040063 ${status} ${value} Run Keyword And Ignore Error Wait Until Page Contains Element link=View/Edit timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
jf986075010a42017-02-22 16:52:54 -050064 Return From Keyword If '${status}' == 'FAIL' ${status}
Jerry Floodfe79d7f2017-11-22 17:32:18 -050065 Set Test Variable ${TEARDOWN_STATUS} FAIL
jf986075010a42017-02-22 16:52:54 -050066
67
Jerry Floodf67ce0e2017-03-20 16:59:23 -040068 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
DR695H910097e2019-05-08 13:55:32 -040072 :FOR ${remove_first} IN @{remove_order}
jf986075010a42017-02-22 16:52:54 -050073 \ ${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 Floodf67ce0e2017-03-20 16:59:23 -040075 \ Exit For Loop If '${status}' == 'PASS'
jf986075010a42017-02-22 16:52:54 -050076 \ ${remove_xpath}= Set Variable //li/div/a/span[@class='glyphicon glyphicon-remove']
Jerry Floodf67ce0e2017-03-20 16:59:23 -040077 Click On Element When Visible xpath=${remove_xpath}
DR695Hccff30b2017-02-17 18:44:24 -050078
jf986075010a42017-02-22 16:52:54 -050079 ${status} ${value}= Run Keyword and Ignore Error Wait Until Page Contains Element xpath=//select[@parameter-id='lcpRegion']
Jerry Floodf67ce0e2017-03-20 16:59:23 -040080 Run Keyword If '${status}'=='PASS' Select From List By Label xpath=//select[@parameter-id='lcpRegion'] ${lcp_region}
jf986075010a42017-02-22 16:52:54 -050081 Run Keyword If '${status}'=='PASS' Select From List By Label xpath=//select[@parameter-id='tenant'] ${tenant}
Jerry Floodf67ce0e2017-03-20 16:59:23 -040082 ${status} ${vfmodule}= Run Keyword And Ignore Error Get Text xpath=//td[contains(text(), 'Vf Module Name')]/../td[2]
DR695Hccff30b2017-02-17 18:44:24 -050083 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]
jf986075010a42017-02-22 16:52:54 -050085 Wait Until Page Contains 100 % 300s
DR695Hccff30b2017-02-17 18:44:24 -050086 ${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}
jf986075010a42017-02-22 16:52:54 -050088 Click Element xpath=//div[@class='ng-scope']/div[@class = 'buttonRow']/button[text() = 'Close']
DR695Hccff30b2017-02-17 18:44:24 -050089 Poll MSO Get Request ${GLOBAL_MSO_STATUS_PATH}${request_id} COMPLETE
jf986075010a42017-02-22 16:52:54 -050090 [Return] ${vfmodule}
Jerry Floodf67ce0e2017-03-20 16:59:23 -040091
DR695H910097e2019-05-08 13:55:32 -040092Handle VID Alert
jf986075010a42017-02-22 16:52:54 -050093 [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 Floodf67ce0e2017-03-20 16:59:23 -040095 Run Keyword And Ignore Error Click Element button=Submit
DR695H910097e2019-05-08 13:55:32 -040096 ${status} ${t}= Run Keyword And Ignore Error Handle Alert
Jerry Floodf67ce0e2017-03-20 16:59:23 -040097 Return From Keyword If '${status}' == 'FAIL'
jf986075010a42017-02-22 16:52:54 -050098 Fail ${t}