blob: 9322f1777fa7ba25ad43b06c7554f7099852a2f9 [file] [log] [blame]
waynedunicane4ff7e52023-03-01 09:07:31 +00001*** Settings ***
2Library Collections
3Library RequestsLibrary
4Library OperatingSystem
5Library DateTime
6Library Process
7Library json
8Resource ${CURDIR}/common-library.robot
9Resource ${CURDIR}/apex-pdp-common.robot
10
11*** Test Cases ***
12Healthcheck
13 [Documentation] Runs Apex PDP Health check
14 ${hcauth}= PolicyAdminAuth
15 ${resp}= PerformGetRequest ${APEX_IP} /policy/apex-pdp/v1/healthcheck 200 null ${hcauth}
16 Should Be Equal As Strings ${resp.json()['code']} 200
17 Set Suite Variable ${pdpName} ${resp.json()['name']}
18
19ValidatePolicyExecutionAndEventRateLowComplexity
20 [Documentation] Validate that a moderate complexity policity can be executed in less than 100ms and minimum 30 events triggered per second
21 Set Test Variable ${policyName} onap.policies.apex.pnf.Test
22 ${postjson}= Get File ${CURDIR}/data/${policyName}.json
adheli.tavares36127472024-07-02 11:51:35 +010023 CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0
waynedunicane4ff7e52023-03-01 09:07:31 +000024 DeployPolicy
25 Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex
rameshiyer27caa7adc2024-01-16 12:21:26 +000026 GetKafkaTopic apex-cl-mgt
waynedunicane4ff7e52023-03-01 09:07:31 +000027 ${data}= Get Binary File ${CURDIR}/data/VesEventForPnfPolicy.json
waynedunicane4ff7e52023-03-01 09:07:31 +000028 ${eventStartTime}= Get Current Date
rameshiyer2731c61d42024-01-21 14:24:03 +000029 ${resp}= Run Process ${CURDIR}/kafka_producer.py unauthenticated.dcae_cl_output ${data} ${KAFKA_IP}
waynedunicane4ff7e52023-03-01 09:07:31 +000030 ${eventEndTime}= Get Current Date
31 ValidateEventExecution ${eventStartTime} ${eventEndTime} 30
32
33ValidatePolicyExecutionAndEventRateHighComplexity
34 [Documentation] Validate that a high complexity policity can be executed in less than 5000ms and minimum 0.6 events triggered per second
35 Set Test Variable ${policyName} onap.policies.apex.pnf.metadataSet.Test
36 ${postjson}= Get File ${CURDIR}/data/${policyName}.json
adheli.tavares36127472024-07-02 11:51:35 +010037 CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0
waynedunicane4ff7e52023-03-01 09:07:31 +000038 ${postjson}= Get File ${CURDIR}/data/onap.pnf.metadataSet.Test.json
adheli.tavares36127472024-07-02 11:51:35 +010039 CreateNodeTemplate /policy/api/v1/nodetemplates 201 ${postjson} 1
waynedunicane4ff7e52023-03-01 09:07:31 +000040 DeployPolicy
41 Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex
rameshiyer27caa7adc2024-01-16 12:21:26 +000042 GetKafkaTopic apex-cl-mgt2
waynedunicane4ff7e52023-03-01 09:07:31 +000043 ${data}= Get Binary File ${CURDIR}/data/VesEventForVnfPolicy.json
waynedunicane4ff7e52023-03-01 09:07:31 +000044 ${eventStartTime}= Get Current Date
rameshiyer2731c61d42024-01-21 14:24:03 +000045 ${resp}= Run Process ${CURDIR}/kafka_producer.py unauthenticated.dcae_policy_example_output ${data} ${KAFKA_IP}
waynedunicane4ff7e52023-03-01 09:07:31 +000046 ${eventEndTime}= Get Current Date
47 ValidateEventExecution ${eventStartTime} ${eventEndTime} 0.6
48
49ValidatePolicyExecutionAndEventRateModerateComplexity
50 [Documentation] Validate that a low complexity policity can be executed in less than 1000ms and minimum 3 events triggered per second
51 Set Test Variable ${policyName} onap.policies.native.apex.Sampledomain
52 ${postjson}= Get File ${CURDIR}/data/${policyName}.json
adheli.tavares36127472024-07-02 11:51:35 +010053 CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0
waynedunicane4ff7e52023-03-01 09:07:31 +000054 DeployPolicy
55 #Wait Until Keyword Succeeds 4 min 5 sec RunEventOnApexEngine
56 Create Session apexSession http://${APEX_EVENTS_IP} max_retries=1
57 ${data}= Get Binary File ${CURDIR}/data/event.json
58 &{headers}= Create Dictionary Content-Type=application/json Accept=application/json
59 Sleep 60s
60 ${eventStartTime}= Get Current Date
61 ${resp}= PUT On Session apexSession /apex/FirstConsumer/EventIn data=${data} headers=${headers}
62 Should Be Equal As Strings ${resp.status_code} 200
63 ${eventEndTime}= Get Current Date
64 ValidateEventExecution ${eventStartTime} ${eventEndTime} 3
65
66WaitForPrometheusServer
67 [Documentation] Sleep time to wait for Prometheus server to gather all metrics
68 Sleep 2 minutes
69
70ValidatePolicyExecutionTimes
71 [Documentation] Validate policy execution times using prometheus metrics
72 ValidatePolicyExecution pdpa_engine_average_execution_time_seconds{engine_instance_id="NSOApexEngine-0:0.0.1", instance="policy-apex-pdp:6969", job="apex-pdp-metrics"} 5000
73 ValidatePolicyExecution pdpa_engine_average_execution_time_seconds{engine_instance_id="MyApexEngine-0:0.0.1"} 1000
74 ValidatePolicyExecution pdpa_engine_average_execution_time_seconds{engine_instance_id="NSOApexEngine-1:0.0.1", instance="policy-apex-pdp:6969", job="apex-pdp-metrics"} 100