3 Library RequestsLibrary
4 Library OperatingSystem
6 Resource ${CURDIR}/../../common-library.robot
11 [Documentation] Verify policy distribution health check
12 ${hcauth}= HealthCheckAuth
13 ${resp}= PerformGetRequest ${POLICY_DISTRIBUTION_PORT} /healthcheck 200 null ${hcauth}
14 Should Be Equal As Strings ${resp.json()['code']} 200
17 [Documentation] Verify policy distribution statistics
18 ${hcauth}= HealthCheckAuth
19 ${resp}= PerformGetRequest ${POLICY_DISTRIBUTION_PORT} /statistics 200 null ${hcauth}
20 Should Be Equal As Strings ${resp.json()['code']} 200
23 [Documentation] Verify policy-distribution is exporting prometheus metrics
24 ${hcauth}= HealthCheckAuth
25 ${resp}= PerformGetRequest ${POLICY_DISTRIBUTION_PORT} /metrics 200 null ${hcauth}
26 Should Contain ${resp.text} total_distribution_received_count_total 0.0
27 Should Contain ${resp.text} distribution_success_count_total 0.0
28 Should Contain ${resp.text} distribution_failure_count_total 0.0
29 Should Contain ${resp.text} total_download_received_count_total 0.0
30 Should Contain ${resp.text} download_success_count_total 0.0
31 Should Contain ${resp.text} download_failure_count_total 0.0
33 InvokeDistributionAndRunEventOnEngine
34 Wait Until Keyword Succeeds 5 min 30 sec InvokeDistributionUsingFile And RunEventOnApexEngine
37 [Documentation] Verify policy-distribution is exporting prometheus metrics after execution
38 ${hcauth}= HealthCheckAuth
39 ${resp}= PerformGetRequest ${POLICY_DISTRIBUTION_PORT} /metrics 200 null ${hcauth}
40 Should Contain ${resp.text} total_distribution_received_count_total 1.0
41 Should Contain ${resp.text} distribution_success_count_total 1.0
42 Should Contain ${resp.text} distribution_failure_count_total 0.0
43 Should Contain ${resp.text} total_download_received_count_total 1.0
44 Should Contain ${resp.text} download_success_count_total 1.0
45 Should Contain ${resp.text} download_failure_count_total 0.0
49 InvokeDistributionUsingFile And RunEventOnApexEngine
50 Copy File ${SCRIPT_DIR}/csar/csar_temp.csar ${SCRIPT_DIR}/csar/temp.csar
51 Move File ${SCRIPT_DIR}/csar/temp.csar ${SCRIPT_DIR}/temp/sample_csar_with_apex_policy.csar
52 Sleep 20 seconds "Waiting for the Policy Distribution to call Policy API and PAP"
53 Create Session apexSession http://localhost:23324 max_retries=1
54 ${data}= Get Binary File ${CURDIR}${/}data${/}event.json
55 &{headers}= Create Dictionary Content-Type=application/json Accept=application/json
56 ${resp}= PUT On Session apexSession /apex/FirstConsumer/EventIn data=${data} headers=${headers} expected_status=200
57 Remove Files ${SCRIPT_DIR}/temp/sample_csar_with_apex_policy.csar