blob: 2270aee316cecb20175dfc3e1ea3ca740f8765b5 [file] [log] [blame]
Gary Wu9abb61c2018-09-27 10:38:50 -07001*** Settings ***
2Library OperatingSystem
3Library RequestsLibrary
4Library requests
5Library Collections
6Library String
7
8*** Variables ***
9${TARGET_URL} https://${DR_PROV_IP}:8443
10${TARGET_URL_FEED} https://${DR_PROV_IP}:8443/feed/1
11${TARGET_URL_SUBSCRIBE} https://${DR_PROV_IP}:8443/subscribe/1
12${TARGET_URL_SUBSCRIPTION} https://${DR_PROV_IP}:8443/subs/1
Conor Wardfdcd89c2018-10-01 11:03:25 +000013${TARGET_URL_PUBLISH_PROV} https://${DR_PROV_IP}:8443/publish/1/csit_test
14${TARGET_URL_PUBLISH_NODE} https://${DR_NODE_IP}:8443/publish/1/csit_test
Gary Wu9abb61c2018-09-27 10:38:50 -070015${CREATE_FEED_DATA} {"name": "CSIT_Test", "version": "m1.0", "description": "CSIT_Test", "business_description": "CSIT_Test", "suspend": false, "deleted": false, "changeowner": true, "authorization": {"classification": "unclassified", "endpoint_addrs": [], "endpoint_ids": [{"password": "rs873m", "id": "rs873m"}]}}
16${UPDATE_FEED_DATA} {"name": "CSIT_Test", "version": "m1.0", "description": "UPDATED-CSIT_Test", "business_description": "CSIT_Test", "suspend": true, "deleted": false, "changeowner": true, "authorization": {"classification": "unclassified", "endpoint_addrs": [], "endpoint_ids": [{"password": "rs873m", "id": "rs873m"}]}}
17${SUBSCRIBE_DATA} {"delivery":{ "url":"https://${DR_PROV_IP}:8080/", "user":"rs873m", "password":"rs873m", "use100":true}, "metadataOnly":false, "suspend":false, "groupid":29, "subscriber":"sg481n"}
18${UPDATE_SUBSCRIPTION_DATA} {"delivery":{ "url":"https://${DR_PROV_IP}:8080/", "user":"sg481n", "password":"sg481n", "use100":true}, "metadataOnly":false, "suspend":true, "groupid":29, "subscriber":"sg481n"}
egernug6f2874b2019-02-06 15:16:54 +000019${FEED_CONTENT_TYPE} application/vnd.dmaap-dr.feed
20${SUBSCRIBE_CONTENT_TYPE} application/vnd.dmaap-dr.subscription
Gary Wu9abb61c2018-09-27 10:38:50 -070021${PUBLISH_FEED_CONTENT_TYPE} application/octet-stream
22
23*** Test Cases ***
24Run Feed Creation
25 [Documentation] Feed Creation
26 [Timeout] 1 minute
27 ${resp}= PostCall ${TARGET_URL} ${CREATE_FEED_DATA} ${FEED_CONTENT_TYPE} rs873m
28 log ${TARGET_URL}
29 log ${resp.text}
30 Should Be Equal As Strings ${resp.status_code} 201
31 log 'JSON Response Code:'${resp}
32
33Run Subscribe to Feed
34 [Documentation] Subscribe to Feed
35 [Timeout] 1 minute
36 ${resp}= PostCall ${TARGET_URL_SUBSCRIBE} ${SUBSCRIBE_DATA} ${SUBSCRIBE_CONTENT_TYPE} sg481n
37 log ${TARGET_URL_SUBSCRIBE}
38 log ${resp.text}
39 Should Be Equal As Strings ${resp.status_code} 201
40 log 'JSON Response Code:'${resp}
41
42Run Publish Feed
43 [Documentation] Publish to Feed
44 [Timeout] 1 minute
45 Sleep 10s Behaviour was noticed where feed was not created in time for publish to be sent
Conor Wardfdcd89c2018-10-01 11:03:25 +000046 ${resp}= PutCall ${TARGET_URL_PUBLISH_PROV} ${CREATE_FEED_DATA} ${PUBLISH_FEED_CONTENT_TYPE} rs873m
47 log ${TARGET_URL_PUBLISH_PROV}
48 Should Contain ${resp.headers['Location']} https://dmaap-dr-node:8443/publish/1/csit_test
49 ${resp}= PutCall ${TARGET_URL_PUBLISH_NODE} ${CREATE_FEED_DATA} ${PUBLISH_FEED_CONTENT_TYPE} rs873m
Gary Wu9abb61c2018-09-27 10:38:50 -070050 Should Be Equal As Strings ${resp.status_code} 204
51 log 'JSON Response Code:'${resp}
52
53Run Update Subscription
54 [Documentation] Update Subscription to suspend and change delivery credentials
55 [Timeout] 1 minute
56 ${resp}= PutCall ${TARGET_URL_SUBSCRIPTION} ${UPDATE_SUBSCRIPTION_DATA} ${SUBSCRIBE_CONTENT_TYPE} sg481n
57 log ${TARGET_URL_SUBSCRIPTION}
58 log ${resp.text}
59 Should Be Equal As Strings ${resp.status_code} 200
60 log 'JSON Response Code:'${resp}
61 ${resp}= GetCall ${TARGET_URL_SUBSCRIPTION} ${SUBSCRIBE_CONTENT_TYPE} sg481n
62 log ${resp.text}
63 Should Contain ${resp.text} "password":"sg481n","user":"sg481n"
64 log 'JSON Response Code:'${resp}
65
66Run Update Feed
67 [Documentation] Update Feed description and suspend
68 [Timeout] 1 minute
69 ${resp}= PutCall ${TARGET_URL_FEED} ${UPDATE_FEED_DATA} ${FEED_CONTENT_TYPE} rs873m
70 log ${TARGET_URL_FEED}
71 log ${resp.text}
72 Should Be Equal As Strings ${resp.status_code} 200
73 log 'JSON Response Code:'${resp}
74 ${resp}= GetCall ${TARGET_URL_FEED} ${FEED_CONTENT_TYPE} rs873m
75 log ${resp.text}
76 Should Contain ${resp.text} "UPDATED-CSIT_Test"
77 log 'JSON Response Code:'${resp}
78
79Run Delete Subscription
80 [Documentation] Delete Subscription
81 [Timeout] 1 minute
82 ${resp}= DeleteCall ${TARGET_URL_SUBSCRIPTION} sg481n
83 log ${resp.text}
84 Should Be Equal As Strings ${resp.status_code} 204
85 log 'JSON Response Code:'${resp}
86
87Run Delete Feed
88 [Documentation] Delete Feed
89 [Timeout] 1 minute
90 ${resp}= DeleteCall ${TARGET_URL_FEED} rs873m
91 log ${resp.text}
92 Should Be Equal As Strings ${resp.status_code} 204
93 log 'JSON Response Code:'${resp}
94
95*** Keywords ***
96PostCall
97 [Arguments] ${url} ${data} ${content_type} ${user}
egernug6f2874b2019-02-06 15:16:54 +000098 ${headers}= Create Dictionary X-DMAAP-DR-ON-BEHALF-OF=${user} Content-Type=${content_type}
Conor Wardfdcd89c2018-10-01 11:03:25 +000099 ${resp}= Evaluate requests.post('${url}', data='${data}', headers=${headers}, verify=False) requests
Gary Wu9abb61c2018-09-27 10:38:50 -0700100 [Return] ${resp}
101
102PutCall
103 [Arguments] ${url} ${data} ${content_type} ${user}
egernug6f2874b2019-02-06 15:16:54 +0000104 ${headers}= Create Dictionary X-DMAAP-DR-ON-BEHALF-OF=${user} Content-Type=${content_type} Authorization=Basic cnM4NzNtOnJzODczbQ==
Conor Wardfdcd89c2018-10-01 11:03:25 +0000105 ${resp}= Evaluate requests.put('${url}', data='${data}', headers=${headers}, verify=False, allow_redirects=False) requests
Gary Wu9abb61c2018-09-27 10:38:50 -0700106 [Return] ${resp}
107
108GetCall
109 [Arguments] ${url} ${content_type} ${user}
egernug6f2874b2019-02-06 15:16:54 +0000110 ${headers}= Create Dictionary X-DMAAP-DR-ON-BEHALF-OF=${user} Content-Type=${content_type}
Conor Wardfdcd89c2018-10-01 11:03:25 +0000111 ${resp}= Evaluate requests.get('${url}', headers=${headers}, verify=False) requests
Gary Wu9abb61c2018-09-27 10:38:50 -0700112 [Return] ${resp}
113
114DeleteCall
115 [Arguments] ${url} ${user}
egernug6f2874b2019-02-06 15:16:54 +0000116 ${headers}= Create Dictionary X-DMAAP-DR-ON-BEHALF-OF=${user}
Conor Wardfdcd89c2018-10-01 11:03:25 +0000117 ${resp}= Evaluate requests.delete('${url}', headers=${headers}, verify=False) requests
Gary Wu9abb61c2018-09-27 10:38:50 -0700118 [Return] ${resp}