1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
*** Settings ***
Library OperatingSystem
Resource common-library.robot
*** Test Cases ***
WaitForPrometheusServer
[Documentation] Sleep time to wait for Prometheus server to gather all metrics
Sleep 1 minute
ValidatePolicyDecisionsGauge
[Documentation] Validate policy execution gauge using prometheus metrics
ValidatePrometheusMetric pdpx_policy_decisions_created{application="optimization",status="permit", instance="policy-xacml-pdp:6969", job="xacml-pdp-metrics"} 1.8E9
ValidatePrometheusMetric pdpx_policy_decisions_created{application="guard",status="not_applicable", instance="policy-xacml-pdp:6969", job="xacml-pdp-metrics"} 1.8E9
ValidatePrometheusMetric pdpx_policy_decisions_created{application="monitoring",status="permit", instance="policy-xacml-pdp:6969", job="xacml-pdp-metrics"} 1.8E9
ValidatePrometheusMetric pdpx_policy_decisions_created{application="naming",status="permit", instance="policy-xacml-pdp:6969", job="xacml-pdp-metrics"} 1.8E9
ValidatePolicyDecisionsTotalCounter
[Documentation] Validate policy decision counters using prometheus metrics
ValidatePrometheusMetric pdpx_policy_decisions_total{application="optimization",status="permit", instance="policy-xacml-pdp:6969", job="xacml-pdp-metrics"} 1
ValidatePrometheusMetric pdpx_policy_decisions_total{application="guard",status="not_applicable", instance="policy-xacml-pdp:6969", job="xacml-pdp-metrics"} 1
ValidatePrometheusMetric pdpx_policy_decisions_total{application="monitoring",status="permit", instance="policy-xacml-pdp:6969", job="xacml-pdp-metrics"} 2
ValidatePrometheusMetric pdpx_policy_decisions_total{application="naming",status="permit", instance="policy-xacml-pdp:6969", job="xacml-pdp-metrics"} 1
*** Keywords ***
ValidatePrometheusMetric
[Arguments] ${url} ${expectedLimit}
[Documentation] Check that the policy execution is under X limit
${resp}= QueryPrometheus ${url}
${actualValue}= Evaluate ${resp['data']['result'][0]['value'][1]}
Should Be True ${actualValue} <= ${expectedLimit}
|