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 ${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 ${FEED1_DATA} { "feedName":"feed1", "feedVersion": "csit", "feedDescription":"generated for CSIT", "owner":"dgl", "asprClassification": "unclassified" }
21 ${FEED2_DATA} { "feedName":"feed2", "feedVersion": "csit", "feedDescription":"generated for CSIT", "owner":"dgl", "asprClassification": "unclassified" }
22 ${PUB2_DATA} { "dcaeLocationName": "${LOC}", "username": "pub2", "userpwd": "topSecret123", "feedId": "2" }
23 ${SUB2_DATA} { "dcaeLocationName": "${LOC}", "username": "sub2", "userpwd": "someSecret123", "deliveryURL": "https://${DMAAPBC_IP}:8443/webapi/noURI", "feedId": "2" }
24 ${TOPIC2_DATA} { "topicName":"singleMRtopic2", "topicDescription":"generated for CSIT", "owner":"dgl", "clients": [ ${PUB}, ${SUB}] }
25 ${TOPIC3_DATA} { "topicName":"singleMRtopic3", "topicDescription":"generated for CSIT", "owner":"dgl"}
26 #${PUB3_DATA} { "fqtn": "${TOPIC_NS}.singleMRtopic3", ${PUB_CORE} }
27 #${SUB3_DATA} { "fqtn": "${TOPIC_NS}.singleMRtopic3", ${SUB_CORE} }
33 [Documentation] Check if www.onap.org can be reached
34 Create Session sanity http://onap.readthedocs.io
35 ${resp}= Get Request sanity /
36 Should Be Equal As Integers ${resp.status_code} 200
39 [Documentation] Create Feed w no clients POST ${DBC_URI}/feeds endpoint
40 ${resp}= PostCall ${DBC_URL}/feeds ${FEED1_DATA}
41 Should Be Equal As Integers ${resp.status_code} 200
44 [Documentation] Create Feed w clients POST ${DBC_URI}/feeds endpoint
45 ${resp}= PostCall ${DBC_URL}/feeds ${FEED2_DATA}
46 Should Be Equal As Integers ${resp.status_code} 200
49 [Documentation] Add Publisher to existing feed
50 ${resp}= PostCall ${DBC_URL}/dr_pubs ${PUB2_DATA}
51 Should Be Equal As Integers ${resp.status_code} 201
52 ${tmp}= Get Json Value ${resp.text} /pubId
53 ${tmp}= Remove String ${tmp} \"
54 Set Suite Variable ${pubId} ${tmp}
57 [Documentation] Add Subscriber to existing feed
58 ${resp}= PostCall ${DBC_URL}/dr_subs ${SUB2_DATA}
59 Should Be Equal As Integers ${resp.status_code} 201
60 ${tmp}= Get Json Value ${resp.text} /subId
61 ${tmp}= Remove String ${tmp} \"
62 Set Suite Variable ${subId} ${tmp}
65 [Documentation] List existing feeds
66 Create Session get ${DBC_URL}
67 ${resp}= Get Request get /feeds
68 Should Be Equal As Integers ${resp.status_code} 200
71 [Documentation] Delete existing subscriber
72 ${resp}= DelCall ${DBC_URL}/dr_subs/${subId}
73 Should Be Equal As Integers ${resp.status_code} 204
76 [Documentation] Delete existing publisher
77 ${resp}= DelCall ${DBC_URL}/dr_pubs/${pubId}
78 Should Be Equal As Integers ${resp.status_code} 204
81 # [Documentation] Create Topic w pub and sub clients POST ${DBC_URI}/topics endpoint
82 # ${resp}= PostCall ${DBC_URL}/topics ${TOPIC2_DATA}
83 # Should Be Equal As Integers ${resp.status_code} 201
86 # [Documentation] Create Topic w no clients and then add a client POST ${DBC_URI}/mr_clients endpoint
87 # ${resp}= PostCall ${DBC_URL}/topics ${TOPIC3_DATA}
88 # Should Be Equal As Integers ${resp.status_code} 201
89 # ${resp}= PostCall ${DBC_URL}/mr_clients ${PUB3_DATA}
90 # Should Be Equal As Integers ${resp.status_code} 200
91 # ${resp}= PostCall ${DBC_URL}/mr_clients ${SUB3_DATA}
92 # Should Be Equal As Integers ${resp.status_code} 200
95 # [Documentation] Query for all topics and specific topic
96 # Create Session get ${DBC_URL}
97 # ${resp}= Get Request get /topics
98 # Should Be Equal As Integers ${resp.status_code} 200
99 # ${resp}= Get Request get /topics/${TOPIC_NS}.singleMRtopic3
100 # Should Be Equal As Integers ${resp.status_code} 200
103 # [Documentation] Delete a subscriber
104 # Create Session get ${DBC_URL}
105 # ${resp}= Get Request get /topics/${TOPIC_NS}.singleMRtopic3
106 # Should Be Equal As Integers ${resp.status_code} 200
107 # ${tmp}= Get Json Value ${resp.text} /clients/1/mrClientId
108 # ${clientId}= Remove String ${tmp} \"
109 # ${resp}= DelCall ${DBC_URL}/mr_clients/${clientId}
110 # Should Be Equal As Integers ${resp.status_code} 204
113 # [Documentation] Delete a publisher
114 # Create Session get ${DBC_URL}
115 # ${resp}= Get Request get /topics/${TOPIC_NS}.singleMRtopic3
116 # Should Be Equal As Integers ${resp.status_code} 200
117 # ${tmp}= Get Json Value ${resp.text} /clients/0/mrClientId
118 # ${clientId}= Remove String ${tmp} \"
119 # ${resp}= DelCall ${DBC_URL}/mr_clients/${clientId}
120 # Should Be Equal As Integers ${resp.status_code} 204
126 Directory Should Exist ${path}
129 [Arguments] ${session} ${path} ${expect}
130 ${resp}= Get Request ${session} ${path}
131 Should Be Equal As Integers ${resp.status_code} ${expect}
134 [Arguments] ${url} ${data}
135 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
136 ${resp}= Evaluate requests.post('${url}',data='${data}', headers=${headers},verify=False) requests
141 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
142 ${resp}= Evaluate requests.delete('${url}', headers=${headers},verify=False) requests