pdragosh | 3f9a096 | 2019-04-16 13:19:45 -0400 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Library Collections |
Jim Hahn | 426ddc1 | 2020-04-14 15:19:53 -0400 | [diff] [blame] | 3 | Library String |
pdragosh | 3f9a096 | 2019-04-16 13:19:45 -0400 | [diff] [blame] | 4 | Library RequestsLibrary |
| 5 | Library OperatingSystem |
Jim Hahn | 426ddc1 | 2020-04-14 15:19:53 -0400 | [diff] [blame] | 6 | Library Process |
pdragosh | 3f9a096 | 2019-04-16 13:19:45 -0400 | [diff] [blame] | 7 | Library json |
| 8 | |
| 9 | *** Test Cases *** |
| 10 | Alive |
Jim Hahn | 426ddc1 | 2020-04-14 15:19:53 -0400 | [diff] [blame] | 11 | [Documentation] Runs Policy PDP Alive Check |
| 12 | ${auth}= Create List demo@people.osaaf.org demo123456! |
| 13 | Log Creating session https://${DROOLS_IP}:9696 |
| 14 | ${session}= Create Session policy https://${DROOLS_IP}:9696 auth=${auth} |
| 15 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 16 | ${resp}= Get Request policy /policy/pdp/engine headers=${headers} |
| 17 | Log Received response from policy ${resp.text} |
| 18 | Should Be Equal As Strings ${resp.status_code} 200 |
| 19 | Should Be Equal As Strings ${resp.json()['alive']} True |
a.sreekumar | 2070574 | 2020-02-14 12:03:33 +0000 | [diff] [blame] | 20 | |
| 21 | Healthcheck |
Jim Hahn | 426ddc1 | 2020-04-14 15:19:53 -0400 | [diff] [blame] | 22 | [Documentation] Runs Policy PDP-D Health check |
| 23 | ${auth}= Create List demo@people.osaaf.org demo123456! |
| 24 | Log Creating session https://${DROOLS_IP}:6969/healthcheck |
| 25 | ${session}= Create Session policy https://${DROOLS_IP}:6969 auth=${auth} |
| 26 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 27 | ${resp}= Get Request policy /healthcheck headers=${headers} |
| 28 | Log Received response from policy ${resp.text} |
| 29 | Should Be Equal As Strings ${resp.status_code} 200 |
| 30 | Should Be Equal As Strings ${resp.json()['healthy']} True |
a.sreekumar | 2070574 | 2020-02-14 12:03:33 +0000 | [diff] [blame] | 31 | |
Jim Hahn | 426ddc1 | 2020-04-14 15:19:53 -0400 | [diff] [blame] | 32 | Controller |
| 33 | [Documentation] Checks controller is up |
| 34 | ${auth}= Create List demo@people.osaaf.org demo123456! |
| 35 | Log Creating session https://${DROOLS_IP}:9696 |
| 36 | ${session}= Create Session policy https://${DROOLS_IP}:9696 auth=${auth} |
| 37 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 38 | ${resp}= Get Request policy /policy/pdp/engine/controllers/frankfurt/drools/facts headers=${headers} |
| 39 | Log Received response from policy ${resp.text} |
| 40 | Should Be Equal As Strings ${resp.status_code} 200 |
| 41 | Should Be Equal As Strings ${resp.json()['frankfurt']} 0 |
Jim Hahn | d248ae9 | 2020-03-17 12:18:46 -0400 | [diff] [blame] | 42 | |
Jim Hahn | 426ddc1 | 2020-04-14 15:19:53 -0400 | [diff] [blame] | 43 | MakeTopics |
| 44 | [Documentation] Creates the Policy topics |
| 45 | ${result}= Run Process ${SCR2}/make_topic.sh POLICY-PDP-PAP |
| 46 | Should Be Equal As Integers ${result.rc} 0 |
| 47 | ${result}= Run Process ${SCR2}/make_topic.sh POLICY-CL-MGT |
| 48 | Should Be Equal As Integers ${result.rc} 0 |
| 49 | |
Jim Hahn | f340ddb | 2020-04-15 08:43:54 -0400 | [diff] [blame] | 50 | CreateVcpeXacmlPolicy |
| 51 | [Documentation] Create VCPE Policy for Xacml |
| 52 | ${auth}= Create List healthcheck zb!XztG34 |
| 53 | ${postyaml}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.yaml |
| 54 | Log Creating session https://${API_IP}:6969 |
| 55 | ${session}= Create Session policy https://${API_IP}:6969 auth=${auth} |
| 56 | ${headers}= Create Dictionary Accept=application/yaml Content-Type=application/yaml |
| 57 | ${resp}= Post Request policy /policy/api/v1/policies data=${postyaml} headers=${headers} |
| 58 | Log Received response from api ${resp.text} |
| 59 | Should Be Equal As Strings ${resp.status_code} 200 |
| 60 | |
| 61 | CreateVcpeDroolsPolicy |
| 62 | [Documentation] Create VCPE Policy for Drools |
| 63 | ${auth}= Create List healthcheck zb!XztG34 |
| 64 | ${postyaml}= Get file ${DATA}/vCPE.policy.operational.input.tosca.yaml |
| 65 | Log Creating session https://${API_IP}:6969 |
| 66 | ${session}= Create Session policy https://${API_IP}:6969 auth=${auth} |
| 67 | ${headers}= Create Dictionary Accept=application/yaml Content-Type=application/yaml |
| 68 | ${resp}= Post Request policy /policy/api/v1/policies data=${postyaml} headers=${headers} |
| 69 | Log Received response from api ${resp.text} |
| 70 | Should Be Equal As Strings ${resp.status_code} 200 |
| 71 | |
| 72 | CreateVdnsXacmlPolicy |
| 73 | [Documentation] Create VDNS Policy for Xacml |
| 74 | ${auth}= Create List healthcheck zb!XztG34 |
| 75 | ${postyaml}= Get file ${DATA}/vDNS.policy.monitoring.input.tosca.yaml |
| 76 | Log Creating session https://${API_IP}:6969 |
| 77 | ${session}= Create Session policy https://${API_IP}:6969 auth=${auth} |
| 78 | ${headers}= Create Dictionary Accept=application/yaml Content-Type=application/yaml |
| 79 | ${resp}= Post Request policy /policy/api/v1/policies data=${postyaml} headers=${headers} |
| 80 | Log Received response from api ${resp.text} |
| 81 | Should Be Equal As Strings ${resp.status_code} 200 |
| 82 | |
| 83 | CreateVdnsDroolsPolicy |
| 84 | [Documentation] Create VDNS Policy for Drools |
| 85 | ${auth}= Create List healthcheck zb!XztG34 |
| 86 | ${postjson}= Get file ${DATA}/vDNS.policy.operational.input.tosca.json |
| 87 | Log Creating session https://${API_IP}:6969 |
| 88 | ${session}= Create Session policy https://${API_IP}:6969 auth=${auth} |
| 89 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 90 | ${resp}= Post Request policy /policy/api/v1/policies data=${postjson} headers=${headers} |
| 91 | Log Received response from api ${resp.text} |
| 92 | Should Be Equal As Strings ${resp.status_code} 200 |
| 93 | |
| 94 | CreateVfwXacmlPolicy |
| 95 | [Documentation] Create VFW Policy for Xacml |
| 96 | ${auth}= Create List healthcheck zb!XztG34 |
| 97 | ${postyaml}= Get file ${DATA}/vFirewall.policy.monitoring.input.tosca.yaml |
| 98 | Log Creating session https://${API_IP}:6969 |
| 99 | ${session}= Create Session policy https://${API_IP}:6969 auth=${auth} |
| 100 | ${headers}= Create Dictionary Accept=application/yaml Content-Type=application/yaml |
| 101 | ${resp}= Post Request policy /policy/api/v1/policies data=${postyaml} headers=${headers} |
| 102 | Log Received response from api ${resp.text} |
| 103 | Should Be Equal As Strings ${resp.status_code} 200 |
| 104 | |
| 105 | CreateVfwDroolsPolicy |
| 106 | [Documentation] Create VFW Policy for Drools |
| 107 | ${auth}= Create List healthcheck zb!XztG34 |
| 108 | ${postjson}= Get file ${DATA}/vFirewall.policy.operational.input.tosca.json |
| 109 | Log Creating session https://${API_IP}:6969 |
| 110 | ${session}= Create Session policy https://${API_IP}:6969 auth=${auth} |
| 111 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 112 | ${resp}= Post Request policy /policy/api/v1/policies data=${postjson} headers=${headers} |
| 113 | Log Received response from api ${resp.text} |
| 114 | Should Be Equal As Strings ${resp.status_code} 200 |
| 115 | |
| 116 | DeployXacmlPolicies |
| 117 | [Documentation] Deploys the Policies to Xacml |
| 118 | ${auth}= Create List healthcheck zb!XztG34 |
| 119 | Log Creating session https://${PAP_IP}:6969 |
| 120 | ${postjson}= Get file ${SCR2}/deploy.xacml.policies.json |
| 121 | ${session}= Create Session policy https://${PAP_IP}:6969 auth=${auth} |
| 122 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 123 | ${resp}= Post Request policy /policy/pap/v1/pdps/deployments/batch data=${postjson} headers=${headers} |
| 124 | Log Received response from pap ${resp.text} |
| 125 | Should Be Equal As Strings ${resp.status_code} 200 |
| 126 | ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-PDP-PAP |
Jim Hahn | 753d613 | 2020-05-06 10:27:21 -0400 | [diff] [blame] | 127 | ... responseTo xacml ACTIVE restart |
Jim Hahn | f340ddb | 2020-04-15 08:43:54 -0400 | [diff] [blame] | 128 | Log Received status ${result.stdout} |
Jim Hahn | 426ddc1 | 2020-04-14 15:19:53 -0400 | [diff] [blame] | 129 | Should Be Equal As Integers ${result.rc} 0 |
Jim Hahn | f340ddb | 2020-04-15 08:43:54 -0400 | [diff] [blame] | 130 | Should Contain ${result.stdout} onap.restart.tca |
| 131 | Should Contain ${result.stdout} onap.scaleout.tca |
| 132 | Should Contain ${result.stdout} onap.vfirewall.tca |
| 133 | |
| 134 | DeployDroolsPolicies |
| 135 | [Documentation] Deploys the Policies to Drools |
| 136 | ${auth}= Create List healthcheck zb!XztG34 |
| 137 | Log Creating session https://${PAP_IP}:6969 |
| 138 | ${postjson}= Get file ${SCR2}/deploy.drools.policies.json |
| 139 | ${session}= Create Session policy https://${PAP_IP}:6969 auth=${auth} |
| 140 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 141 | ${resp}= Post Request policy /policy/pap/v1/pdps/deployments/batch data=${postjson} headers=${headers} |
| 142 | Log Received response from pap ${resp.text} |
| 143 | Should Be Equal As Strings ${resp.status_code} 200 |
Jim Hahn | 426ddc1 | 2020-04-14 15:19:53 -0400 | [diff] [blame] | 144 | ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-PDP-PAP |
| 145 | ... responseTo drools ACTIVE |
| 146 | Log Received status ${result.stdout} |
| 147 | Sleep 3s |
| 148 | Should Be Equal As Integers ${result.rc} 0 |
| 149 | Should Contain ${result.stdout} operational.restart |
Jim Hahn | f340ddb | 2020-04-15 08:43:54 -0400 | [diff] [blame] | 150 | Should Contain ${result.stdout} operational.scaleout |
Jim Hahn | 426ddc1 | 2020-04-14 15:19:53 -0400 | [diff] [blame] | 151 | Should Contain ${result.stdout} operational.modifyconfig |
| 152 | |
| 153 | VcpeExecute |
| 154 | [Documentation] Executes VCPE Policy |
| 155 | ${result}= Run Process ${SCR2}/onset.sh ${SCR2}/vcpeOnset.json |
| 156 | Should Be Equal As Integers ${result.rc} 0 |
| 157 | ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT |
| 158 | ... ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e |
| 159 | Log Received notification ${result.stdout} |
| 160 | Should Be Equal As Integers ${result.rc} 0 |
| 161 | Should Contain ${result.stdout} ACTIVE |
| 162 | ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT |
| 163 | ... ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e |
| 164 | Log Received notification ${result.stdout} |
| 165 | Should Be Equal As Integers ${result.rc} 0 |
| 166 | Should Contain ${result.stdout} OPERATION |
| 167 | Should Contain ${result.stdout} Sending guard query for APPC Restart |
| 168 | Should Be Equal As Integers ${result.rc} 0 |
| 169 | ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT |
| 170 | ... ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e |
| 171 | Log Received notification ${result.stdout} |
| 172 | Should Be Equal As Integers ${result.rc} 0 |
| 173 | Should Contain ${result.stdout} OPERATION |
| 174 | Should Contain ${result.stdout} Guard result for APPC Restart is Permit |
| 175 | ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT |
| 176 | ... ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e |
| 177 | Log Received notification ${result.stdout} |
| 178 | Should Be Equal As Integers ${result.rc} 0 |
| 179 | Should Contain ${result.stdout} OPERATION |
| 180 | Should Contain ${result.stdout} actor=APPC,operation=Restart |
| 181 | ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT |
| 182 | ... ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e |
| 183 | Log Received notification ${result.stdout} |
| 184 | Should Be Equal As Integers ${result.rc} 0 |
| 185 | Should Contain ${result.stdout} OPERATION: SUCCESS |
| 186 | Should Contain ${result.stdout} actor=APPC,operation=Restart |
| 187 | ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT |
| 188 | ... ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e |
| 189 | Log Received notification ${result.stdout} |
| 190 | Should Be Equal As Integers ${result.rc} 0 |
| 191 | Should Contain ${result.stdout} FINAL: SUCCESS |
| 192 | Should Contain ${result.stdout} APPC |
| 193 | Should Contain ${result.stdout} Restart |
| 194 | |
| 195 | VdnsExecute |
| 196 | [Documentation] Executes VDNS Policy |
| 197 | ${result}= Run Process ${SCR2}/onset.sh ${SCR2}/vdnsOnset.json |
| 198 | Should Be Equal As Integers ${result.rc} 0 |
| 199 | ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT |
| 200 | ... ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3 |
| 201 | Log Received notification ${result.stdout} |
| 202 | Should Be Equal As Integers ${result.rc} 0 |
| 203 | Should Contain ${result.stdout} ACTIVE |
| 204 | ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT |
| 205 | ... ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3 |
| 206 | Log Received notification ${result.stdout} |
| 207 | Should Be Equal As Integers ${result.rc} 0 |
| 208 | Should Contain ${result.stdout} OPERATION |
| 209 | Should Contain ${result.stdout} Sending guard query for SO VF Module Create |
| 210 | ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT |
| 211 | ... ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3 |
| 212 | Log Received notification ${result.stdout} |
| 213 | Should Be Equal As Integers ${result.rc} 0 |
| 214 | Should Contain ${result.stdout} OPERATION |
| 215 | Should Contain ${result.stdout} Guard result for SO VF Module Create is Permit |
| 216 | ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT |
| 217 | ... ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3 |
| 218 | Log Received notification ${result.stdout} |
| 219 | Should Be Equal As Integers ${result.rc} 0 |
| 220 | Should Contain ${result.stdout} OPERATION |
| 221 | Should Contain ${result.stdout} actor=SO,operation=VF Module Create |
| 222 | ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT |
| 223 | ... ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3 |
| 224 | Log Received notification ${result.stdout} |
| 225 | Should Be Equal As Integers ${result.rc} 0 |
| 226 | Should Contain ${result.stdout} OPERATION: SUCCESS |
| 227 | Should Contain ${result.stdout} actor=SO,operation=VF Module Create |
| 228 | ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT |
| 229 | ... ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3 |
| 230 | Log Received notification ${result.stdout} |
| 231 | Should Be Equal As Integers ${result.rc} 0 |
| 232 | Should Contain ${result.stdout} FINAL: SUCCESS |
| 233 | Should Contain ${result.stdout} SO |
| 234 | Should Contain ${result.stdout} VF Module Create |
| 235 | |
| 236 | VfwExecute |
| 237 | [Documentation] Executes VFW Policy |
| 238 | ${result}= Run Process ${SCR2}/onset.sh ${SCR2}/vfwOnset.json |
| 239 | Should Be Equal As Integers ${result.rc} 0 |
| 240 | ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT |
| 241 | ... ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a |
| 242 | Log Received notification ${result.stdout} |
| 243 | Should Be Equal As Integers ${result.rc} 0 |
| 244 | Should Contain ${result.stdout} ACTIVE |
| 245 | ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT |
| 246 | ... ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a |
| 247 | Log Received notification ${result.stdout} |
| 248 | Should Be Equal As Integers ${result.rc} 0 |
| 249 | Should Contain ${result.stdout} OPERATION |
| 250 | Should Contain ${result.stdout} Sending guard query for APPC ModifyConfig |
| 251 | ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT |
| 252 | ... ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a |
| 253 | Log Received notification ${result.stdout} |
| 254 | Should Be Equal As Integers ${result.rc} 0 |
| 255 | Should Contain ${result.stdout} OPERATION |
| 256 | Should Contain ${result.stdout} Guard result for APPC ModifyConfig is Permit |
| 257 | ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT |
| 258 | ... ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a |
| 259 | Log Received notification ${result.stdout} |
| 260 | Should Be Equal As Integers ${result.rc} 0 |
| 261 | Should Contain ${result.stdout} OPERATION |
| 262 | Should Contain ${result.stdout} actor=APPC,operation=ModifyConfig |
| 263 | ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT |
| 264 | ... ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a |
| 265 | Log Received notification ${result.stdout} |
| 266 | Should Be Equal As Integers ${result.rc} 0 |
| 267 | Should Contain ${result.stdout} OPERATION: SUCCESS |
| 268 | Should Contain ${result.stdout} actor=APPC,operation=ModifyConfig |
| 269 | ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT |
| 270 | ... ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a |
| 271 | Log Received notification ${result.stdout} |
| 272 | Should Be Equal As Integers ${result.rc} 0 |
| 273 | Should Contain ${result.stdout} FINAL: SUCCESS |
| 274 | Should Contain ${result.stdout} APPC |
| 275 | Should Contain ${result.stdout} ModifyConfig |