blob: 8bd313a95d2973ab59e18796c930e2272ea59775 [file] [log] [blame]
Gary Wu9abb61c2018-09-27 10:38:50 -07001*** Settings ***
2Library OperatingSystem
3Library RequestsLibrary
4Library json
5
6*** Variables ***
7${MESSAGE} {"ping": "ok"}
Dileep Ranganathan5dc29ae2018-10-06 16:35:11 -07008${BASIC} Basic
9${Music_AUTHVALUE} Y29uZHVjdG9yOmMwbmR1Y3Qwcg==
10${HAS_AUTHVALUE} YWRtaW4xOnBsYW4uMTU=
11${Music_Auth} ${BASIC} ${Music_AUTHVALUE}
12${HAS_Auth} ${BASIC} ${HAS_AUTHVALUE}
Gary Wu9abb61c2018-09-27 10:38:50 -070013${RESP_STATUS} "error"
14${RESP_MESSAGE_WRONG_VERSION} "conductor_template_version must be one of: 2016-11-01"
15${RESP_MESSAGE_WITHOUT_DEMANDS} Undefined Demand
16
17#global variables
18${generatedPlanId}
19${generatedAID}
20${resultStatus}
21
22*** Test Cases ***
23Check Cassandra Docker Container
24 [Documentation] It checks cassandra docker container is running
25 ${rc} ${output}= Run and Return RC and Output docker ps
26 Log To Console *********************
27 Log To Console retrurn_code = ${rc}
28 Log To Console output = ${output}
29 Should Be Equal As Integers ${rc} 0
30 Should Contain ${output} music-db
31
32Check Zookeeper Docker Container
33 [Documentation] It checks zookeeper docker container is running
34 ${rc} ${output}= Run and Return RC and Output docker ps
35 Log To Console *********************
36 Log To Console retrurn_code = ${rc}
37 Log To Console output = ${output}
38 Should Be Equal As Integers ${rc} 0
39 Should Contain ${output} music-zk
40
41Check Tomcat Docker Container
42 [Documentation] It checks tomcat docker container is running
43 ${rc} ${output}= Run and Return RC and Output docker ps
44 Log To Console *********************
45 Log To Console retrurn_code = ${rc}
46 Log To Console output = ${output}
47 Should Be Equal As Integers ${rc} 0
48 Should Contain ${output} music-tomcat
49
50Check Music War Docker Container
51 [Documentation] It checks music.war docker container is running
52 ${rc} ${output}= Run and Return RC and Output docker ps
53 Log To Console *********************
54 Log To Console retrurn_code = ${rc}
55 Log To Console output = ${output}
56 Should Be Equal As Integers ${rc} 0
57 Should Contain ${output} music-war
58
59Get Music Version
60 [Documentation] It sends a REST GET request to retrieve the Music.war version
61 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
Dileep Ranganathan5dc29ae2018-10-06 16:35:11 -070062 &{headers}= Create Dictionary Authorization=${HAS_Auth} Content-Type=application/json Accept=application/json
Gary Wu9abb61c2018-09-27 10:38:50 -070063 ${resp}= Get Request musicaas /MUSIC/rest/v2/version headers=${headers}
64 Log To Console *********************
65 Log To Console response = ${resp}
66 Log To Console body = ${resp.text}
67 Should Be Equal As Integers ${resp.status_code} 200
68
69Check ConductorApi Docker Container
70 [Documentation] It checks conductor-api docker container is running
71 ${rc} ${output}= Run and Return RC and Output docker ps
72 Log To Console *********************
73 Log To Console retrurn_code = ${rc}
74 Log To Console output = ${output}
75 Should Be Equal As Integers ${rc} 0
76 Should Contain ${output} cond-api
77
78Check ConductorController Docker Container
79 [Documentation] It checks conductor-controller docker container is running
80 ${rc} ${output}= Run and Return RC and Output docker ps
81 Log To Console *********************
82 Log To Console retrurn_code = ${rc}
83 Log To Console output = ${output}
84 Should Be Equal As Integers ${rc} 0
85 Should Contain ${output} cond-cont
86
87Check ConductorSolver Docker Container
88 [Documentation] It checks conductor-solver docker container is running
89 ${rc} ${output}= Run and Return RC and Output docker ps
90 Log To Console *********************
91 Log To Console retrurn_code = ${rc}
92 Log To Console output = ${output}
93 Should Be Equal As Integers ${rc} 0
94 Should Contain ${output} cond-solv
95
96Check ConductorReservation Docker Container
97 [Documentation] It checks conductor-reservation docker container is running
98 ${rc} ${output}= Run and Return RC and Output docker ps
99 Log To Console *********************
100 Log To Console retrurn_code = ${rc}
101 Log To Console output = ${output}
102 Should Be Equal As Integers ${rc} 0
103 Should Contain ${output} cond-resv
104
105Check ConductorData Docker Container
106 [Documentation] It checks conductor-data docker container is running
107 ${rc} ${output}= Run and Return RC and Output docker ps
108 Log To Console *********************
109 Log To Console retrurn_code = ${rc}
110 Log To Console output = ${output}
111 Should Be Equal As Integers ${rc} 0
112 Should Contain ${output} cond-data
113
114Get Root Url
115 [Documentation] It sends a REST GET request to root url
116 Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT}
Dileep Ranganathan5dc29ae2018-10-06 16:35:11 -0700117 &{headers}= Create Dictionary Authorization=${HAS_Auth} Content-Type=application/json Accept=application/json
Gary Wu9abb61c2018-09-27 10:38:50 -0700118 ${resp}= Get Request optf-cond / headers=${headers}
119 Log To Console *********************
120 Log To Console response = ${resp}
121 Log To Console body = ${resp.text}
122 Should Be Equal As Integers ${resp.status_code} 200
123 Sleep 10s Wait For 10 seconds
124
125Conductor AddHealthcheck Row Into Music
126 [Documentation] It sends a REST PUT request to Music to inject healthcheck plan
127 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
128 ${data}= Get Binary File ${CURDIR}${/}data${/}healthcheck.json
Dileep Ranganathan5dc29ae2018-10-06 16:35:11 -0700129 &{headers}= Create Dictionary ns=conductor Authorization=${Music_Auth} userId=conductor password=c0nduct0r Content-Type=application/json Accept=application/json
Gary Wu9abb61c2018-09-27 10:38:50 -0700130 ${resp}= Put Request musicaas /MUSIC/rest/v2/keyspaces/conductor/tables/plans/rows?id=healthcheck data=${data} headers=${headers}
131 Log To Console *********************
132 Log To Console response = ${resp}
133 Log To Console body = ${resp.text}
134 ${response_json} json.loads ${resp.content}
135 Should Be Equal As Integers ${resp.status_code} 200
136 Sleep 5s Wait Injection effectiveness
137
138Healthcheck
139 [Documentation] It sends a REST GET request to healthcheck url
140 Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT}
Dileep Ranganathan5dc29ae2018-10-06 16:35:11 -0700141 &{headers}= Create Dictionary Authorization=${HAS_Auth} Content-Type=application/json Accept=application/json
Gary Wu9abb61c2018-09-27 10:38:50 -0700142 ${resp}= Get Request optf-cond /v1/plans/healthcheck headers=${headers}
143 Log To Console *********************
144 Log To Console response = ${resp}
145 Log To Console body = ${resp.text}
146 Should Be Equal As Integers ${resp.status_code} 200
147
148SendPlanWithWrongVersion
149 [Documentation] It sends a POST request to conductor
150 Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT}
151 ${data}= Get Binary File ${CURDIR}${/}data${/}plan_with_wrong_version.json
Dileep Ranganathan5dc29ae2018-10-06 16:35:11 -0700152 &{headers}= Create Dictionary Authorization=${HAS_Auth} Content-Type=application/json Accept=application/json
Gary Wu9abb61c2018-09-27 10:38:50 -0700153 ${resp}= Post Request optf-cond /v1/plans data=${data} headers=${headers}
154 Log To Console *********************
155 Log To Console response = ${resp}
156 Log To Console body = ${resp.text}
157 ${response_json} json.loads ${resp.content}
158 ${generatedPlanId}= Convert To String ${response_json['id']}
159 Set Global Variable ${generatedPlanId}
160 Log To Console generatedPlanId = ${generatedPlanId}
161 Should Be Equal As Integers ${resp.status_code} 201
162 Sleep 10s Wait Plan Resolution
163
164GetPlanWithWrongVersion
165 [Documentation] It sends a REST GET request to capture error
166 Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT}
Dileep Ranganathan5dc29ae2018-10-06 16:35:11 -0700167 &{headers}= Create Dictionary Authorization=${HAS_Auth} Content-Type=application/json Accept=application/json
Gary Wu9abb61c2018-09-27 10:38:50 -0700168 ${resp}= Get Request optf-cond /v1/plans/${generatedPlanId} headers=${headers}
169 Log To Console *********************
170 Log To Console response = ${resp}
171 ${response_json} json.loads ${resp.content}
172 ${resultStatus}= Convert To String ${response_json['plans'][0]['status']}
173 Set Global Variable ${resultStatus}
174 Log To Console resultStatus = ${resultStatus}
175 Log To Console body = ${resp.text}
176 Should Be Equal As Integers ${resp.status_code} 200
177 Should Be Equal error ${resultStatus}
178
179SendPlanWithoutDemandSection
180 [Documentation] It sends a POST request to conductor
181 Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT}
182 ${data}= Get Binary File ${CURDIR}${/}data${/}plan_without_demand_section.json
Dileep Ranganathan5dc29ae2018-10-06 16:35:11 -0700183 &{headers}= Create Dictionary Authorization=${HAS_Auth} Content-Type=application/json Accept=application/json
Gary Wu9abb61c2018-09-27 10:38:50 -0700184 ${resp}= Post Request optf-cond /v1/plans data=${data} headers=${headers}
185 Log To Console *********************
186 Log To Console response = ${resp}
187 Log To Console body = ${resp.text}
188 ${response_json} json.loads ${resp.content}
189 ${generatedPlanId}= Convert To String ${response_json['id']}
190 Set Global Variable ${generatedPlanId}
191 Log To Console generatedPlanId = ${generatedPlanId}
192 Should Be Equal As Integers ${resp.status_code} 201
193 Sleep 10s Wait Plan Resolution
194
195GetPlanWithoutDemandSection
196 [Documentation] It sends a REST GET request to capture error
197 Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT}
Dileep Ranganathan5dc29ae2018-10-06 16:35:11 -0700198 &{headers}= Create Dictionary Authorization=${HAS_Auth} Content-Type=application/json Accept=application/json
Gary Wu9abb61c2018-09-27 10:38:50 -0700199 ${resp}= Get Request optf-cond /v1/plans/${generatedPlanId} headers=${headers}
200 Log To Console *********************
201 Log To Console response = ${resp}
202 ${response_json} json.loads ${resp.content}
203 ${resultStatus}= Convert To String ${response_json['plans'][0]['status']}
204 Set Global Variable ${resultStatus}
205 Log To Console resultStatus = ${resultStatus}
206 Log To Console body = ${resp.text}
207 Should Be Equal As Integers ${resp.status_code} 200
208 Should Be Equal error ${resultStatus}
209
210SendPlanWithWrongConstraint
211 [Documentation] It sends a POST request to conductor
212 Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT}
213 ${data}= Get Binary File ${CURDIR}${/}data${/}plan_with_wrong_distance_constraint.json
Dileep Ranganathan5dc29ae2018-10-06 16:35:11 -0700214 &{headers}= Create Dictionary Authorization=${HAS_Auth} Content-Type=application/json Accept=application/json
Gary Wu9abb61c2018-09-27 10:38:50 -0700215 ${resp}= Post Request optf-cond /v1/plans data=${data} headers=${headers}
216 Log To Console *********************
217 Log To Console response = ${resp}
218 Log To Console body = ${resp.text}
219 ${response_json} json.loads ${resp.content}
220 ${generatedPlanId}= Convert To String ${response_json['id']}
221 Set Global Variable ${generatedPlanId}
222 Log To Console generatedPlanId = ${generatedPlanId}
223 Should Be Equal As Integers ${resp.status_code} 201
224 Sleep 10s Wait Plan Resolution
225
226GetPlanWithWrongConstraint
227 [Documentation] It sends a REST GET request to capture error
228 Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT}
Dileep Ranganathan5dc29ae2018-10-06 16:35:11 -0700229 &{headers}= Create Dictionary Authorization=${HAS_Auth} Content-Type=application/json Accept=application/json
Gary Wu9abb61c2018-09-27 10:38:50 -0700230 ${resp}= Get Request optf-cond /v1/plans/${generatedPlanId} headers=${headers}
231 Log To Console *********************
232 Log To Console response = ${resp}
233 ${response_json} json.loads ${resp.content}
234 ${resultStatus}= Convert To String ${response_json['plans'][0]['status']}
235 Set Global Variable ${resultStatus}
236 Log To Console resultStatus = ${resultStatus}
237 Log To Console body = ${resp.text}
238 Should Be Equal As Integers ${resp.status_code} 200
239 Should Be Equal error ${resultStatus}
240
241
242SendPlanWithLatiAndLongi
243 [Documentation] It sends a POST request to conductor
244 Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT}
245 ${data}= Get Binary File ${CURDIR}${/}data${/}plan_with_lati_and_longi.json
Dileep Ranganathan5dc29ae2018-10-06 16:35:11 -0700246 &{headers}= Create Dictionary Authorization=${HAS_Auth} Content-Type=application/json Accept=application/json
Gary Wu9abb61c2018-09-27 10:38:50 -0700247 ${resp}= Post Request optf-cond /v1/plans data=${data} headers=${headers}
248 Log To Console *********************
249 Log To Console response = ${resp}
250 Log To Console body = ${resp.text}
251 ${response_json} json.loads ${resp.content}
252 ${generatedPlanId}= Convert To String ${response_json['id']}
253 Set Global Variable ${generatedPlanId}
254 Log To Console generatedPlanId = ${generatedPlanId}
255 Should Be Equal As Integers ${resp.status_code} 201
256 Sleep 60s Wait Plan Resolution
257
258GetPlanWithLatiAndLongi
259 [Documentation] It sends a REST GET request to capture recommendations
260 Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT}
Dileep Ranganathan5dc29ae2018-10-06 16:35:11 -0700261 &{headers}= Create Dictionary Authorization=${HAS_Auth} Content-Type=application/json Accept=application/json
Gary Wu9abb61c2018-09-27 10:38:50 -0700262 ${resp}= Get Request optf-cond /v1/plans/${generatedPlanId} headers=${headers}
263 Log To Console *********************
264 Log To Console response = ${resp}
265 ${response_json} json.loads ${resp.content}
266 ${resultStatus}= Convert To String ${response_json['plans'][0]['status']}
267 Set Global Variable ${resultStatus}
268 Log To Console resultStatus = ${resultStatus}
269 Log To Console body = ${resp.text}
270 Should Be Equal As Integers ${resp.status_code} 200
271 Should Be Equal done ${resultStatus}
272
273SendPlanWithShortDistanceConstraint
274 [Documentation] It sends a POST request to conductor
275 Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT}
276 ${data}= Get Binary File ${CURDIR}${/}data${/}plan_with_short_distance_constraint.json
Dileep Ranganathan5dc29ae2018-10-06 16:35:11 -0700277 &{headers}= Create Dictionary Authorization=${HAS_Auth} Content-Type=application/json Accept=application/json
Gary Wu9abb61c2018-09-27 10:38:50 -0700278 ${resp}= Post Request optf-cond /v1/plans data=${data} headers=${headers}
279 Log To Console *********************
280 Log To Console response = ${resp}
281 Log To Console body = ${resp.text}
282 ${response_json} json.loads ${resp.content}
283 ${generatedPlanId}= Convert To String ${response_json['id']}
284 Set Global Variable ${generatedPlanId}
285 Log To Console generatedPlanId = ${generatedPlanId}
286 Should Be Equal As Integers ${resp.status_code} 201
287 Sleep 60s Wait Plan Resolution
288
289GetPlanWithShortDistanceConstraint
290 [Documentation] It sends a REST GET request to capture recommendations
291 Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT}
Dileep Ranganathan5dc29ae2018-10-06 16:35:11 -0700292 &{headers}= Create Dictionary Authorization=${HAS_Auth} Content-Type=application/json Accept=application/json
Gary Wu9abb61c2018-09-27 10:38:50 -0700293 ${resp}= Get Request optf-cond /v1/plans/${generatedPlanId} headers=${headers}
294 Log To Console *********************
295 Log To Console response = ${resp}
296 ${response_json} json.loads ${resp.content}
297 ${resultStatus}= Convert To String ${response_json['plans'][0]['status']}
298 Set Global Variable ${resultStatus}
299 Log To Console resultStatus = ${resultStatus}
300 Log To Console body = ${resp.text}
301 Should Be Equal As Integers ${resp.status_code} 200
302 Should Be Equal not found ${resultStatus}
303
304SendPlanWithVimFit
305 [Documentation] It sends a POST request to conductor
306 Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT}
307 ${data}= Get Binary File ${CURDIR}${/}data${/}plan_with_vim_fit.json
Dileep Ranganathan5dc29ae2018-10-06 16:35:11 -0700308 &{headers}= Create Dictionary Authorization=${HAS_Auth} Content-Type=application/json Accept=application/json
Gary Wu9abb61c2018-09-27 10:38:50 -0700309 ${resp}= Post Request optf-cond /v1/plans data=${data} headers=${headers}
310 Log To Console *********************
311 Log To Console response = ${resp}
312 Log To Console body = ${resp.text}
313 ${response_json} json.loads ${resp.content}
314 ${generatedPlanId}= Convert To String ${response_json['id']}
315 Set Global Variable ${generatedPlanId}
316 Log To Console generatedPlanId = ${generatedPlanId}
317 Should Be Equal As Integers ${resp.status_code} 201
318 Sleep 60s Wait Plan Resolution
319
320GetPlanWithVimFit
321 [Documentation] It sends a REST GET request to capture recommendations
322 Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT}
Dileep Ranganathan5dc29ae2018-10-06 16:35:11 -0700323 &{headers}= Create Dictionary Authorization=${HAS_Auth} Content-Type=application/json Accept=application/json
Gary Wu9abb61c2018-09-27 10:38:50 -0700324 ${resp}= Get Request optf-cond /v1/plans/${generatedPlanId} headers=${headers}
325 Log To Console *********************
326 Log To Console response = ${resp}
327 ${response_json} json.loads ${resp.content}
328 ${resultStatus}= Convert To String ${response_json['plans'][0]['status']}
329 Set Global Variable ${resultStatus}
330 Log To Console resultStatus = ${resultStatus}
331 Log To Console body = ${resp.text}
332 Should Be Equal As Integers ${resp.status_code} 200
333 Should Be Equal done ${resultStatus}
334
335SendPlanWithHpa
336 [Documentation] It sends a POST request to conductor
337 Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT}
338 ${data}= Get Binary File ${CURDIR}${/}data${/}plan_with_hpa.json
Dileep Ranganathan5dc29ae2018-10-06 16:35:11 -0700339 &{headers}= Create Dictionary Authorization=${HAS_Auth} Content-Type=application/json Accept=application/json
Gary Wu9abb61c2018-09-27 10:38:50 -0700340 ${resp}= Post Request optf-cond /v1/plans data=${data} headers=${headers}
341 Log To Console *********************
342 Log To Console response = ${resp}
343 Log To Console body = ${resp.text}
344 ${response_json} json.loads ${resp.content}
345 ${generatedPlanId}= Convert To String ${response_json['id']}
346 Set Global Variable ${generatedPlanId}
347 Log To Console generatedPlanId = ${generatedPlanId}
348 Should Be Equal As Integers ${resp.status_code} 201
349 Sleep 60s Wait Plan Resolution
350
351GetPlanWithHpa
352 [Documentation] It sends a REST GET request to capture recommendations
353 Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT}
Dileep Ranganathan5dc29ae2018-10-06 16:35:11 -0700354 &{headers}= Create Dictionary Authorization=${HAS_Auth} Content-Type=application/json Accept=application/json
Gary Wu9abb61c2018-09-27 10:38:50 -0700355 ${resp}= Get Request optf-cond /v1/plans/${generatedPlanId} headers=${headers}
356 Log To Console *********************
357 Log To Console response = ${resp}
358 ${response_json} json.loads ${resp.content}
359 ${resultStatus}= Convert To String ${response_json['plans'][0]['status']}
360 Set Global Variable ${resultStatus}
361 Log To Console resultStatus = ${resultStatus}
362 Log To Console body = ${resp.text}
363 Should Be Equal As Integers ${resp.status_code} 200
364 Should Be Equal done ${resultStatus}
365
366SendPlanWithHpaSimple
367 [Documentation] It sends a POST request to conductor
368 Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT}
369 ${data}= Get Binary File ${CURDIR}${/}data${/}plan_with_hpa_simple.json
Dileep Ranganathan5dc29ae2018-10-06 16:35:11 -0700370 &{headers}= Create Dictionary Authorization=${HAS_Auth} Content-Type=application/json Accept=application/json
Gary Wu9abb61c2018-09-27 10:38:50 -0700371 ${resp}= Post Request optf-cond /v1/plans data=${data} headers=${headers}
372 Log To Console *********************
373 Log To Console response = ${resp}
374 Log To Console body = ${resp.text}
375 ${response_json} json.loads ${resp.content}
376 ${generatedPlanId}= Convert To String ${response_json['id']}
377 Set Global Variable ${generatedPlanId}
378 Log To Console generatedPlanId = ${generatedPlanId}
379 Should Be Equal As Integers ${resp.status_code} 201
380 Sleep 60s Wait Plan Resolution
381
382GetPlanWithHpaSimple
383 [Documentation] It sends a REST GET request to capture recommendations
384 Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT}
Dileep Ranganathan5dc29ae2018-10-06 16:35:11 -0700385 &{headers}= Create Dictionary Authorization=${HAS_Auth} Content-Type=application/json Accept=application/json
Gary Wu9abb61c2018-09-27 10:38:50 -0700386 ${resp}= Get Request optf-cond /v1/plans/${generatedPlanId} headers=${headers}
387 Log To Console *********************
388 Log To Console response = ${resp}
389 ${response_json} json.loads ${resp.content}
390 ${resultStatus}= Convert To String ${response_json['plans'][0]['status']}
391 Set Global Variable ${resultStatus}
392 Log To Console resultStatus = ${resultStatus}
393 Log To Console body = ${resp.text}
394 Should Be Equal As Integers ${resp.status_code} 200
395 Should Be Equal done ${resultStatus}
396
397SendPlanWithHpaMandatory
398 [Documentation] It sends a POST request to conductor
399 Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT}
400 ${data}= Get Binary File ${CURDIR}${/}data${/}plan_with_hpa_requirements_mandatory.json
Dileep Ranganathan5dc29ae2018-10-06 16:35:11 -0700401 &{headers}= Create Dictionary Authorization=${HAS_Auth} Content-Type=application/json Accept=application/json
Gary Wu9abb61c2018-09-27 10:38:50 -0700402 ${resp}= Post Request optf-cond /v1/plans data=${data} headers=${headers}
403 Log To Console *********************
404 Log To Console response = ${resp}
405 Log To Console body = ${resp.text}
406 ${response_json} json.loads ${resp.content}
407 ${generatedPlanId}= Convert To String ${response_json['id']}
408 Set Global Variable ${generatedPlanId}
409 Log To Console generatedPlanId = ${generatedPlanId}
410 Should Be Equal As Integers ${resp.status_code} 201
411 Sleep 60s Wait Plan Resolution
412
413GetPlanWithHpaMandatory
414 [Documentation] It sends a REST GET request to capture recommendations
415 Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT}
Dileep Ranganathan5dc29ae2018-10-06 16:35:11 -0700416 &{headers}= Create Dictionary Authorization=${HAS_Auth} Content-Type=application/json Accept=application/json
Gary Wu9abb61c2018-09-27 10:38:50 -0700417 ${resp}= Get Request optf-cond /v1/plans/${generatedPlanId} headers=${headers}
418 Log To Console *********************
419 Log To Console response = ${resp}
420 ${response_json} json.loads ${resp.content}
421 ${resultStatus}= Convert To String ${response_json['plans'][0]['status']}
422 Set Global Variable ${resultStatus}
423 Log To Console resultStatus = ${resultStatus}
424 Log To Console body = ${resp.text}
425 Should Be Equal As Integers ${resp.status_code} 200
426 Should Be Equal done ${resultStatus}
427
428SendPlanWithHpaOptionals
429 [Documentation] It sends a POST request to conductor
430 Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT}
431 ${data}= Get Binary File ${CURDIR}${/}data${/}plan_with_hpa_requirements_optionals.json
Dileep Ranganathan5dc29ae2018-10-06 16:35:11 -0700432 &{headers}= Create Dictionary Authorization=${HAS_Auth} Content-Type=application/json Accept=application/json
Gary Wu9abb61c2018-09-27 10:38:50 -0700433 ${resp}= Post Request optf-cond /v1/plans data=${data} headers=${headers}
434 Log To Console *********************
435 Log To Console response = ${resp}
436 Log To Console body = ${resp.text}
437 ${response_json} json.loads ${resp.content}
438 ${generatedPlanId}= Convert To String ${response_json['id']}
439 Set Global Variable ${generatedPlanId}
440 Log To Console generatedPlanId = ${generatedPlanId}
441 Should Be Equal As Integers ${resp.status_code} 201
442 Sleep 60s Wait Plan Resolution
443
444GetPlanWithHpaOptionals
445 [Documentation] It sends a REST GET request to capture recommendations
446 Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT}
Dileep Ranganathan5dc29ae2018-10-06 16:35:11 -0700447 &{headers}= Create Dictionary Authorization=${HAS_Auth} Content-Type=application/json Accept=application/json
Gary Wu9abb61c2018-09-27 10:38:50 -0700448 ${resp}= Get Request optf-cond /v1/plans/${generatedPlanId} headers=${headers}
449 Log To Console *********************
450 Log To Console response = ${resp}
451 ${response_json} json.loads ${resp.content}
452 ${resultStatus}= Convert To String ${response_json['plans'][0]['status']}
453 Set Global Variable ${resultStatus}
454 Log To Console resultStatus = ${resultStatus}
455 Log To Console body = ${resp.text}
456 Should Be Equal As Integers ${resp.status_code} 200
457 Should Be Equal done ${resultStatus}
458
459SendPlanWithHpaUnmatched
460 [Documentation] It sends a POST request to conductor
461 Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT}
462 ${data}= Get Binary File ${CURDIR}${/}data${/}plan_with_hpa_unmatched.json
Dileep Ranganathan5dc29ae2018-10-06 16:35:11 -0700463 &{headers}= Create Dictionary Authorization=${HAS_Auth} Content-Type=application/json Accept=application/json
Gary Wu9abb61c2018-09-27 10:38:50 -0700464 ${resp}= Post Request optf-cond /v1/plans data=${data} headers=${headers}
465 Log To Console *********************
466 Log To Console response = ${resp}
467 Log To Console body = ${resp.text}
468 ${response_json} json.loads ${resp.content}
469 ${generatedPlanId}= Convert To String ${response_json['id']}
470 Set Global Variable ${generatedPlanId}
471 Log To Console generatedPlanId = ${generatedPlanId}
472 Should Be Equal As Integers ${resp.status_code} 201
473 Sleep 60s Wait Plan Resolution
474
475GetPlanWithHpaUnmatched
476 [Documentation] It sends a REST GET request to capture recommendations
477 Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT}
Dileep Ranganathan5dc29ae2018-10-06 16:35:11 -0700478 &{headers}= Create Dictionary Authorization=${HAS_Auth} Content-Type=application/json Accept=application/json
Gary Wu9abb61c2018-09-27 10:38:50 -0700479 ${resp}= Get Request optf-cond /v1/plans/${generatedPlanId} headers=${headers}
480 Log To Console *********************
481 Log To Console response = ${resp}
482 ${response_json} json.loads ${resp.content}
483 ${resultStatus}= Convert To String ${response_json['plans'][0]['status']}
484 Set Global Variable ${resultStatus}
485 Log To Console resultStatus = ${resultStatus}
486 Log To Console body = ${resp.text}
487 Should Be Equal As Integers ${resp.status_code} 200
488 Should Be Equal not found ${resultStatus}
489
490# HPA Score Multi objective Optimization
491SendPlanWithHpaScoreMultiObj
492 [Documentation] It sends a POST request to conductor
493 Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT}
494 ${data}= Get Binary File ${CURDIR}${/}data${/}plan_with_hpa_score_multi_objective.json
Dileep Ranganathan5dc29ae2018-10-06 16:35:11 -0700495 &{headers}= Create Dictionary Authorization=${HAS_Auth} Content-Type=application/json Accept=application/json
Gary Wu9abb61c2018-09-27 10:38:50 -0700496 ${resp}= Post Request optf-cond /v1/plans data=${data} headers=${headers}
497 Log To Console *********************
498 Log To Console response = ${resp}
499 Log To Console body = ${resp.text}
500 ${response_json} json.loads ${resp.content}
501 ${generatedPlanId}= Convert To String ${response_json['id']}
502 Set Global Variable ${generatedPlanId}
503 Log To Console generatedPlanId = ${generatedPlanId}
504 Should Be Equal As Integers ${resp.status_code} 201
505 Sleep 60s Wait Plan Resolution
506
507GetPlanWithHpaScoreMultiObj
508 [Documentation] It sends a REST GET request to capture recommendations
509 Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT}
Dileep Ranganathan5dc29ae2018-10-06 16:35:11 -0700510 &{headers}= Create Dictionary Authorization=${HAS_Auth} Content-Type=application/json Accept=application/json
Gary Wu9abb61c2018-09-27 10:38:50 -0700511 ${resp}= Get Request optf-cond /v1/plans/${generatedPlanId} headers=${headers}
512 Log To Console *********************
513 Log To Console response = ${resp}
514 ${response_json} json.loads ${resp.content}
515 ${resultStatus}= Convert To String ${response_json['plans'][0]['status']}
516 ${vim-id}= Convert To String ${response_json['plans'][0]['recommendations'][0]['vG']['candidate']['vim-id']}
517 # ${hpa_score}= Convert To String ${response_json['plans'][0]['recommendations']['vG']['hpa_score']}
518 Set Global Variable ${resultStatus}
519 Log To Console resultStatus = ${resultStatus}
520 Log To Console body = ${resp.text}
521 Should Be Equal As Integers ${resp.status_code} 200
522 Should Be Equal done ${resultStatus}
523 Should Be Equal HPA-cloud_cloud-region-1 ${vim-id}
524
525
526*** Keywords ***
527
528