Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Library OperatingSystem |
| 3 | Library RequestsLibrary |
| 4 | Library requests |
| 5 | Library Collections |
| 6 | Library 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 Ward | fdcd89c | 2018-10-01 11:03:25 +0000 | [diff] [blame] | 13 | ${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 Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 15 | ${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"} |
egernug | 6f2874b | 2019-02-06 15:16:54 +0000 | [diff] [blame] | 19 | ${FEED_CONTENT_TYPE} application/vnd.dmaap-dr.feed |
| 20 | ${SUBSCRIBE_CONTENT_TYPE} application/vnd.dmaap-dr.subscription |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 21 | ${PUBLISH_FEED_CONTENT_TYPE} application/octet-stream |
| 22 | |
| 23 | *** Test Cases *** |
| 24 | Run 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 | |
| 33 | Run 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 | |
| 42 | Run 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 Ward | fdcd89c | 2018-10-01 11:03:25 +0000 | [diff] [blame] | 46 | ${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 Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 50 | Should Be Equal As Strings ${resp.status_code} 204 |
| 51 | log 'JSON Response Code:'${resp} |
| 52 | |
| 53 | Run 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 | |
| 66 | Run 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 | |
| 79 | Run 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 | |
| 87 | Run 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 *** |
| 96 | PostCall |
| 97 | [Arguments] ${url} ${data} ${content_type} ${user} |
egernug | 6f2874b | 2019-02-06 15:16:54 +0000 | [diff] [blame] | 98 | ${headers}= Create Dictionary X-DMAAP-DR-ON-BEHALF-OF=${user} Content-Type=${content_type} |
Conor Ward | fdcd89c | 2018-10-01 11:03:25 +0000 | [diff] [blame] | 99 | ${resp}= Evaluate requests.post('${url}', data='${data}', headers=${headers}, verify=False) requests |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 100 | [Return] ${resp} |
| 101 | |
| 102 | PutCall |
| 103 | [Arguments] ${url} ${data} ${content_type} ${user} |
egernug | 6f2874b | 2019-02-06 15:16:54 +0000 | [diff] [blame] | 104 | ${headers}= Create Dictionary X-DMAAP-DR-ON-BEHALF-OF=${user} Content-Type=${content_type} Authorization=Basic cnM4NzNtOnJzODczbQ== |
Conor Ward | fdcd89c | 2018-10-01 11:03:25 +0000 | [diff] [blame] | 105 | ${resp}= Evaluate requests.put('${url}', data='${data}', headers=${headers}, verify=False, allow_redirects=False) requests |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 106 | [Return] ${resp} |
| 107 | |
| 108 | GetCall |
| 109 | [Arguments] ${url} ${content_type} ${user} |
egernug | 6f2874b | 2019-02-06 15:16:54 +0000 | [diff] [blame] | 110 | ${headers}= Create Dictionary X-DMAAP-DR-ON-BEHALF-OF=${user} Content-Type=${content_type} |
Conor Ward | fdcd89c | 2018-10-01 11:03:25 +0000 | [diff] [blame] | 111 | ${resp}= Evaluate requests.get('${url}', headers=${headers}, verify=False) requests |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 112 | [Return] ${resp} |
| 113 | |
| 114 | DeleteCall |
| 115 | [Arguments] ${url} ${user} |
egernug | 6f2874b | 2019-02-06 15:16:54 +0000 | [diff] [blame] | 116 | ${headers}= Create Dictionary X-DMAAP-DR-ON-BEHALF-OF=${user} |
Conor Ward | fdcd89c | 2018-10-01 11:03:25 +0000 | [diff] [blame] | 117 | ${resp}= Evaluate requests.delete('${url}', headers=${headers}, verify=False) requests |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 118 | [Return] ${resp} |