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