Jim Hahn | b3a962f | 2021-05-12 11:33:43 -0400 | [diff] [blame] | 1 | *** Settings *** |
Ram Krishna Verma | ab96e4d | 2021-08-03 10:14:46 -0400 | [diff] [blame] | 2 | Library Collections |
| 3 | Library RequestsLibrary |
| 4 | Library OperatingSystem |
| 5 | Library json |
adheli.tavares | 1f339f8 | 2023-02-17 15:14:07 +0000 | [diff] [blame] | 6 | Resource ${CURDIR}/common-library.robot |
Jim Hahn | b3a962f | 2021-05-12 11:33:43 -0400 | [diff] [blame] | 7 | |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 8 | *** Keywords *** |
| 9 | GetReq |
| 10 | [Arguments] ${url} |
| 11 | ${auth}= PolicyAdminAuth |
adheli.tavares | 1f339f8 | 2023-02-17 15:14:07 +0000 | [diff] [blame] | 12 | ${resp}= PerformGetRequest ${POLICY_PAP_IP} ${url} 200 null ${auth} |
adheli.tavares | 8361cb0 | 2024-02-21 15:29:36 +0000 | [diff] [blame] | 13 | RETURN ${resp} |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 14 | |
adheli.tavares | 2ac4b6c | 2024-05-30 10:17:05 +0100 | [diff] [blame] | 15 | CheckUndeploymentStatus |
| 16 | QueryPolicyAudit /policy/pap/v1/policies/audit 200 testGroup pdpTypeA onap.restart.tca UNDEPLOYMENT |
adheli.tavares | 9fc9fa4 | 2023-02-09 11:56:27 +0000 | [diff] [blame] | 17 | |
Jim Hahn | b3a962f | 2021-05-12 11:33:43 -0400 | [diff] [blame] | 18 | *** Test Cases *** |
| 19 | LoadPolicy |
Ram Krishna Verma | ab96e4d | 2021-08-03 10:14:46 -0400 | [diff] [blame] | 20 | [Documentation] Create a policy named 'onap.restart.tca' and version '1.0.0' using specific api |
a.sreekumar | 60d6a08 | 2021-08-20 17:39:53 +0100 | [diff] [blame] | 21 | ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.json |
| 22 | CreatePolicy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies 200 ${postjson} onap.restart.tca 1.0.0 |
Jim Hahn | b3a962f | 2021-05-12 11:33:43 -0400 | [diff] [blame] | 23 | |
rameshiyer27 | a8be1f7 | 2022-03-16 10:36:33 +0000 | [diff] [blame] | 24 | LoadPolicyWithMetadataSet |
| 25 | [Documentation] Create a policy named 'operational.apex.decisionMaker' and version '1.0.0' using specific api |
| 26 | ${postjson}= Get file ${CURDIR}/data/apex.policy.decisionmaker.input.tosca.json |
| 27 | CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} operational.apex.decisionMaker 1.0.0 |
| 28 | |
| 29 | LoadNodeTemplates |
| 30 | [Documentation] Create node templates in database using specific api |
| 31 | ${postjson}= Get file ${NODETEMPLATES}/nodetemplates.metadatasets.input.tosca.json |
| 32 | CreateNodeTemplate /policy/api/v1/nodetemplates 200 ${postjson} 3 |
| 33 | |
Jim Hahn | b3a962f | 2021-05-12 11:33:43 -0400 | [diff] [blame] | 34 | Healthcheck |
Ram Krishna Verma | ab96e4d | 2021-08-03 10:14:46 -0400 | [diff] [blame] | 35 | [Documentation] Verify policy pap health check |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 36 | ${resp}= GetReq /policy/pap/v1/healthcheck |
Ram Krishna Verma | ab96e4d | 2021-08-03 10:14:46 -0400 | [diff] [blame] | 37 | Should Be Equal As Strings ${resp.json()['code']} 200 |
Jim Hahn | b3a962f | 2021-05-12 11:33:43 -0400 | [diff] [blame] | 38 | |
Ram Krishna Verma | dc2d473 | 2021-08-31 17:11:06 -0400 | [diff] [blame] | 39 | Consolidated Healthcheck |
| 40 | [Documentation] Verify policy consolidated health check |
rameshiyer27 | f2e4da7 | 2024-01-13 21:26:09 +0000 | [diff] [blame] | 41 | sleep 20 |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 42 | ${resp}= GetReq /policy/pap/v1/components/healthcheck |
Ram Krishna Verma | dc2d473 | 2021-08-31 17:11:06 -0400 | [diff] [blame] | 43 | Should Be Equal As Strings ${resp.json()['healthy']} True |
| 44 | |
a.sreekumar | 60d6a08 | 2021-08-20 17:39:53 +0100 | [diff] [blame] | 45 | Metrics |
| 46 | [Documentation] Verify policy pap is exporting prometheus metrics |
a.sreekumar | 67f7bd9 | 2022-02-14 13:51:34 +0000 | [diff] [blame] | 47 | ${auth}= PolicyAdminAuth |
adheli.tavares | 1f339f8 | 2023-02-17 15:14:07 +0000 | [diff] [blame] | 48 | ${resp}= GetMetrics ${POLICY_PAP_IP} ${auth} /policy/pap/v1/ |
adheli.tavares | 43a40e1 | 2023-07-18 12:04:20 +0100 | [diff] [blame] | 49 | Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/healthcheck",} |
| 50 | Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/components/healthcheck",} 1.0 |
liamfallon | 0132d7a | 2023-01-23 09:52:24 +0000 | [diff] [blame] | 51 | Should Contain ${resp.text} spring_data_repository_invocations_seconds_count{exception="None",method="save",repository="PdpGroupRepository",state="SUCCESS",} 1.0 |
| 52 | Should Contain ${resp.text} spring_data_repository_invocations_seconds_count{exception="None",method="findByKeyName",repository="PdpGroupRepository",state="SUCCESS",} 1.0 |
adheli.tavares | 1153b6d | 2023-02-28 12:59:37 +0000 | [diff] [blame] | 53 | Should Contain ${resp.text} spring_data_repository_invocations_seconds_count{exception="None",method="findAll",repository="PolicyStatusRepository",state="SUCCESS",} |
a.sreekumar | 60d6a08 | 2021-08-20 17:39:53 +0100 | [diff] [blame] | 54 | |
Ram Krishna Verma | ab96e4d | 2021-08-03 10:14:46 -0400 | [diff] [blame] | 55 | AddPdpGroup |
| 56 | [Documentation] Add a new PdpGroup named 'testGroup' in the policy database |
a.sreekumar | 60d6a08 | 2021-08-20 17:39:53 +0100 | [diff] [blame] | 57 | ${postjson}= Get file ${CURDIR}/data/create.group.request.json |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 58 | ${auth}= PolicyAdminAuth |
adheli.tavares | 1f339f8 | 2023-02-17 15:14:07 +0000 | [diff] [blame] | 59 | PerformPostRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/groups/batch 200 ${postjson} null ${auth} |
a.sreekumar | 60d6a08 | 2021-08-20 17:39:53 +0100 | [diff] [blame] | 60 | |
| 61 | QueryPdpGroupsBeforeActivation |
| 62 | [Documentation] Verify PdpGroups before activation |
| 63 | QueryPdpGroups 2 defaultGroup ACTIVE 0 testGroup PASSIVE 0 |
Jim Hahn | b3a962f | 2021-05-12 11:33:43 -0400 | [diff] [blame] | 64 | |
| 65 | ActivatePdpGroup |
Ram Krishna Verma | ab96e4d | 2021-08-03 10:14:46 -0400 | [diff] [blame] | 66 | [Documentation] Change the state of PdpGroup named 'testGroup' to ACTIVE |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 67 | ${auth}= PolicyAdminAuth |
adheli.tavares | 1f339f8 | 2023-02-17 15:14:07 +0000 | [diff] [blame] | 68 | PerformPutRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/groups/testGroup 200 state=ACTIVE ${auth} |
Jim Hahn | b3a962f | 2021-05-12 11:33:43 -0400 | [diff] [blame] | 69 | |
Ram Krishna Verma | ab96e4d | 2021-08-03 10:14:46 -0400 | [diff] [blame] | 70 | QueryPdpGroupsAfterActivation |
| 71 | [Documentation] Verify PdpGroups after activation |
a.sreekumar | 60d6a08 | 2021-08-20 17:39:53 +0100 | [diff] [blame] | 72 | QueryPdpGroups 2 defaultGroup ACTIVE 0 testGroup ACTIVE 0 |
Jim Hahn | b3a962f | 2021-05-12 11:33:43 -0400 | [diff] [blame] | 73 | |
| 74 | DeployPdpGroups |
Ram Krishna Verma | ab96e4d | 2021-08-03 10:14:46 -0400 | [diff] [blame] | 75 | [Documentation] Deploy policies in PdpGroups |
a.sreekumar | 60d6a08 | 2021-08-20 17:39:53 +0100 | [diff] [blame] | 76 | ${postjson}= Get file ${CURDIR}/data/deploy.group.request.json |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 77 | ${auth}= PolicyAdminAuth |
adheli.tavares | 1f339f8 | 2023-02-17 15:14:07 +0000 | [diff] [blame] | 78 | PerformPostRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/deployments/batch 202 ${postjson} null ${auth} |
Ram Krishna Verma | ab96e4d | 2021-08-03 10:14:46 -0400 | [diff] [blame] | 79 | |
| 80 | QueryPdpGroupsAfterDeploy |
| 81 | [Documentation] Verify PdpGroups after undeploy |
a.sreekumar | 60d6a08 | 2021-08-20 17:39:53 +0100 | [diff] [blame] | 82 | QueryPdpGroups 2 defaultGroup ACTIVE 0 testGroup ACTIVE 1 |
Jim Hahn | b3a962f | 2021-05-12 11:33:43 -0400 | [diff] [blame] | 83 | |
Ram Krishna Verma | cfe6854 | 2021-07-29 18:09:58 -0400 | [diff] [blame] | 84 | QueryPolicyAuditAfterDeploy |
Ram Krishna Verma | ab96e4d | 2021-08-03 10:14:46 -0400 | [diff] [blame] | 85 | [Documentation] Verify policy audit record after deploy |
a.sreekumar | 60d6a08 | 2021-08-20 17:39:53 +0100 | [diff] [blame] | 86 | QueryPolicyAudit /policy/pap/v1/policies/audit 200 testGroup pdpTypeA onap.restart.tca DEPLOYMENT |
Ram Krishna Verma | cfe6854 | 2021-07-29 18:09:58 -0400 | [diff] [blame] | 87 | |
rameshiyer27 | a8be1f7 | 2022-03-16 10:36:33 +0000 | [diff] [blame] | 88 | QueryPolicyAuditWithMetadataSetAfterDeploy |
| 89 | [Documentation] Verify policy audit record after deploy |
| 90 | QueryPolicyAudit /policy/pap/v1/policies/audit 200 testGroup pdpTypeC operational.apex.decisionMaker DEPLOYMENT |
| 91 | |
Jim Hahn | b3a962f | 2021-05-12 11:33:43 -0400 | [diff] [blame] | 92 | UndeployPolicy |
Ram Krishna Verma | ab96e4d | 2021-08-03 10:14:46 -0400 | [diff] [blame] | 93 | [Documentation] Undeploy a policy named 'onap.restart.tca' from PdpGroups |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 94 | ${auth}= PolicyAdminAuth |
adheli.tavares | 1f339f8 | 2023-02-17 15:14:07 +0000 | [diff] [blame] | 95 | PerformDeleteRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/policies/onap.restart.tca 202 ${auth} |
Jim Hahn | b3a962f | 2021-05-12 11:33:43 -0400 | [diff] [blame] | 96 | |
rameshiyer27 | a8be1f7 | 2022-03-16 10:36:33 +0000 | [diff] [blame] | 97 | UndeployPolicyWithMetadataSet |
| 98 | [Documentation] Undeploy a policy named 'operational.apex.decisionMaker' from PdpGroups |
| 99 | ${auth}= PolicyAdminAuth |
adheli.tavares | 1f339f8 | 2023-02-17 15:14:07 +0000 | [diff] [blame] | 100 | PerformDeleteRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/policies/operational.apex.decisionMaker 202 ${auth} |
rameshiyer27 | a8be1f7 | 2022-03-16 10:36:33 +0000 | [diff] [blame] | 101 | |
Jim Hahn | b3a962f | 2021-05-12 11:33:43 -0400 | [diff] [blame] | 102 | QueryPdpGroupsAfterUndeploy |
Ram Krishna Verma | ab96e4d | 2021-08-03 10:14:46 -0400 | [diff] [blame] | 103 | [Documentation] Verify PdpGroups after undeploy |
a.sreekumar | 60d6a08 | 2021-08-20 17:39:53 +0100 | [diff] [blame] | 104 | QueryPdpGroups 2 defaultGroup ACTIVE 0 testGroup ACTIVE 0 |
Jim Hahn | b3a962f | 2021-05-12 11:33:43 -0400 | [diff] [blame] | 105 | |
Ram Krishna Verma | cfe6854 | 2021-07-29 18:09:58 -0400 | [diff] [blame] | 106 | QueryPolicyAuditAfterUnDeploy |
liamfallon | a660eda | 2022-07-14 13:29:58 +0100 | [diff] [blame] | 107 | [Documentation] Verify policy audit record after undeploy |
adheli.tavares | 2ac4b6c | 2024-05-30 10:17:05 +0100 | [diff] [blame] | 108 | Wait Until Keyword Succeeds 2 min 10 sec CheckUndeploymentStatus |
Ram Krishna Verma | cfe6854 | 2021-07-29 18:09:58 -0400 | [diff] [blame] | 109 | |
rameshiyer27 | a8be1f7 | 2022-03-16 10:36:33 +0000 | [diff] [blame] | 110 | QueryPolicyAuditWithMetadataSetAfterUnDeploy |
| 111 | [Documentation] Verify policy audit record after undeploy |
| 112 | QueryPolicyAudit /policy/pap/v1/policies/audit 200 testGroup pdpTypeC operational.apex.decisionMaker UNDEPLOYMENT |
| 113 | |
Jim Hahn | b3a962f | 2021-05-12 11:33:43 -0400 | [diff] [blame] | 114 | DeactivatePdpGroup |
Ram Krishna Verma | ab96e4d | 2021-08-03 10:14:46 -0400 | [diff] [blame] | 115 | [Documentation] Change the state of PdpGroup named 'testGroup' to PASSIVE |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 116 | ${auth}= PolicyAdminAuth |
adheli.tavares | 1f339f8 | 2023-02-17 15:14:07 +0000 | [diff] [blame] | 117 | PerformPutRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/groups/testGroup 200 state=PASSIVE ${auth} |
Jim Hahn | b3a962f | 2021-05-12 11:33:43 -0400 | [diff] [blame] | 118 | |
| 119 | DeletePdpGroups |
Ram Krishna Verma | ab96e4d | 2021-08-03 10:14:46 -0400 | [diff] [blame] | 120 | [Documentation] Delete the PdpGroup named 'testGroup' from policy database |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 121 | ${auth}= PolicyAdminAuth |
adheli.tavares | 1f339f8 | 2023-02-17 15:14:07 +0000 | [diff] [blame] | 122 | PerformDeleteRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/groups/testGroup 200 ${auth} |
Jim Hahn | b3a962f | 2021-05-12 11:33:43 -0400 | [diff] [blame] | 123 | |
| 124 | QueryPdpGroupsAfterDelete |
Ram Krishna Verma | ab96e4d | 2021-08-03 10:14:46 -0400 | [diff] [blame] | 125 | [Documentation] Verify PdpGroups after delete |
a.sreekumar | 60d6a08 | 2021-08-20 17:39:53 +0100 | [diff] [blame] | 126 | QueryPdpGroups 1 defaultGroup ACTIVE 0 null null null |