waynedunican | e4ff7e5 | 2023-03-01 09:07:31 +0000 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Library Collections |
| 3 | Library RequestsLibrary |
| 4 | Library OperatingSystem |
| 5 | Library DateTime |
| 6 | Library Process |
| 7 | Library json |
| 8 | Resource ${CURDIR}/common-library.robot |
| 9 | Resource ${CURDIR}/apex-pdp-common.robot |
| 10 | |
| 11 | *** Test Cases *** |
| 12 | Healthcheck |
| 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 | |
| 19 | ValidatePolicyExecutionAndEventRateLowComplexity |
| 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.tavares | 3612747 | 2024-07-02 11:51:35 +0100 | [diff] [blame^] | 23 | CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 |
waynedunican | e4ff7e5 | 2023-03-01 09:07:31 +0000 | [diff] [blame] | 24 | DeployPolicy |
| 25 | Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex |
rameshiyer27 | caa7adc | 2024-01-16 12:21:26 +0000 | [diff] [blame] | 26 | GetKafkaTopic apex-cl-mgt |
waynedunican | e4ff7e5 | 2023-03-01 09:07:31 +0000 | [diff] [blame] | 27 | ${data}= Get Binary File ${CURDIR}/data/VesEventForPnfPolicy.json |
waynedunican | e4ff7e5 | 2023-03-01 09:07:31 +0000 | [diff] [blame] | 28 | ${eventStartTime}= Get Current Date |
rameshiyer27 | 31c61d4 | 2024-01-21 14:24:03 +0000 | [diff] [blame] | 29 | ${resp}= Run Process ${CURDIR}/kafka_producer.py unauthenticated.dcae_cl_output ${data} ${KAFKA_IP} |
waynedunican | e4ff7e5 | 2023-03-01 09:07:31 +0000 | [diff] [blame] | 30 | ${eventEndTime}= Get Current Date |
| 31 | ValidateEventExecution ${eventStartTime} ${eventEndTime} 30 |
| 32 | |
| 33 | ValidatePolicyExecutionAndEventRateHighComplexity |
| 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.tavares | 3612747 | 2024-07-02 11:51:35 +0100 | [diff] [blame^] | 37 | CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 |
waynedunican | e4ff7e5 | 2023-03-01 09:07:31 +0000 | [diff] [blame] | 38 | ${postjson}= Get File ${CURDIR}/data/onap.pnf.metadataSet.Test.json |
adheli.tavares | 3612747 | 2024-07-02 11:51:35 +0100 | [diff] [blame^] | 39 | CreateNodeTemplate /policy/api/v1/nodetemplates 201 ${postjson} 1 |
waynedunican | e4ff7e5 | 2023-03-01 09:07:31 +0000 | [diff] [blame] | 40 | DeployPolicy |
| 41 | Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex |
rameshiyer27 | caa7adc | 2024-01-16 12:21:26 +0000 | [diff] [blame] | 42 | GetKafkaTopic apex-cl-mgt2 |
waynedunican | e4ff7e5 | 2023-03-01 09:07:31 +0000 | [diff] [blame] | 43 | ${data}= Get Binary File ${CURDIR}/data/VesEventForVnfPolicy.json |
waynedunican | e4ff7e5 | 2023-03-01 09:07:31 +0000 | [diff] [blame] | 44 | ${eventStartTime}= Get Current Date |
rameshiyer27 | 31c61d4 | 2024-01-21 14:24:03 +0000 | [diff] [blame] | 45 | ${resp}= Run Process ${CURDIR}/kafka_producer.py unauthenticated.dcae_policy_example_output ${data} ${KAFKA_IP} |
waynedunican | e4ff7e5 | 2023-03-01 09:07:31 +0000 | [diff] [blame] | 46 | ${eventEndTime}= Get Current Date |
| 47 | ValidateEventExecution ${eventStartTime} ${eventEndTime} 0.6 |
| 48 | |
| 49 | ValidatePolicyExecutionAndEventRateModerateComplexity |
| 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.tavares | 3612747 | 2024-07-02 11:51:35 +0100 | [diff] [blame^] | 53 | CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 |
waynedunican | e4ff7e5 | 2023-03-01 09:07:31 +0000 | [diff] [blame] | 54 | 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 | |
| 66 | WaitForPrometheusServer |
| 67 | [Documentation] Sleep time to wait for Prometheus server to gather all metrics |
| 68 | Sleep 2 minutes |
| 69 | |
| 70 | ValidatePolicyExecutionTimes |
| 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 |