move uuid to onaplib.utilities
[testsuite.git] / robot / resources / vid / create_vid_vnf.robot
1 *** Settings ***
2 Documentation     Creates VID VNF Instance
3
4 Library    SeleniumLibrary    60
5 Library         String
6 Library        DateTime
7 Library               RequestsLibrary
8
9 Resource          ../so_interface.robot
10 Resource          vid_interface.robot
11
12 *** Keywords ***
13
14 Create VID VNF
15     [Documentation]    Creates a VNF instance using VID for passed instance id with the passed service instance name
16     [Arguments]    ${service_instance_id}    ${service_instance_name}    ${product_family}    ${lcp_region}    ${tenant}   ${vnf_type}   ${customer}   ${line_of_business}=LOB-Demonstration   ${platform}=Platform-Demonstration
17     Go To VID HOME
18     Click Link       xpath=//div[@heading = 'Search for Existing Service Instances']/a
19     Wait Until Page Contains    Please search by    timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
20
21     # If we don't wait for this control to be enabled, the submit results in a 'not found' pop-up (UnexpectedAlertPresentException)
22     #Input Text When Enabled    //input[@name='selectedServiceInstance']    ${service_instance_id}
23     #Select From List By Label    //select[@ng-model='selectedserviceinstancetype']    Service Instance Id
24     Select From List By Label    //select[@ng-model='selectedCustomer']    ${customer}
25     Click Button    button=Submit
26     Wait Until Page Contains Element    link=View/Edit    timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
27     Click Element     xpath=//a[contains(text(), 'View/Edit')]
28     Wait Until Page Contains    View/Edit Service Instance     timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
29     # in slower environment the background load of data from AAI takes time so that the button is not populated yet
30     Sleep   20s
31     Click Element    button=Add node instance
32     #01681d02-2304-4c91-ab2d 0
33     # This is where firefox breaks. Th elink never becomes visible when run with the script.
34     ${dataTestsId}=    Catenate   AddVNFOption-${vnf_type}
35     Sleep   10s
36     Click Element    xpath=//a[contains(text(), '${vnf_type}')]
37     Wait Until Page Contains Element    xpath=//input[@parameter-id='instanceName']    ${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
38     Wait Until Element Is Enabled    xpath=//input[@parameter-id='instanceName']    ${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
39     ## Without this sleep, the input text below gets immediately wiped out.
40     ## Wait Until Angular Ready just sleeps for its timeout value
41     Sleep    10s
42     Input Text    xpath=//input[@parameter-id='instanceName']    ${service_instance_name}
43     Select From List By Label     xpath=//select[@parameter-id='productFamily']    ${product_family}
44     # Fix for Dublin
45     ${cloud_owner_uc}=   Convert To Uppercase   ${GLOBAL_AAI_CLOUD_OWNER}
46     Select From List By Label    xpath=//select[@parameter-id='lcpRegion']    ${lcp_region} (${cloud_owner_uc})
47     Select From List By Label    xpath=//select[@parameter-id='tenant']    ${tenant}
48     Sleep    5s
49     Click Element   xpath=//multiselect[@parameter-id='lineOfBusiness']
50     Sleep    5s
51     Click Element   xpath=//button[contains(text(),${line_of_business})] 
52     Select From List By Label    xpath=//select[@parameter-id='platform']    ${platform}
53     Click Element    button=Confirm
54         Wait Until Element Contains    xpath=//pre[@class = 'log ng-binding']    requestState    timeout=${GLOBAL_VID_UI_TIMEOUT_LONG}
55     ${response text}=    Get Text    xpath=//pre[@class = 'log ng-binding']
56         Should Not Contain    ${response text}    FAILED
57     Click Element    button=Close
58     ${instance_id}=    Parse Instance Id     ${response text}
59     Wait Until Page Contains    ${service_instance_name}    ${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
60     [Return]     ${instance_id}
61
62 Delete VID VNF
63     [Arguments]    ${service_instance_id}    ${lcp_region}    ${tenant}    ${vnf_instance_id}
64     Go To VID HOME
65     Click Link       xpath=//div[@heading = 'Search for Existing Service Instances']/a
66     Wait Until Page Contains    Please search by    timeout=60s
67     Wait Until Page Contains Element    xpath=//div[@class='statusLine aaiHidden']    timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
68     Wait Until Element Is Not Visible    xpath=//div[@class='statusLine aaiHidden']    timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
69
70     # If we don't wait for this control to be enabled, the submit results in a 'not found' pop-up (UnexpectedAlertPresentException)
71     Input Text When Enabled    //input[@name='selectedServiceInstance']    ${service_instance_id}
72     Click Button    button=Submit
73     Wait Until Page Contains Element    link=View/Edit    timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
74     Click Element     link=View/Edit
75     Wait Until Page Contains    View/Edit Service Instance     timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
76     Wait Until Page Contains Element    xpath=//div[@class='statusLine']    timeout=${GLOBAL_VID_UI_TIMEOUT_LONG}
77     Wait Until Element Is Not Visible    xpath=//div[@class='statusLine aaiHidden']    timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
78     Click On Element When Visible    xpath=//li/div[contains(.,'${vnf_instance_id}')]/a/span[@class='glyphicon glyphicon-remove']    timeout=${GLOBAL_VID_UI_TIMEOUT_LONG}
79     ${cloud_owner_uc}=   Convert To Uppercase   ${GLOBAL_AAI_CLOUD_OWNER}
80     Select From List By Label    xpath=//select[@parameter-id='lcpRegion']    ${lcp_region} (${cloud_owner_uc})
81     Select From List By Label    xpath=//select[@parameter-id='tenant']    ${tenant}
82     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]
84
85     ${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}
87     Poll MSO Get Request    ${GLOBAL_MSO_STATUS_PATH}${request_id}   COMPLETE
88
89 Create VID VNF module
90     [Arguments]    ${service_instance_id}    ${vf_module_name}    ${lcp_region}    ${TENANT}    ${VNF_TYPE}   ${customer}   ${vnf_name}  
91     Go To VID HOME
92     Click Link       xpath=//div[@heading = 'Search for Existing Service Instances']/a
93     Wait Until Page Contains    Please search by    timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
94     Wait Until Page Contains Element    xpath=//div[@class='statusLine aaiHidden']    timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
95
96      # If we don't wait for this control to be enabled, the submit results in a 'not found' pop-up (UnexpectedAlertPresentException)
97     Select From List By Label    //select[@ng-model='selectedCustomer']    ${customer}
98     ###Input Text When Enabled    //input[@name='selectedServiceInstance']    ${service_instance_id}
99     Click Button    button=Submit
100     Wait Until Page Contains Element    link=View/Edit    timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
101     Click Element     link=View/Edit
102     Wait Until Keyword Succeeds   300s   5s   Wait For Add VF Module
103     Click Element     xpath=//div[contains(.,'${vnf_name}')]/div/button[contains(.,'Add VF-Module')]
104
105     # This is where firefox breaks. Th elink never becomes visible when run with the script.
106     Click Element    link=${vnf_type}
107     Wait Until Page Contains Element    xpath=//input[@parameter-id='instanceName']    ${GLOBAL_VID_UI_TIMEOUT_SHORT}
108     Wait Until Element Is Enabled    xpath=//input[@parameter-id='instanceName']    ${GLOBAL_VID_UI_TIMEOUT_SHORT}
109
110     ## Without this sleep, the input text below gets immediately wiped out.
111     ## Wait Until Angular Ready just sleeps for its timeout value
112     Sleep    10s
113     Input Text    xpath=//input[@parameter-id='instanceName']    ${vf_module_name}
114     ${cloud_owner_uc}=   Convert To Uppercase   ${GLOBAL_AAI_CLOUD_OWNER}
115     Select From List By Label    xpath=//select[@parameter-id='lcpRegion']    ${lcp_region} (${cloud_owner_uc})
116     Select From List By Label    xpath=//select[@parameter-id='tenant']    ${tenant}
117     Wait Until Element Is Visible    xpath=//input[@parameter-id='sdncPreload']       ${GLOBAL_VID_UI_TIMEOUT_SHORT}
118     Wait Until Element Is Enabled    xpath=//input[@parameter-id='sdncPreload']       ${GLOBAL_VID_UI_TIMEOUT_SHORT}
119     Select Checkbox    xpath=//input[@parameter-id='sdncPreload']
120     Click Element    button=Confirm
121         Wait Until Element Contains    xpath=//pre[@class = 'log ng-binding']    requestState    timeout=${GLOBAL_VID_UI_TIMEOUT_LONG}
122     ${response text}=    Get Text    xpath=//pre[@class = 'log ng-binding']
123     Click Element    button=Close
124     ${instance_id}=    Parse Instance Id     ${response text}
125
126     ${request_id}=    Parse Request Id     ${response text}
127     Poll MSO Get Request    ${GLOBAL_MSO_STATUS_PATH}${request_id}   COMPLETE
128     [Return]     ${instance_id}
129
130 Wait For Add VF Module
131     [Documentation]   Retry by refresh if the ADD VF-Module is not visible
132     Wait Until Page Contains    View/Edit Service Instance     timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
133     ${status}   ${value}   Run Keyword And Ignore Error   Wait Until Element Is Visible    button=Add VF-Module   timeout=${GLOBAL_VID_UI_TIMEOUT_SHORT}
134     Return From Keyword If   '${status}' == 'PASS'
135     Reload Page
136     Fail    Retry