Chenfei Gao | d4c5185 | 2019-02-06 20:45:10 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Library Collections |
| 3 | Library RequestsLibrary |
| 4 | Library OperatingSystem |
| 5 | Library json |
| 6 | |
| 7 | *** Test Cases *** |
| 8 | Healthcheck |
| 9 | [Documentation] Runs Policy Api Health check |
Bilal A | 9f54c00 | 2020-01-16 16:12:19 +0000 | [diff] [blame] | 10 | ${auth}= Create List healthcheck zb!XztG34 |
Chenfei Gao | fd96738 | 2019-02-12 15:52:37 -0500 | [diff] [blame] | 11 | Log Creating session https://${POLICY_API_IP}:6969 |
| 12 | ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} |
Chenfei Gao | d4c5185 | 2019-02-06 20:45:10 -0500 | [diff] [blame] | 13 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
Michael Mokry | 88f4d47 | 2019-03-04 12:00:05 -0600 | [diff] [blame] | 14 | ${resp}= Get Request policy /policy/api/v1/healthcheck headers=${headers} |
Chenfei Gao | d4c5185 | 2019-02-06 20:45:10 -0500 | [diff] [blame] | 15 | Log Received response from policy ${resp.text} |
| 16 | Should Be Equal As Strings ${resp.status_code} 200 |
| 17 | Should Be Equal As Strings ${resp.json()['code']} 200 |
| 18 | |
| 19 | Statistics |
| 20 | [Documentation] Runs Policy Api Statistics |
Bilal A | 9f54c00 | 2020-01-16 16:12:19 +0000 | [diff] [blame] | 21 | ${auth}= Create List healthcheck zb!XztG34 |
Chenfei Gao | fd96738 | 2019-02-12 15:52:37 -0500 | [diff] [blame] | 22 | Log Creating session https://${POLICY_API_IP}:6969 |
| 23 | ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} |
Chenfei Gao | d4c5185 | 2019-02-06 20:45:10 -0500 | [diff] [blame] | 24 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
Michael Mokry | 88f4d47 | 2019-03-04 12:00:05 -0600 | [diff] [blame] | 25 | ${resp}= Get Request policy /policy/api/v1/statistics headers=${headers} |
Chenfei Gao | d4c5185 | 2019-02-06 20:45:10 -0500 | [diff] [blame] | 26 | Log Received response from policy ${resp.text} |
| 27 | Should Be Equal As Strings ${resp.status_code} 200 |
Chenfei Gao | fd96738 | 2019-02-12 15:52:37 -0500 | [diff] [blame] | 28 | Should Be Equal As Strings ${resp.json()['code']} 200 |
Bilal A | 95097c2 | 2019-04-12 22:38:32 +0000 | [diff] [blame] | 29 | |
| 30 | RetrievePolicyTypes |
| 31 | [Documentation] Gets Policy Types |
Bilal A | 9f54c00 | 2020-01-16 16:12:19 +0000 | [diff] [blame] | 32 | ${auth}= Create List healthcheck zb!XztG34 |
Bilal A | 95097c2 | 2019-04-12 22:38:32 +0000 | [diff] [blame] | 33 | Log Creating session https://${POLICY_API_IP}:6969 |
| 34 | ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} |
| 35 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 36 | ${resp}= Get Request policy /policy/api/v1/policytypes headers=${headers} |
| 37 | Log Received response from policy ${resp.text} |
| 38 | Should Be Equal As Strings ${resp.status_code} 200 |
| 39 | Should Be Equal As Strings ${resp.json()['version']} 1.0.0 |
| 40 | |
Bilal A | 9f54c00 | 2020-01-16 16:12:19 +0000 | [diff] [blame] | 41 | CreateTCAPolicyTypeV1 |
a.sreekumar | 2070574 | 2020-02-14 12:03:33 +0000 | [diff] [blame] | 42 | [Documentation] Create TCA Policy Type Version 1. Trying to create an existing policy type with any change and same version should cause error. |
Bilal A | 9f54c00 | 2020-01-16 16:12:19 +0000 | [diff] [blame] | 43 | ${auth}= Create List healthcheck zb!XztG34 |
Pamela Dragosh | bd5f1dc | 2020-08-19 16:18:52 -0400 | [diff] [blame] | 44 | ${postjson}= Get file ${CURDIR}/data/onap.policy.monitoring.tcagen2.v1.json |
Bilal A | 9f54c00 | 2020-01-16 16:12:19 +0000 | [diff] [blame] | 45 | Log Creating session https://${POLICY_API_IP}:6969 |
| 46 | ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} |
| 47 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 48 | ${resp}= Post Request policy /policy/api/v1/policytypes data=${postjson} headers=${headers} |
| 49 | Log Received response from policy ${resp.text} |
| 50 | Should Be Equal As Strings ${resp.status_code} 406 |
| 51 | |
| 52 | CreateTCAPolicyTypeV2 |
| 53 | [Documentation] Create TCA Policy Type Version 2 |
| 54 | ${auth}= Create List healthcheck zb!XztG34 |
Pamela Dragosh | bd5f1dc | 2020-08-19 16:18:52 -0400 | [diff] [blame] | 55 | ${postjson}= Get file ${CURDIR}/data/onap.policy.monitoring.tcagen2.v2.json |
Bilal A | 4174bbb | 2019-04-15 21:15:50 +0000 | [diff] [blame] | 56 | Log Creating session https://${POLICY_API_IP}:6969 |
| 57 | ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} |
| 58 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 59 | ${resp}= Post Request policy /policy/api/v1/policytypes data=${postjson} headers=${headers} |
| 60 | Log Received response from policy ${resp.text} |
| 61 | Should Be Equal As Strings ${resp.status_code} 200 |
| 62 | ${postjsonobject} To Json ${postjson} |
Bilal A | 9f54c00 | 2020-01-16 16:12:19 +0000 | [diff] [blame] | 63 | Dictionary Should Contain Key ${resp.json()} tosca_definitions_version |
| 64 | Dictionary Should Contain Key ${postjsonobject} tosca_definitions_version |
Bilal A | 4174bbb | 2019-04-15 21:15:50 +0000 | [diff] [blame] | 65 | |
| 66 | RetrieveMonitoringPolicyTypes |
| 67 | [Documentation] Retrieve Monitoring related Policy Types |
Bilal A | 9f54c00 | 2020-01-16 16:12:19 +0000 | [diff] [blame] | 68 | ${auth}= Create List healthcheck zb!XztG34 |
Bilal A | 4174bbb | 2019-04-15 21:15:50 +0000 | [diff] [blame] | 69 | Log Creating session https://${POLICY_API_IP}:6969 |
| 70 | ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} |
| 71 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 72 | ${resp}= Get Request policy /policy/api/v1/policytypes/onap.policies.Monitoring headers=${headers} |
| 73 | Log Received response from policy ${resp.text} |
| 74 | Should Be Equal As Strings ${resp.status_code} 200 |
jhh | 9d5fb22 | 2019-09-09 13:59:23 -0500 | [diff] [blame] | 75 | List Should Contain Value ${resp.json()['policy_types']} onap.policies.Monitoring |
Bilal A | 4174bbb | 2019-04-15 21:15:50 +0000 | [diff] [blame] | 76 | |
| 77 | |
Bilal A | 9f54c00 | 2020-01-16 16:12:19 +0000 | [diff] [blame] | 78 | CreateNewMonitoringPolicyV1 |
| 79 | [Documentation] Create a new Monitoring TCA policy version 1 |
| 80 | ${auth}= Create List healthcheck zb!XztG34 |
Jim Hahn | 09148c8 | 2020-09-02 11:16:16 -0400 | [diff] [blame] | 81 | ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.json |
Bilal A | 4174bbb | 2019-04-15 21:15:50 +0000 | [diff] [blame] | 82 | Log Creating session https://${POLICY_API_IP}:6969 |
| 83 | ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} |
| 84 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
Pamela Dragosh | bd5f1dc | 2020-08-19 16:18:52 -0400 | [diff] [blame] | 85 | ${resp}= Post Request policy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies data=${postjson} headers=${headers} |
Bilal A | 4174bbb | 2019-04-15 21:15:50 +0000 | [diff] [blame] | 86 | Log Received response from policy ${resp.text} |
| 87 | ${postjsonobject} To Json ${postjson} |
| 88 | Should Be Equal As Strings ${resp.status_code} 200 |
| 89 | Dictionary Should Contain Key ${resp.json()['topology_template']['policies'][0]} onap.restart.tca |
| 90 | Dictionary Should Contain Key ${postjsonobject['topology_template']['policies'][0]} onap.restart.tca |
| 91 | |
Bilal A | 9f54c00 | 2020-01-16 16:12:19 +0000 | [diff] [blame] | 92 | SimpleCreateNewMonitoringPolicyV1 |
a.sreekumar | 2070574 | 2020-02-14 12:03:33 +0000 | [diff] [blame] | 93 | [Documentation] Create a new Monitoring TCA policiy version 1 using simple endpoint. Trying to create an existing policy with any change and same version should cause error. |
Bilal A | 9f54c00 | 2020-01-16 16:12:19 +0000 | [diff] [blame] | 94 | ${auth}= Create List healthcheck zb!XztG34 |
Jim Hahn | 09148c8 | 2020-09-02 11:16:16 -0400 | [diff] [blame] | 95 | ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.v1_2.json |
Bilal A | 9f54c00 | 2020-01-16 16:12:19 +0000 | [diff] [blame] | 96 | Log Creating session https://${POLICY_API_IP}:6969 |
| 97 | ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} |
| 98 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 99 | ${resp}= Post Request policy /policy/api/v1/policies data=${postjson} headers=${headers} |
| 100 | Log Received response from policy ${resp.text} |
| 101 | Should Be Equal As Strings ${resp.status_code} 406 |
| 102 | |
| 103 | SimpleCreateNewMonitoringPolicyV2 |
| 104 | [Documentation] Create a new Monitoring TCA policiy version 2 using simple endpoint |
| 105 | ${auth}= Create List healthcheck zb!XztG34 |
Jim Hahn | 09148c8 | 2020-09-02 11:16:16 -0400 | [diff] [blame] | 106 | ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.v2.json |
Chenfei Gao | d5ba0fd | 2019-10-21 16:13:27 -0400 | [diff] [blame] | 107 | Log Creating session https://${POLICY_API_IP}:6969 |
| 108 | ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} |
| 109 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 110 | ${resp}= Post Request policy /policy/api/v1/policies data=${postjson} headers=${headers} |
| 111 | Log Received response from policy ${resp.text} |
| 112 | ${postjsonobject} To Json ${postjson} |
| 113 | Should Be Equal As Strings ${resp.status_code} 200 |
| 114 | Dictionary Should Contain Key ${resp.json()['topology_template']['policies'][0]} onap.restart.tca |
| 115 | Dictionary Should Contain Key ${postjsonobject['topology_template']['policies'][0]} onap.restart.tca |
| 116 | |
Bilal A | 4174bbb | 2019-04-15 21:15:50 +0000 | [diff] [blame] | 117 | RetrievePoliciesOfType |
| 118 | [Documentation] Retrieve all Policies Created for a specific Policy Type |
| 119 | ${auth}= Create List healthcheck zb!XztG34 |
Jim Hahn | 09148c8 | 2020-09-02 11:16:16 -0400 | [diff] [blame] | 120 | ${expjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.json |
Bilal A | 4174bbb | 2019-04-15 21:15:50 +0000 | [diff] [blame] | 121 | Log Creating session https://${POLICY_API_IP}:6969 |
| 122 | ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} |
| 123 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
Pamela Dragosh | bd5f1dc | 2020-08-19 16:18:52 -0400 | [diff] [blame] | 124 | ${resp}= Get Request policy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies headers=${headers} |
Bilal A | 4174bbb | 2019-04-15 21:15:50 +0000 | [diff] [blame] | 125 | Log Received response from policy ${resp.text} |
| 126 | ${expjsonobject} To Json ${expjson} |
| 127 | Should Be Equal As Strings ${resp.status_code} 200 |
| 128 | Dictionary Should Contain Key ${resp.json()['topology_template']['policies'][0]} onap.restart.tca |
| 129 | Dictionary Should Contain Key ${expjsonobject['topology_template']['policies'][0]} onap.restart.tca |
| 130 | |
puthuparambil.aditya | c4090ee | 2020-07-29 14:57:05 +0100 | [diff] [blame] | 131 | RetrieveAllPolicies |
| 132 | [Documentation] Retrieve all Policies |
| 133 | ${auth}= Create List healthcheck zb!XztG34 |
Jim Hahn | 09148c8 | 2020-09-02 11:16:16 -0400 | [diff] [blame] | 134 | ${expjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.json |
puthuparambil.aditya | c4090ee | 2020-07-29 14:57:05 +0100 | [diff] [blame] | 135 | Log Creating session https://${POLICY_API_IP}:6969 |
| 136 | ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} |
| 137 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 138 | ${resp}= Get Request policy /policy/api/v1/policies headers=${headers} |
| 139 | Log Received response from policy ${resp.text} |
| 140 | ${expjsonobject} To Json ${expjson} |
| 141 | Should Be Equal As Strings ${resp.status_code} 200 |
| 142 | Should Contain ${expjsonobject['topology_template']['policies'][0]} onap.restart.tca |
| 143 | |
| 144 | RetrieveSpecificPolicy |
| 145 | [Documentation] Retrieve a specific Policy named 'onap.restart.tca' and version '1.0.0' |
| 146 | ${auth}= Create List healthcheck zb!XztG34 |
Jim Hahn | 09148c8 | 2020-09-02 11:16:16 -0400 | [diff] [blame] | 147 | ${expjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.json |
puthuparambil.aditya | c4090ee | 2020-07-29 14:57:05 +0100 | [diff] [blame] | 148 | Log Creating session https://${POLICY_API_IP}:6969 |
| 149 | ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} |
| 150 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 151 | ${resp}= Get Request policy /policy/api/v1/policies/onap.restart.tca/versions/1.0.0/ headers=${headers} |
| 152 | Log Received response from policy ${resp.text} |
| 153 | ${expjsonobject} To Json ${expjson} |
| 154 | Should Be Equal As Strings ${resp.status_code} 200 |
| 155 | Dictionary Should Contain Key ${resp.json()['topology_template']['policies'][0]} onap.restart.tca |
| 156 | Dictionary Should Contain Key ${expjsonobject['topology_template']['policies'][0]} onap.restart.tca |
| 157 | |
| 158 | DeleteSpecificPolicy |
| 159 | [Documentation] Delete a specific Policy named 'onap.restart.tca' and version '1.0.0' |
Bilal A | 4174bbb | 2019-04-15 21:15:50 +0000 | [diff] [blame] | 160 | ${auth}= Create List healthcheck zb!XztG34 |
| 161 | Log Creating session https://${POLICY_API_IP}:6969 |
| 162 | ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} |
| 163 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
puthuparambil.aditya | c4090ee | 2020-07-29 14:57:05 +0100 | [diff] [blame] | 164 | ${resp}= Delete Request policy /policy/api/v1/policies/onap.restart.tca/versions/1.0.0 headers=${headers} |
Bilal A | 4174bbb | 2019-04-15 21:15:50 +0000 | [diff] [blame] | 165 | Log Received response from policy ${resp.text} |
| 166 | Should Be Equal As Strings ${resp.status_code} 200 |
puthuparambil.aditya | c4090ee | 2020-07-29 14:57:05 +0100 | [diff] [blame] | 167 | ${resp}= Delete Request policy /policy/api/v1/policies/onap.restart.tca/versions/1.0.0 headers=${headers} |
Bilal A | 4174bbb | 2019-04-15 21:15:50 +0000 | [diff] [blame] | 168 | Should Be Equal As Strings ${resp.status_code} 404 |
Bilal A | 9f54c00 | 2020-01-16 16:12:19 +0000 | [diff] [blame] | 169 | |
| 170 | DeleteSpecificPolicyV2 |
| 171 | [Documentation] Delete the Monitoring Policy Version 2 of the TCA Policy Type |
| 172 | ${auth}= Create List healthcheck zb!XztG34 |
| 173 | Log Creating session https://${POLICY_API_IP}:6969 |
| 174 | ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} |
| 175 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
Pamela Dragosh | bd5f1dc | 2020-08-19 16:18:52 -0400 | [diff] [blame] | 176 | ${resp}= Delete Request policy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies/onap.restart.tca/versions/2.0.0 headers=${headers} |
Bilal A | 9f54c00 | 2020-01-16 16:12:19 +0000 | [diff] [blame] | 177 | Log Received response from policy ${resp.text} |
| 178 | Should Be Equal As Strings ${resp.status_code} 200 |
Pamela Dragosh | bd5f1dc | 2020-08-19 16:18:52 -0400 | [diff] [blame] | 179 | ${resp}= Delete Request policy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies/onap.restart.tca/versions/2.0.0 headers=${headers} |
Bilal A | 9f54c00 | 2020-01-16 16:12:19 +0000 | [diff] [blame] | 180 | Should Be Equal As Strings ${resp.status_code} 404 |
| 181 | |
| 182 | DeleteSpecificPolicyTypeV1 |
| 183 | [Documentation] Delete the TCA Policy Type Version 1 |
| 184 | ${auth}= Create List healthcheck zb!XztG34 |
| 185 | Log Creating session https://${POLICY_API_IP}:6969 |
| 186 | ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} |
| 187 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
Pamela Dragosh | bd5f1dc | 2020-08-19 16:18:52 -0400 | [diff] [blame] | 188 | ${resp}= Delete Request policy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0 headers=${headers} |
Bilal A | 9f54c00 | 2020-01-16 16:12:19 +0000 | [diff] [blame] | 189 | Log Received response from policy ${resp.text} |
| 190 | Should Be Equal As Strings ${resp.status_code} 200 |
Pamela Dragosh | bd5f1dc | 2020-08-19 16:18:52 -0400 | [diff] [blame] | 191 | ${resp}= Delete Request policy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0 headers=${headers} |
Bilal A | 9f54c00 | 2020-01-16 16:12:19 +0000 | [diff] [blame] | 192 | Should Be Equal As Strings ${resp.status_code} 404 |
| 193 | |
| 194 | DeleteSpecificPolicyTypeV2 |
| 195 | [Documentation] Delete the TCA Policy Type Version 2 |
| 196 | ${auth}= Create List healthcheck zb!XztG34 |
| 197 | Log Creating session https://${POLICY_API_IP}:6969 |
| 198 | ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} |
| 199 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
Pamela Dragosh | bd5f1dc | 2020-08-19 16:18:52 -0400 | [diff] [blame] | 200 | ${resp}= Delete Request policy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/2.0.0 headers=${headers} |
Bilal A | 9f54c00 | 2020-01-16 16:12:19 +0000 | [diff] [blame] | 201 | Log Received response from policy ${resp.text} |
| 202 | Should Be Equal As Strings ${resp.status_code} 200 |
Pamela Dragosh | bd5f1dc | 2020-08-19 16:18:52 -0400 | [diff] [blame] | 203 | ${resp}= Delete Request policy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/2.0.0 headers=${headers} |
Bilal A | 9f54c00 | 2020-01-16 16:12:19 +0000 | [diff] [blame] | 204 | Should Be Equal As Strings ${resp.status_code} 404 |