3 Library RequestsLibrary
4 Library OperatingSystem
10 [Documentation] Runs Policy Distribution Health check
11 ${auth}= Create List healthcheck zb!XztG34
12 Log Creating session https://${POLICY_DISTRIBUTION_IP}:6969
13 ${session}= Create Session policy https://${POLICY_DISTRIBUTION_IP}:6969 auth=${auth}
14 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
15 ${resp}= Get Request policy /healthcheck headers=${headers}
16 Log Received response from policy ${resp.text}
17 Should Be Equal As Strings ${resp.status_code} 200
18 Should Be Equal As Strings ${resp.json()['code']} 200
21 [Documentation] Runs Policy Distribution Statistics
22 ${auth}= Create List healthcheck zb!XztG34
23 Log Creating session https://${POLICY_DISTRIBUTION_IP}:6969
24 ${session}= Create Session policy https://${POLICY_DISTRIBUTION_IP}:6969 auth=${auth}
25 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
26 ${resp}= Get Request policy /statistics headers=${headers}
27 Log Received response from policy ${resp.text}
28 Should Be Equal As Strings ${resp.status_code} 200
29 Should Be Equal As Strings ${resp.json()['code']} 200
31 InvokeDistributionAndRunEventOnEngine
32 Wait Until Keyword Succeeds 5 min 30 sec InvokeDistributionUsingFile And RunEventOnApexEngine
36 InvokeDistributionUsingFile And RunEventOnApexEngine
37 Copy File ${SCRIPT_DIR}/config/distribution/csar/csar_temp.csar ${SCRIPT_DIR}/config/distribution/csar/temp.csar
38 Move File ${SCRIPT_DIR}/config/distribution/csar/temp.csar ${SCRIPT_DIR}/config/distribution/temp/sample_csar_with_apex_policy.csar
39 Sleep 20 seconds "Waiting for the Policy Distribution to call Policy API and PAP"
40 Create Session apexSession http://${APEX_IP}:23324 max_retries=1
41 ${data}= Get Binary File ${CURDIR}${/}data${/}event.json
42 &{headers}= Create Dictionary Content-Type=application/json Accept=application/json
43 ${resp}= Put Request apexSession /apex/FirstConsumer/EventIn data=${data} headers=${headers}
44 Should Be Equal As Strings ${resp.status_code} 200
45 Remove Files ${SCRIPT_DIR}/config/distribution/temp/sample_csar_with_apex_policy.csar