3 Library OperatingSystem
4 Library RequestsLibrary
7 ${DBC_URL} http://${DMAAPBC_IP}:8080/webapi
8 ${LOC} csit-sanfrancisco
9 ${FEED1_DATA} { "feedName":"feed1", "feedVersion": "csit", "feedDescription":"generated for CSIT", "owner":"dgl", "asprClassification": "unclassified" }
10 ${FEED2_DATA} { "feedName":"feed2", "feedVersion": "csit", "feedDescription":"generated for CSIT", "owner":"dgl", "asprClassification": "unclassified" }
11 ${PUB2_DATA} { "dcaeLocationName": "${LOC}", "username": "pub2", "userpwd": "topSecret123", "feedId": "2" }
12 ${SUB2_DATA} { "dcaeLocationName": "${LOC}", "username": "sub2", "userpwd": "someSecret123", "deliveryURL": "https://${DMAAPBC_IP}:8443/webapi/noURI", "feedId": "2" }
17 [Documentation] Create Feed w no clients POST webapi/feeds endpoint
18 ${resp}= PostCall ${DBC_URL}/feeds ${FEED1_DATA}
19 Should Be Equal As Integers ${resp.status_code} 200
22 [Documentation] Create Feed w clients POST webapi/feeds endpoint
23 ${resp}= PostCall ${DBC_URL}/feeds ${FEED2_DATA}
24 Should Be Equal As Integers ${resp.status_code} 200
27 [Documentation] Add Publisher to existing feed
28 ${resp}= PostCall ${DBC_URL}/dr_pubs ${PUB2_DATA}
29 Should Be Equal As Integers ${resp.status_code} 201
30 ${JSON}= Evaluate json.loads(r"""${resp.content}""", strict=False)
31 ${result}= Set Variable ${JSON['pubId']}
32 Set Suite Variable ${pubId} ${result}
35 [Documentation] Add Subscriber to existing feed
36 ${resp}= PostCall ${DBC_URL}/dr_subs ${SUB2_DATA}
37 Should Be Equal As Integers ${resp.status_code} 201
38 ${JSON}= Evaluate json.loads(r"""${resp.content}""", strict=False)
39 ${result}= Set Variable ${JSON['subId']}
40 Set Suite Variable ${subId} ${result}
43 [Documentation] List existing feeds
44 ${resp}= Evaluate requests.get('${DBC_URL}/feeds', verify=False) requests
45 Should Be Equal As Integers ${resp.status_code} 200
48 [Documentation] Delete existing subscriber
49 ${resp}= DelCall ${DBC_URL}/dr_subs/${subId}
50 Should Be Equal As Integers ${resp.status_code} 204
53 [Documentation] Delete existing publisher
54 ${resp}= DelCall ${DBC_URL}/dr_pubs/${pubId}
55 Should Be Equal As Integers ${resp.status_code} 204
60 [Arguments] ${url} ${data}
61 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
62 ${resp}= Evaluate requests.post('${url}',data='${data}', headers=${headers},verify=False) requests
67 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
68 ${resp}= Evaluate requests.delete('${url}', headers=${headers},verify=False) requests