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 |
| 10 | ${generatedAID} |
| 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 |
| 26 | ${resp}= Get Request SMS /v1/sms/status headers=${headers} |
| 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} |
| 41 | Should Be Equal As Integers ${resp.status_code} 201 |
| 42 | |
| 43 | SMS CreateSecret |
| 44 | [Documentation] Create A Secret within the Domain |
| 45 | Create Session SMS ${SMS_HOSTNAME}:${SMS_PORT} |
| 46 | ${data} Get Binary File ${CURDIR}${/}data${/}create_secret.json |
| 47 | &{headers}= Create Dictionary Content-Type=application/json Accept=application/json |
| 48 | ${resp}= Post Request SMS /v1/sms/domain/curltestdomain/secret data=${data} headers=${headers} |
| 49 | Log To Console ********************* |
| 50 | Log To Console response = ${resp} |
| 51 | Log To Console body = ${resp.text} |
| 52 | Should Be Equal As Integers ${resp.status_code} 201 |
| 53 | |
| 54 | SMS ListSecret |
| 55 | [Documentation] Lists all Secret Names within Domain |
| 56 | Create Session SMS ${SMS_HOSTNAME}:${SMS_PORT} |
| 57 | &{headers}= Create Dictionary Content-Type=application/json Accept=application/json |
| 58 | ${resp}= Get Request SMS /v1/sms/domain/curltestdomain/secret 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 | SMS GetSecret |
| 65 | [Documentation] Gets a single Secret with Values from Domain |
| 66 | Create Session SMS ${SMS_HOSTNAME}:${SMS_PORT} |
| 67 | &{headers}= Create Dictionary Content-Type=application/json Accept=application/json |
| 68 | ${resp}= Get Request SMS /v1/sms/domain/curltestdomain/secret/curltestsecret1 headers=${headers} |
| 69 | Log To Console ********************* |
| 70 | Log To Console response = ${resp} |
| 71 | Log To Console body = ${resp.text} |
| 72 | Should Be Equal As Integers ${resp.status_code} 200 |
| 73 | |
| 74 | SMS DeleteSecret |
| 75 | [Documentation] Deletes a Secret referenced by Name from Domain |
| 76 | Create Session SMS ${SMS_HOSTNAME}:${SMS_PORT} |
| 77 | &{headers}= Create Dictionary Content-Type=application/json Accept=application/json |
| 78 | ${resp}= Delete Request SMS /v1/sms/domain/curltestdomain/secret/curltestsecret1 headers=${headers} |
| 79 | Log To Console ********************* |
| 80 | Log To Console response = ${resp} |
| 81 | Log To Console body = ${resp.text} |
| 82 | Should Be Equal As Integers ${resp.status_code} 204 |
| 83 | |
| 84 | SMS DeleteDomain |
| 85 | [Documentation] Deletes a Domain referenced by Name |
| 86 | Create Session SMS ${SMS_HOSTNAME}:${SMS_PORT} |
| 87 | &{headers}= Create Dictionary Content-Type=application/json Accept=application/json |
| 88 | ${resp}= Delete Request SMS /v1/sms/domain/curltestdomain headers=${headers} |
| 89 | Log To Console ********************* |
| 90 | Log To Console response = ${resp} |
| 91 | Log To Console body = ${resp.text} |
| 92 | Should Be Equal As Integers ${resp.status_code} 204 |
| 93 | |
| 94 | *** Keywords *** |