2 Resource ../../common.robot
5 Library OperatingSystem
6 Library RequestsLibrary
7 Library HttpLibrary.HTTP
12 ${MESSAGE} Hello, world!
14 ${DBC_URL} http://${DMAAPBC_IP}:8080/${DBC_URI}
15 ${TOPIC_NS} org.onap.dmaap.onapCSIT
16 ${LOC} csit-sanfrancisco
17 ${PUB_CORE} "dcaeLocationName": "${LOC}", "clientRole": "org.onap.dmaap.client.pub", "action": [ "pub", "view" ]
18 ${SUB_CORE} "dcaeLocationName": "${LOC}", "clientRole": "org.onap.dmaap.client.sub", "action": [ "sub", "view" ]
19 ${PUB} { ${PUB_CORE} }
20 ${SUB} { ${SUB_CORE} }
21 ${TOPIC1_DATA} { "topicName":"singleMRtopic1", "topicDescription":"generated for CSIT", "owner":"dgl"}
22 ${TOPIC2_DATA} { "topicName":"singleMRtopic2", "topicDescription":"generated for CSIT", "owner":"dgl", "clients": [ ${PUB}, ${SUB}] }
23 ${TOPIC3_DATA} { "topicName":"singleMRtopic3", "topicDescription":"generated for CSIT", "owner":"dgl"}
24 ${PUB3_DATA} { "fqtn": "${TOPIC_NS}.singleMRtopic3", ${PUB_CORE} }
25 ${SUB3_DATA} { "fqtn": "${TOPIC_NS}.singleMRtopic3", ${SUB_CORE} }
31 [Documentation] Check if www.onap.org can be reached
32 Create Session sanity http://onap.readthedocs.io
33 ${resp}= Get Request sanity /
34 Should Be Equal As Integers ${resp.status_code} 200
37 [Documentation] Create Topic w no clients POST ${DBC_URI}/topics endpoint
38 ${resp}= PostCall ${DBC_URL}/topics ${TOPIC1_DATA}
39 Should Be Equal As Integers ${resp.status_code} 201
42 [Documentation] Create Topic w pub and sub clients POST ${DBC_URI}/topics endpoint
43 ${resp}= PostCall ${DBC_URL}/topics ${TOPIC2_DATA}
44 Should Be Equal As Integers ${resp.status_code} 201
47 [Documentation] Create Topic w no clients and then add a client POST ${DBC_URI}/mr_clients endpoint
48 ${resp}= PostCall ${DBC_URL}/topics ${TOPIC3_DATA}
49 Should Be Equal As Integers ${resp.status_code} 201
50 ${resp}= PostCall ${DBC_URL}/mr_clients ${PUB3_DATA}
51 Should Be Equal As Integers ${resp.status_code} 200
52 ${resp}= PostCall ${DBC_URL}/mr_clients ${SUB3_DATA}
53 Should Be Equal As Integers ${resp.status_code} 200
56 [Documentation] Query for all topics and specific topic
57 Create Session get ${DBC_URL}
58 ${resp}= Get Request get /topics
59 Should Be Equal As Integers ${resp.status_code} 200
60 ${resp}= Get Request get /topics/${TOPIC_NS}.singleMRtopic3
61 Should Be Equal As Integers ${resp.status_code} 200
64 [Documentation] Delete a subscriber
65 Create Session get ${DBC_URL}
66 ${resp}= Get Request get /topics/${TOPIC_NS}.singleMRtopic3
67 Should Be Equal As Integers ${resp.status_code} 200
68 ${tmp}= Get Json Value ${resp.text} /clients/1/mrClientId
69 ${clientId}= Remove String ${tmp} \"
70 ${resp}= DelCall ${DBC_URL}/mr_clients/${clientId}
71 Should Be Equal As Integers ${resp.status_code} 204
74 [Documentation] Delete a publisher
75 Create Session get ${DBC_URL}
76 ${resp}= Get Request get /topics/${TOPIC_NS}.singleMRtopic3
77 Should Be Equal As Integers ${resp.status_code} 200
78 ${tmp}= Get Json Value ${resp.text} /clients/0/mrClientId
79 ${clientId}= Remove String ${tmp} \"
80 ${resp}= DelCall ${DBC_URL}/mr_clients/${clientId}
81 Should Be Equal As Integers ${resp.status_code} 204
87 Directory Should Exist ${path}
90 [Arguments] ${session} ${path} ${expect}
91 ${resp}= Get Request ${session} ${path}
92 Should Be Equal As Integers ${resp.status_code} ${expect}
95 [Arguments] ${url} ${data}
96 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
97 ${resp}= Evaluate requests.post('${url}',data='${data}', headers=${headers},verify=False) requests
102 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
103 ${resp}= Evaluate requests.delete('${url}', headers=${headers},verify=False) requests