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