blob: a1ca5e208bff940070f25c8d14b9cf14506d4e73 [file] [log] [blame]
pdragosh3f9a0962019-04-16 13:19:45 -04001*** Settings ***
2Library Collections
Jim Hahn426ddc12020-04-14 15:19:53 -04003Library String
pdragosh3f9a0962019-04-16 13:19:45 -04004Library RequestsLibrary
5Library OperatingSystem
Jim Hahn426ddc12020-04-14 15:19:53 -04006Library Process
pdragosh3f9a0962019-04-16 13:19:45 -04007Library json
8
9*** Test Cases ***
10Alive
Jim Hahn426ddc12020-04-14 15:19:53 -040011 [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.sreekumar20705742020-02-14 12:03:33 +000020
21Healthcheck
Jim Hahn426ddc12020-04-14 15:19:53 -040022 [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.sreekumar20705742020-02-14 12:03:33 +000031
Jim Hahn426ddc12020-04-14 15:19:53 -040032Controller
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 Hahnd248ae92020-03-17 12:18:46 -040042
Jim Hahn426ddc12020-04-14 15:19:53 -040043MakeTopics
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 Hahnf340ddb2020-04-15 08:43:54 -040050CreateVcpeXacmlPolicy
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
61CreateVcpeDroolsPolicy
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
72CreateVdnsXacmlPolicy
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
83CreateVdnsDroolsPolicy
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
94CreateVfwXacmlPolicy
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
105CreateVfwDroolsPolicy
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
116DeployXacmlPolicies
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 Hahn753d6132020-05-06 10:27:21 -0400127 ... responseTo xacml ACTIVE restart
Jim Hahnf340ddb2020-04-15 08:43:54 -0400128 Log Received status ${result.stdout}
Jim Hahn426ddc12020-04-14 15:19:53 -0400129 Should Be Equal As Integers ${result.rc} 0
Jim Hahnf340ddb2020-04-15 08:43:54 -0400130 Should Contain ${result.stdout} onap.restart.tca
131 Should Contain ${result.stdout} onap.scaleout.tca
132 Should Contain ${result.stdout} onap.vfirewall.tca
133
134DeployDroolsPolicies
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 Hahn426ddc12020-04-14 15:19:53 -0400144 ${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 Hahnf340ddb2020-04-15 08:43:54 -0400150 Should Contain ${result.stdout} operational.scaleout
Jim Hahn426ddc12020-04-14 15:19:53 -0400151 Should Contain ${result.stdout} operational.modifyconfig
152
153VcpeExecute
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
195VdnsExecute
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
236VfwExecute
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