blob: d68b9ed1756d4da83a43c77dd92cfcffd06d0c2c [file] [log] [blame]
Dominic Lunanuova5a2d8972018-04-17 20:59:12 +00001*** Settings ***
2Resource ../../common.robot
3Library Collections
4Library json
5Library OperatingSystem
6Library RequestsLibrary
Dominic Lunanuovadb5f9892018-04-20 18:54:47 +00007Library HttpLibrary.HTTP
8Library String
Dominic Lunanuova5a2d8972018-04-17 20:59:12 +00009
10
11*** Variables ***
12${MESSAGE} Hello, world!
13${DBC_URI} webapi
Dominic Lunanuovadb5f9892018-04-20 18:54:47 +000014${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} }
Dominic Lunanuova5a2d8972018-04-17 20:59:12 +000026
27
28
29*** Test Cases ***
30Url Test
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
35
Dominic Lunanuovadb5f9892018-04-20 18:54:47 +000036(DMAAP-293)
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
40
41(DMAAP-294)
42 [Documentation] Create Topic w pub and sub clients POST ${DBC_URI}/topics endpoint
43 ${resp}= PostCall ${DBC_URL}/topics ${TOPIC2_DATA}
Dominic Lunanuova5a2d8972018-04-17 20:59:12 +000044 Should Be Equal As Integers ${resp.status_code} 201
45
Dominic Lunanuovadb5f9892018-04-20 18:54:47 +000046(DMAAP-295)
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
54
55(DMAAP-297)
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
62
63(DMAAP-301)
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
72
73(DMAAP-302)
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
82
83
Dominic Lunanuova5a2d8972018-04-17 20:59:12 +000084*** Keywords ***
85CheckDir
86 [Arguments] ${path}
87 Directory Should Exist ${path}
88
89CheckUrl
90 [Arguments] ${session} ${path} ${expect}
91 ${resp}= Get Request ${session} ${path}
92 Should Be Equal As Integers ${resp.status_code} ${expect}
93
94PostCall
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
98 [Return] ${resp}
99
Dominic Lunanuovadb5f9892018-04-20 18:54:47 +0000100DelCall
101 [Arguments] ${url}
102 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
103 ${resp}= Evaluate requests.delete('${url}', headers=${headers},verify=False) requests
104 [Return] ${resp}