Kiran Kamineni | ac3438c | 2019-03-13 12:24:23 -0700 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Suite Setup Run keywords Check k8splugin API Docker Container Created header Created session |
| 3 | Library OperatingSystem |
| 4 | Library RequestsLibrary |
| 5 | |
| 6 | *** Variables *** |
| 7 | |
| 8 | *** Test Cases *** |
| 9 | Create Definition |
| 10 | [Template] Post template |
| 11 | /v1/rb/definition create_rbdefinition.json |
| 12 | |
| 13 | Get Definition |
| 14 | [Template] Get template |
| 15 | /v1/rb/definition |
| 16 | /v1/rb/definition/7eb09e38-4363-9942-1234-3beb2e95fd85 |
| 17 | |
| 18 | Delete Definition |
| 19 | [Template] Delete template |
| 20 | /v1/rb/definition/7eb09e38-4363-9942-1234-3beb2e95fd85 |
| 21 | |
| 22 | *** Keywords *** |
| 23 | Created session |
| 24 | Create Session multicloud_k8s_session http://${SERVICE_IP}:${SERVICE_PORT} |
| 25 | Set Suite Variable ${suite_multicloud_k8s_session} multicloud_k8s_session |
| 26 | |
| 27 | Created header |
| 28 | ${headers}= Create Dictionary Content-Type=application/json Accept=application/json |
| 29 | Set Suite Variable ${suite_headers} ${headers} |
| 30 | |
| 31 | Delete template |
| 32 | [Documentation] Deletes from Definition |
| 33 | [Arguments] ${topic} |
| 34 | ${resp}= Delete Request ${suite_multicloud_k8s_session} ${topic} headers=${suite_headers} |
| 35 | Log To Console ********************* |
| 36 | Log To Console response = ${resp} |
| 37 | Log To Console body = ${resp.text} |
| 38 | Should Be Equal As Integers ${resp.status_code} 204 |
| 39 | |
| 40 | Post template |
| 41 | [Documentation] Create A Definition |
| 42 | [Arguments] ${topic} ${file} |
| 43 | ${data} Get Binary File ${CURDIR}${/}data${/}${file} |
| 44 | ${resp}= Post Request ${suite_multicloud_k8s_session} ${topic} data=${data} headers=${suite_headers} |
| 45 | Log To Console ********************* |
| 46 | Log To Console response = ${resp} |
| 47 | Log To Console body = ${resp.text} |
| 48 | Should Be Equal As Integers ${resp.status_code} 201 |
| 49 | |
| 50 | Get template |
| 51 | [Documentation] Gets from Definition |
| 52 | [Arguments] ${topic} |
| 53 | ${resp}= Get Request ${suite_multicloud_k8s_session} ${topic} headers=${suite_headers} |
| 54 | Log To Console ********************* |
| 55 | Log To Console response = ${resp} |
| 56 | Log To Console body = ${resp.text} |
| 57 | Should Be Equal As Integers ${resp.status_code} 200 |
| 58 | |
| 59 | Check k8splugin API Docker Container |
| 60 | [Documentation] Checks if k8splugin docker container is running |
| 61 | ${rc} ${output}= Run and Return RC and Output docker ps |
| 62 | Log To Console ********************* |
| 63 | Log To Console retrurn_code = ${rc} |
| 64 | Log To Console output = ${output} |
| 65 | Should Be Equal As Integers ${rc} 0 |
| 66 | Should Contain ${output} nexus3.onap.org:10001/onap/multicloud/k8s |