Michael Mokry | 88f4d47 | 2019-03-04 12:00:05 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Library Collections |
| 3 | Library RequestsLibrary |
| 4 | Library OperatingSystem |
Jim Hahn | 2d94921 | 2020-05-11 10:13:32 -0400 | [diff] [blame] | 5 | Library Process |
Michael Mokry | 88f4d47 | 2019-03-04 12:00:05 -0600 | [diff] [blame] | 6 | Library json |
| 7 | |
| 8 | *** Test Cases *** |
| 9 | Healthcheck |
| 10 | [Documentation] Runs Policy Xacml PDP Health check |
Jim Hahn | 5785bf8 | 2020-04-16 18:32:27 -0400 | [diff] [blame] | 11 | ${auth}= Create List healthcheck zb!XztG34 |
Michael Mokry | ed8bae5 | 2019-03-12 15:10:53 -0500 | [diff] [blame] | 12 | Log Creating session https://${POLICY_PDPX_IP}:6969 |
| 13 | ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth} |
Michael Mokry | 88f4d47 | 2019-03-04 12:00:05 -0600 | [diff] [blame] | 14 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 15 | ${resp}= Get Request policy /policy/pdpx/v1/healthcheck headers=${headers} |
| 16 | Log Received response from policy ${resp.text} |
| 17 | Should Be Equal As Strings ${resp.status_code} 200 |
| 18 | Should Be Equal As Strings ${resp.json()['code']} 200 |
| 19 | |
| 20 | Statistics |
| 21 | [Documentation] Runs Policy Xacml PDP Statistics |
HOCKLA | 2e519f5 | 2019-10-23 13:00:00 -0500 | [diff] [blame] | 22 | ${auth}= Create List healthcheck zb!XztG34 |
Michael Mokry | ed8bae5 | 2019-03-12 15:10:53 -0500 | [diff] [blame] | 23 | Log Creating session https://${POLICY_PDPX_IP}:6969 |
| 24 | ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth} |
Michael Mokry | 88f4d47 | 2019-03-04 12:00:05 -0600 | [diff] [blame] | 25 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 26 | ${resp}= Get Request policy /policy/pdpx/v1/statistics headers=${headers} |
| 27 | Log Received response from policy ${resp.text} |
| 28 | Should Be Equal As Strings ${resp.status_code} 200 |
| 29 | Should Be Equal As Strings ${resp.json()['code']} 200 |
HOCKLA | 2e519f5 | 2019-10-23 13:00:00 -0500 | [diff] [blame] | 30 | |
Jim Hahn | 2d94921 | 2020-05-11 10:13:32 -0400 | [diff] [blame] | 31 | MakeTopics |
| 32 | [Documentation] Creates the Policy topics |
| 33 | ${result}= Run Process ${SCR_DMAAP}/make_topic.sh POLICY-PDP-PAP |
| 34 | Should Be Equal As Integers ${result.rc} 0 |
| 35 | |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 36 | ExecuteXacmlPolicy |
Jim Hahn | 514799f | 2020-04-20 12:05:50 -0400 | [diff] [blame] | 37 | Wait Until Keyword Succeeds 0 min 15 sec CreateMonitorPolicy |
| 38 | Wait Until Keyword Succeeds 0 min 15 sec CreateOptimizationPolicy |
| 39 | Wait Until Keyword Succeeds 0 min 15 sec GetDefaultDecision |
| 40 | Wait Until Keyword Succeeds 0 min 15 sec DeployPolicies |
Jim Hahn | 5785bf8 | 2020-04-16 18:32:27 -0400 | [diff] [blame] | 41 | Wait Until Keyword Succeeds 0 min 15 sec GetAbbreviatedDecisionResult |
| 42 | Wait Until Keyword Succeeds 0 min 15 sec GetMonitoringDecision |
| 43 | Wait Until Keyword Succeeds 0 min 15 sec GetNamingDecision |
Jim Hahn | 514799f | 2020-04-20 12:05:50 -0400 | [diff] [blame] | 44 | Wait Until Keyword Succeeds 0 min 15 sec GetOptimizationDecision |
HOCKLA | 2e519f5 | 2019-10-23 13:00:00 -0500 | [diff] [blame] | 45 | |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 46 | *** Keywords *** |
| 47 | |
Jim Hahn | 514799f | 2020-04-20 12:05:50 -0400 | [diff] [blame] | 48 | CreateMonitorPolicy |
| 49 | [Documentation] Create a Monitoring policy |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 50 | ${auth}= Create List healthcheck zb!XztG34 |
Jim Hahn | 514799f | 2020-04-20 12:05:50 -0400 | [diff] [blame] | 51 | ${postjson}= Get file ${DATA2}/vCPE.policy.monitoring.input.tosca.json |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 52 | Log Creating session https://${POLICY_API_IP}:6969 |
| 53 | ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} |
| 54 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
Pamela Dragosh | bd5f1dc | 2020-08-19 16:18:52 -0400 | [diff] [blame] | 55 | ${resp}= Post Request policy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies data=${postjson} headers=${headers} |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 56 | Log Received response from policy4 ${resp.text} |
| 57 | ${postjsonobject} To Json ${postjson} |
| 58 | Should Be Equal As Strings ${resp.status_code} 200 |
| 59 | Dictionary Should Contain Key ${resp.json()} tosca_definitions_version |
| 60 | Dictionary Should Contain Key ${postjsonobject} tosca_definitions_version |
| 61 | |
Jim Hahn | 514799f | 2020-04-20 12:05:50 -0400 | [diff] [blame] | 62 | CreateOptimizationPolicy |
| 63 | [Documentation] Create an Optimization policy |
| 64 | ${auth}= Create List healthcheck zb!XztG34 |
| 65 | ${postjson}= Get file ${DATA2}/vCPE.policies.optimization.input.tosca.json |
| 66 | Log Creating session https://${POLICY_API_IP}:6969 |
| 67 | ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} |
| 68 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 69 | ${resp}= Post Request policy /policy/api/v1/policytypes/onap.policies.optimization.resource.AffinityPolicy/versions/1.0.0/policies data=${postjson} headers=${headers} |
| 70 | Log Received response from policy4 ${resp.text} |
| 71 | ${postjsonobject} To Json ${postjson} |
| 72 | Should Be Equal As Strings ${resp.status_code} 200 |
| 73 | Dictionary Should Contain Key ${resp.json()} tosca_definitions_version |
| 74 | Dictionary Should Contain Key ${postjsonobject} tosca_definitions_version |
| 75 | |
| 76 | DeployPolicies |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 77 | [Documentation] Runs Policy PAP to deploy a policy |
| 78 | ${auth}= Create List healthcheck zb!XztG34 |
Jim Hahn | 514799f | 2020-04-20 12:05:50 -0400 | [diff] [blame] | 79 | ${postjson}= Get file ${CURDIR}/data/vCPE.policy.input.tosca.deploy.json |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 80 | Log Creating session https://${POLICY_PAP_IP}:6969 |
| 81 | ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth} |
| 82 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 83 | ${resp}= Post Request policy /policy/pap/v1/pdps/policies data=${postjson} headers=${headers} |
| 84 | Log Received response from policy5 ${resp.text} |
| 85 | ${postjsonobject} To Json ${postjson} |
| 86 | Should Be Equal As Strings ${resp.status_code} 200 |
Jim Hahn | 2d94921 | 2020-05-11 10:13:32 -0400 | [diff] [blame] | 87 | ${result}= Run Process ${SCR_DMAAP}/wait_topic.sh POLICY-PDP-PAP |
| 88 | ... responseTo xacml ACTIVE onap.restart.tca |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 89 | |
| 90 | GetStatisticsAfterDeployed |
| 91 | [Documentation] Runs Policy Xacml PDP Statistics after policy is deployed |
HOCKLA | 2e519f5 | 2019-10-23 13:00:00 -0500 | [diff] [blame] | 92 | ${auth}= Create List healthcheck zb!XztG34 |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 93 | Log Creating session https://${POLICY_PDPX_IP}:6969 |
| 94 | ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth} |
| 95 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 96 | ${resp}= Get Request policy /policy/pdpx/v1/statistics headers=${headers} |
| 97 | Log Received response from policy ${resp.text} |
| 98 | Should Be Equal As Strings ${resp.status_code} 200 |
| 99 | Should Be Equal As Strings ${resp.json()['code']} 200 |
| 100 | Should Be Equal As Strings ${resp.json()['totalPoliciesCount'] 1 |
HOCKLA | 2e519f5 | 2019-10-23 13:00:00 -0500 | [diff] [blame] | 101 | |
Jim Hahn | 514799f | 2020-04-20 12:05:50 -0400 | [diff] [blame] | 102 | GetDefaultDecision |
| 103 | [Documentation] Get Default Decision with no policies in Xacml PDP |
| 104 | ${auth}= Create List healthcheck zb!XztG34 |
| 105 | ${postjson}= Get file ${CURDIR}/data/onap.policy.guard.decision.request.json |
| 106 | Log Creating session https://${POLICY_PDPX_IP}:6969 |
| 107 | ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth} |
| 108 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 109 | ${params}= Create Dictionary abbrev=true |
| 110 | ${resp}= Post Request policy /policy/pdpx/v1/decision params=${params} data=${postjson} headers=${headers} |
| 111 | Log Received response from policy ${resp.text} |
| 112 | ${status}= Get From Dictionary ${resp.json()} status |
| 113 | Should Be Equal As Strings ${resp.status_code} 200 |
| 114 | Should Be Equal As Strings ${status} Permit |
| 115 | |
HOCKLA | 2e519f5 | 2019-10-23 13:00:00 -0500 | [diff] [blame] | 116 | GetAbbreviatedDecisionResult |
| 117 | [Documentation] Get Decision with abbreviated results from Policy Xacml PDP |
| 118 | ${auth}= Create List healthcheck zb!XztG34 |
| 119 | ${postjson}= Get file ${CURDIR}/data/onap.policy.monitoring.decision.request.json |
| 120 | Log Creating session https://${POLICY_PDPX_IP}:6969 |
| 121 | ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth} |
| 122 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 123 | ${params}= Create Dictionary abbrev=true |
| 124 | ${resp}= Post Request policy /policy/pdpx/v1/decision params=${params} data=${postjson} headers=${headers} |
| 125 | Log Received response from policy ${resp.text} |
| 126 | ${policy}= Get From Dictionary ${resp.json()['policies']} onap.restart.tca |
| 127 | Should Be Equal As Strings ${resp.status_code} 200 |
| 128 | Dictionary Should Contain Key ${policy} type |
| 129 | Dictionary Should Contain Key ${policy} metadata |
| 130 | Dictionary Should Not Contain Key ${policy} type_version |
| 131 | Dictionary Should Not Contain Key ${policy} properties |
| 132 | Dictionary Should Not Contain Key ${policy} name |
| 133 | Dictionary Should Not Contain Key ${policy} version |
| 134 | |
Jim Hahn | 5785bf8 | 2020-04-16 18:32:27 -0400 | [diff] [blame] | 135 | GetMonitoringDecision |
| 136 | [Documentation] Get Decision from Monitoring Policy Xacml PDP |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 137 | ${auth}= Create List healthcheck zb!XztG34 |
| 138 | ${postjson}= Get file ${CURDIR}/data/onap.policy.monitoring.decision.request.json |
| 139 | Log Creating session https://${POLICY_PDPX_IP}:6969 |
| 140 | ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth} |
| 141 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 142 | ${resp}= Post Request policy /policy/pdpx/v1/decision data=${postjson} headers=${headers} |
| 143 | Log Received response from policy ${resp.text} |
HOCKLA | 2e519f5 | 2019-10-23 13:00:00 -0500 | [diff] [blame] | 144 | ${policy}= Get From Dictionary ${resp.json()['policies']} onap.restart.tca |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 145 | Should Be Equal As Strings ${resp.status_code} 200 |
HOCKLA | 2e519f5 | 2019-10-23 13:00:00 -0500 | [diff] [blame] | 146 | Dictionary Should Contain Key ${policy} type |
| 147 | Dictionary Should Contain Key ${policy} metadata |
| 148 | Dictionary Should Contain Key ${policy} type_version |
| 149 | Dictionary Should Contain Key ${policy} properties |
| 150 | Dictionary Should Contain Key ${policy} name |
| 151 | Dictionary Should Contain Key ${policy} version |
Jim Hahn | 5785bf8 | 2020-04-16 18:32:27 -0400 | [diff] [blame] | 152 | |
| 153 | GetNamingDecision |
| 154 | [Documentation] Get Decision from Naming Policy Xacml PDP |
| 155 | ${auth}= Create List healthcheck zb!XztG34 |
| 156 | ${postjson}= Get file ${CURDIR}/data/onap.policy.naming.decision.request.json |
| 157 | Log Creating session https://${POLICY_PDPX_IP}:6969 |
| 158 | ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth} |
| 159 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 160 | ${resp}= Post Request policy /policy/pdpx/v1/decision data=${postjson} headers=${headers} |
| 161 | Log Received response from policy ${resp.text} |
Jim Hahn | ddb4043 | 2020-04-29 11:14:31 -0400 | [diff] [blame] | 162 | ${policy}= Get From Dictionary ${resp.json()['policies']} SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP |
Jim Hahn | 5785bf8 | 2020-04-16 18:32:27 -0400 | [diff] [blame] | 163 | Should Be Equal As Strings ${resp.status_code} 200 |
| 164 | Dictionary Should Contain Key ${policy} type |
| 165 | Dictionary Should Contain Key ${policy} type_version |
| 166 | Dictionary Should Contain Key ${policy} properties |
| 167 | Dictionary Should Contain Key ${policy} name |
| 168 | |
Jim Hahn | 514799f | 2020-04-20 12:05:50 -0400 | [diff] [blame] | 169 | GetOptimizationDecision |
| 170 | [Documentation] Get Decision from Optimization Policy Xacml PDP |
| 171 | ${auth}= Create List healthcheck zb!XztG34 |
| 172 | ${postjson}= Get file ${CURDIR}/data/onap.policy.optimization.decision.request.json |
| 173 | Log Creating session https://${POLICY_PDPX_IP}:6969 |
| 174 | ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth} |
| 175 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 176 | ${resp}= Post Request policy /policy/pdpx/v1/decision data=${postjson} headers=${headers} |
| 177 | Log Received response from policy ${resp.text} |
| 178 | ${policy}= Get From Dictionary ${resp.json()['policies']} OSDF_CASABLANCA.Affinity_Default |
| 179 | Should Be Equal As Strings ${resp.status_code} 200 |
| 180 | Dictionary Should Contain Key ${policy} type |
| 181 | Dictionary Should Contain Key ${policy} type_version |
| 182 | Dictionary Should Contain Key ${policy} properties |
| 183 | Dictionary Should Contain Key ${policy} name |
| 184 | |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 185 | GetStatisticsAfterDecision |
| 186 | [Documentation] Runs Policy Xacml PDP Statistics after Decision request |
Jim Hahn | 5785bf8 | 2020-04-16 18:32:27 -0400 | [diff] [blame] | 187 | ${auth}= Create List healthcheck zb!XztG34 |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 188 | Log Creating session https://${POLICY_PDPX_IP}:6969 |
| 189 | ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth} |
| 190 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 191 | ${resp}= Get Request policy /policy/pdpx/v1/statistics headers=${headers} |
| 192 | Log Received response from policy ${resp.text} |
| 193 | Should Be Equal As Strings ${resp.status_code} 200 |
| 194 | Should Be Equal As Strings ${resp.json()['code']} 200 |
| 195 | Should Be Equal As Strings ${resp.json()['totalDecisionsCount'] 1 |
Jim Hahn | 5785bf8 | 2020-04-16 18:32:27 -0400 | [diff] [blame] | 196 | |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 197 | UndeployMonitorPolicy |
| 198 | [Documentation] Runs Policy PAP to undeploy a policy |
| 199 | ${auth}= Create List healthcheck zb!XztG34 |
| 200 | Log Creating session https://${POLICY_PAP_IP}:6969 |
| 201 | ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth} |
| 202 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 203 | ${resp}= Delete Request policy /policy/pap/v1/pdps/policies/onap.restart.tca headers=${headers} |
| 204 | Log Received response from policy ${resp.text} |
| 205 | Should Be Equal As Strings ${resp.status_code} 200 |
Jim Hahn | 5785bf8 | 2020-04-16 18:32:27 -0400 | [diff] [blame] | 206 | |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 207 | GetStatisticsAfterUndeploy |
| 208 | [Documentation] Runs Policy Xacml PDP Statistics after policy is undeployed |
Jim Hahn | 5785bf8 | 2020-04-16 18:32:27 -0400 | [diff] [blame] | 209 | ${auth}= Create List healthcheck zb!XztG34 |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 210 | Log Creating session https://${POLICY_PDPX_IP}:6969 |
| 211 | ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth} |
| 212 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 213 | ${resp}= Get Request policy /policy/pdpx/v1/statistics headers=${headers} |
| 214 | Log Received response from policy ${resp.text} |
| 215 | Should Be Equal As Strings ${resp.status_code} 200 |
| 216 | Should Be Equal As Strings ${resp.json()['code']} 200 |
| 217 | Should Be Equal As Strings ${resp.json()['totalPoliciesCount'] 0 |