blob: fcac20263070b01d446c0eb59d1b9d8797286a77 [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
13${TARGET_URL_PUBLISH} https://${DR_NODE_IP}:8443/publish/1/csit_test
14${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"}]}}
15${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"}]}}
16${SUBSCRIBE_DATA} {"delivery":{ "url":"https://${DR_PROV_IP}:8080/", "user":"rs873m", "password":"rs873m", "use100":true}, "metadataOnly":false, "suspend":false, "groupid":29, "subscriber":"sg481n"}
17${UPDATE_SUBSCRIPTION_DATA} {"delivery":{ "url":"https://${DR_PROV_IP}:8080/", "user":"sg481n", "password":"sg481n", "use100":true}, "metadataOnly":false, "suspend":true, "groupid":29, "subscriber":"sg481n"}
18${FEED_CONTENT_TYPE} application/vnd.att-dr.feed
19${SUBSCRIBE_CONTENT_TYPE} application/vnd.att-dr.subscription
20${PUBLISH_FEED_CONTENT_TYPE} application/octet-stream
21
22*** Test Cases ***
23Run Feed Creation
24 [Documentation] Feed Creation
25 [Timeout] 1 minute
26 ${resp}= PostCall ${TARGET_URL} ${CREATE_FEED_DATA} ${FEED_CONTENT_TYPE} rs873m
27 log ${TARGET_URL}
28 log ${resp.text}
29 Should Be Equal As Strings ${resp.status_code} 201
30 log 'JSON Response Code:'${resp}
31
32Run Subscribe to Feed
33 [Documentation] Subscribe to Feed
34 [Timeout] 1 minute
35 ${resp}= PostCall ${TARGET_URL_SUBSCRIBE} ${SUBSCRIBE_DATA} ${SUBSCRIBE_CONTENT_TYPE} sg481n
36 log ${TARGET_URL_SUBSCRIBE}
37 log ${resp.text}
38 Should Be Equal As Strings ${resp.status_code} 201
39 log 'JSON Response Code:'${resp}
40
41Run Publish Feed
42 [Documentation] Publish to Feed
43 [Timeout] 1 minute
44 Sleep 10s Behaviour was noticed where feed was not created in time for publish to be sent
45 ${resp}= PutCall ${TARGET_URL_PUBLISH} ${CREATE_FEED_DATA} ${PUBLISH_FEED_CONTENT_TYPE} rs873m
46 log ${TARGET_URL_PUBLISH}
47 log ${resp.text}
48 Should Be Equal As Strings ${resp.status_code} 204
49 log 'JSON Response Code:'${resp}
50
51Run Update Subscription
52 [Documentation] Update Subscription to suspend and change delivery credentials
53 [Timeout] 1 minute
54 ${resp}= PutCall ${TARGET_URL_SUBSCRIPTION} ${UPDATE_SUBSCRIPTION_DATA} ${SUBSCRIBE_CONTENT_TYPE} sg481n
55 log ${TARGET_URL_SUBSCRIPTION}
56 log ${resp.text}
57 Should Be Equal As Strings ${resp.status_code} 200
58 log 'JSON Response Code:'${resp}
59 ${resp}= GetCall ${TARGET_URL_SUBSCRIPTION} ${SUBSCRIBE_CONTENT_TYPE} sg481n
60 log ${resp.text}
61 Should Contain ${resp.text} "password":"sg481n","user":"sg481n"
62 log 'JSON Response Code:'${resp}
63
64Run Update Feed
65 [Documentation] Update Feed description and suspend
66 [Timeout] 1 minute
67 ${resp}= PutCall ${TARGET_URL_FEED} ${UPDATE_FEED_DATA} ${FEED_CONTENT_TYPE} rs873m
68 log ${TARGET_URL_FEED}
69 log ${resp.text}
70 Should Be Equal As Strings ${resp.status_code} 200
71 log 'JSON Response Code:'${resp}
72 ${resp}= GetCall ${TARGET_URL_FEED} ${FEED_CONTENT_TYPE} rs873m
73 log ${resp.text}
74 Should Contain ${resp.text} "UPDATED-CSIT_Test"
75 log 'JSON Response Code:'${resp}
76
77Run Delete Subscription
78 [Documentation] Delete Subscription
79 [Timeout] 1 minute
80 ${resp}= DeleteCall ${TARGET_URL_SUBSCRIPTION} sg481n
81 log ${resp.text}
82 Should Be Equal As Strings ${resp.status_code} 204
83 log 'JSON Response Code:'${resp}
84
85Run Delete Feed
86 [Documentation] Delete Feed
87 [Timeout] 1 minute
88 ${resp}= DeleteCall ${TARGET_URL_FEED} rs873m
89 log ${resp.text}
90 Should Be Equal As Strings ${resp.status_code} 204
91 log 'JSON Response Code:'${resp}
92
93*** Keywords ***
94PostCall
95 [Arguments] ${url} ${data} ${content_type} ${user}
96 ${headers}= Create Dictionary X-ATT-DR-ON-BEHALF-OF=${user} Content-Type=${content_type}
97 ${resp}= Evaluate requests.post('${url}',data='${data}', headers=${headers},verify=False) requests
98 [Return] ${resp}
99
100PutCall
101 [Arguments] ${url} ${data} ${content_type} ${user}
102 ${headers}= Create Dictionary X-ATT-DR-ON-BEHALF-OF=${user} Content-Type=${content_type} Authorization=Basic cnM4NzNtOnJzODczbQ==
103 ${resp}= Evaluate requests.put('${url}',data='${data}', headers=${headers},verify=False) requests
104 [Return] ${resp}
105
106GetCall
107 [Arguments] ${url} ${content_type} ${user}
108 ${headers}= Create Dictionary X-ATT-DR-ON-BEHALF-OF=${user} Content-Type=${content_type}
109 ${resp}= Evaluate requests.get('${url}', headers=${headers},verify=False) requests
110 [Return] ${resp}
111
112DeleteCall
113 [Arguments] ${url} ${user}
114 ${headers}= Create Dictionary X-ATT-DR-ON-BEHALF-OF=${user}
115 ${resp}= Evaluate requests.delete('${url}', headers=${headers},verify=False) requests
116 [Return] ${resp}