blob: 93084a00957d81b09e56251115e6ee208c1e86e6 [file] [log] [blame]
Kiran Kaminenibe7fcd92018-03-27 11:23:37 -07001*** Settings ***
2Library OperatingSystem
3Library RequestsLibrary
4Library json
5
6*** Variables ***
7${MESSAGE} {"ping": "ok"}
8
9#global variables
Kiran Kaminenie3eb1652018-09-13 12:10:48 -070010${generatedDomId}
Kiran Kaminenibe7fcd92018-03-27 11:23:37 -070011
12*** Test Cases ***
13SMS 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
22SMS 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 Kaminenia42f86e2018-04-17 11:58:21 -070026 ${resp}= Get Request SMS /v1/sms/quorum/status headers=${headers}
Kiran Kaminenibe7fcd92018-03-27 11:23:37 -070027 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
32SMS 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 Kaminenie3eb1652018-09-13 12:10:48 -070041 ${response_json} json.loads ${resp.content}
42 ${generatedDomId}= Convert To String ${response_json['uuid']}
43 Set Global Variable ${generatedDomId}
Kiran Kaminenibe7fcd92018-03-27 11:23:37 -070044 Should Be Equal As Integers ${resp.status_code} 201
45
46SMS 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 Kaminenie3eb1652018-09-13 12:10:48 -070051 ${resp}= Post Request SMS /v1/sms/domain/${generatedDomId}/secret data=${data} headers=${headers}
Kiran Kaminenibe7fcd92018-03-27 11:23:37 -070052 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
57SMS 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 Kaminenie3eb1652018-09-13 12:10:48 -070061 ${resp}= Get Request SMS /v1/sms/domain/${generatedDomId}/secret headers=${headers}
Kiran Kaminenibe7fcd92018-03-27 11:23:37 -070062 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
67SMS 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 Kaminenie3eb1652018-09-13 12:10:48 -070071 ${resp}= Get Request SMS /v1/sms/domain/${generatedDomId}/secret/curltestsecret1 headers=${headers}
Kiran Kaminenibe7fcd92018-03-27 11:23:37 -070072 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
77SMS 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 Kaminenie3eb1652018-09-13 12:10:48 -070081 ${resp}= Delete Request SMS /v1/sms/domain/${generatedDomId}/secret/curltestsecret1 headers=${headers}
Kiran Kaminenibe7fcd92018-03-27 11:23:37 -070082 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
87SMS 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 Kaminenie3eb1652018-09-13 12:10:48 -070091 ${resp}= Delete Request SMS /v1/sms/domain/${generatedDomId} headers=${headers}
Kiran Kaminenibe7fcd92018-03-27 11:23:37 -070092 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 ***