2 Documentation Creates VID VNF Instance
4 Library SeleniumLibrary 60
7 Library RequestsLibrary
8 Resource ../global_properties.robot
9 Resource vid_interface.robot
10 Library ONAPLibrary.SO WITH NAME SO
14 [Documentation] Creates a VNF instance using VID for passed instance id with the passed service instance name
15 [Arguments] ${service_instance_id} ${service_instance_name} ${product_family} ${lcp_region} ${tenant} ${vnf_type} ${customer} ${line_of_business}=LOB-Demonstration ${platform}=Platform-Demonstration ${cloud_owner_uc}=${GLOBAL_AAI_CLOUD_OWNER}
17 ##### TEST BIGGER WINDOW TO AVOID MASKED ITEMS PROBLEM #####
18 ${width} ${height}= Get Window Size
19 Set Window Size 2000 1000
20 ${width} ${height}= Get Window Size
21 Click Link xpath=//div[@heading = 'Search for Existing Service Instances']/a
22 Wait Until Page Contains Please search by timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
24 Input Text When Enabled //input[@name='selectedServiceInstance'] ${service_instance_id}
25 Select From List By Label //select[@ng-model='selectedserviceinstancetype'] Service Instance Id
26 Select From List By Label //select[@ng-model='selectedCustomer'] ${customer}
27 Click On Button When Enabled //button[contains(text(),'Submit')]
28 Wait Until Page Contains Element link=View/Edit timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
29 Click Element xpath=//a[contains(text(), 'View/Edit')]
30 Wait Until Page Contains View/Edit Service Instance timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
31 # in slower environment the background load of data from AAI takes time so that the button is not populated yet
32 Wait Until Page Contains Add node instance timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
33 Click On Button When Enabled //button[contains(text(),'Add node instance')]
34 Wait Until Page Contains ${vnf_type} timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
35 #01681d02-2304-4c91-ab2d 0
36 # This is where firefox breaks. Th elink never becomes visible when run with the script.
37 ${dataTestsId}= Catenate AddVNFOption-${vnf_type}
39 Wait Until Element Is Enabled xpath=//a[contains(text(), '${vnf_type}')]
40 Wait Until Element Is Visible xpath=//a[contains(text(), '${vnf_type}')]
41 Click Element xpath=//a[contains(text(), '${vnf_type}')]
42 Wait Until Page Contains Element xpath=//input[@parameter-id='instanceName'] ${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
43 Wait Until Element Is Enabled xpath=//input[@parameter-id='instanceName'] ${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
44 ## Without this sleep, the input text below gets immediately wiped out.
45 ## Wait Until Angular Ready just sleeps for its timeout value
47 Input Text xpath=//input[@parameter-id='instanceName'] ${service_instance_name}
48 Select From List By Label xpath=//select[@parameter-id='productFamily'] ${product_family}
50 ${cloud_owner_uc}= Convert To Uppercase ${cloud_owner_uc}
51 Select From List By Label xpath=//select[@parameter-id='lcpRegion'] ${lcp_region} (${cloud_owner_uc})
52 Select From List By Label xpath=//select[@parameter-id='tenant'] ${tenant}
53 Select From List When Enabled //select[@parameter-id='lineOfBusiness'] ${line_of_business}
54 Select From List By Label xpath=//select[@parameter-id='platform'] ${platform}
55 Click On Button When Enabled //button[contains(text(),'Confirm')]
56 Wait Until Element Contains xpath=//pre[@class = 'log ng-binding'] requestState timeout=${GLOBAL_VID_UI_TIMEOUT_LONG}
57 ${response text}= Get Text xpath=//pre[@class = 'log ng-binding']
58 Should Not Contain ${response text} FAILED
59 Click On Button When Enabled //button[contains(text(),'Close')]
60 ${instance_id}= Parse Instance Id ${response text}
61 # sometimes the page refreshes - a reload is required on timeout but next step for VF Module does that
62 Run Keyword And Ignore Error Wait Until Page Contains ${service_instance_name} ${GLOBAL_VID_UI_TIMEOUT_LONG}
63 [Return] ${instance_id}
66 [Arguments] ${service_instance_id} ${lcp_region} ${tenant} ${vnf_instance_id} ${cloud_owner_uc}=${GLOBAL_AAI_CLOUD_OWNER}
68 Click Link xpath=//div[@heading = 'Search for Existing Service Instances']/a
69 Wait Until Page Contains Please search by timeout=60s
70 Wait Until Page Contains Element xpath=//div[@class='statusLine aaiHidden'] timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
71 Wait Until Element Is Not Visible xpath=//div[@class='statusLine aaiHidden'] timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
73 # If we don't wait for this control to be enabled, the submit results in a 'not found' pop-up (UnexpectedAlertPresentException)
74 Input Text When Enabled //input[@name='selectedServiceInstance'] ${service_instance_id}
75 Click On Button When Enabled //button[contains(text(),'Submit')]
76 Wait Until Page Contains Element link=View/Edit timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
77 Click Element link=View/Edit
78 Wait Until Page Contains View/Edit Service Instance timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
79 Wait Until Page Contains Element xpath=//div[@class='statusLine'] timeout=${GLOBAL_VID_UI_TIMEOUT_LONG}
80 Wait Until Element Is Not Visible xpath=//div[@class='statusLine aaiHidden'] timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
81 Click On Element When Visible xpath=//li/div[contains(.,'${vnf_instance_id}')]/a/span[@class='glyphicon glyphicon-remove'] timeout=${GLOBAL_VID_UI_TIMEOUT_LONG}
82 ${cloud_owner_uc}= Convert To Uppercase ${cloud_owner_uc}
83 Select From List By Label xpath=//select[@parameter-id='lcpRegion'] ${lcp_region} (${cloud_owner_uc})
84 Select From List By Label xpath=//select[@parameter-id='tenant'] ${tenant}
85 Click Element xpath=//div[@class='buttonRow']/button[@ngx-enabled='true']
86 #//*[@id="mContent"]/div/div/div/div/table/tbody/tr/td/div/div[2]/div/div[1]/div[5]/button[1]
88 ${response text}= Get Text xpath=//div[@ng-controller='deletionDialogController']//div[@ng-controller= 'msoCommitController']/pre[@class = 'log ng-binding']
89 ${request_id}= Parse Request Id ${response text}
90 ${auth}= Create List ${GLOBAL_SO_USERNAME} ${GLOBAL_SO_PASSWORD}
91 ${resp}= SO.Run Polling Get Request ${GLOBAL_SO_ENDPOINT} ${GLOBAL_SO_STATUS_PATH}${request_id} auth=${auth}
94 [Arguments] ${service_instance_id} ${vf_module_name} ${lcp_region} ${TENANT} ${VNF_TYPE} ${customer} ${vnf_name} ${cloud_owner_uc}=${GLOBAL_AAI_CLOUD_OWNER}
96 Click Link xpath=//div[@heading = 'Search for Existing Service Instances']/a
97 Wait Until Page Contains Please search by timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
98 Wait Until Page Contains Element xpath=//div[@class='statusLine aaiHidden'] timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
100 # If we don't wait for this control to be enabled, the submit results in a 'not found' pop-up (UnexpectedAlertPresentException)
101 Input Text When Enabled //input[@name='selectedServiceInstance'] ${service_instance_id}
102 Select From List By Label //select[@ng-model='selectedserviceinstancetype'] Service Instance Id
103 Select From List By Label //select[@ng-model='selectedCustomer'] ${customer}
104 Click On Button When Enabled //button[contains(text(),'Submit')]
105 Wait Until Page Contains Element link=View/Edit timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
106 Click Element link=View/Edit
108 Wait Until Keyword Succeeds 300s 5s Wait For Add VF Module
110 ### Optionally checking if Volume Group option is there ###
112 ## first checking if the VNF has ANY volume modules
113 ${volume_status} ${value} Run Keyword And Ignore Error Wait Until Element Is Visible //button[contains(text(),'Add Volume Group')] timeout=15s
114 Run Keyword If '${volume_status}' == 'PASS' Click Element xpath=//div[contains(.,'${vnf_name}')]/div/button[contains(.,'Add Volume Group')]
116 ## now checking that this specific module has volumes
117 ${volume_module_status} ${value} Run Keyword And Ignore Error Wait Until Element Is Visible link=${VNF_TYPE} timeout=15s
118 ${uuid}= Generate UUID4
119 ${vf_module_volume_name}= Evaluate str("${uuid}")[:8]
120 ${vf_module_volume_name}= Set Variable If '${volume_module_status}' == 'PASS' volume_${vf_module_volume_name} None
121 Run Keyword If '${volume_module_status}' == 'PASS' Log Volumes found for ${vf_module_name} console=yes
122 Run Keyword If '${volume_module_status}' == 'PASS' Fill Module Form And Submit ${vf_module_volume_name} ${lcp_region} ${TENANT} ${VNF_TYPE} cloud_owner_uc=${cloud_owner_uc}
123 ## sleep to give VID a chance to update Volume Group
124 Run Keyword If '${volume_module_status}' == 'PASS' Sleep 30s
126 ### end volume stuff ###
128 #Click Element xpath=//div[contains(.,'${vnf_name}')]/div/button[contains(.,'Add VF-Module')]
129 Click On Element When Visible //div[contains(.,'${vnf_name}')]/div/button[contains(.,'Add VF-Module')]
130 ${instance_id}= Fill Module Form And Submit ${vf_module_name} ${lcp_region} ${TENANT} ${VNF_TYPE} cloud_owner_uc=${cloud_owner_uc} volume_group=${vf_module_volume_name}
131 [Return] ${instance_id}
133 Fill Module Form And Submit
134 [Documentation] Separating this so volume module can use as well.
135 [Arguments] ${vf_module_name} ${lcp_region} ${tenant} ${vnf_type} ${cloud_owner_uc}=${GLOBAL_AAI_CLOUD_OWNER} ${volume_group}=None
137 # This is where firefox breaks. Th elink never becomes visible when run with the script.
138 Click Element link=${vnf_type}
139 Wait Until Page Contains Element xpath=//input[@parameter-id='instanceName'] ${GLOBAL_VID_UI_TIMEOUT_SHORT}
140 Wait Until Element Is Enabled xpath=//input[@parameter-id='instanceName'] ${GLOBAL_VID_UI_TIMEOUT_SHORT}
142 ## Without this sleep, the input text below gets immediately wiped out.
143 ## Wait Until Angular Ready just sleeps for its timeout value
145 Input Text xpath=//input[@parameter-id='instanceName'] ${vf_module_name}
146 ${cloud_owner_uc}= Convert To Uppercase ${cloud_owner_uc}
147 Select From List By Label xpath=//select[@parameter-id='lcpRegion'] ${lcp_region} (${cloud_owner_uc})
148 Select From List By Label xpath=//select[@parameter-id='tenant'] ${tenant}
151 ${status} ${value} Run Keyword And Ignore Error Wait Until Element Is Visible xpath=//select[@parameter-id='availableVolumeGroup'] 15s
152 Run Keyword If '${status}' == 'PASS' Select From List By Label xpath=//select[@parameter-id='availableVolumeGroup'] ${volume_group}
155 ${status} ${value} Run Keyword And Ignore Error Wait Until Element Is Visible xpath=//input[@parameter-id='sdncPreload'] ${GLOBAL_VID_UI_TIMEOUT_SHORT}
156 Run Keyword If '${status}' == 'PASS' Wait Until Element Is Enabled xpath=//input[@parameter-id='sdncPreload'] ${GLOBAL_VID_UI_TIMEOUT_SHORT}
157 Run Keyword If '${status}' == 'PASS' Select Checkbox xpath=//input[@parameter-id='sdncPreload']
158 Capture Page Screenshot
159 Log Submitting vf module instance ${vf_module_name} in VID console=yes
160 Click On Button When Enabled //button[contains(text(),'Confirm')]
161 Wait Until Element Contains xpath=//pre[@class = 'log ng-binding'] requestState timeout=300s
162 ${response text}= Get Text xpath=//pre[@class = 'log ng-binding']
163 Click On Button When Enabled //button[contains(text(),'Close')]
164 ${instance_id}= Parse Instance Id ${response text}
166 ${request_id}= Parse Request Id ${response text}
167 ${auth}= Create List ${GLOBAL_SO_USERNAME} ${GLOBAL_SO_PASSWORD}
168 ${resp}= SO.Run Polling Get Request ${GLOBAL_SO_ENDPOINT} ${GLOBAL_SO_STATUS_PATH}${request_id} auth=${auth}
169 [Return] ${instance_id}
171 Wait For Add VF Module
172 [Documentation] Retry by refresh if the ADD VF-Module is not visible
173 Wait Until Page Contains View/Edit Service Instance timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
175 ${status} ${value} Run Keyword And Ignore Error Wait Until Element Is Visible //button[contains(text(),'Add VF-Module')] timeout=${GLOBAL_VID_UI_TIMEOUT_SHORT}
176 Return From Keyword If '${status}' == 'PASS'