2 Resource ../../common.robot
5 Library OperatingSystem
6 Library RequestsLibrary
7 Library HttpLibrary.HTTP
13 ${DBC_URL} http://${DMAAPBC_IP}:8080/${DBC_URI}
14 ${LOC} csit-sanfrancisco
15 ${FEED1_DATA} { "feedName":"feed1", "feedVersion": "csit", "feedDescription":"generated for CSIT", "owner":"dgl", "asprClassification": "unclassified" }
16 ${FEED2_DATA} { "feedName":"feed2", "feedVersion": "csit", "feedDescription":"generated for CSIT", "owner":"dgl", "asprClassification": "unclassified" }
17 ${PUB2_DATA} { "dcaeLocationName": "${LOC}", "username": "pub2", "userpwd": "topSecret123", "feedId": "2" }
18 ${SUB2_DATA} { "dcaeLocationName": "${LOC}", "username": "sub2", "userpwd": "someSecret123", "deliveryURL": "https://${DMAAPBC_IP}:8443/webapi/noURI", "feedId": "2" }
23 [Documentation] Create Feed w no clients POST ${DBC_URI}/feeds endpoint
24 ${resp}= PostCall ${DBC_URL}/feeds ${FEED1_DATA}
25 Should Be Equal As Integers ${resp.status_code} 200
28 [Documentation] Create Feed w clients POST ${DBC_URI}/feeds endpoint
29 ${resp}= PostCall ${DBC_URL}/feeds ${FEED2_DATA}
30 Should Be Equal As Integers ${resp.status_code} 200
33 [Documentation] Add Publisher to existing feed
34 ${resp}= PostCall ${DBC_URL}/dr_pubs ${PUB2_DATA}
35 Should Be Equal As Integers ${resp.status_code} 201
36 ${JSON}= Evaluate json.loads(r"""${resp.content}""", strict=False)
37 ${result}= Set Variable ${JSON['pubId']}
38 Set Suite Variable ${pubId} ${result}
41 [Documentation] Add Subscriber to existing feed
42 ${resp}= PostCall ${DBC_URL}/dr_subs ${SUB2_DATA}
43 Should Be Equal As Integers ${resp.status_code} 201
44 ${JSON}= Evaluate json.loads(r"""${resp.content}""", strict=False)
45 ${result}= Set Variable ${JSON['subId']}
46 Set Suite Variable ${subId} ${result}
49 [Documentation] List existing feeds
50 Create Session get ${DBC_URL}
51 ${resp}= GET On Session get /feeds
52 Should Be Equal As Integers ${resp.status_code} 200
55 [Documentation] Delete existing subscriber
56 ${resp}= DelCall ${DBC_URL}/dr_subs/${subId}
57 Should Be Equal As Integers ${resp.status_code} 204
60 [Documentation] Delete existing publisher
61 ${resp}= DelCall ${DBC_URL}/dr_pubs/${pubId}
62 Should Be Equal As Integers ${resp.status_code} 204
67 [Arguments] ${url} ${data}
68 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
69 ${resp}= Evaluate requests.post('${url}',data='${data}', headers=${headers},verify=False) requests
74 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
75 ${resp}= Evaluate requests.delete('${url}', headers=${headers},verify=False) requests