blob: 37d3e1585f7383115000120a69ac75ff45f2d166 [file] [log] [blame]
Gary Wu9abb61c2018-09-27 10:38:50 -07001*** Settings ***
2Resource ../../common.robot
3Library Collections
4Library json
5Library OperatingSystem
6Library RequestsLibrary
7Library HttpLibrary.HTTP
8Library String
9
10
11*** Variables ***
efiacor3d202b52021-03-29 09:25:03 +010012${DBC_URI} webapi
13${DBC_URL} http://${DMAAP_BC_IP}:8080/${DBC_URI}
Gary Wu9abb61c2018-09-27 10:38:50 -070014${TOPIC_NS} org.onap.dmaap.onapCSIT
15${LOC} csit-sanfrancisco
16${PUB_CORE} "dcaeLocationName": "${LOC}", "clientRole": "org.onap.dmaap.client.pub", "action": [ "pub", "view" ]
17${SUB_CORE} "dcaeLocationName": "${LOC}", "clientRole": "org.onap.dmaap.client.sub", "action": [ "sub", "view" ]
18${PUB} { ${PUB_CORE} }
19${SUB} { ${SUB_CORE} }
20${TOPIC1_DATA} { "topicName":"singleMRtopic1", "topicDescription":"generated for CSIT", "owner":"dgl"}
21${TOPIC2_DATA} { "topicName":"singleMRtopic2", "topicDescription":"generated for CSIT", "owner":"dgl", "clients": [ ${PUB}, ${SUB}] }
22${TOPIC3_DATA} { "topicName":"singleMRtopic3", "topicDescription":"generated for CSIT", "owner":"dgl"}
23${PUB3_DATA} { "fqtn": "${TOPIC_NS}.singleMRtopic3", ${PUB_CORE} }
24${SUB3_DATA} { "fqtn": "${TOPIC_NS}.singleMRtopic3", ${SUB_CORE} }
25
26
Gary Wu9abb61c2018-09-27 10:38:50 -070027*** Test Cases ***
Gary Wu9abb61c2018-09-27 10:38:50 -070028(DMAAP-293)
29 [Documentation] Create Topic w no clients POST ${DBC_URI}/topics endpoint
30 ${resp}= PostCall ${DBC_URL}/topics ${TOPIC1_DATA}
31 Should Be Equal As Integers ${resp.status_code} 201
32
33(DMAAP-294)
34 [Documentation] Create Topic w pub and sub clients POST ${DBC_URI}/topics endpoint
35 ${resp}= PostCall ${DBC_URL}/topics ${TOPIC2_DATA}
36 Should Be Equal As Integers ${resp.status_code} 201
37
38(DMAAP-295)
39 [Documentation] Create Topic w no clients and then add a client POST ${DBC_URI}/mr_clients endpoint
40 ${resp}= PostCall ${DBC_URL}/topics ${TOPIC3_DATA}
41 Should Be Equal As Integers ${resp.status_code} 201
42 ${resp}= PostCall ${DBC_URL}/mr_clients ${PUB3_DATA}
43 Should Be Equal As Integers ${resp.status_code} 200
44 ${resp}= PostCall ${DBC_URL}/mr_clients ${SUB3_DATA}
45 Should Be Equal As Integers ${resp.status_code} 200
46
47(DMAAP-297)
48 [Documentation] Query for all topics and specific topic
49 Create Session get ${DBC_URL}
efiacor3d202b52021-03-29 09:25:03 +010050 ${resp}= GET On Session get /topics
Gary Wu9abb61c2018-09-27 10:38:50 -070051 Should Be Equal As Integers ${resp.status_code} 200
efiacor3d202b52021-03-29 09:25:03 +010052 ${resp}= GET On Session get /topics/${TOPIC_NS}.singleMRtopic3
Gary Wu9abb61c2018-09-27 10:38:50 -070053 Should Be Equal As Integers ${resp.status_code} 200
54
55(DMAAP-301)
56 [Documentation] Delete a subscriber
57 Create Session get ${DBC_URL}
efiacor3d202b52021-03-29 09:25:03 +010058 ${resp}= GET On Session get /topics/${TOPIC_NS}.singleMRtopic3
Gary Wu9abb61c2018-09-27 10:38:50 -070059 Should Be Equal As Integers ${resp.status_code} 200
efiacor3d202b52021-03-29 09:25:03 +010060 ${JSON}= Evaluate json.loads(r"""${resp.content}""", strict=False)
61 ${clientId}= Set Variable ${JSON['clients'][1]['mrClientId']}
Gary Wu9abb61c2018-09-27 10:38:50 -070062 ${resp}= DelCall ${DBC_URL}/mr_clients/${clientId}
63 Should Be Equal As Integers ${resp.status_code} 204
64
65(DMAAP-302)
66 [Documentation] Delete a publisher
67 Create Session get ${DBC_URL}
efiacor3d202b52021-03-29 09:25:03 +010068 ${resp}= GET On Session get /topics/${TOPIC_NS}.singleMRtopic3
Gary Wu9abb61c2018-09-27 10:38:50 -070069 Should Be Equal As Integers ${resp.status_code} 200
efiacor3d202b52021-03-29 09:25:03 +010070 ${JSON}= Evaluate json.loads(r"""${resp.content}""", strict=False)
71 ${clientId}= Set Variable ${JSON['clients'][0]['mrClientId']}
Gary Wu9abb61c2018-09-27 10:38:50 -070072 ${resp}= DelCall ${DBC_URL}/mr_clients/${clientId}
73 Should Be Equal As Integers ${resp.status_code} 204
74
75
76*** Keywords ***
Gary Wu9abb61c2018-09-27 10:38:50 -070077PostCall
78 [Arguments] ${url} ${data}
79 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
80 ${resp}= Evaluate requests.post('${url}',data='${data}', headers=${headers},verify=False) requests
81 [Return] ${resp}
82
83DelCall
84 [Arguments] ${url}
85 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
86 ${resp}= Evaluate requests.delete('${url}', headers=${headers},verify=False) requests
87 [Return] ${resp}