blob: 13bf16ed4656c19675c0246d6adfb0ff4ad9b59a [file] [log] [blame]
Jim Hahnb3a962f2021-05-12 11:33:43 -04001*** Settings ***
Ram Krishna Vermaab96e4d2021-08-03 10:14:46 -04002Library Collections
3Library RequestsLibrary
4Library OperatingSystem
5Library json
adheli.tavares1f339f82023-02-17 15:14:07 +00006Resource ${CURDIR}/common-library.robot
Jim Hahnb3a962f2021-05-12 11:33:43 -04007
adheli.tavares496b3012021-11-01 10:40:32 +00008*** Keywords ***
9GetReq
10 [Arguments] ${url}
11 ${auth}= PolicyAdminAuth
adheli.tavares1f339f82023-02-17 15:14:07 +000012 ${resp}= PerformGetRequest ${POLICY_PAP_IP} ${url} 200 null ${auth}
adheli.tavares8361cb02024-02-21 15:29:36 +000013 RETURN ${resp}
adheli.tavares496b3012021-11-01 10:40:32 +000014
adheli.tavares2ac4b6c2024-05-30 10:17:05 +010015CheckUndeploymentStatus
16 QueryPolicyAudit /policy/pap/v1/policies/audit 200 testGroup pdpTypeA onap.restart.tca UNDEPLOYMENT
adheli.tavares9fc9fa42023-02-09 11:56:27 +000017
Jim Hahnb3a962f2021-05-12 11:33:43 -040018*** Test Cases ***
19LoadPolicy
Ram Krishna Vermaab96e4d2021-08-03 10:14:46 -040020 [Documentation] Create a policy named 'onap.restart.tca' and version '1.0.0' using specific api
a.sreekumar60d6a082021-08-20 17:39:53 +010021 ${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 Hahnb3a962f2021-05-12 11:33:43 -040023
rameshiyer27a8be1f72022-03-16 10:36:33 +000024LoadPolicyWithMetadataSet
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
29LoadNodeTemplates
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 Hahnb3a962f2021-05-12 11:33:43 -040034Healthcheck
Ram Krishna Vermaab96e4d2021-08-03 10:14:46 -040035 [Documentation] Verify policy pap health check
adheli.tavares496b3012021-11-01 10:40:32 +000036 ${resp}= GetReq /policy/pap/v1/healthcheck
Ram Krishna Vermaab96e4d2021-08-03 10:14:46 -040037 Should Be Equal As Strings ${resp.json()['code']} 200
Jim Hahnb3a962f2021-05-12 11:33:43 -040038
Ram Krishna Vermadc2d4732021-08-31 17:11:06 -040039Consolidated Healthcheck
40 [Documentation] Verify policy consolidated health check
rameshiyer27f2e4da72024-01-13 21:26:09 +000041 sleep 20
adheli.tavares496b3012021-11-01 10:40:32 +000042 ${resp}= GetReq /policy/pap/v1/components/healthcheck
Ram Krishna Vermadc2d4732021-08-31 17:11:06 -040043 Should Be Equal As Strings ${resp.json()['healthy']} True
44
a.sreekumar60d6a082021-08-20 17:39:53 +010045Metrics
46 [Documentation] Verify policy pap is exporting prometheus metrics
a.sreekumar67f7bd92022-02-14 13:51:34 +000047 ${auth}= PolicyAdminAuth
adheli.tavares1f339f82023-02-17 15:14:07 +000048 ${resp}= GetMetrics ${POLICY_PAP_IP} ${auth} /policy/pap/v1/
adheli.tavares43a40e12023-07-18 12:04:20 +010049 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
liamfallon0132d7a2023-01-23 09:52:24 +000051 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.tavares1153b6d2023-02-28 12:59:37 +000053 Should Contain ${resp.text} spring_data_repository_invocations_seconds_count{exception="None",method="findAll",repository="PolicyStatusRepository",state="SUCCESS",}
a.sreekumar60d6a082021-08-20 17:39:53 +010054
Ram Krishna Vermaab96e4d2021-08-03 10:14:46 -040055AddPdpGroup
56 [Documentation] Add a new PdpGroup named 'testGroup' in the policy database
a.sreekumar60d6a082021-08-20 17:39:53 +010057 ${postjson}= Get file ${CURDIR}/data/create.group.request.json
adheli.tavares496b3012021-11-01 10:40:32 +000058 ${auth}= PolicyAdminAuth
adheli.tavares1f339f82023-02-17 15:14:07 +000059 PerformPostRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/groups/batch 200 ${postjson} null ${auth}
a.sreekumar60d6a082021-08-20 17:39:53 +010060
61QueryPdpGroupsBeforeActivation
62 [Documentation] Verify PdpGroups before activation
63 QueryPdpGroups 2 defaultGroup ACTIVE 0 testGroup PASSIVE 0
Jim Hahnb3a962f2021-05-12 11:33:43 -040064
65ActivatePdpGroup
Ram Krishna Vermaab96e4d2021-08-03 10:14:46 -040066 [Documentation] Change the state of PdpGroup named 'testGroup' to ACTIVE
adheli.tavares496b3012021-11-01 10:40:32 +000067 ${auth}= PolicyAdminAuth
adheli.tavares1f339f82023-02-17 15:14:07 +000068 PerformPutRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/groups/testGroup 200 state=ACTIVE ${auth}
Jim Hahnb3a962f2021-05-12 11:33:43 -040069
Ram Krishna Vermaab96e4d2021-08-03 10:14:46 -040070QueryPdpGroupsAfterActivation
71 [Documentation] Verify PdpGroups after activation
a.sreekumar60d6a082021-08-20 17:39:53 +010072 QueryPdpGroups 2 defaultGroup ACTIVE 0 testGroup ACTIVE 0
Jim Hahnb3a962f2021-05-12 11:33:43 -040073
74DeployPdpGroups
Ram Krishna Vermaab96e4d2021-08-03 10:14:46 -040075 [Documentation] Deploy policies in PdpGroups
a.sreekumar60d6a082021-08-20 17:39:53 +010076 ${postjson}= Get file ${CURDIR}/data/deploy.group.request.json
adheli.tavares496b3012021-11-01 10:40:32 +000077 ${auth}= PolicyAdminAuth
adheli.tavares1f339f82023-02-17 15:14:07 +000078 PerformPostRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/deployments/batch 202 ${postjson} null ${auth}
Ram Krishna Vermaab96e4d2021-08-03 10:14:46 -040079
80QueryPdpGroupsAfterDeploy
81 [Documentation] Verify PdpGroups after undeploy
a.sreekumar60d6a082021-08-20 17:39:53 +010082 QueryPdpGroups 2 defaultGroup ACTIVE 0 testGroup ACTIVE 1
Jim Hahnb3a962f2021-05-12 11:33:43 -040083
Ram Krishna Vermacfe68542021-07-29 18:09:58 -040084QueryPolicyAuditAfterDeploy
Ram Krishna Vermaab96e4d2021-08-03 10:14:46 -040085 [Documentation] Verify policy audit record after deploy
a.sreekumar60d6a082021-08-20 17:39:53 +010086 QueryPolicyAudit /policy/pap/v1/policies/audit 200 testGroup pdpTypeA onap.restart.tca DEPLOYMENT
Ram Krishna Vermacfe68542021-07-29 18:09:58 -040087
rameshiyer27a8be1f72022-03-16 10:36:33 +000088QueryPolicyAuditWithMetadataSetAfterDeploy
89 [Documentation] Verify policy audit record after deploy
90 QueryPolicyAudit /policy/pap/v1/policies/audit 200 testGroup pdpTypeC operational.apex.decisionMaker DEPLOYMENT
91
Jim Hahnb3a962f2021-05-12 11:33:43 -040092UndeployPolicy
Ram Krishna Vermaab96e4d2021-08-03 10:14:46 -040093 [Documentation] Undeploy a policy named 'onap.restart.tca' from PdpGroups
adheli.tavares496b3012021-11-01 10:40:32 +000094 ${auth}= PolicyAdminAuth
adheli.tavares1f339f82023-02-17 15:14:07 +000095 PerformDeleteRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/policies/onap.restart.tca 202 ${auth}
Jim Hahnb3a962f2021-05-12 11:33:43 -040096
rameshiyer27a8be1f72022-03-16 10:36:33 +000097UndeployPolicyWithMetadataSet
98 [Documentation] Undeploy a policy named 'operational.apex.decisionMaker' from PdpGroups
99 ${auth}= PolicyAdminAuth
adheli.tavares1f339f82023-02-17 15:14:07 +0000100 PerformDeleteRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/policies/operational.apex.decisionMaker 202 ${auth}
rameshiyer27a8be1f72022-03-16 10:36:33 +0000101
Jim Hahnb3a962f2021-05-12 11:33:43 -0400102QueryPdpGroupsAfterUndeploy
Ram Krishna Vermaab96e4d2021-08-03 10:14:46 -0400103 [Documentation] Verify PdpGroups after undeploy
a.sreekumar60d6a082021-08-20 17:39:53 +0100104 QueryPdpGroups 2 defaultGroup ACTIVE 0 testGroup ACTIVE 0
Jim Hahnb3a962f2021-05-12 11:33:43 -0400105
Ram Krishna Vermacfe68542021-07-29 18:09:58 -0400106QueryPolicyAuditAfterUnDeploy
liamfallona660eda2022-07-14 13:29:58 +0100107 [Documentation] Verify policy audit record after undeploy
adheli.tavares2ac4b6c2024-05-30 10:17:05 +0100108 Wait Until Keyword Succeeds 2 min 10 sec CheckUndeploymentStatus
Ram Krishna Vermacfe68542021-07-29 18:09:58 -0400109
rameshiyer27a8be1f72022-03-16 10:36:33 +0000110QueryPolicyAuditWithMetadataSetAfterUnDeploy
111 [Documentation] Verify policy audit record after undeploy
112 QueryPolicyAudit /policy/pap/v1/policies/audit 200 testGroup pdpTypeC operational.apex.decisionMaker UNDEPLOYMENT
113
Jim Hahnb3a962f2021-05-12 11:33:43 -0400114DeactivatePdpGroup
Ram Krishna Vermaab96e4d2021-08-03 10:14:46 -0400115 [Documentation] Change the state of PdpGroup named 'testGroup' to PASSIVE
adheli.tavares496b3012021-11-01 10:40:32 +0000116 ${auth}= PolicyAdminAuth
adheli.tavares1f339f82023-02-17 15:14:07 +0000117 PerformPutRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/groups/testGroup 200 state=PASSIVE ${auth}
Jim Hahnb3a962f2021-05-12 11:33:43 -0400118
119DeletePdpGroups
Ram Krishna Vermaab96e4d2021-08-03 10:14:46 -0400120 [Documentation] Delete the PdpGroup named 'testGroup' from policy database
adheli.tavares496b3012021-11-01 10:40:32 +0000121 ${auth}= PolicyAdminAuth
adheli.tavares1f339f82023-02-17 15:14:07 +0000122 PerformDeleteRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/groups/testGroup 200 ${auth}
Jim Hahnb3a962f2021-05-12 11:33:43 -0400123
124QueryPdpGroupsAfterDelete
Ram Krishna Vermaab96e4d2021-08-03 10:14:46 -0400125 [Documentation] Verify PdpGroups after delete
a.sreekumar60d6a082021-08-20 17:39:53 +0100126 QueryPdpGroups 1 defaultGroup ACTIVE 0 null null null