blob: 42be44157ee07a5538f1d2aaea347f032fafbec8 [file] [log] [blame]
Jim Hahnb3a962f2021-05-12 11:33:43 -04001*** Settings ***
2Library Collections
3Library RequestsLibrary
4Library OperatingSystem
5Library json
a.sreekumar9a12d022021-07-08 15:32:52 +01006Library Process
adheli.tavares1f339f82023-02-17 15:14:07 +00007Resource ${CURDIR}/common-library.robot
waynedunicane4ff7e52023-03-01 09:07:31 +00008Resource ${CURDIR}/apex-pdp-common.robot
Jim Hahnb3a962f2021-05-12 11:33:43 -04009
10*** Test Cases ***
11
12Healthcheck
13 [Documentation] Runs Apex PDP Health check
adheli.tavares1153b6d2023-02-28 12:59:37 +000014 ${hcauth}= PolicyAdminAuth
adheli.tavares1f339f82023-02-17 15:14:07 +000015 ${resp}= PerformGetRequest ${APEX_IP} /policy/apex-pdp/v1/healthcheck 200 null ${hcauth}
a.sreekumar60d6a082021-08-20 17:39:53 +010016 Should Be Equal As Strings ${resp.json()['code']} 200
a.sreekumardf1a5bd2021-06-30 16:46:00 +010017 Set Suite Variable ${pdpName} ${resp.json()['name']}
Jim Hahnb3a962f2021-05-12 11:33:43 -040018
a.sreekumar60d6a082021-08-20 17:39:53 +010019ExecuteApexSampleDomainPolicy
adheli.tavares1153b6d2023-02-28 12:59:37 +000020 # [Tags] docker
a.sreekumar9a12d022021-07-08 15:32:52 +010021 Set Test Variable ${policyName} onap.policies.native.apex.Sampledomain
adheli.tavares1f339f82023-02-17 15:14:07 +000022 ${postjson}= Get File ${CURDIR}/data/${policyName}.json
a.sreekumar60d6a082021-08-20 17:39:53 +010023 CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0
a.sreekumar60d6a082021-08-20 17:39:53 +010024 DeployPolicy
25 Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex
a.sreekumar9a12d022021-07-08 15:32:52 +010026 Wait Until Keyword Succeeds 4 min 5 sec RunEventOnApexEngine
Jim Hahnb3a962f2021-05-12 11:33:43 -040027
a.sreekumarf7151192021-10-20 17:28:04 +010028ExecuteApexTestPnfPolicy
29 Set Test Variable ${policyName} onap.policies.apex.pnf.Test
adheli.tavares1f339f82023-02-17 15:14:07 +000030 ${postjson}= Get File ${CURDIR}/data/${policyName}.json
a.sreekumar60d6a082021-08-20 17:39:53 +010031 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
rameshiyer27f2e4da72024-01-13 21:26:09 +000034 GetKafkaTopic apex-cl-mgt
35 Wait Until Keyword Succeeds 2 min 5 sec TriggerAndVerifyTestPnfPolicy apex-cl-mgt
a.sreekumarf7151192021-10-20 17:28:04 +010036
rameshiyer27f2e4da72024-01-13 21:26:09 +000037#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.sreekumar9a12d022021-07-08 15:32:52 +010045
rameshiyer27a8be1f72022-03-16 10:36:33 +000046ExecuteApexTestPnfPolicyWithMetadataSet
47 Set Test Variable ${policyName} onap.policies.apex.pnf.metadataSet.Test
adheli.tavares1f339f82023-02-17 15:14:07 +000048 ${postjson}= Get File ${CURDIR}/data/${policyName}.json
rameshiyer27a8be1f72022-03-16 10:36:33 +000049 CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0
adheli.tavares1f339f82023-02-17 15:14:07 +000050 ${postjson}= Get File ${CURDIR}/data/onap.pnf.metadataSet.Test.json
rameshiyer27a8be1f72022-03-16 10:36:33 +000051 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
rameshiyer27f2e4da72024-01-13 21:26:09 +000054 GetKafkaTopic apex-cl-mgt2
55 Wait Until Keyword Succeeds 2 min 5 sec TriggerAndVerifyTestPnfPolicy apex-cl-mgt2
rameshiyer27a8be1f72022-03-16 10:36:33 +000056
Rashmi Pujarb056fde2022-04-08 15:45:32 -040057Metrics
58 [Documentation] Verify policy-apex-pdp is exporting prometheus metrics
adheli.tavares1153b6d2023-02-28 12:59:37 +000059 ${auth}= PolicyAdminAuth
adheli.tavares1f339f82023-02-17 15:14:07 +000060 ${resp}= PerformGetRequest ${APEX_IP} /metrics 200 null ${auth}
rameshiyer27f2e4da72024-01-13 21:26:09 +000061 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 Pujarb056fde2022-04-08 15:45:32 -040065 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 Hahnb3a962f2021-05-12 11:33:43 -040077*** Keywords ***
78
a.sreekumarf7151192021-10-20 17:28:04 +010079TriggerAndVerifyTestPnfPolicy
rameshiyer27caa7adc2024-01-16 12:21:26 +000080 [Documentation] Send TestPnf policy trigger event to Kafka and read notifications to verify policy execution
rameshiyer27f2e4da72024-01-13 21:26:09 +000081 [Arguments] ${topic}
a.sreekumarf7151192021-10-20 17:28:04 +010082 ${data}= Get Binary File ${CURDIR}/data/VesEventForPnfPolicy.json
rameshiyer2731c61d42024-01-21 14:24:03 +000083 ${resp}= Run Process ${CURDIR}/kafka_producer.py unauthenticated.dcae_cl_output ${data} ${KAFKA_IP}
rameshiyer27f2e4da72024-01-13 21:26:09 +000084 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.sreekumarf7151192021-10-20 17:28:04 +010087
88TriggerAndVerifyTestVnfPolicy
rameshiyer27caa7adc2024-01-16 12:21:26 +000089 [Documentation] Send TestVnf policy trigger event to Kafka and read notifications to verify policy execution
90 [Arguments] ${topic}
a.sreekumarf7151192021-10-20 17:28:04 +010091 ${data}= Get Binary File ${CURDIR}/data/VesEventForVnfPolicy.json
rameshiyer2731c61d42024-01-21 14:24:03 +000092 ${resp}= Run Process ${CURDIR}/kafka_producer.py unauthenticated.dcae_policy_example_output ${data} ${KAFKA_IP}
rameshiyer27caa7adc2024-01-16 12:21:26 +000093 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.