blob: 2b1c6d64eb6eebf878e8795b9db0704e26bf5e5f [file] [log] [blame]
Gary Wu9abb61c2018-09-27 10:38:50 -07001*** Settings ***
2Library Collections
3Library RequestsLibrary
4Library OperatingSystem
5Library json
6
7*** Test Cases ***
a.sreekumardf7d47f2019-08-29 13:24:04 +00008
Gary Wu9abb61c2018-09-27 10:38:50 -07009Healthcheck
10 [Documentation] Runs Policy Distribution Health check
a.sreekumardf7d47f2019-08-29 13:24:04 +000011 ${auth}= Create List healthcheck zb!XztG34
ramvermad6e21392019-02-11 14:52:47 +000012 Log Creating session https://${POLICY_DISTRIBUTION_IP}:6969
13 ${session}= Create Session policy https://${POLICY_DISTRIBUTION_IP}:6969 auth=${auth}
Gary Wu9abb61c2018-09-27 10:38:50 -070014 ${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
a.sreekumardf7d47f2019-08-29 13:24:04 +000019
Bilal Aa86c81d2019-03-13 13:32:24 +000020Statistics
21 [Documentation] Runs Policy Distribution Statistics
a.sreekumardf7d47f2019-08-29 13:24:04 +000022 ${auth}= Create List healthcheck zb!XztG34
Bilal Aa86c81d2019-03-13 13:32:24 +000023 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
a.sreekumardf7d47f2019-08-29 13:24:04 +000030
31InvokeDistributionAndRunEventOnEngine
32 Wait Until Keyword Succeeds 5 min 30 sec InvokeDistributionUsingFile And RunEventOnApexEngine
33
34*** Keywords ***
35
36InvokeDistributionUsingFile 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