Jim Hahn | 3486a92 | 2021-05-10 15:36:30 -0400 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Library Collections |
| 3 | Library RequestsLibrary |
| 4 | Library OperatingSystem |
| 5 | Library Process |
| 6 | Library json |
adheli.tavares | 1f339f8 | 2023-02-17 15:14:07 +0000 | [diff] [blame] | 7 | Resource ${CURDIR}/common-library.robot |
Jim Hahn | 3486a92 | 2021-05-10 15:36:30 -0400 | [diff] [blame] | 8 | |
| 9 | *** Test Cases *** |
| 10 | Healthcheck |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 11 | [Documentation] Verify policy xacml-pdp health check |
| 12 | ${resp}= PdpxGetReq /policy/pdpx/v1/healthcheck |
| 13 | Should Be Equal As Strings ${resp.json()['code']} 200 |
Jim Hahn | 3486a92 | 2021-05-10 15:36:30 -0400 | [diff] [blame] | 14 | |
a.sreekumar | 60d6a08 | 2021-08-20 17:39:53 +0100 | [diff] [blame] | 15 | Metrics |
| 16 | [Documentation] Verify policy-xacml-pdp is exporting prometheus metrics |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 17 | ${resp}= PdpxGetReq /metrics |
a.sreekumar | 60d6a08 | 2021-08-20 17:39:53 +0100 | [diff] [blame] | 18 | Should Contain ${resp.text} jvm_threads_current |
| 19 | |
Jim Hahn | 3486a92 | 2021-05-10 15:36:30 -0400 | [diff] [blame] | 20 | MakeTopics |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 21 | [Documentation] Creates the Policy topics |
rameshiyer27 | f2e4da7 | 2024-01-13 21:26:09 +0000 | [diff] [blame] | 22 | GetKafkaTopic policy-pdp-pap |
Jim Hahn | 3486a92 | 2021-05-10 15:36:30 -0400 | [diff] [blame] | 23 | |
| 24 | ExecuteXacmlPolicy |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 25 | CreateMonitorPolicy |
| 26 | CreateOptimizationPolicy |
| 27 | Wait Until Keyword Succeeds 1 min 15 sec GetDefaultDecision |
| 28 | DeployPolicies |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 29 | Wait Until Keyword Succeeds 1 min 15 sec GetAbbreviatedDecisionResult |
| 30 | Wait Until Keyword Succeeds 1 min 15 sec GetMonitoringDecision |
| 31 | Wait Until Keyword Succeeds 1 min 15 sec GetNamingDecision |
| 32 | Wait Until Keyword Succeeds 1 min 15 sec GetOptimizationDecision |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 33 | UndeployMonitorPolicy |
Jim Hahn | 3486a92 | 2021-05-10 15:36:30 -0400 | [diff] [blame] | 34 | |
| 35 | *** Keywords *** |
| 36 | |
| 37 | CreateMonitorPolicy |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 38 | [Documentation] Create a Monitoring policy |
adheli.tavares | 1f339f8 | 2023-02-17 15:14:07 +0000 | [diff] [blame] | 39 | ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.json |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 40 | CreatePolicy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies 200 ${postjson} onap.restart.tca 1.0.0 |
Jim Hahn | 3486a92 | 2021-05-10 15:36:30 -0400 | [diff] [blame] | 41 | |
| 42 | CreateOptimizationPolicy |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 43 | [Documentation] Create an Optimization policy |
adheli.tavares | 1f339f8 | 2023-02-17 15:14:07 +0000 | [diff] [blame] | 44 | ${postjson}= Get file ${DATA}/vCPE.policies.optimization.input.tosca.json |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 45 | CreatePolicy /policy/api/v1/policytypes/onap.policies.optimization.resource.AffinityPolicy/versions/1.0.0/policies 200 ${postjson} OSDF_CASABLANCA.Affinity_Default 1.0.0 |
Jim Hahn | 3486a92 | 2021-05-10 15:36:30 -0400 | [diff] [blame] | 46 | |
| 47 | GetDefaultDecision |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 48 | [Documentation] Get Default Decision with no policies in Xacml PDP |
| 49 | ${postjson}= Get file ${CURDIR}/data/onap.policy.guard.decision.request.json |
| 50 | ${resp}= DecisionPostReq ${postjson} abbrev=true |
| 51 | ${status}= Get From Dictionary ${resp.json()} status |
| 52 | Should Be Equal As Strings ${status} Permit |
Jim Hahn | 3486a92 | 2021-05-10 15:36:30 -0400 | [diff] [blame] | 53 | |
| 54 | DeployPolicies |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 55 | [Documentation] Runs Policy PAP to deploy a policy |
| 56 | ${postjson}= Get file ${CURDIR}/data/vCPE.policy.input.tosca.deploy.json |
| 57 | ${policyadmin}= PolicyAdminAuth |
adheli.tavares | 1f339f8 | 2023-02-17 15:14:07 +0000 | [diff] [blame] | 58 | PerformPostRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/policies 202 ${postjson} null ${policyadmin} |
rameshiyer27 | f2e4da7 | 2024-01-13 21:26:09 +0000 | [diff] [blame] | 59 | sleep 20s |
| 60 | ${result}= CheckKafkaTopic policy-notification onap.restart.tca |
| 61 | Should Contain ${result} deployed-policies |
Jim Hahn | 3486a92 | 2021-05-10 15:36:30 -0400 | [diff] [blame] | 62 | |
Jim Hahn | 3486a92 | 2021-05-10 15:36:30 -0400 | [diff] [blame] | 63 | GetAbbreviatedDecisionResult |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 64 | [Documentation] Get Decision with abbreviated results from Policy Xacml PDP |
| 65 | ${postjson}= Get file ${CURDIR}/data/onap.policy.monitoring.decision.request.json |
| 66 | ${resp}= DecisionPostReq ${postjson} abbrev=true |
| 67 | ${policy}= Get From Dictionary ${resp.json()['policies']} onap.restart.tca |
| 68 | Dictionary Should Contain Key ${policy} type |
| 69 | Dictionary Should Contain Key ${policy} metadata |
| 70 | Dictionary Should Not Contain Key ${policy} type_version |
| 71 | Dictionary Should Not Contain Key ${policy} properties |
| 72 | Dictionary Should Not Contain Key ${policy} name |
| 73 | Dictionary Should Not Contain Key ${policy} version |
Jim Hahn | 3486a92 | 2021-05-10 15:36:30 -0400 | [diff] [blame] | 74 | |
| 75 | GetMonitoringDecision |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 76 | [Documentation] Get Decision from Monitoring Policy Xacml PDP |
| 77 | ${postjson}= Get file ${CURDIR}/data/onap.policy.monitoring.decision.request.json |
| 78 | ${resp}= DecisionPostReq ${postjson} null |
| 79 | ${policy}= Get From Dictionary ${resp.json()['policies']} onap.restart.tca |
| 80 | Dictionary Should Contain Key ${policy} type |
| 81 | Dictionary Should Contain Key ${policy} metadata |
| 82 | Dictionary Should Contain Key ${policy} type_version |
| 83 | Dictionary Should Contain Key ${policy} properties |
| 84 | Dictionary Should Contain Key ${policy} name |
| 85 | Dictionary Should Contain Key ${policy} version |
Jim Hahn | 3486a92 | 2021-05-10 15:36:30 -0400 | [diff] [blame] | 86 | |
| 87 | GetNamingDecision |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 88 | [Documentation] Get Decision from Naming Policy Xacml PDP |
| 89 | ${postjson}= Get file ${CURDIR}/data/onap.policy.naming.decision.request.json |
| 90 | ${resp}= DecisionPostReq ${postjson} null |
| 91 | ${policy}= Get From Dictionary ${resp.json()['policies']} SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP |
| 92 | Dictionary Should Contain Key ${policy} type |
| 93 | Dictionary Should Contain Key ${policy} type_version |
| 94 | Dictionary Should Contain Key ${policy} properties |
| 95 | Dictionary Should Contain Key ${policy} name |
Jim Hahn | 3486a92 | 2021-05-10 15:36:30 -0400 | [diff] [blame] | 96 | |
| 97 | GetOptimizationDecision |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 98 | [Documentation] Get Decision from Optimization Policy Xacml PDP |
| 99 | ${postjson}= Get file ${CURDIR}/data/onap.policy.optimization.decision.request.json |
| 100 | ${resp}= DecisionPostReq ${postjson} null |
| 101 | ${policy}= Get From Dictionary ${resp.json()['policies']} OSDF_CASABLANCA.Affinity_Default |
| 102 | Dictionary Should Contain Key ${policy} type |
| 103 | Dictionary Should Contain Key ${policy} type_version |
| 104 | Dictionary Should Contain Key ${policy} properties |
| 105 | Dictionary Should Contain Key ${policy} name |
Jim Hahn | 3486a92 | 2021-05-10 15:36:30 -0400 | [diff] [blame] | 106 | |
Jim Hahn | 3486a92 | 2021-05-10 15:36:30 -0400 | [diff] [blame] | 107 | UndeployMonitorPolicy |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 108 | [Documentation] Runs Policy PAP to undeploy a policy |
| 109 | ${policyadmin}= PolicyAdminAuth |
adheli.tavares | 1f339f8 | 2023-02-17 15:14:07 +0000 | [diff] [blame] | 110 | PerformDeleteRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/policies/onap.restart.tca 202 ${policyadmin} |
Jim Hahn | 3486a92 | 2021-05-10 15:36:30 -0400 | [diff] [blame] | 111 | |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 112 | PdpxGetReq |
| 113 | [Arguments] ${url} |
adheli.tavares | 1153b6d | 2023-02-28 12:59:37 +0000 | [diff] [blame] | 114 | ${hcauth}= PolicyAdminAuth |
adheli.tavares | 1f339f8 | 2023-02-17 15:14:07 +0000 | [diff] [blame] | 115 | ${resp}= PerformGetRequest ${POLICY_PDPX_IP} ${url} 200 null ${hcauth} |
adheli.tavares | 8361cb0 | 2024-02-21 15:29:36 +0000 | [diff] [blame] | 116 | RETURN ${resp} |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 117 | |
| 118 | DecisionPostReq |
| 119 | [Arguments] ${postjson} ${abbr} |
adheli.tavares | 1153b6d | 2023-02-28 12:59:37 +0000 | [diff] [blame] | 120 | ${hcauth}= PolicyAdminAuth |
adheli.tavares | 1f339f8 | 2023-02-17 15:14:07 +0000 | [diff] [blame] | 121 | ${resp}= PerformPostRequest ${POLICY_PDPX_IP} /policy/pdpx/v1/decision 200 ${postjson} ${abbr} ${hcauth} |
adheli.tavares | 8361cb0 | 2024-02-21 15:29:36 +0000 | [diff] [blame] | 122 | RETURN ${resp} |