Jim Hahn | b3a962f | 2021-05-12 11:33:43 -0400 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Library Collections |
| 3 | Library RequestsLibrary |
| 4 | Library OperatingSystem |
| 5 | Library json |
a.sreekumar | 9a12d02 | 2021-07-08 15:32:52 +0100 | [diff] [blame] | 6 | Library Process |
adheli.tavares | 1f339f8 | 2023-02-17 15:14:07 +0000 | [diff] [blame] | 7 | Resource ${CURDIR}/common-library.robot |
waynedunican | e4ff7e5 | 2023-03-01 09:07:31 +0000 | [diff] [blame] | 8 | Resource ${CURDIR}/apex-pdp-common.robot |
Jim Hahn | b3a962f | 2021-05-12 11:33:43 -0400 | [diff] [blame] | 9 | |
| 10 | *** Test Cases *** |
| 11 | |
| 12 | Healthcheck |
| 13 | [Documentation] Runs Apex PDP Health check |
adheli.tavares | 1153b6d | 2023-02-28 12:59:37 +0000 | [diff] [blame] | 14 | ${hcauth}= PolicyAdminAuth |
adheli.tavares | 1f339f8 | 2023-02-17 15:14:07 +0000 | [diff] [blame] | 15 | ${resp}= PerformGetRequest ${APEX_IP} /policy/apex-pdp/v1/healthcheck 200 null ${hcauth} |
a.sreekumar | 60d6a08 | 2021-08-20 17:39:53 +0100 | [diff] [blame] | 16 | Should Be Equal As Strings ${resp.json()['code']} 200 |
a.sreekumar | df1a5bd | 2021-06-30 16:46:00 +0100 | [diff] [blame] | 17 | Set Suite Variable ${pdpName} ${resp.json()['name']} |
Jim Hahn | b3a962f | 2021-05-12 11:33:43 -0400 | [diff] [blame] | 18 | |
a.sreekumar | 60d6a08 | 2021-08-20 17:39:53 +0100 | [diff] [blame] | 19 | ExecuteApexSampleDomainPolicy |
adheli.tavares | 1153b6d | 2023-02-28 12:59:37 +0000 | [diff] [blame] | 20 | # [Tags] docker |
a.sreekumar | 9a12d02 | 2021-07-08 15:32:52 +0100 | [diff] [blame] | 21 | Set Test Variable ${policyName} onap.policies.native.apex.Sampledomain |
adheli.tavares | 1f339f8 | 2023-02-17 15:14:07 +0000 | [diff] [blame] | 22 | ${postjson}= Get File ${CURDIR}/data/${policyName}.json |
a.sreekumar | 60d6a08 | 2021-08-20 17:39:53 +0100 | [diff] [blame] | 23 | CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 |
a.sreekumar | 60d6a08 | 2021-08-20 17:39:53 +0100 | [diff] [blame] | 24 | DeployPolicy |
| 25 | Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex |
a.sreekumar | 9a12d02 | 2021-07-08 15:32:52 +0100 | [diff] [blame] | 26 | Wait Until Keyword Succeeds 4 min 5 sec RunEventOnApexEngine |
Jim Hahn | b3a962f | 2021-05-12 11:33:43 -0400 | [diff] [blame] | 27 | |
a.sreekumar | f715119 | 2021-10-20 17:28:04 +0100 | [diff] [blame] | 28 | ExecuteApexTestPnfPolicy |
| 29 | Set Test Variable ${policyName} onap.policies.apex.pnf.Test |
adheli.tavares | 1f339f8 | 2023-02-17 15:14:07 +0000 | [diff] [blame] | 30 | ${postjson}= Get File ${CURDIR}/data/${policyName}.json |
a.sreekumar | 60d6a08 | 2021-08-20 17:39:53 +0100 | [diff] [blame] | 31 | CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 |
| 32 | DeployPolicy |
| 33 | Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex |
rameshiyer27 | f2e4da7 | 2024-01-13 21:26:09 +0000 | [diff] [blame] | 34 | GetKafkaTopic apex-cl-mgt |
| 35 | Wait Until Keyword Succeeds 2 min 5 sec TriggerAndVerifyTestPnfPolicy apex-cl-mgt |
a.sreekumar | f715119 | 2021-10-20 17:28:04 +0100 | [diff] [blame] | 36 | |
rameshiyer27 | f2e4da7 | 2024-01-13 21:26:09 +0000 | [diff] [blame] | 37 | #ExecuteApexTestVnfPolicy |
| 38 | # Set Test Variable ${policyName} onap.policies.apex.vnf.Test |
| 39 | # ${postjson}= Get File ${CURDIR}/data/${policyName}.json |
| 40 | # CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 |
| 41 | # DeployPolicy |
| 42 | # Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex |
| 43 | # GetTopic apex-cl-mgt |
| 44 | # Wait Until Keyword Succeeds 2 min 5 sec TriggerAndVerifyTestVnfPolicy |
a.sreekumar | 9a12d02 | 2021-07-08 15:32:52 +0100 | [diff] [blame] | 45 | |
rameshiyer27 | a8be1f7 | 2022-03-16 10:36:33 +0000 | [diff] [blame] | 46 | ExecuteApexTestPnfPolicyWithMetadataSet |
| 47 | Set Test Variable ${policyName} onap.policies.apex.pnf.metadataSet.Test |
adheli.tavares | 1f339f8 | 2023-02-17 15:14:07 +0000 | [diff] [blame] | 48 | ${postjson}= Get File ${CURDIR}/data/${policyName}.json |
rameshiyer27 | a8be1f7 | 2022-03-16 10:36:33 +0000 | [diff] [blame] | 49 | CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 |
adheli.tavares | 1f339f8 | 2023-02-17 15:14:07 +0000 | [diff] [blame] | 50 | ${postjson}= Get File ${CURDIR}/data/onap.pnf.metadataSet.Test.json |
rameshiyer27 | a8be1f7 | 2022-03-16 10:36:33 +0000 | [diff] [blame] | 51 | CreateNodeTemplate /policy/api/v1/nodetemplates 200 ${postjson} 1 |
| 52 | DeployPolicy |
| 53 | Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex |
rameshiyer27 | f2e4da7 | 2024-01-13 21:26:09 +0000 | [diff] [blame] | 54 | GetKafkaTopic apex-cl-mgt2 |
| 55 | Wait Until Keyword Succeeds 2 min 5 sec TriggerAndVerifyTestPnfPolicy apex-cl-mgt2 |
rameshiyer27 | a8be1f7 | 2022-03-16 10:36:33 +0000 | [diff] [blame] | 56 | |
Rashmi Pujar | b056fde | 2022-04-08 15:45:32 -0400 | [diff] [blame] | 57 | Metrics |
| 58 | [Documentation] Verify policy-apex-pdp is exporting prometheus metrics |
adheli.tavares | 1153b6d | 2023-02-28 12:59:37 +0000 | [diff] [blame] | 59 | ${auth}= PolicyAdminAuth |
adheli.tavares | 1f339f8 | 2023-02-17 15:14:07 +0000 | [diff] [blame] | 60 | ${resp}= PerformGetRequest ${APEX_IP} /metrics 200 null ${auth} |
rameshiyer27 | f2e4da7 | 2024-01-13 21:26:09 +0000 | [diff] [blame] | 61 | Should Contain ${resp.text} pdpa_policy_deployments_total{operation="deploy",status="TOTAL",} 3.0 |
| 62 | Should Contain ${resp.text} pdpa_policy_deployments_total{operation="deploy",status="SUCCESS",} 3.0 |
| 63 | Should Contain ${resp.text} pdpa_policy_executions_total{status="SUCCESS",} 6.0 |
| 64 | Should Contain ${resp.text} pdpa_policy_executions_total{status="TOTAL",} 6.0 |
Rashmi Pujar | b056fde | 2022-04-08 15:45:32 -0400 | [diff] [blame] | 65 | Should Match ${resp.text} *pdpa_engine_event_executions{engine_instance_id="NSOApexEngine-*:0.0.1",}* |
| 66 | Should Match ${resp.text} *pdpa_engine_event_executions{engine_instance_id="MyApexEngine-*:0.0.1",}* |
| 67 | Should Match ${resp.text} *pdpa_engine_state{engine_instance_id=*,} 2.0* |
| 68 | Should Contain ${resp.text} pdpa_engine_event_executions |
| 69 | Should Contain ${resp.text} pdpa_engine_average_execution_time_seconds |
| 70 | Should Contain ${resp.text} pdpa_engine_last_execution_time_bucket |
| 71 | Should Contain ${resp.text} pdpa_engine_last_execution_time_count |
| 72 | Should Contain ${resp.text} pdpa_engine_last_execution_time_sum |
| 73 | Should Match ${resp.text} *pdpa_engine_last_start_timestamp_epoch{engine_instance_id="NSOApexEngine-*:0.0.1",}*E12* |
| 74 | Should Match ${resp.text} *pdpa_engine_last_start_timestamp_epoch{engine_instance_id="MyApexEngine-*:0.0.1",}*E12* |
| 75 | Should Contain ${resp.text} jvm_threads_current |
| 76 | |
Jim Hahn | b3a962f | 2021-05-12 11:33:43 -0400 | [diff] [blame] | 77 | *** Keywords *** |
| 78 | |
a.sreekumar | f715119 | 2021-10-20 17:28:04 +0100 | [diff] [blame] | 79 | TriggerAndVerifyTestPnfPolicy |
rameshiyer27 | caa7adc | 2024-01-16 12:21:26 +0000 | [diff] [blame] | 80 | [Documentation] Send TestPnf policy trigger event to Kafka and read notifications to verify policy execution |
rameshiyer27 | f2e4da7 | 2024-01-13 21:26:09 +0000 | [diff] [blame] | 81 | [Arguments] ${topic} |
a.sreekumar | f715119 | 2021-10-20 17:28:04 +0100 | [diff] [blame] | 82 | ${data}= Get Binary File ${CURDIR}/data/VesEventForPnfPolicy.json |
rameshiyer27 | 31c61d4 | 2024-01-21 14:24:03 +0000 | [diff] [blame] | 83 | ${resp}= Run Process ${CURDIR}/kafka_producer.py unauthenticated.dcae_cl_output ${data} ${KAFKA_IP} |
rameshiyer27 | f2e4da7 | 2024-01-13 21:26:09 +0000 | [diff] [blame] | 84 | Run Keyword CheckLogMessage ${topic} ACTIVE VES event has been received. Going to fetch details from AAI. |
| 85 | Run Keyword CheckLogMessage ${topic} SUCCESS Received response from AAI successfully. Hostname in AAI matches with the one in Ves event. Going to make the update-config request to CDS. |
| 86 | Run Keyword CheckLogMessage ${topic} FINAL_SUCCESS Successfully processed the VES event. Hostname is updated. |
a.sreekumar | f715119 | 2021-10-20 17:28:04 +0100 | [diff] [blame] | 87 | |
| 88 | TriggerAndVerifyTestVnfPolicy |
rameshiyer27 | caa7adc | 2024-01-16 12:21:26 +0000 | [diff] [blame] | 89 | [Documentation] Send TestVnf policy trigger event to Kafka and read notifications to verify policy execution |
| 90 | [Arguments] ${topic} |
a.sreekumar | f715119 | 2021-10-20 17:28:04 +0100 | [diff] [blame] | 91 | ${data}= Get Binary File ${CURDIR}/data/VesEventForVnfPolicy.json |
rameshiyer27 | 31c61d4 | 2024-01-21 14:24:03 +0000 | [diff] [blame] | 92 | ${resp}= Run Process ${CURDIR}/kafka_producer.py unauthenticated.dcae_policy_example_output ${data} ${KAFKA_IP} |
rameshiyer27 | caa7adc | 2024-01-16 12:21:26 +0000 | [diff] [blame] | 93 | Run Keyword CheckLogMessage ${topic} ACTIVE VES event has been received. Going to fetch VNF details from AAI. |
| 94 | Run Keyword CheckLogMessage ${topic} SUCCESS VNF details are received from AAI successfully. Sending ConfigModify request to CDS. |
| 95 | Run Keyword CheckLogMessage ${topic} SUCCESS ConfigModify request is successful. Sending restart request to CDS. |
| 96 | Run Keyword CheckLogMessage ${topic} FINAL_SUCCESS Successfully processed the VES Event. Restart is complete. |