blob: e1850bf6c8beb1ddfb88082b061a7481953a5987 [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
3Library ExtendedSelenium2Library
4Library 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
11
12*** Variables ***
13${VID_ENV} /vid
DR695Hbf5a3a32017-06-30 13:09:57 -040014${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 -050015${TEARDOWN_STATUS} FAIL
16
DR695Hccff30b2017-02-17 18:44:24 -050017*** Keywords ***
Jerry Floodf67ce0e2017-03-20 16:59:23 -040018
19Teardown VID
DR695Hccff30b2017-02-17 18:44:24 -050020 [Documentation] Teardown the VID This assumes that the any runnign stacks have been torn down
Jerry Floodfe79d7f2017-11-22 17:32:18 -050021 [Arguments] ${service_instance_id} ${lcp_region} ${tenant} ${customer}
Jerry Floodf67ce0e2017-03-20 16:59:23 -040022 Return From Keyword If len('${service_instance_id}') == 0
jf986075010a42017-02-22 16:52:54 -050023 # 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 -050024 Set Test Variable ${TEARDOWN_STATUS} FAIL
25 Wait Until Keyword Succeeds 300s 1s Delete VID ${service_instance_id} ${lcp_region} ${tenant} ${customer}
26 Return From Keyword If '${TEARDOWN_STATUS}' == 'PASS'
27 Fail ${TEARDOWN_STATUS}
DR695Hccff30b2017-02-17 18:44:24 -050028
Jerry Floodf67ce0e2017-03-20 16:59:23 -040029
30Delete VID
DR695Hccff30b2017-02-17 18:44:24 -050031 [Documentation] Teardown the next VID entity that has a Remove icon.
Jerry Floodfe79d7f2017-11-22 17:32:18 -050032 [Arguments] ${service_instance_id} ${lcp_region} ${tenant} ${customer}
Jerry Floodf67ce0e2017-03-20 16:59:23 -040033 # 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 -050034 ${remove_order}= Create List vDNS_Ete vPKG Vfmodule_Ete
Jerry Floodf67ce0e2017-03-20 16:59:23 -040035
jf986075010a42017-02-22 16:52:54 -050036 # FAIL status is returned in ${vfmodule} because FAIL are ignored during teardown
Jerry Floodfe79d7f2017-11-22 17:32:18 -050037 ${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 -050038 Return From Keyword If '${status}' == 'FAIL'
39 Return From Keyword If '${vfmodule}' == 'FAIL'
40 # After tearing down a VF module, execute the reverse HB for it to remove the references from A&AI
41 Run Keyword If 'Vfmodule_Ete' in '${vfmodule}' Execute Reverse Heatbridge
42 Fail Continue with Next Remove
43
Jerry Floodf67ce0e2017-03-20 16:59:23 -040044Delete Next VID Entity
jf986075010a42017-02-22 16:52:54 -050045 [Documentation] Teardown the next VID entity that has a Remove icon.
Jerry Floodfe79d7f2017-11-22 17:32:18 -050046 [Arguments] ${service_instance_id} ${lcp_region} ${tenant} ${remove_order} ${customer}
jf986075010a42017-02-22 16:52:54 -050047 ${vfmodule}= Catenate
DR695Hccff30b2017-02-17 18:44:24 -050048 Go To ${VID_SERVICE_MODELS_SEARCH_URL}
Jerry Floodf67ce0e2017-03-20 16:59:23 -040049 Wait Until Page Contains Please search by timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
50 Wait Until Page Contains Element xpath=//div[@class='statusLine aaiHidden'] timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
51 Wait Until Element Is Not Visible xpath=//div[@class='statusLine aaiHidden'] timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
52
53 # 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 -050054 Select From List By Label //select[@ng-model='selectedCustomer'] ${customer}
55 Click Button button=Submit
jf986075010a42017-02-22 16:52:54 -050056
57 # When Handle alert detects a pop-up. it will return FAIL and we are done
58 # Return from Keyword is required because FAIL is inored during teardown
Jerry Floodfe79d7f2017-11-22 17:32:18 -050059 Set Test Variable ${TEARDOWN_STATUS} PASS
jf986075010a42017-02-22 16:52:54 -050060 ${status} ${value} Run Keyword And Ignore Error Handle Alert
61 Return From Keyword If '${status}' == 'FAIL' ${status}
Jerry Floodf67ce0e2017-03-20 16:59:23 -040062 ${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 -050063 Return From Keyword If '${status}' == 'FAIL' ${status}
Jerry Floodfe79d7f2017-11-22 17:32:18 -050064 Set Test Variable ${TEARDOWN_STATUS} FAIL
jf986075010a42017-02-22 16:52:54 -050065
66
Jerry Floodf67ce0e2017-03-20 16:59:23 -040067 Click Element link=View/Edit
68 Wait Until Page Contains View/Edit Service Instance timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
69 Wait Until Element Is Visible xpath=//a/span[@class='glyphicon glyphicon-remove'] timeout=${GLOBAL_VID_UI_TIMEOUT_LONG}
70
71 :for ${remove_first} in @{remove_order}
jf986075010a42017-02-22 16:52:54 -050072 \ ${remove_xpath}= Set Variable //li/div[contains(.,'${remove_first}')]/a/span[@class='glyphicon glyphicon-remove']
73 \ ${status} ${data}= Run Keyword And Ignore Error Page Should Contain Element xpath=${remove_xpath}
Jerry Floodf67ce0e2017-03-20 16:59:23 -040074 \ Exit For Loop If '${status}' == 'PASS'
jf986075010a42017-02-22 16:52:54 -050075 \ ${remove_xpath}= Set Variable //li/div/a/span[@class='glyphicon glyphicon-remove']
Jerry Floodf67ce0e2017-03-20 16:59:23 -040076 Click On Element When Visible xpath=${remove_xpath}
DR695Hccff30b2017-02-17 18:44:24 -050077
jf986075010a42017-02-22 16:52:54 -050078 ${status} ${value}= Run Keyword and Ignore Error Wait Until Page Contains Element xpath=//select[@parameter-id='lcpRegion']
Jerry Floodf67ce0e2017-03-20 16:59:23 -040079 Run Keyword If '${status}'=='PASS' Select From List By Label xpath=//select[@parameter-id='lcpRegion'] ${lcp_region}
jf986075010a42017-02-22 16:52:54 -050080 Run Keyword If '${status}'=='PASS' Select From List By Label xpath=//select[@parameter-id='tenant'] ${tenant}
Jerry Floodf67ce0e2017-03-20 16:59:23 -040081 ${status} ${vfmodule}= Run Keyword And Ignore Error Get Text xpath=//td[contains(text(), 'Vf Module Name')]/../td[2]
DR695Hccff30b2017-02-17 18:44:24 -050082 Click Element xpath=//div[@class='buttonRow']/button[@ngx-enabled='true']
83 #//*[@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 -050084 Wait Until Page Contains 100 % 300s
DR695Hccff30b2017-02-17 18:44:24 -050085 ${response text}= Get Text xpath=//div[@ng-controller='deletionDialogController']//div[@ng-controller= 'msoCommitController']/pre[@class = 'log ng-binding']
86 ${request_id}= Parse Request Id ${response text}
jf986075010a42017-02-22 16:52:54 -050087 Click Element xpath=//div[@class='ng-scope']/div[@class = 'buttonRow']/button[text() = 'Close']
DR695Hccff30b2017-02-17 18:44:24 -050088 Poll MSO Get Request ${GLOBAL_MSO_STATUS_PATH}${request_id} COMPLETE
jf986075010a42017-02-22 16:52:54 -050089 [Return] ${vfmodule}
Jerry Floodf67ce0e2017-03-20 16:59:23 -040090
jf986075010a42017-02-22 16:52:54 -050091Handle Alert
92 [Documentation] When service instance has been deleted, an alert will be triggered on the search to end the loop
93 ... 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 -040094 Run Keyword And Ignore Error Click Element button=Submit
jf986075010a42017-02-22 16:52:54 -050095 ${status} ${t}= Run Keyword And Ignore Error Get Alert Message
Jerry Floodf67ce0e2017-03-20 16:59:23 -040096 Return From Keyword If '${status}' == 'FAIL'
jf986075010a42017-02-22 16:52:54 -050097 Fail ${t}