blob: 7855b76b37f9db0d2013abcf78981257379be6ef [file] [log] [blame]
Gary Wu9abb61c2018-09-27 10:38:50 -07001*** Settings ***
2Documentation Policy ONAP CSIT Test cases
3Library String
4Library HttpLibrary.HTTP
5LIbrary Process
6Library BuiltIn
7Resource policy_interface.robot
8Resource json_templater.robot
9
10*** Variables ***
11${RESOURCE_PATH_CREATE} /pdp/api/createPolicy
12${RESOURCE_PATH_CREATE_PUSH} /pdp/api/pushPolicy
13${RESOURCE_PATH_CREATE_DELETE} /pdp/api/deletePolicy
14${RESOURCE_PATH_GET_CONFIG} /pdp/api/getConfig
HOCKLA3e332f42019-02-20 09:32:19 -060015${RESOURCE_PATH_LISTPOLICY} /pdp/api/listPolicy
Gary Wu9abb61c2018-09-27 10:38:50 -070016${CREATE_CONFIG_VFW_TEMPLATE} ${CURDIR}/configpolicy_vFW_R1.template
17${CREATE_CONFIG_VDNS_TEMPLATE} ${CURDIR}/configpolicy_vDNS_R1.template
18${CREATE_CONFIG_VCPE_TEMPLATE} ${CURDIR}/configpolicy_vCPE_R1.template
19${CREATE_OPS_VFW_TEMPLATE} ${CURDIR}/opspolicy_VFW_R1.template
20${CREATE_OOF_HPA_TEMPLATE} ${CURDIR}/oofpolicy_HPA_R1.template
21${CREATE_SDNC_VFW_TEMPLATE} ${CURDIR}/sdncnamingpolicy_vFW.template
22${CREATE_SDNC_VPG_TEMPLATE} ${CURDIR}/sdncnamingpolicy_vPG.template
23${PUSH_POLICY_TEMPLATE} ${CURDIR}/pushpolicy.template
24${CREATE_OPS_VDNS_TEMPLATE} ${CURDIR}/opspolicy_VDNS_R1.template
25${DEL_POLICY_TEMPLATE} ${CURDIR}/deletepolicy.template
26${GETCONFIG_TEMPLATE} ${CURDIR}/getconfigpolicy.template
27${GETOOF_TEMPLATE} ${CURDIR}/getoofpolicy.template
HOCKLA3e332f42019-02-20 09:32:19 -060028${LISTPOLICY_TEMPLATE} ${CURDIR}/listpolicy.template
Gary Wu9abb61c2018-09-27 10:38:50 -070029${CONFIG_POLICY_VFW_NAME} vFirewall
30${CONFIG_POLICY_VFW_TYPE} MicroService
31${CONFIG_POLICY_VDNS_NAME} vLoadBalancer
32${CONFIG_POLICY_VDNS_TYPE} MicroService
33${OPS_POLICY_VFW_NAME} vFirewall
34${OPS_POLICY_VFW_TYPE} BRMS_PARAM
35${OPS_POLICY_VDNS_NAME} vLoadBalancer
36${OPS_POLICY_VDNS_TYPE} BRMS_PARAM
37${CONFIG_POLICY_VCPE_NAME} vCPE
38${CONFIG_POLICY_VCPE_TYPE} MicroService
39${OPS_POLICY_VCPE_NAME} vCPE
40${OPS_POLICY_VCPE_TYPE} BRMS_PARAM
41${OPS_POLICY_VOLTE_NAME} VoLTE
42${OPS_POLICY_VOLTE_TYPE} BRMS_PARAM
43${OOF_POLICY_HPA_NAME} HPA
44${OOF_POLICY_HPA_TYPE} Optimization
45${SDNC_POLICY_VFW_NAME} ONAP_vFW_Naming
46${SDNC_POLICY_VPG_NAME} ONAP_vPG_Naming
47${file_path} ../testsuite/robot/assets/templates/ControlLoopDemo__closedLoopControlName.drl
48${RESOURCE_PATH_UPLOAD} /pdp/api/policyEngineImport?importParametersJson=%7B%22serviceName%22%3A%22Manyu456%22%2C%20%22serviceType%22%3A%22BRMSPARAM%22%7D
49${CREATE_OPS_VCPE_TEMPLATE} ${CURDIR}/opspolicy_vCPE_R1.template
50${CREATE_OPS_VOLTE_TEMPLATE} ${CURDIR}/opspolicy_vOLTE_R1.template
51
52
53*** Test Cases ***
54Policy Health check
55 Run Policy Health Check
56
57VFW Config Policy
58 ${CONFIG_POLICY_VFW_NAME}= Create Config VFW Policy
59 Push Config Policy ${CONFIG_POLICY_VFW_NAME} ${CONFIG_POLICY_VFW_TYPE}
60 #VFW Policy Tests
61
62VDNS Config Policy
63 ${CONFIG_POLICY_VDNS_NAME}= Create Config VDNS Policy
64 Push Config Policy ${CONFIG_POLICY_VDNS_NAME} ${CONFIG_POLICY_VDNS_TYPE}
65 #VDNS Policy Tests
66
67VCPE Config Policy
68 ${CONFIG_POLICY_VCPE_NAME}= Create Config VCPE Policy
69 Push Config Policy ${CONFIG_POLICY_VCPE_NAME} ${CONFIG_POLICY_VCPE_TYPE}
70 #VCPE Policy Tests
71
72VFW Ops Policy
73 ${OPS_POLICY_VFW_NAME}= Create Ops VFW Policy
74 Push Ops Policy ${OPS_POLICY_VFW_NAME} ${OPS_POLICY_VFW_TYPE}
75
76VDNS Ops Policy
77 ${OPS_POLICY_VDNS_NAME}= Create Ops VDNS Policy
78 Push Ops Policy ${OPS_POLICY_VDNS_NAME} ${OPS_POLICY_VDNS_TYPE}
79
80VCPE Ops Policy
81 ${OPS_POLICY_VCPE_NAME}= Create Ops VCPE Policy
82 Push Ops Policy ${OPS_POLICY_VCPE_NAME} ${OPS_POLICY_VCPE_TYPE}
83
84VOLTE Ops Policy
85 ${OPS_POLICY_VOLTE_NAME}= Create Ops VOLTE Policy
86 Push Ops Policy ${OPS_POLICY_VOLTE_NAME} ${OPS_POLICY_VOLTE_TYPE}
87 #VOLTE Policy Tests
88
89VFW SDNC Naming Policy
90 ${SDNC_POLICY_VFW_NAME}= Create VFW SDNC Naming Policy
91 Push Config Policy ${SDNC_POLICY_VFW_NAME} ${CONFIG_POLICY_VFW_TYPE}
92 #VFW Policy Tests
93
94VPG SDNC Naming Policy
95 ${SDNC_POLICY_VPG_NAME}= Create VPG SDNC Naming Policy
96 Push Config Policy ${SDNC_POLICY_VPG_NAME} ${CONFIG_POLICY_VFW_TYPE}
97 #VPG Policy Tests
98
99HPA OOF Policy
100 ${OOF_POLICY_HPA_NAME}= Create OOF HPA Policy
101 Push Config Policy ${OOF_POLICY_HPA_NAME} ${OOF_POLICY_HPA_TYPE}
102 #HPA Policy Tests
103
104VFW Get Configs Policy
105 Sleep 5s
106 Get Configs VFW Policy
107
108VDNS Get Configs Policy
109 Sleep 5s
110 Get Configs VDNS Policy
111
112VCPE Get Configs Policy
113 Sleep 5s
114 Get Configs VCPE Policy
115
116HPA Get OOF Policy
117 Sleep 5s
118 Get OOF HPA Policy
119
HOCKLA3e332f42019-02-20 09:32:19 -0600120ListPolicy
121 ListPolicy test com.Config_Sample.1.xml
122
Gary Wu9abb61c2018-09-27 10:38:50 -0700123*** Keywords ***
124
125VFW Policy Tests
126 ${CONFIG_POLICY_VFW_NAME}= Create Config VFW Policy
127 Push Config Policy ${CONFIG_POLICY_VFW_NAME} ${CONFIG_POLICY_VFW_TYPE}
128 Get Configs VFW Policy
129 ${OPS_POLICY_VFW_NAME}= Create Ops VFW Policy
130 Push Ops Policy ${OPS_POLICY_VFW_NAME} ${OPS_POLICY_VFW_TYPE}
131 ${SDNC_POLICY_VFW_NAME}= Create VFW SDNC Naming Policy
132 Push Config Policy ${CONFIG_POLICY_VFW_NAME} ${CONFIG_POLICY_VFW_TYPE}
133
134VDNS Policy Tests
135 ${CONFIG_POLICY_VDNS_NAME}= Create Config VDNS Policy
136 Push Config Policy ${CONFIG_POLICY_VDNS_NAME} ${CONFIG_POLICY_VDNS_TYPE}
137 Get Configs VDNS Policy
138 ${OPS_POLICY_VDNS_NAME}= Create Ops VDNS Policy
139 Push Ops Policy ${OPS_POLICY_VDNS_NAME} ${OPS_POLICY_VDNS_TYPE}
140
141VCPE Policy Tests
142 ${CONFIG_POLICY_VCPE_NAME}= Create Config VCPE Policy
143 Push Config Policy ${CONFIG_POLICY_VCPE_NAME} ${CONFIG_POLICY_VCPE_TYPE}
144 Get Configs VCPE Policy
145 ${OPS_POLICY_VCPE_NAME}= Create Ops VCPE Policy
146 Push Ops Policy ${OPS_POLICY_VCPE_NAME} ${OPS_POLICY_VCPE_TYPE}
147
148VPG Policy Tests
149 ${SDNC_POLICY_VPG_NAME}= Create VPG SDNC Naming Policy
150 Push Config Policy ${SDNC_POLICY_VPG_NAME} ${CONFIG_POLICY_VFW_TYPE}
151
152VOLTE Policy Tests
153 ${OPS_POLICY_VOLTE_NAME}= Create Ops VOLTE Policy
154 Push Ops Policy ${OPS_POLICY_VOLTE_NAME} ${OPS_POLICY_VOLTE_TYPE}
155
156HPA Policy Tests
157 ${OOF_POLICY_HPA_NAME}= Create OOF HPA Policy
158 Push Config Policy ${OOF_POLICY_HPA_NAME} ${OOF_POLICY_HPA_TYPE}
159 Get OOF HPA Policy
160
161Get Configs VFW Policy
162 [Documentation] Get Config Policy for VFW
163 ${getconfigpolicy}= Catenate .*${CONFIG_POLICY_VFW_NAME}*
164 ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy}
165 ${output} = Fill JSON Template File ${GETCONFIG_TEMPLATE} ${configpolicy_name}
166 ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output}
167 Should Be Equal As Strings ${get_resp.status_code} 200
168
169Create OOF HPA Policy
170 [Documentation] Create OOF Policy
171 ${randompolicyname} = Create Policy Name
172 ${policyname1}= Catenate com.${randompolicyname}_HPA
173 ${OOF_POLICY_HPA_NAME}= Set Test Variable ${policyname1}
174 ${hpapolicy}= Create Dictionary policy_name=${policyname1}
175 ${output} = Fill JSON Template File ${CREATE_OOF_HPA_TEMPLATE} ${hpapolicy}
176 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
177 Log ${put_resp}
178 Should Be Equal As Strings ${put_resp.status_code} 200
179 [Return] ${policyname1}
180
181Get OOF HPA Policy
182 [Documentation] Get OOF Policy for HPA
183 ${gethpapolicy}= Catenate .*${OOF_POLICY_HPA_NAME}*
184 ${hpapolicy_name}= Create Dictionary oof_policy_name=${gethpapolicy}
185 ${output} = Fill JSON Template File ${GETOOF_TEMPLATE} ${hpapolicy_name}
186 ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output}
187 Should Be Equal As Strings ${get_resp.status_code} 200
188
189Create Config VFW Policy
190 [Documentation] Create Config Policy
191 ${randompolicyname} = Create Policy Name
192 ${policyname1}= Catenate com.${randompolicyname}_vFirewall
193 ${CONFIG_POLICY_VFW_NAME}= Set Test Variable ${policyname1}
194 ${configpolicy}= Create Dictionary policy_name=${policyname1}
195 ${output} = Fill JSON Template File ${CREATE_CONFIG_VFW_TEMPLATE} ${configpolicy}
196 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
197 Should Be Equal As Strings ${put_resp.status_code} 200
198 [Return] ${policyname1}
199
200Create VPG SDNC Naming Policy
201 [Documentation] Create VPG SDNC Naming Policy
202 ${randompolicyname} = Create Policy Name
203 ${policyname1}= Catenate com.${randompolicyname}_ONAP_vPG_Naming
204 ${SDNC_POLICY_VPG_NAME}= Set Test Variable ${policyname1}
205 ${sdncpolicy}= Create Dictionary policy_name=${policyname1}
206 ${output} = Fill JSON Template File ${CREATE_SDNC_VPG_TEMPLATE} ${sdncpolicy}
207 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
208 Should Be Equal As Strings ${put_resp.status_code} 200
209 [Return] ${policyname1}
210
211Create VFW SDNC Naming Policy
212 [Documentation] Create VFW SDNC Naming Policy
213 ${randompolicyname} = Create Policy Name
214 ${policyname1}= Catenate com.${randompolicyname}_ONAP_vFW_Naming
215 ${SDNC_POLICY_VFW_NAME}= Set Test Variable ${policyname1}
216 ${sdncpolicy}= Create Dictionary policy_name=${policyname1}
217 ${output} = Fill JSON Template File ${CREATE_SDNC_VFW_TEMPLATE} ${sdncpolicy}
218 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
219 Should Be Equal As Strings ${put_resp.status_code} 200
220 [Return] ${policyname1}
221
222Create Policy Name
223 [Documentation] Generate Policy Name
224 [Arguments] ${prefix}=CSIT_
225 ${random}= Generate Random String 15 [LOWER][NUMBERS]
226 ${policyname}= Catenate ${prefix}${random}
227 [Return] ${policyname}
228
229Create Ops VFW Policy
230 [Documentation] Create Operational Policy
231 ${randompolicyname} = Create Policy Name
232 ${policyname1}= Catenate com.${randompolicyname}_vFirewall
233 ${OPS_POLICY_VFW_NAME}= Set Test Variable ${policyname1}
234 ${dict}= Create Dictionary policy_name=${policyname1}
235 ${output} = Fill JSON Template File ${CREATE_OPS_VFW_TEMPLATE} ${dict}
236 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
237 Log ${put_resp}
238 Should Be Equal As Strings ${put_resp.status_code} 200
239 [Return] ${policyname1}
240
241Push Ops Policy
242 [Documentation] Push Ops Policy
243 [Arguments] ${policyname} ${policytype}
244 ${dict}= Create Dictionary policy_name=${policyname} policy_type=${policytype}
245 ${output} = Fill JSON Template File ${PUSH_POLICY_TEMPLATE} ${dict}
246 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE_PUSH} ${output}
247 Should Be Equal As Strings ${put_resp.status_code} 200
248
249Push Config Policy
250 [Documentation] Push Config Policy
251 [Arguments] ${policyname} ${policytype}
252 ${dict}= Create Dictionary policy_name=${policyname} policy_type=${policytype}
253 ${output} = Fill JSON Template File ${PUSH_POLICY_TEMPLATE} ${dict}
254 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE_PUSH} ${output}
255 Should Be Equal As Strings ${put_resp.status_code} 200
256
257Delete Ops Policy
258 [Documentation] Delete Config Policy
259 [Arguments] ${policy_name}
260 ${policyname3}= Catenate com.Config_BRMS_Param_${policyname}.1.xml
261 ${dict}= Create Dictionary policy_name=${policyname3}
262 ${output} = Fill JSON Template ${DEL_POLICY_TEMPLATE} ${dict}
263 ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output}
264 Should Be Equal As Strings ${put_resp.status_code} 200
265
266Delete Config Policy
267 [Documentation] Delete Ops Policy
268 [Arguments] ${policy_name}
269 ${policyname3}= Catenate com.Config_MS_com.${policy_name}.1.xml
270 ${dict}= Create Dictionary policy_name=${policyname3}
271 ${output} = Fill JSON Template ${DEL_POLICY_TEMPLATE} ${dict}
272 ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output}
273 Should Be Equal As Strings ${put_resp.status_code} 200
274
275Delete OOF Policy
276 [Documentation] Delete OOF Policy
277 [Arguments] ${policy_name}
278 ${policyname3}= Catenate com.Config_OOF_${policy_name}.1.xml
279 ${dict}= Create Dictionary policy_name=${policyname3}
280 ${output} = Fill JSON Template ${DEL_POLICY_TEMPLATE} ${dict}
281 ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output}
282 Should Be Equal As Strings ${put_resp.status_code} 200
283
284Get Configs VDNS Policy
285 [Documentation] Get Config Policy for VDNS
286 ${getconfigpolicy}= Catenate .*${CONFIG_POLICY_VDNS_NAME}*
287 ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy}
288 ${output} = Fill JSON Template File ${GETCONFIG_TEMPLATE} ${configpolicy_name}
289 ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output}
290 Should Be Equal As Strings ${get_resp.status_code} 200
291
292Create Config VDNS Policy
293 [Documentation] Create Config Policy
294 ${randompolicyname} = Create Policy Name
295 ${policyname1}= Catenate com.${randompolicyname}_vLoadBalancer
296 ${CONFIG_POLICY_VDNS_NAME}= Set Test Variable ${policyname1}
297 ${configpolicy}= Create Dictionary policy_name=${policyname1}
298 ${output} = Fill JSON Template File ${CREATE_CONFIG_VDNS_TEMPLATE} ${configpolicy}
299 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
300 Should Be Equal As Strings ${put_resp.status_code} 200
301 [Return] ${policyname1}
302
303Create Ops VDNS Policy
304 [Documentation] Create Operational Policy
305 ${randompolicyname} = Create Policy Name
306 ${policyname1}= Catenate com.${randompolicyname}_vLoadBalancer
307 ${OPS_POLICY_VDNS_NAME}= Set Test Variable ${policyname1}
308 ${dict}= Create Dictionary policy_name=${policyname1}
309 ${output} = Fill JSON Template File ${CREATE_OPS_VDNS_TEMPLATE} ${dict}
310 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
311 Log ${put_resp}
312 Should Be Equal As Strings ${put_resp.status_code} 200
313 [Return] ${policyname1}
314
315Create Config VCPE Policy
316 [Documentation] Create Config Policy
317 ${randompolicyname} = Create Policy Name
318 ${policyname1}= Catenate com.${randompolicyname}_vCPE
319 ${CONFIG_POLICY_VCPE_NAME}= Set Test Variable ${policyname1}
320 ${configpolicy}= Create Dictionary policy_name=${policyname1}
321 ${output} = Fill JSON Template File ${CREATE_CONFIG_VCPE_TEMPLATE} ${configpolicy}
322 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
323 Should Be Equal As Strings ${put_resp.status_code} 200
324 [Return] ${policyname1}
325
326Get Configs VCPE Policy
327 [Documentation] Get Config Policy for VCPE
328 ${getconfigpolicy}= Catenate .*${CONFIG_POLICY_VCPE_NAME}*
329 ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy}
330 ${output} = Fill JSON Template File ${GETCONFIG_TEMPLATE} ${configpolicy_name}
331 ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output}
332 Should Be Equal As Strings ${get_resp.status_code} 200
333
334Create Ops vCPE Policy
335 [Documentation] Create Operational Policy
336 ${randompolicyname} = Create Policy Name
337 ${policyname1}= Catenate com.${randompolicyname}_vCPE
338 ${OPS_POLICY_VCPE_NAME}= Set Test Variable ${policyname1}
339 ${dict}= Create Dictionary policy_name=${policyname1}
340 ${output} = Fill JSON Template File ${CREATE_OPS_VCPE_TEMPLATE} ${dict}
341 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
342 Log ${put_resp}
343 Should Be Equal As Strings ${put_resp.status_code} 200
344 [Return] ${policyname1}
345
346Create Ops VolTE Policy
347 [Documentation] Create Operational Policy
348 ${randompolicyname} = Create Policy Name
349 ${policyname1}= Catenate com.${randompolicyname}_VoLTE
350 ${dict}= Create Dictionary policy_name=${policyname1}
351 ${output} = Fill JSON Template File ${CREATE_OPS_VOLTE_TEMPLATE} ${dict}
352 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
353 Log ${put_resp}
354 Should Be Equal As Strings ${put_resp.status_code} 200
355 [Return] ${policyname1}
356
357Upload DRL file
358 [Documentation] Upload DRL file1
359 ${file_data}= Get Binary File ${file_path}
360 ${files}= Create Dictionary file=${file_data}
361 #${CONFIG_POLICY_VDNS_NAME}= Set Test Variable ${policyname1}
362 # ${files2} = {'file': open('../testsuite/robot/assets/templates/ControlLoopDemo__closedLoopControlName.drl', 'rb')}
363 # ${files}= Create Dictionary file ${file_data}
364 ${put_resp} = Run Policy Post form Request ${RESOURCE_PATH_UPLOAD} ${files}
365 Should Be Equal As Strings ${put_resp.status_code} 200
HOCKLA3e332f42019-02-20 09:32:19 -0600366
367ListPolicy test
368 [Documentation] Listing Config Policies
369 [Arguments] ${policy_name}
370 ${dict}= Create Dictionary policy_name=${policy_name}
371 ${output} = Fill JSON Template File ${LISTPOLICY_TEMPLATE} ${dict}
372 ${put_resp} = policy_interface.Run Policy Post Request ${RESOURCE_PATH_LISTPOLICY} ${output}
373 Should Be Equal As Strings ${put_resp.status_code} 200
374