blob: 5909abd298e5fad24977c3ed50a1251097d2b3d4 [file] [log] [blame]
ma987de38164b2017-09-28 16:33:03 -05001*** Settings ***
2Documentation Policy ONAP CSIT Test cases
3Library String
4Library HttpLibrary.HTTP
5LIbrary Process
RAJU3f5fd662017-10-11 15:50:00 -05006Library BuiltIn
ma987de38164b2017-09-28 16:33:03 -05007Resource policy_interface.robot
8Resource json_templater.robot
9
10*** Variables ***
RAJU39e27742017-10-05 10:03:36 -050011${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
RAJUbb7d13c2017-10-19 15:59:57 -050015${CREATE_CONFIG_VFW_TEMPLATE} ${CURDIR}/configpolicy_vFW_R1.template
16${CREATE_CONFIG_VDNS_TEMPLATE} ${CURDIR}/configpolicy_vDNS_R1.template
17${CREATE_CONFIG_VCPE_TEMPLATE} ${CURDIR}/configpolicy_vCPE_R1.template
RAJU39e27742017-10-05 10:03:36 -050018${CREATE_OPS_VFW_TEMPLATE} ${CURDIR}/opspolicy_VFW_R1.template
Michael Mokryc8c64222018-04-02 00:25:06 -050019${CREATE_OOF_HPA_TEMPLATE} ${CURDIR}/oofpolicy_HPA_R1.template
ma987de38164b2017-09-28 16:33:03 -050020${PUSH_POLICY_TEMPLATE} ${CURDIR}/pushpolicy.template
RAJU39e27742017-10-05 10:03:36 -050021${CREATE_OPS_VDNS_TEMPLATE} ${CURDIR}/opspolicy_VDNS_R1.template
ma987de38164b2017-09-28 16:33:03 -050022${DEL_POLICY_TEMPLATE} ${CURDIR}/deletepolicy.template
23${GETCONFIG_TEMPLATE} ${CURDIR}/getconfigpolicy.template
Michael Mokryc8c64222018-04-02 00:25:06 -050024${GETOOF_TEMPLATE} ${CURDIR}/getoofpolicy.template
ma987de38164b2017-09-28 16:33:03 -050025${CONFIG_POLICY_VFW_NAME} vFirewall
26${CONFIG_POLICY_VFW_TYPE} MicroService
27${CONFIG_POLICY_VDNS_NAME} vLoadBalancer
28${CONFIG_POLICY_VDNS_TYPE} MicroService
29${OPS_POLICY_VFW_NAME} vFirewall
30${OPS_POLICY_VFW_TYPE} BRMS_PARAM
31${OPS_POLICY_VDNS_NAME} vLoadBalancer
32${OPS_POLICY_VDNS_TYPE} BRMS_PARAM
33${CONFIG_POLICY_VCPE_NAME} vCPE
34${CONFIG_POLICY_VCPE_TYPE} MicroService
35${OPS_POLICY_VCPE_NAME} vCPE
36${OPS_POLICY_VCPE_TYPE} BRMS_PARAM
37${OPS_POLICY_VOLTE_NAME} VoLTE
38${OPS_POLICY_VOLTE_TYPE} BRMS_PARAM
Michael Mokryc8c64222018-04-02 00:25:06 -050039${OOF_POLICY_HPA_NAME} HPA
40${OOF_POLICY_HPA_TYPE} Optimization
ma987de38164b2017-09-28 16:33:03 -050041${file_path} ../testsuite/robot/assets/templates/ControlLoopDemo__closedLoopControlName.drl
42${RESOURCE_PATH_UPLOAD} /pdp/api/policyEngineImport?importParametersJson=%7B%22serviceName%22%3A%22Manyu456%22%2C%20%22serviceType%22%3A%22BRMSPARAM%22%7D
RAJUbb7d13c2017-10-19 15:59:57 -050043${CREATE_OPS_VCPE_TEMPLATE} ${CURDIR}/opspolicy_vCPE_R1.template
44${CREATE_OPS_VOLTE_TEMPLATE} ${CURDIR}/opspolicy_vOLTE_R1.template
ma987de38164b2017-09-28 16:33:03 -050045
46
47*** Test Cases ***
48Policy Health check
49 Run Policy Health Check
50
51VFW Config Policy
52 ${CONFIG_POLICY_VFW_NAME}= Create Config VFW Policy
RAJU3f5fd662017-10-11 15:50:00 -050053 Push Config Policy ${CONFIG_POLICY_VFW_NAME} ${CONFIG_POLICY_VFW_TYPE}
ma987de38164b2017-09-28 16:33:03 -050054 #VFW Policy Tests
55
56VDNS Config Policy
57 ${CONFIG_POLICY_VDNS_NAME}= Create Config VDNS Policy
58 Push Config Policy ${CONFIG_POLICY_VDNS_NAME} ${CONFIG_POLICY_VDNS_TYPE}
RAJU3f5fd662017-10-11 15:50:00 -050059 #VDNS Policy Tests
60
ma987de38164b2017-09-28 16:33:03 -050061VCPE Config Policy
62 ${CONFIG_POLICY_VCPE_NAME}= Create Config VCPE Policy
63 Push Config Policy ${CONFIG_POLICY_VCPE_NAME} ${CONFIG_POLICY_VCPE_TYPE}
64 #VCPE Policy Tests
RAJU3f5fd662017-10-11 15:50:00 -050065
RAJU39e27742017-10-05 10:03:36 -050066VFW Ops Policy
67 ${OPS_POLICY_VFW_NAME}= Create Ops VFW Policy
68 Push Ops Policy ${OPS_POLICY_VFW_NAME} ${OPS_POLICY_VFW_TYPE}
69
70VDNS Ops Policy
71 ${OPS_POLICY_VDNS_NAME}= Create Ops VDNS Policy
72 Push Ops Policy ${OPS_POLICY_VDNS_NAME} ${OPS_POLICY_VDNS_TYPE}
73
74VCPE Ops Policy
75 ${OPS_POLICY_VCPE_NAME}= Create Ops VCPE Policy
76 Push Ops Policy ${OPS_POLICY_VCPE_NAME} ${OPS_POLICY_VCPE_TYPE}
77
78VOLTE Ops Policy
79 ${OPS_POLICY_VOLTE_NAME}= Create Ops VOLTE Policy
80 Push Ops Policy ${OPS_POLICY_VOLTE_NAME} ${OPS_POLICY_VOLTE_TYPE}
ma987de38164b2017-09-28 16:33:03 -050081 #VOLTE Policy Tests
Michael Mokryc8c64222018-04-02 00:25:06 -050082
83HPA OOF Policy
84 ${OOF_POLICY_HPA_NAME}= Create OOF HPA Policy
85 Push Config Policy ${OOF_POLICY_HPA_NAME} ${OOF_POLICY_HPA_TYPE}
86 #HPA Policy Tests
87
RAJU3f5fd662017-10-11 15:50:00 -050088VFW Get Configs Policy
89 Sleep 5s
90 Get Configs VFW Policy
91
92VDNS Get Configs Policy
93 Sleep 5s
94 Get Configs VDNS Policy
95
96VCPE Get Configs Policy
97 Sleep 5s
98 Get Configs VCPE Policy
ma987de38164b2017-09-28 16:33:03 -050099
Michael Mokryc8c64222018-04-02 00:25:06 -0500100HPA Get OOF Policy
101 Sleep 5s
102 Get OOF HPA Policy
103
ma987de38164b2017-09-28 16:33:03 -0500104*** Keywords ***
105
106VFW Policy Tests
107 ${CONFIG_POLICY_VFW_NAME}= Create Config VFW Policy
108 Push Config Policy ${CONFIG_POLICY_VFW_NAME} ${CONFIG_POLICY_VFW_TYPE}
109 Get Configs VFW Policy
110 ${OPS_POLICY_VFW_NAME}= Create Ops VFW Policy
111 Push Ops Policy ${OPS_POLICY_VFW_NAME} ${OPS_POLICY_VFW_TYPE}
112
113VDNS Policy Tests
114 ${CONFIG_POLICY_VDNS_NAME}= Create Config VDNS Policy
115 Push Config Policy ${CONFIG_POLICY_VDNS_NAME} ${CONFIG_POLICY_VDNS_TYPE}
116 Get Configs VDNS Policy
117 ${OPS_POLICY_VDNS_NAME}= Create Ops VDNS Policy
118 Push Ops Policy ${OPS_POLICY_VDNS_NAME} ${OPS_POLICY_VDNS_TYPE}
119
120VCPE Policy Tests
121 ${CONFIG_POLICY_VCPE_NAME}= Create Config VCPE Policy
122 Push Config Policy ${CONFIG_POLICY_VCPE_NAME} ${CONFIG_POLICY_VCPE_TYPE}
123 Get Configs VCPE Policy
124 ${OPS_POLICY_VCPE_NAME}= Create Ops VCPE Policy
125 Push Ops Policy ${OPS_POLICY_VCPE_NAME} ${OPS_POLICY_VCPE_TYPE}
126
127VOLTE Policy Tests
128 ${OPS_POLICY_VOLTE_NAME}= Create Ops VOLTE Policy
129 Push Ops Policy ${OPS_POLICY_VOLTE_NAME} ${OPS_POLICY_VOLTE_TYPE}
130
Michael Mokryc8c64222018-04-02 00:25:06 -0500131HPA Policy Tests
132 ${OOF_POLICY_HPA_NAME}= Create OOF HPA Policy
133 Push Config Policy ${OOF_POLICY_HPA_NAME} ${OOF_POLICY_HPA_TYPE}
134 Get OOF HPA Policy
135
ma987de38164b2017-09-28 16:33:03 -0500136Get Configs VFW Policy
137 [Documentation] Get Config Policy for VFW
138 ${getconfigpolicy}= Catenate .*${CONFIG_POLICY_VFW_NAME}*
139 ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy}
140 ${output} = Fill JSON Template File ${GETCONFIG_TEMPLATE} ${configpolicy_name}
141 ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output}
142 Should Be Equal As Strings ${get_resp.status_code} 200
143
Michael Mokryc8c64222018-04-02 00:25:06 -0500144Create OOF HPA Policy
145 [Documentation] Create OOF Policy
146 ${randompolicyname} = Create Policy Name
147 ${policyname1}= Catenate com.${randompolicyname}_HPA
148 ${OOF_POLICY_HPA_NAME}= Set Test Variable ${policyname1}
149 ${hpapolicy}= Create Dictionary policy_name=${policyname1}
150 ${output} = Fill JSON Template File ${CREATE_OOF_HPA_TEMPLATE} ${hpapolicy}
151 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
152 Log ${put_resp}
153 Should Be Equal As Strings ${put_resp.status_code} 200
154 [Return] ${policyname1}
155
156Get OOF HPA Policy
157 [Documentation] Get OOF Policy for HPA
158 ${gethpapolicy}= Catenate .*${OOF_POLICY_HPA_NAME}*
159 ${hpapolicy_name}= Create Dictionary oof_policy_name=${gethpapolicy}
160 ${output} = Fill JSON Template File ${GETOOF_TEMPLATE} ${hpapolicy_name}
161 ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output}
162 Should Be Equal As Strings ${get_resp.status_code} 200
163
ma987de38164b2017-09-28 16:33:03 -0500164Create Config VFW Policy
165 [Documentation] Create Config Policy
166 ${randompolicyname} = Create Policy Name
167 ${policyname1}= Catenate com.${randompolicyname}_vFirewall
168 ${CONFIG_POLICY_VFW_NAME}= Set Test Variable ${policyname1}
169 ${configpolicy}= Create Dictionary policy_name=${policyname1}
170 ${output} = Fill JSON Template File ${CREATE_CONFIG_VFW_TEMPLATE} ${configpolicy}
171 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
172 Should Be Equal As Strings ${put_resp.status_code} 200
173 [Return] ${policyname1}
174
175 Create Policy Name
176 [Documentation] Generate Policy Name
177 [Arguments] ${prefix}=CSIT_
178 ${random}= Generate Random String 15 [LOWER][NUMBERS]
179 ${policyname}= Catenate ${prefix}${random}
180 [Return] ${policyname}
181
182Create Ops VFW Policy
183 [Documentation] Create Opertional Policy
184 ${randompolicyname} = Create Policy Name
185 ${policyname1}= Catenate com.${randompolicyname}_vFirewall
186 ${OPS_POLICY_VFW_NAME}= Set Test Variable ${policyname1}
187 ${dict}= Create Dictionary policy_name=${policyname1}
188 ${output} = Fill JSON Template File ${CREATE_OPS_VFW_TEMPLATE} ${dict}
189 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
190 Log ${put_resp}
191 Should Be Equal As Strings ${put_resp.status_code} 200
192 [Return] ${policyname1}
193
194Push Ops Policy
195 [Documentation] Push Ops Policy
196 [Arguments] ${policyname} ${policytype}
197 ${dict}= Create Dictionary policy_name=${policyname} policy_type=${policytype}
198 ${output} = Fill JSON Template File ${PUSH_POLICY_TEMPLATE} ${dict}
199 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE_PUSH} ${output}
200 Should Be Equal As Strings ${put_resp.status_code} 200
201
202Push Config Policy
203 [Documentation] Push Config Policy
204 [Arguments] ${policyname} ${policytype}
205 ${dict}= Create Dictionary policy_name=${policyname} policy_type=${policytype}
206 ${output} = Fill JSON Template File ${PUSH_POLICY_TEMPLATE} ${dict}
207 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE_PUSH} ${output}
208 Should Be Equal As Strings ${put_resp.status_code} 200
209
210Delete Ops Policy
211 [Documentation] Delete Config Policy
212 [Arguments] ${policy_name}
213 ${policyname3}= Catenate com.Config_BRMS_Param_${policyname}.1.xml
214 ${dict}= Create Dictionary policy_name=${policyname3}
215 ${output} = Fill JSON Template ${DEL_POLICY_TEMPLATE} ${dict}
216 ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output}
217 Should Be Equal As Strings ${put_resp.status_code} 200
218
219Delete Config Policy
220 [Documentation] Delete Ops Policy
221 [Arguments] ${policy_name}
222 ${policyname3}= Catenate com.Config_MS_com.${policy_name}.1.xml
223 ${dict}= Create Dictionary policy_name=${policyname3}
224 ${output} = Fill JSON Template ${DEL_POLICY_TEMPLATE} ${dict}
225 ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output}
226 Should Be Equal As Strings ${put_resp.status_code} 200
227
Michael Mokryc8c64222018-04-02 00:25:06 -0500228Delete OOF Policy
229 [Documentation] Delete OOF Policy
230 [Arguments] ${policy_name}
231 ${policyname3}= Catenate com.Config_OOF_${policy_name}.1.xml
232 ${dict}= Create Dictionary policy_name=${policyname3}
233 ${output} = Fill JSON Template ${DEL_POLICY_TEMPLATE} ${dict}
234 ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output}
235 Should Be Equal As Strings ${put_resp.status_code} 200
236
ma987de38164b2017-09-28 16:33:03 -0500237Get Configs VDNS Policy
238 [Documentation] Get Config Policy for VDNS
239 ${getconfigpolicy}= Catenate .*${CONFIG_POLICY_VDNS_NAME}*
240 ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy}
241 ${output} = Fill JSON Template File ${GETCONFIG_TEMPLATE} ${configpolicy_name}
242 ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output}
243 Should Be Equal As Strings ${get_resp.status_code} 200
244
245Create Config VDNS Policy
246 [Documentation] Create Config Policy
247 ${randompolicyname} = Create Policy Name
248 ${policyname1}= Catenate com.${randompolicyname}_vLoadBalancer
249 ${CONFIG_POLICY_VDNS_NAME}= Set Test Variable ${policyname1}
250 ${configpolicy}= Create Dictionary policy_name=${policyname1}
251 ${output} = Fill JSON Template File ${CREATE_CONFIG_VDNS_TEMPLATE} ${configpolicy}
252 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
253 Should Be Equal As Strings ${put_resp.status_code} 200
254 [Return] ${policyname1}
255
256Create Ops VDNS Policy
257 [Documentation] Create Opertional Policy
258 ${randompolicyname} = Create Policy Name
259 ${policyname1}= Catenate com.${randompolicyname}_vLoadBalancer
260 ${OPS_POLICY_VDNS_NAME}= Set Test Variable ${policyname1}
261 ${dict}= Create Dictionary policy_name=${policyname1}
262 ${output} = Fill JSON Template File ${CREATE_OPS_VDNS_TEMPLATE} ${dict}
263 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
264 Log ${put_resp}
265 Should Be Equal As Strings ${put_resp.status_code} 200
266 [Return] ${policyname1}
267
268Create Config VCPE Policy
269 [Documentation] Create Config Policy
270 ${randompolicyname} = Create Policy Name
RAJUbb7d13c2017-10-19 15:59:57 -0500271 ${policyname1}= Catenate com.${randompolicyname}_vCPE
ma987de38164b2017-09-28 16:33:03 -0500272 ${CONFIG_POLICY_VCPE_NAME}= Set Test Variable ${policyname1}
273 ${configpolicy}= Create Dictionary policy_name=${policyname1}
274 ${output} = Fill JSON Template File ${CREATE_CONFIG_VCPE_TEMPLATE} ${configpolicy}
275 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
276 Should Be Equal As Strings ${put_resp.status_code} 200
277 [Return] ${policyname1}
278
279Get Configs VCPE Policy
280 [Documentation] Get Config Policy for VCPE
281 ${getconfigpolicy}= Catenate .*${CONFIG_POLICY_VCPE_NAME}*
282 ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy}
283 ${output} = Fill JSON Template File ${GETCONFIG_TEMPLATE} ${configpolicy_name}
284 ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output}
285 Should Be Equal As Strings ${get_resp.status_code} 200
286
287Create Ops vCPE Policy
288 [Documentation] Create Opertional Policy
289 ${randompolicyname} = Create Policy Name
RAJUbb7d13c2017-10-19 15:59:57 -0500290 ${policyname1}= Catenate com.${randompolicyname}_vCPE
RAJU39e27742017-10-05 10:03:36 -0500291 ${OPS_POLICY_VCPE_NAME}= Set Test Variable ${policyname1}
292 ${dict}= Create Dictionary policy_name=${policyname1}
ma987de38164b2017-09-28 16:33:03 -0500293 ${output} = Fill JSON Template File ${CREATE_OPS_VCPE_TEMPLATE} ${dict}
294 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
295 Log ${put_resp}
296 Should Be Equal As Strings ${put_resp.status_code} 200
RAJU39e27742017-10-05 10:03:36 -0500297 [Return] ${policyname1}
ma987de38164b2017-09-28 16:33:03 -0500298
299Create Ops VolTE Policy
300 [Documentation] Create Opertional Policy
301 ${randompolicyname} = Create Policy Name
RAJUbb7d13c2017-10-19 15:59:57 -0500302 ${policyname1}= Catenate com.${randompolicyname}_VoLTE
RAJU39e27742017-10-05 10:03:36 -0500303 ${dict}= Create Dictionary policy_name=${policyname1}
ma987de38164b2017-09-28 16:33:03 -0500304 ${output} = Fill JSON Template File ${CREATE_OPS_VOLTE_TEMPLATE} ${dict}
305 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
306 Log ${put_resp}
307 Should Be Equal As Strings ${put_resp.status_code} 200
RAJU39e27742017-10-05 10:03:36 -0500308 [Return] ${policyname1}
ma987de38164b2017-09-28 16:33:03 -0500309
310Upload DRL file
311 [Documentation] Upload DRL file1
312 ${file_data}= Get Binary File ${file_path}
313 ${files}= Create Dictionary file=${file_data}
314 #${CONFIG_POLICY_VDNS_NAME}= Set Test Variable ${policyname1}
315 # ${files2} = {'file': open('../testsuite/robot/assets/templates/ControlLoopDemo__closedLoopControlName.drl', 'rb')}
316 # ${files}= Create Dictionary file ${file_data}
317 ${put_resp} = Run Policy Post form Request ${RESOURCE_PATH_UPLOAD} ${files}
Michael Mokryc8c64222018-04-02 00:25:06 -0500318 Should Be Equal As Strings ${put_resp.status_code} 200