diff options
-rw-r--r-- | compose/metrics/prometheus.yml | 6 | ||||
-rw-r--r-- | csit/resources/tests/apex-pdp-common.robot | 8 | ||||
-rw-r--r-- | csit/resources/tests/apex-slas.robot | 6 | ||||
-rw-r--r-- | csit/resources/tests/common-library.robot | 8 | ||||
-rw-r--r-- | csit/resources/tests/drools-applications-slas.robot | 14 | ||||
-rw-r--r-- | csit/resources/tests/xacml-pdp-slas.robot | 30 | ||||
-rwxr-xr-x | csit/run-k8s-csit.sh | 2 | ||||
-rwxr-xr-x | csit/run-project-csit.sh | 8 |
8 files changed, 63 insertions, 19 deletions
diff --git a/compose/metrics/prometheus.yml b/compose/metrics/prometheus.yml index c3d87f57..5ff5f949 100644 --- a/compose/metrics/prometheus.yml +++ b/compose/metrics/prometheus.yml @@ -1,6 +1,6 @@ # # ===========LICENSE_START==================================================== -# Copyright (C) 2022-2023 Nordix Foundation. +# Copyright (C) 2022-2024 Nordix Foundation. # ============================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -58,7 +58,7 @@ scrape_configs: - job_name: "drools-apps-metrics" static_configs: - targets: - - "drools-apps:9696" + - "policy-drools-apps:9696" basic_auth: username: "demo@people.osaaf.org" password: "demo123456!" @@ -66,7 +66,7 @@ scrape_configs: - job_name: "drools-pdp-metrics" static_configs: - targets: - - "drools:9696" + - "policy-drools:9696" basic_auth: username: "demo@people.osaaf.org" password: "demo123456!" diff --git a/csit/resources/tests/apex-pdp-common.robot b/csit/resources/tests/apex-pdp-common.robot index 958f6901..81924604 100644 --- a/csit/resources/tests/apex-pdp-common.robot +++ b/csit/resources/tests/apex-pdp-common.robot @@ -31,14 +31,6 @@ CheckLogMessage ${result}= CheckKafkaTopic ${topic} ${status} Should Contain ${result} ${expectedMsg} -ValidatePolicyExecution - [Arguments] ${url} ${executionTime} - [Documentation] Check that policy execution under X milliseconds - ${resp}= QueryPrometheus ${url} - ${rawNumber}= Evaluate ${resp['data']['result'][0]['value'][1]} - ${actualTime}= Set Variable ${rawNumber * ${1000}} - Should Be True ${actualTime} <= ${executionTime} - ValidateEventExecution [Arguments] ${eventStartTime} ${eventEndTime} ${eventsNo} [Documentation] Check that X amount of events were exeuted per second diff --git a/csit/resources/tests/apex-slas.robot b/csit/resources/tests/apex-slas.robot index f6e64b89..760bc348 100644 --- a/csit/resources/tests/apex-slas.robot +++ b/csit/resources/tests/apex-slas.robot @@ -17,7 +17,7 @@ Healthcheck Set Suite Variable ${pdpName} ${resp.json()['name']} ValidatePolicyExecutionAndEventRateLowComplexity - [Documentation] Validate that a moderate complexity policity can be executed in less than 100ms and minimum 10 events triggered per second + [Documentation] Validate that a moderate complexity policy can be executed in less than 100ms and minimum 10 events triggered per second Set Test Variable ${policyName} onap.policies.apex.pnf.Test ${postjson}= Get File ${CURDIR}/data/${policyName}.json CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 @@ -31,7 +31,7 @@ ValidatePolicyExecutionAndEventRateLowComplexity ValidateEventExecution ${eventStartTime} ${eventEndTime} 10 ValidatePolicyExecutionAndEventRateModerateComplexity - [Documentation] Validate that a low complexity policity can be executed in less than 1000ms and minimum 1 events triggered per second + [Documentation] Validate that a low complexity policy can be executed in less than 1000ms and minimum 1 events triggered per second Set Test Variable ${policyName} onap.policies.native.apex.Sampledomain ${postjson}= Get File ${CURDIR}/data/${policyName}.json CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 @@ -42,7 +42,7 @@ ValidatePolicyExecutionAndEventRateModerateComplexity ValidateEventExecution ${eventStartTime} ${eventEndTime} 1 ValidatePolicyExecutionAndEventRateHighComplexity - [Documentation] Validate that a high complexity policity can be executed in less than 5000ms and minimum 0.2 events triggered per second + [Documentation] Validate that a high complexity policy can be executed in less than 5000ms and minimum 0.2 events triggered per second Set Test Variable ${policyName} onap.policies.apex.pnf.metadataSet.Test ${postjson}= Get File ${CURDIR}/data/${policyName}.json CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 diff --git a/csit/resources/tests/common-library.robot b/csit/resources/tests/common-library.robot index 4d69b349..e0b1c0f1 100644 --- a/csit/resources/tests/common-library.robot +++ b/csit/resources/tests/common-library.robot @@ -157,3 +157,11 @@ GetKafkaTopic [Arguments] ${topic} ${resp}= Run Process ${CURDIR}/make_topics.py ${topic} ${KAFKA_IP} Log ${resp.stdout} + +ValidatePolicyExecution + [Arguments] ${url} ${executionTime} + [Documentation] Check that policy execution under X milliseconds + ${resp}= QueryPrometheus ${url} + ${rawNumber}= Evaluate ${resp['data']['result'][0]['value'][1]} + ${actualTime}= Set Variable ${rawNumber * ${1000}} + Should Be True ${actualTime} <= ${executionTime}
\ No newline at end of file diff --git a/csit/resources/tests/drools-applications-slas.robot b/csit/resources/tests/drools-applications-slas.robot new file mode 100644 index 00000000..a153925d --- /dev/null +++ b/csit/resources/tests/drools-applications-slas.robot @@ -0,0 +1,14 @@ +*** 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 + +ValidatePolicyExecutionTimes + [Documentation] Validate policy execution times using prometheus metrics + ValidatePolicyExecution pdpd_policy_executions_latency_seconds_count{controller="usecases",controlloop="ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3",policy="operational.scaleout:1.0.0",status="SUCCESS", instance="policy-drools-apps:9696", job="drools-apps-metrics"} 1000 + ValidatePolicyExecution pdpd_policy_deployments_total{state="ACTIVE",operation="deploy",status="SUCCESS", instance="policy-drools-apps:9696", job="drools-apps-metrics"} 3000 + diff --git a/csit/resources/tests/xacml-pdp-slas.robot b/csit/resources/tests/xacml-pdp-slas.robot new file mode 100644 index 00000000..e3d2d910 --- /dev/null +++ b/csit/resources/tests/xacml-pdp-slas.robot @@ -0,0 +1,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} diff --git a/csit/run-k8s-csit.sh b/csit/run-k8s-csit.sh index 69c5f9dc..feab0437 100755 --- a/csit/run-k8s-csit.sh +++ b/csit/run-k8s-csit.sh @@ -32,7 +32,7 @@ POLICY_CLAMP_ROBOT="policy-clamp-test.robot clamp-slas.robot" POLICY_API_ROBOT="api-test.robot api-slas.robot" POLICY_PAP_ROBOT="pap-test.robot pap-slas.robot" POLICY_APEX_PDP_ROBOT="apex-pdp-test.robot apex-slas.robot" -POLICY_XACML_PDP_ROBOT="xacml-pdp-test.robot" +POLICY_XACML_PDP_ROBOT="xacml-pdp-test.robot xacml-pdp-slas.robot" POLICY_DROOLS_PDP_ROBOT="drools-pdp-test.robot" POLICY_DISTRIBUTION_ROBOT="distribution-test.robot" diff --git a/csit/run-project-csit.sh b/csit/run-project-csit.sh index 409209fd..8183cdee 100755 --- a/csit/run-project-csit.sh +++ b/csit/run-project-csit.sh @@ -123,8 +123,8 @@ function apex_healthcheck() { } function setup_drools_apps() { - export ROBOT_FILES="drools-applications-test.robot" - source ${DOCKER_COMPOSE_DIR}/start-compose.sh drools-applications + export ROBOT_FILES="drools-applications-test.robot drools-applications-slas.robot" + source ${DOCKER_COMPOSE_DIR}/start-compose.sh drools-applications --grafana sleep 10 bash ${SCRIPTS}/wait_for_rest.sh localhost ${PAP_PORT} sleep 10 @@ -134,8 +134,8 @@ function setup_drools_apps() { } function setup_xacml_pdp() { - export ROBOT_FILES="xacml-pdp-test.robot" - source ${DOCKER_COMPOSE_DIR}/start-compose.sh xacml-pdp + export ROBOT_FILES="xacml-pdp-test.robot xacml-pdp-slas.robot" + source ${DOCKER_COMPOSE_DIR}/start-compose.sh xacml-pdp --grafana sleep 10 bash ${SCRIPTS}/wait_for_rest.sh localhost "${XACML_PORT}" } |