DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation The main interface for interacting with Policy. It handles low level stuff like managing the http request library and Policy required fields |
| 3 | Library RequestsClientCert |
| 4 | Library RequestsLibrary |
| 5 | Library String |
| 6 | Library JSONUtils |
Brian Freeman | 55b96e2 | 2019-05-08 20:49:45 -0500 | [diff] [blame] | 7 | Library Collections |
Sylvain Desbureaux | 2e33ff6 | 2019-05-15 14:41:18 +0200 | [diff] [blame] | 8 | Library Collections |
DR695H | 910097e | 2019-05-08 13:55:32 -0400 | [diff] [blame] | 9 | Library SSHLibrary |
| 10 | Library OperatingSystem |
| 11 | Resource json_templater.robot |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 12 | Resource global_properties.robot |
DR695H | 910097e | 2019-05-08 13:55:32 -0400 | [diff] [blame] | 13 | Resource ssh/files.robot |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 14 | |
| 15 | *** Variables *** |
| 16 | ${POLICY_HEALTH_CHECK_PATH} /healthcheck |
DR695H | bf5a3a3 | 2017-06-30 13:09:57 -0400 | [diff] [blame] | 17 | ${POLICY_ENDPOINT} ${GLOBAL_POLICY_SERVER_PROTOCOL}://${GLOBAL_INJECTED_POLICY_IP_ADDR}:${GLOBAL_POLICY_SERVER_PORT} |
Gary Wu | 251aa68 | 2018-07-30 15:22:20 -0700 | [diff] [blame] | 18 | ${POLICY_HEALTHCHECK_ENDPOINT} ${GLOBAL_POLICY_SERVER_PROTOCOL}://${GLOBAL_INJECTED_POLICY_HEALTHCHECK_IP_ADDR}:${GLOBAL_POLICY_HEALTHCHECK_PORT} |
Brian Freeman | ca5e32e | 2018-07-23 12:47:21 -0500 | [diff] [blame] | 19 | ${POLICY_TEMPLATES} robot/assets/templates/policy |
Brian Freeman | d65e2aa | 2018-07-26 11:13:46 -0500 | [diff] [blame] | 20 | ${DROOLS_ENDPOINT} ${GLOBAL_POLICY_SERVER_PROTOCOL}://${GLOBAL_INJECTED_POLICY_IP_ADDR}:${GLOBAL_DROOLS_SERVER_PORT} |
Bilal A | 461aa5b | 2019-05-06 14:00:57 -0400 | [diff] [blame] | 21 | ${POLICY_API_IP} ${GLOBAL_INJECTED_POLICY_API_IP_ADDR} |
| 22 | ${POLICY_PAP_IP} ${GLOBAL_INJECTED_POLICY_PAP_IP_ADDR} |
| 23 | ${POLICY_DISTRIBUTION_IP} ${GLOBAL_INJECTED_POLICY_DISTRIBUTION_IP_ADDR} |
| 24 | ${POLICY_PDPX_IP} ${GLOBAL_INJECTED_POLICY_PDPX_IP_ADDR} |
| 25 | ${POLICY_APEX_PDP_IP} ${GLOBAL_INJECTED_POLICY_APEX_PDP_IP_ADDR} |
| 26 | ${POLICY_HEALTHCHECK_USERNAME} ${GLOBAL_POLICY_HEALTHCHECK_USERNAME} |
| 27 | ${POLICY_HEALTHCHECK_PASSWORD} ${GLOBAL_POLICY_HEALTHCHECK_PASSWORD} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 28 | |
Brian Freeman | 88fbb99 | 2019-05-17 17:46:56 -0500 | [diff] [blame^] | 29 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 30 | *** Keywords *** |
| 31 | |
| 32 | Run Policy Health Check |
| 33 | [Documentation] Runs Policy Health check |
Brian Freeman | 55b96e2 | 2019-05-08 20:49:45 -0500 | [diff] [blame] | 34 | ${auth}= Create List ${GLOBAL_POLICY_USERNAME} ${GLOBAL_POLICY_PASSWORD} |
DR695H | bf5a3a3 | 2017-06-30 13:09:57 -0400 | [diff] [blame] | 35 | Log Creating session ${POLICY_ENDPOINT} |
| 36 | ${session}= Create Session policy ${POLICY_HEALTHCHECK_ENDPOINT} auth=${auth} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 37 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 38 | ${resp}= Get Request policy ${POLICY_HEALTH_CHECK_PATH} headers=${headers} |
| 39 | Log Received response from policy ${resp.text} |
| 40 | Should Be Equal As Strings ${resp.status_code} 200 |
| 41 | Should Be True ${resp.json()['healthy']} |
| 42 | @{ITEMS}= Copy List ${resp.json()['details']} |
| 43 | :FOR ${ELEMENT} IN @{ITEMS} |
| 44 | \ Should Be Equal As Strings ${ELEMENT['code']} 200 |
| 45 | \ Should Be True ${ELEMENT['healthy']} |
Brian Freeman | 55b96e2 | 2019-05-08 20:49:45 -0500 | [diff] [blame] | 46 | |
Brian Freeman | d65e2aa | 2018-07-26 11:13:46 -0500 | [diff] [blame] | 47 | Run Drools Get Request |
| 48 | [Documentation] Runs Drools Get Request |
| 49 | [Arguments] ${data_path} |
| 50 | ${auth}= Create List ${GLOBAL_DROOLS_USERNAME} ${GLOBAL_DROOLS_PASSWORD} |
| 51 | Log Creating session ${POLICY_ENDPOINT} |
| 52 | ${session}= Create Session policy ${DROOLS_ENDPOINT} auth=${auth} |
| 53 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 54 | ${resp}= Get Request policy ${data_path} headers=${headers} |
| 55 | Log Received response from policy ${resp.text} |
| 56 | Should Be Equal As Strings ${resp.status_code} 200 |
| 57 | [Return] ${resp} |
| 58 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 59 | Run Policy Put Request |
| 60 | [Documentation] Runs Policy Put request |
| 61 | [Arguments] ${data_path} ${data} |
DR695H | bf5a3a3 | 2017-06-30 13:09:57 -0400 | [diff] [blame] | 62 | Log Creating session ${POLICY_ENDPOINT} |
| 63 | ${session}= Create Session policy ${POLICY_ENDPOINT} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 64 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json Authorization=Basic ${GLOBAL_POLICY_AUTH} ClientAuth=${GLOBAL_POLICY_CLIENTAUTH} Environment=TEST |
| 65 | ${resp}= Put Request policy ${data_path} data=${data} headers=${headers} |
| 66 | Log Received response from policy ${resp.text} |
| 67 | [Return] ${resp} |
Brian Freeman | e14d257 | 2019-04-29 16:20:21 -0500 | [diff] [blame] | 68 | |
Brian Freeman | c967dd6 | 2019-04-30 09:47:44 -0500 | [diff] [blame] | 69 | Run Policy Get Request |
| 70 | [Documentation] Runs Policy Get request |
| 71 | [Arguments] ${data_path} |
| 72 | Log Creating session ${POLICY_ENDPOINT} |
| 73 | ${session}= Create Session policy ${POLICY_ENDPOINT} |
| 74 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json Authorization=Basic ${GLOBAL_POLICY_AUTH} ClientAuth=${GLOBAL_POLICY_CLIENTAUTH} Environment=TEST |
| 75 | ${resp}= Get Request policy ${data_path} headers=${headers} |
| 76 | Log Received response from policy ${resp.text} |
| 77 | |
Brian Freeman | 55b96e2 | 2019-05-08 20:49:45 -0500 | [diff] [blame] | 78 | Run Policy Pap Get Request |
| 79 | [Documentation] Runs Policy Pap Get request |
| 80 | [Arguments] ${data_path} |
| 81 | ${auth}= Create List ${POLICY_HEALTHCHECK_USERNAME} ${POLICY_HEALTHCHECK_PASSWORD} |
| 82 | Log Creating session ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_PAP_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} |
Sylvain Desbureaux | 2e33ff6 | 2019-05-15 14:41:18 +0200 | [diff] [blame] | 83 | ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_PAP_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} auth=${auth} |
Brian Freeman | 55b96e2 | 2019-05-08 20:49:45 -0500 | [diff] [blame] | 84 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 85 | ${resp}= Get Request policy ${data_path} headers=${headers} |
| 86 | Log Received response from Policy Pap ${resp.text} |
| 87 | [Return] ${resp} |
| 88 | |
| 89 | |
Brian Freeman | e14d257 | 2019-04-29 16:20:21 -0500 | [diff] [blame] | 90 | Run Policy Post Request |
| 91 | [Documentation] Runs Policy Post request |
| 92 | [Arguments] ${data_path} ${data} |
| 93 | Log Creating session ${POLICY_ENDPOINT} |
| 94 | ${session}= Create Session policy ${POLICY_ENDPOINT} |
| 95 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json Authorization=Basic ${GLOBAL_POLICY_AUTH} ClientAuth=${GLOBAL_POLICY_CLIENTAUTH} Environment=TEST |
| 96 | ${resp}= Post Request policy ${data_path} data=${data} headers=${headers} |
| 97 | Log Received response from policy ${resp.text} |
| 98 | [Return] ${resp} |
Brian Freeman | c967dd6 | 2019-04-30 09:47:44 -0500 | [diff] [blame] | 99 | |
Brian Freeman | 55b96e2 | 2019-05-08 20:49:45 -0500 | [diff] [blame] | 100 | Run Policy Api Post Request |
| 101 | [Documentation] Runs Policy Api Post request |
| 102 | [Arguments] ${data_path} ${data} |
| 103 | ${auth}= Create List ${POLICY_HEALTHCHECK_USERNAME} ${POLICY_HEALTHCHECK_PASSWORD} |
Sylvain Desbureaux | 2e33ff6 | 2019-05-15 14:41:18 +0200 | [diff] [blame] | 104 | ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_API_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} auth=${auth} |
Brian Freeman | 55b96e2 | 2019-05-08 20:49:45 -0500 | [diff] [blame] | 105 | Log Creating session ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_API_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} |
| 106 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 107 | ${resp}= Post Request policy ${data_path} data=${data} headers=${headers} |
| 108 | Log Received response from policy ${resp.text} |
| 109 | [Return] ${resp} |
| 110 | |
| 111 | |
| 112 | Run Policy Pap Post Request |
| 113 | [Documentation] Runs Policy Pap Post request |
| 114 | [Arguments] ${data_path} ${data} |
| 115 | ${auth}= Create List ${POLICY_HEALTHCHECK_USERNAME} ${POLICY_HEALTHCHECK_PASSWORD} |
Sylvain Desbureaux | 2e33ff6 | 2019-05-15 14:41:18 +0200 | [diff] [blame] | 116 | ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_PAP_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} auth=${auth} |
Brian Freeman | 55b96e2 | 2019-05-08 20:49:45 -0500 | [diff] [blame] | 117 | Log Creating session ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_PAP_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} |
| 118 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 119 | ${resp}= Post Request policy ${data_path} data=${data} headers=${headers} |
| 120 | Log Received response from policy ${resp.text} |
| 121 | [Return] ${resp} |
| 122 | |
| 123 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 124 | Run Policy Delete Request |
| 125 | [Documentation] Runs Policy Delete request |
| 126 | [Arguments] ${data_path} ${data} |
DR695H | bf5a3a3 | 2017-06-30 13:09:57 -0400 | [diff] [blame] | 127 | Log Creating session ${POLICY_ENDPOINT} |
| 128 | ${session}= Create Session policy ${POLICY_ENDPOINT} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 129 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json Authorization=Basic ${GLOBAL_POLICY_AUTH} ClientAuth=${GLOBAL_POLICY_CLIENTAUTH} Environment=TEST |
| 130 | ${resp}= Delete Request policy ${data_path} data=${data} headers=${headers} |
| 131 | Log Received response from policy ${resp.text} |
| 132 | [Return] ${resp} |
Brian Freeman | 55b96e2 | 2019-05-08 20:49:45 -0500 | [diff] [blame] | 133 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 134 | Run Policy Get Configs Request |
| 135 | [Documentation] Runs Policy Get Configs request |
| 136 | [Arguments] ${data_path} ${data} |
DR695H | bf5a3a3 | 2017-06-30 13:09:57 -0400 | [diff] [blame] | 137 | Log Creating session ${POLICY_ENDPOINT} |
| 138 | ${session}= Create Session policy ${POLICY_ENDPOINT} |
Brian Freeman | 55b96e2 | 2019-05-08 20:49:45 -0500 | [diff] [blame] | 139 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json Authorization=Basic ${GLOBAL_POLICY_AUTH} ClientAuth=${GLOBAL_POLICY_CLIENTAUTH} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 140 | ${resp}= Post Request policy ${data_path} data=${data} headers=${headers} |
| 141 | Log Received response from policy ${resp.text} |
Gary Wu | 76bc74f | 2018-03-22 13:25:49 -0700 | [diff] [blame] | 142 | [Return] ${resp} |
| 143 | |
| 144 | |
| 145 | |
Brian Freeman | c967dd6 | 2019-04-30 09:47:44 -0500 | [diff] [blame] | 146 | Update vVFWCL Policy Old |
Gary Wu | 76bc74f | 2018-03-22 13:25:49 -0700 | [diff] [blame] | 147 | [Arguments] ${resource_id} |
Brian Freeman | ca5e32e | 2018-07-23 12:47:21 -0500 | [diff] [blame] | 148 | Run Keyword and Ignore Error Delete vFWCL Policy |
Gary Wu | 76bc74f | 2018-03-22 13:25:49 -0700 | [diff] [blame] | 149 | Sleep 20s |
Brian Freeman | d65e2aa | 2018-07-26 11:13:46 -0500 | [diff] [blame] | 150 | Log To Console Create vFWCL Policy |
Gary Wu | 76bc74f | 2018-03-22 13:25:49 -0700 | [diff] [blame] | 151 | Create vFWCL Policy ${resource_id} |
| 152 | Sleep 5s |
Brian Freeman | d65e2aa | 2018-07-26 11:13:46 -0500 | [diff] [blame] | 153 | Log To Console Push vFWCL Policy |
Gary Wu | 76bc74f | 2018-03-22 13:25:49 -0700 | [diff] [blame] | 154 | Push vFWCL Policy |
| 155 | Sleep 20s |
Brian Freeman | d65e2aa | 2018-07-26 11:13:46 -0500 | [diff] [blame] | 156 | Log To Console Reboot Drools |
Gary Wu | 76bc74f | 2018-03-22 13:25:49 -0700 | [diff] [blame] | 157 | Reboot Drools |
| 158 | Sleep 20s |
Brian Freeman | d65e2aa | 2018-07-26 11:13:46 -0500 | [diff] [blame] | 159 | Log To Console Validate vFWCL Policy |
Brian Freeman | c967dd6 | 2019-04-30 09:47:44 -0500 | [diff] [blame] | 160 | Validate the vFWCL Policy Old |
| 161 | |
| 162 | Update vVFWCL Policy |
Brian Freeman | 0d866b5 | 2019-05-08 20:30:14 -0500 | [diff] [blame] | 163 | [Arguments] ${resource_id} |
Brian Freeman | 55b96e2 | 2019-05-08 20:49:45 -0500 | [diff] [blame] | 164 | Log To Console Create vFWCL Monitoring Policy |
Brian Freeman | c967dd6 | 2019-04-30 09:47:44 -0500 | [diff] [blame] | 165 | Create vFirewall Monitoring Policy |
| 166 | Sleep 5s |
Brian Freeman | 55b96e2 | 2019-05-08 20:49:45 -0500 | [diff] [blame] | 167 | Log To Console Create vFWCL Operational Policy |
Brian Freeman | 7594828 | 2019-05-14 20:44:46 -0500 | [diff] [blame] | 168 | ${op_policy_version}= Create vFirewall Operational Policy ${resource_id} |
Brian Freeman | c967dd6 | 2019-04-30 09:47:44 -0500 | [diff] [blame] | 169 | Sleep 5s |
Brian Freeman | 55b96e2 | 2019-05-08 20:49:45 -0500 | [diff] [blame] | 170 | Log To Console Push vFWCL To PDP Group |
Brian Freeman | 7594828 | 2019-05-14 20:44:46 -0500 | [diff] [blame] | 171 | Push vFirewall Policies To PDP Group ${op_policy_version} |
Brian Freeman | c967dd6 | 2019-04-30 09:47:44 -0500 | [diff] [blame] | 172 | Sleep 20s |
| 173 | Log To Console Validate vFWCL Policy |
Gary Wu | 76bc74f | 2018-03-22 13:25:49 -0700 | [diff] [blame] | 174 | Validate the vFWCL Policy |
| 175 | |
Brian Freeman | c967dd6 | 2019-04-30 09:47:44 -0500 | [diff] [blame] | 176 | |
Gary Wu | 76bc74f | 2018-03-22 13:25:49 -0700 | [diff] [blame] | 177 | Delete vFWCL Policy |
| 178 | ${data}= OperatingSystem.Get File ${POLICY_TEMPLATES}/FirewallPolicy_delete.template |
| 179 | ${resp}= Run Policy Delete Request /pdp/api/deletePolicy ${data} |
| 180 | Should Be Equal As Strings ${resp.status_code} 200 |
| 181 | |
| 182 | Create vFWCL Policy |
| 183 | [Arguments] ${resource_id} |
| 184 | ${dict}= Create Dictionary RESOURCE_ID=${resource_id} |
| 185 | ${data}= Fill JSON Template File ${POLICY_TEMPLATES}/FirewallPolicy_update.template ${dict} |
| 186 | ${resp}= Run Policy Put Request /pdp/api/updatePolicy ${data} |
| 187 | Should Be Equal As Strings ${resp.status_code} 200 |
| 188 | |
| 189 | Push vFWCL Policy |
| 190 | ${dict}= Create Dictionary |
| 191 | ${data}= Fill JSON Template File ${POLICY_TEMPLATES}/FirewallPolicy_push.template ${dict} |
| 192 | ${resp}= Run Policy Put Request /pdp/api/pushPolicy ${data} |
| 193 | Should Be Equal As Strings ${resp.status_code} 200 |
| 194 | |
| 195 | Reboot Drools |
| 196 | ${stop}= Catenate docker exec -t -u policy drools bash -c "source /opt/app/policy/etc/profile.d/env.sh; policy stop" |
| 197 | ${start}= Catenate docker exec -t -u policy drools bash -c "source /opt/app/policy/etc/profile.d/env.sh; policy start" |
| 198 | Wait Until Keyword Succeeds 120 5 sec Open Connection And Log In ${GLOBAL_INJECTED_POLICY_IP_ADDR} root ${GLOBAL_VM_PRIVATE_KEY} |
| 199 | Write ${stop} |
| 200 | ${status} ${stdout}= Run Keyword And Ignore Error SSHLibrary.Read Until Regexp has stopped |
| 201 | Log ${status}: stdout=${stdout} |
| 202 | ${ctrlc}= Evaluate '\x03' |
| 203 | Run Keyword If '${status}' == 'FAIL' Write ${ctrlc} |
| 204 | Sleep 5s |
| 205 | Write ${start} |
| 206 | ${stdout}= SSHLibrary.Read Until Regexp is running |
| 207 | Log stdout=${stdout} |
| 208 | Should Contain ${stdout} is running |
| 209 | |
Brian Freeman | c967dd6 | 2019-04-30 09:47:44 -0500 | [diff] [blame] | 210 | Validate the vFWCL Policy Old |
Gary Wu | 76bc74f | 2018-03-22 13:25:49 -0700 | [diff] [blame] | 211 | ${resp}= Run Drools Get Request /policy/pdp/engine/controllers/amsterdam/drools |
| 212 | Should Be Equal As Strings ${resp.status_code} 200 |
| 213 | ${resp}= Run Drools Get Request /policy/pdp/engine/controllers/amsterdam/drools/facts/closedloop-amsterdam/org.onap.policy.controlloop.Params |
| 214 | Should Be Equal As Strings ${resp.status_code} 200 |
Brian Freeman | e14d257 | 2019-04-29 16:20:21 -0500 | [diff] [blame] | 215 | |
Brian Freeman | 55b96e2 | 2019-05-08 20:49:45 -0500 | [diff] [blame] | 216 | Validate the vFWCL Policy |
| 217 | ${resp}= Run Policy Pap Get Request /policy/pap/v1/pdps |
Brian Freeman | c967dd6 | 2019-04-30 09:47:44 -0500 | [diff] [blame] | 218 | Log Received response from policy ${resp.text} |
| 219 | Should Be Equal As Strings ${resp.status_code} 200 |
Brian Freeman | e14d257 | 2019-04-29 16:20:21 -0500 | [diff] [blame] | 220 | |
| 221 | Create vFirewall Monitoring Policy |
| 222 | ${dict}= Create Dictionary |
| 223 | ${data}= Fill JSON Template File ${POLICY_TEMPLATES}/vFirewall_policy_monitoring_input_tosca.template ${dict} |
Brian Freeman | 55b96e2 | 2019-05-08 20:49:45 -0500 | [diff] [blame] | 224 | ${resp}= Run Policy Api Post Request /policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/policies ${data} |
Brian Freeman | e14d257 | 2019-04-29 16:20:21 -0500 | [diff] [blame] | 225 | Should Be Equal As Strings ${resp.status_code} 200 |
| 226 | |
| 227 | |
| 228 | Create vFirewall Operational Policy |
| 229 | [Arguments] ${resource_id} |
| 230 | ${dict}= Create Dictionary RESOURCE_ID=${resource_id} |
Brian Freeman | 88fbb99 | 2019-05-17 17:46:56 -0500 | [diff] [blame^] | 231 | #vFirewall_policy_operational_content.yaml |
| 232 | #vFirewall_policy_operational_url_enc_content_input.template |
| 233 | ${content_data} OperatingSystem.Get File ${POLICY_TEMPLATES}/vFirewall_policy_operational_content.yaml |
| 234 | ${content_data}= Replace String Using Regexp ${content_data} ${RESOURCE_ID} ${resource_id} |
| 235 | ${encoded_content_data}= Evaluate urllib.urlencode('''${content_data}''') urllib |
| 236 | ${content_dictionary}= Create Dictionary URL_ENCODED_CONTENT {$encoded_content_data} |
| 237 | ${data_2}= Fill JSON Template File ${POLICY_TEMPLATES}/vFirewall_policy_operational_url_enc_content_input.template ${dict_2} |
| 238 | Log To Console ${data_2} |
Brian Freeman | e14d257 | 2019-04-29 16:20:21 -0500 | [diff] [blame] | 239 | ${data}= Fill JSON Template File ${POLICY_TEMPLATES}/vFirewall_policy_operational_input.template ${dict} |
Brian Freeman | 55b96e2 | 2019-05-08 20:49:45 -0500 | [diff] [blame] | 240 | ${resp}= Run Policy Api Post Request /policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies ${data} |
Brian Freeman | e14d257 | 2019-04-29 16:20:21 -0500 | [diff] [blame] | 241 | Should Be Equal As Strings ${resp.status_code} 200 |
Brian Freeman | 7594828 | 2019-05-14 20:44:46 -0500 | [diff] [blame] | 242 | [Return] ${resp.json()['policy-version']} |
Brian Freeman | e14d257 | 2019-04-29 16:20:21 -0500 | [diff] [blame] | 243 | |
Brian Freeman | 88fbb99 | 2019-05-17 17:46:56 -0500 | [diff] [blame^] | 244 | Create vFirewall Operational Policy |
| 245 | [Arguments] ${resource_id} |
| 246 | ${dict}= Create Dictionary RESOURCE_ID=${resource_id} |
| 247 | ${content_data} OperatingSystem.Get File ${POLICY_TEMPLATES}/vFirewall_policy_operational_content.yaml |
| 248 | ${content_data}= Replace String Using Regexp ${content_data} __RESOURCE_ID__ ${resource_id} |
| 249 | ${encoded_content_data}= Evaluate urllib.quote_plus('''${content_data}''') urllib |
| 250 | ${content_dictionary}= Create Dictionary URL_ENCODED_CONTENT ${encoded_content_data} |
| 251 | ${data_2}= Fill JSON Template File ${POLICY_TEMPLATES}/vFirewall_policy_operational_url_enc_content_input.template ${content_dictionary} |
| 252 | Log To Console ${data_2} |
| 253 | ${resp}= Run Policy Api Post Request /policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies ${data_2} |
| 254 | # |
| 255 | # pre-encoded content version |
| 256 | #${data}= Fill JSON Template File ${POLICY_TEMPLATES}/vFirewall_policy_operational_input.template ${dict} |
| 257 | #${resp}= Run Policy Api Post Request /policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies ${data} |
| 258 | # |
| 259 | Should Be Equal As Strings ${resp.status_code} 200 |
| 260 | [Return] ${resp.json()['policy-version']} |
| 261 | |
| 262 | |
| 263 | |
| 264 | |
Brian Freeman | e14d257 | 2019-04-29 16:20:21 -0500 | [diff] [blame] | 265 | |
| 266 | Push vFirewall Policies To PDP Group |
Brian Freeman | 7594828 | 2019-05-14 20:44:46 -0500 | [diff] [blame] | 267 | [Arguments] ${op_policy_version} |
| 268 | ${dict}= Create Dictionary OP_POLICY_VERSION=${op_policy_version} |
Brian Freeman | e14d257 | 2019-04-29 16:20:21 -0500 | [diff] [blame] | 269 | ${data}= Fill JSON Template File ${POLICY_TEMPLATES}/vFirewall_push.template ${dict} |
Brian Freeman | 55b96e2 | 2019-05-08 20:49:45 -0500 | [diff] [blame] | 270 | #${resp}= Run Policy Post Request /policy/pap/v1/pdps/policies ${data} |
| 271 | ${resp}= Run Policy Pap Post Request /policy/pap/v1/pdps/policies ${data} |
| 272 | #Should Be Equal As Strings ${resp.status_code} 200 |
Brian Freeman | e14d257 | 2019-04-29 16:20:21 -0500 | [diff] [blame] | 273 | |
Bilal A | 461aa5b | 2019-05-06 14:00:57 -0400 | [diff] [blame] | 274 | Run Policy API Healthcheck |
| 275 | [Documentation] Runs Policy Api Health check |
| 276 | ${auth}= Create List ${POLICY_HEALTHCHECK_USERNAME} ${POLICY_HEALTHCHECK_PASSWORD} |
| 277 | Log Creating session ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_API_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} |
Sylvain Desbureaux | 2e33ff6 | 2019-05-15 14:41:18 +0200 | [diff] [blame] | 278 | ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_API_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} auth=${auth} |
Bilal A | 461aa5b | 2019-05-06 14:00:57 -0400 | [diff] [blame] | 279 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 280 | ${resp}= Get Request policy /policy/api/v1/healthcheck headers=${headers} |
| 281 | Log Received response from policy ${resp.text} |
| 282 | Should Be Equal As Strings ${resp.status_code} 200 |
| 283 | Should Be Equal As Strings ${resp.json()['code']} 200 |
| 284 | |
| 285 | Run Policy PAP Healthcheck |
| 286 | [Documentation] Runs Policy PAP Health check |
| 287 | ${auth}= Create List ${POLICY_HEALTHCHECK_USERNAME} ${POLICY_HEALTHCHECK_PASSWORD} |
| 288 | Log Creating session ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_PAP_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} |
Sylvain Desbureaux | 2e33ff6 | 2019-05-15 14:41:18 +0200 | [diff] [blame] | 289 | ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_PAP_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} auth=${auth} |
Bilal A | 461aa5b | 2019-05-06 14:00:57 -0400 | [diff] [blame] | 290 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 291 | ${resp}= Get Request policy /policy/pap/v1/healthcheck headers=${headers} |
| 292 | Log Received response from policy ${resp.text} |
| 293 | Should Be Equal As Strings ${resp.status_code} 200 |
| 294 | Should Be Equal As Strings ${resp.json()['code']} 200 |
| 295 | |
| 296 | Run Policy Distribution Healthcheck |
| 297 | [Documentation] Runs Policy Distribution Health check |
| 298 | ${auth}= Create List ${POLICY_HEALTHCHECK_USERNAME} ${POLICY_HEALTHCHECK_PASSWORD} |
| 299 | Log Creating session ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_DISTRIBUTION_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} |
Sylvain Desbureaux | 2e33ff6 | 2019-05-15 14:41:18 +0200 | [diff] [blame] | 300 | ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_DISTRIBUTION_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} auth=${auth} |
Bilal A | 461aa5b | 2019-05-06 14:00:57 -0400 | [diff] [blame] | 301 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 302 | ${resp}= Get Request policy /healthcheck headers=${headers} |
| 303 | Log Received response from policy ${resp.text} |
| 304 | Should Be Equal As Strings ${resp.status_code} 200 |
| 305 | Should Be Equal As Strings ${resp.json()['code']} 200 |
| 306 | |
| 307 | Run Policy XACML PDP Healthcheck |
| 308 | [Documentation] Runs Policy Xacml PDP Health check |
| 309 | ${auth}= Create List ${POLICY_HEALTHCHECK_USERNAME} ${POLICY_HEALTHCHECK_PASSWORD} |
| 310 | Log Creating session ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_PDPX_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} |
| 311 | ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_PDPX_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} auth=${auth} |
| 312 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 313 | ${resp}= Get Request policy /policy/pdpx/v1/healthcheck headers=${headers} |
| 314 | Log Received response from policy ${resp.text} |
| 315 | Should Be Equal As Strings ${resp.status_code} 200 |
| 316 | Should Be Equal As Strings ${resp.json()['code']} 200 |
| 317 | |
| 318 | Run Policy APEX PDP Healthcheck |
| 319 | [Documentation] Runs Policy Apex PDP Health check |
| 320 | ${auth}= Create List ${POLICY_HEALTHCHECK_USERNAME} ${POLICY_HEALTHCHECK_PASSWORD} |
| 321 | Log Creating session ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_APEX_PDP_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} |
Sylvain Desbureaux | 2e33ff6 | 2019-05-15 14:41:18 +0200 | [diff] [blame] | 322 | ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_APEX_PDP_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} auth=${auth} |
Bilal A | 461aa5b | 2019-05-06 14:00:57 -0400 | [diff] [blame] | 323 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 324 | ${resp}= Get Request policy /policy/apex-pdp/v1/healthcheck headers=${headers} |
| 325 | Log Received response from policy ${resp.text} |
| 326 | Should Be Equal As Strings ${resp.status_code} 200 |
| 327 | Should Be Equal As Strings ${resp.json()['code']} 200 |
| 328 | |