Kiran Kamineni | be7fcd9 | 2018-03-27 11:23:37 -0700 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Library OperatingSystem |
| 3 | Library RequestsLibrary |
| 4 | Library json |
| 5 | |
| 6 | *** Variables *** |
| 7 | ${MESSAGE} {"ping": "ok"} |
| 8 | |
| 9 | #global variables |
Kiran Kamineni | e3eb165 | 2018-09-13 12:10:48 -0700 | [diff] [blame^] | 10 | ${generatedDomId} |
Kiran Kamineni | be7fcd9 | 2018-03-27 11:23:37 -0700 | [diff] [blame] | 11 | |
| 12 | *** Test Cases *** |
| 13 | SMS Check SMS API Docker Container |
| 14 | [Documentation] Checks if SMS docker container is running |
| 15 | ${rc} ${output}= Run and Return RC and Output docker ps |
| 16 | Log To Console ********************* |
| 17 | Log To Console retrurn_code = ${rc} |
| 18 | Log To Console output = ${output} |
| 19 | Should Be Equal As Integers ${rc} 0 |
| 20 | Should Contain ${output} nexus3.onap.org:10001/onap/aaf/sms |
| 21 | |
| 22 | SMS GetStatus |
| 23 | [Documentation] Gets Backend Status |
| 24 | Create Session SMS ${SMS_HOSTNAME}:${SMS_PORT} |
| 25 | &{headers}= Create Dictionary Content-Type=application/json Accept=application/json |
Kiran Kamineni | a42f86e | 2018-04-17 11:58:21 -0700 | [diff] [blame] | 26 | ${resp}= Get Request SMS /v1/sms/quorum/status headers=${headers} |
Kiran Kamineni | be7fcd9 | 2018-03-27 11:23:37 -0700 | [diff] [blame] | 27 | Log To Console ********************* |
| 28 | Log To Console response = ${resp} |
| 29 | Log To Console body = ${resp.text} |
| 30 | Should Be Equal As Integers ${resp.status_code} 200 |
| 31 | |
| 32 | SMS CreateDomain |
| 33 | [Documentation] Creates a Secret Domain to hold Secrets |
| 34 | Create Session SMS ${SMS_HOSTNAME}:${SMS_PORT} |
| 35 | ${data} Get Binary File ${CURDIR}${/}data${/}create_domain.json |
| 36 | &{headers}= Create Dictionary Content-Type=application/json Accept=application/json |
| 37 | ${resp}= Post Request SMS /v1/sms/domain data=${data} headers=${headers} |
| 38 | Log To Console ********************* |
| 39 | Log To Console response = ${resp} |
| 40 | Log To Console body = ${resp.text} |
Kiran Kamineni | e3eb165 | 2018-09-13 12:10:48 -0700 | [diff] [blame^] | 41 | ${response_json} json.loads ${resp.content} |
| 42 | ${generatedDomId}= Convert To String ${response_json['uuid']} |
| 43 | Set Global Variable ${generatedDomId} |
Kiran Kamineni | be7fcd9 | 2018-03-27 11:23:37 -0700 | [diff] [blame] | 44 | Should Be Equal As Integers ${resp.status_code} 201 |
| 45 | |
| 46 | SMS CreateSecret |
| 47 | [Documentation] Create A Secret within the Domain |
| 48 | Create Session SMS ${SMS_HOSTNAME}:${SMS_PORT} |
| 49 | ${data} Get Binary File ${CURDIR}${/}data${/}create_secret.json |
| 50 | &{headers}= Create Dictionary Content-Type=application/json Accept=application/json |
Kiran Kamineni | e3eb165 | 2018-09-13 12:10:48 -0700 | [diff] [blame^] | 51 | ${resp}= Post Request SMS /v1/sms/domain/${generatedDomId}/secret data=${data} headers=${headers} |
Kiran Kamineni | be7fcd9 | 2018-03-27 11:23:37 -0700 | [diff] [blame] | 52 | Log To Console ********************* |
| 53 | Log To Console response = ${resp} |
| 54 | Log To Console body = ${resp.text} |
| 55 | Should Be Equal As Integers ${resp.status_code} 201 |
| 56 | |
| 57 | SMS ListSecret |
| 58 | [Documentation] Lists all Secret Names within Domain |
| 59 | Create Session SMS ${SMS_HOSTNAME}:${SMS_PORT} |
| 60 | &{headers}= Create Dictionary Content-Type=application/json Accept=application/json |
Kiran Kamineni | e3eb165 | 2018-09-13 12:10:48 -0700 | [diff] [blame^] | 61 | ${resp}= Get Request SMS /v1/sms/domain/${generatedDomId}/secret headers=${headers} |
Kiran Kamineni | be7fcd9 | 2018-03-27 11:23:37 -0700 | [diff] [blame] | 62 | Log To Console ********************* |
| 63 | Log To Console response = ${resp} |
| 64 | Log To Console body = ${resp.text} |
| 65 | Should Be Equal As Integers ${resp.status_code} 200 |
| 66 | |
| 67 | SMS GetSecret |
| 68 | [Documentation] Gets a single Secret with Values from Domain |
| 69 | Create Session SMS ${SMS_HOSTNAME}:${SMS_PORT} |
| 70 | &{headers}= Create Dictionary Content-Type=application/json Accept=application/json |
Kiran Kamineni | e3eb165 | 2018-09-13 12:10:48 -0700 | [diff] [blame^] | 71 | ${resp}= Get Request SMS /v1/sms/domain/${generatedDomId}/secret/curltestsecret1 headers=${headers} |
Kiran Kamineni | be7fcd9 | 2018-03-27 11:23:37 -0700 | [diff] [blame] | 72 | Log To Console ********************* |
| 73 | Log To Console response = ${resp} |
| 74 | Log To Console body = ${resp.text} |
| 75 | Should Be Equal As Integers ${resp.status_code} 200 |
| 76 | |
| 77 | SMS DeleteSecret |
| 78 | [Documentation] Deletes a Secret referenced by Name from Domain |
| 79 | Create Session SMS ${SMS_HOSTNAME}:${SMS_PORT} |
| 80 | &{headers}= Create Dictionary Content-Type=application/json Accept=application/json |
Kiran Kamineni | e3eb165 | 2018-09-13 12:10:48 -0700 | [diff] [blame^] | 81 | ${resp}= Delete Request SMS /v1/sms/domain/${generatedDomId}/secret/curltestsecret1 headers=${headers} |
Kiran Kamineni | be7fcd9 | 2018-03-27 11:23:37 -0700 | [diff] [blame] | 82 | Log To Console ********************* |
| 83 | Log To Console response = ${resp} |
| 84 | Log To Console body = ${resp.text} |
| 85 | Should Be Equal As Integers ${resp.status_code} 204 |
| 86 | |
| 87 | SMS DeleteDomain |
| 88 | [Documentation] Deletes a Domain referenced by Name |
| 89 | Create Session SMS ${SMS_HOSTNAME}:${SMS_PORT} |
| 90 | &{headers}= Create Dictionary Content-Type=application/json Accept=application/json |
Kiran Kamineni | e3eb165 | 2018-09-13 12:10:48 -0700 | [diff] [blame^] | 91 | ${resp}= Delete Request SMS /v1/sms/domain/${generatedDomId} headers=${headers} |
Kiran Kamineni | be7fcd9 | 2018-03-27 11:23:37 -0700 | [diff] [blame] | 92 | Log To Console ********************* |
| 93 | Log To Console response = ${resp} |
| 94 | Log To Console body = ${resp.text} |
| 95 | Should Be Equal As Integers ${resp.status_code} 204 |
| 96 | |
| 97 | *** Keywords *** |