blob: e55ccac8c5292cf247d31b7881d83a8a7fc331a7 [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
DR695H1a207a42019-06-20 17:20:56 -04007Library ONAPLibrary.Templating
Gary Wu9abb61c2018-09-27 10:38:50 -07008Resource policy_interface.robot
Gary Wu9abb61c2018-09-27 10:38:50 -07009
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
DR695H1a207a42019-06-20 17:20:56 -040016${CREATE_CONFIG_VFW_TEMPLATE} configpolicy_vFW_R1.jinja
17${CREATE_CONFIG_VDNS_TEMPLATE} configpolicy_vDNS_R1.jinja
18${CREATE_CONFIG_VCPE_TEMPLATE} configpolicy_vCPE_R1.jinja
19${CREATE_OPS_VFW_TEMPLATE} opspolicy_VFW_R1.jinja
20${CREATE_OOF_HPA_TEMPLATE} oofpolicy_HPA_R1.jinja
21${CREATE_SDNC_VFW_TEMPLATE} sdncnamingpolicy_vFW.jinja
22${CREATE_SDNC_VPG_TEMPLATE} sdncnamingpolicy_vPG.jinja
23${PUSH_POLICY_TEMPLATE} pushpolicy.jinja
24${MULTIPLE_PUSH_POLICY_TEMPLATE} multiple_pushpolicy.jinja
25${MULTIPLE_UNPUSH_POLICY_TEMPLATE} multiple_unpushpolicy.jinja
26${CREATE_OPS_VDNS_TEMPLATE} opspolicy_VDNS_R1.jinja
27${DEL_POLICY_TEMPLATE} deletepolicy.jinja
28${GETCONFIG_TEMPLATE} getconfigpolicy.jinja
29${GETOOF_TEMPLATE} getoofpolicy.jinja
30${LISTPOLICY_TEMPLATE} listpolicy.jinja
Gary Wu9abb61c2018-09-27 10:38:50 -070031${CONFIG_POLICY_VFW_NAME} vFirewall
32${CONFIG_POLICY_VFW_TYPE} MicroService
33${CONFIG_POLICY_VDNS_NAME} vLoadBalancer
34${CONFIG_POLICY_VDNS_TYPE} MicroService
35${OPS_POLICY_VFW_NAME} vFirewall
36${OPS_POLICY_VFW_TYPE} BRMS_PARAM
37${OPS_POLICY_VDNS_NAME} vLoadBalancer
38${OPS_POLICY_VDNS_TYPE} BRMS_PARAM
39${CONFIG_POLICY_VCPE_NAME} vCPE
40${CONFIG_POLICY_VCPE_TYPE} MicroService
41${OPS_POLICY_VCPE_NAME} vCPE
42${OPS_POLICY_VCPE_TYPE} BRMS_PARAM
43${OPS_POLICY_VOLTE_NAME} VoLTE
44${OPS_POLICY_VOLTE_TYPE} BRMS_PARAM
45${OOF_POLICY_HPA_NAME} HPA
46${OOF_POLICY_HPA_TYPE} Optimization
47${SDNC_POLICY_VFW_NAME} ONAP_vFW_Naming
48${SDNC_POLICY_VPG_NAME} ONAP_vPG_Naming
HOCKLA092093d2019-04-05 13:00:50 -050049${MULTIPLE_PUSH_POLICY_NAME1} com.testBase1
50${MULTIPLE_PUSH_POLICY_NAME2} com.testBase2
51${MULTIPLE_PUSH_POLICY_NAME3} com.testBase3
Gary Wu9abb61c2018-09-27 10:38:50 -070052${file_path} ../testsuite/robot/assets/templates/ControlLoopDemo__closedLoopControlName.drl
53${RESOURCE_PATH_UPLOAD} /pdp/api/policyEngineImport?importParametersJson=%7B%22serviceName%22%3A%22Manyu456%22%2C%20%22serviceType%22%3A%22BRMSPARAM%22%7D
DR695H1a207a42019-06-20 17:20:56 -040054${CREATE_OPS_VCPE_TEMPLATE} opspolicy_vCPE_R1.jinja
55${CREATE_OPS_VOLTE_TEMPLATE} opspolicy_vOLTE_R1.jinja
Gary Wu9abb61c2018-09-27 10:38:50 -070056
57
58*** Test Cases ***
59Policy Health check
60 Run Policy Health Check
61
62VFW Config Policy
63 ${CONFIG_POLICY_VFW_NAME}= Create Config VFW Policy
64 Push Config Policy ${CONFIG_POLICY_VFW_NAME} ${CONFIG_POLICY_VFW_TYPE}
65 #VFW Policy Tests
66
67VDNS Config Policy
68 ${CONFIG_POLICY_VDNS_NAME}= Create Config VDNS Policy
69 Push Config Policy ${CONFIG_POLICY_VDNS_NAME} ${CONFIG_POLICY_VDNS_TYPE}
70 #VDNS Policy Tests
71
72VCPE Config Policy
73 ${CONFIG_POLICY_VCPE_NAME}= Create Config VCPE Policy
74 Push Config Policy ${CONFIG_POLICY_VCPE_NAME} ${CONFIG_POLICY_VCPE_TYPE}
75 #VCPE Policy Tests
76
77VFW Ops Policy
78 ${OPS_POLICY_VFW_NAME}= Create Ops VFW Policy
79 Push Ops Policy ${OPS_POLICY_VFW_NAME} ${OPS_POLICY_VFW_TYPE}
80
81VDNS Ops Policy
82 ${OPS_POLICY_VDNS_NAME}= Create Ops VDNS Policy
83 Push Ops Policy ${OPS_POLICY_VDNS_NAME} ${OPS_POLICY_VDNS_TYPE}
84
85VCPE Ops Policy
86 ${OPS_POLICY_VCPE_NAME}= Create Ops VCPE Policy
87 Push Ops Policy ${OPS_POLICY_VCPE_NAME} ${OPS_POLICY_VCPE_TYPE}
88
89VOLTE Ops Policy
90 ${OPS_POLICY_VOLTE_NAME}= Create Ops VOLTE Policy
91 Push Ops Policy ${OPS_POLICY_VOLTE_NAME} ${OPS_POLICY_VOLTE_TYPE}
92 #VOLTE Policy Tests
93
94VFW SDNC Naming Policy
95 ${SDNC_POLICY_VFW_NAME}= Create VFW SDNC Naming Policy
96 Push Config Policy ${SDNC_POLICY_VFW_NAME} ${CONFIG_POLICY_VFW_TYPE}
97 #VFW Policy Tests
98
99VPG SDNC Naming Policy
100 ${SDNC_POLICY_VPG_NAME}= Create VPG SDNC Naming Policy
101 Push Config Policy ${SDNC_POLICY_VPG_NAME} ${CONFIG_POLICY_VFW_TYPE}
102 #VPG Policy Tests
103
104HPA OOF Policy
105 ${OOF_POLICY_HPA_NAME}= Create OOF HPA Policy
106 Push Config Policy ${OOF_POLICY_HPA_NAME} ${OOF_POLICY_HPA_TYPE}
107 #HPA Policy Tests
108
109VFW Get Configs Policy
110 Sleep 5s
111 Get Configs VFW Policy
112
113VDNS Get Configs Policy
114 Sleep 5s
115 Get Configs VDNS Policy
116
117VCPE Get Configs Policy
118 Sleep 5s
119 Get Configs VCPE Policy
120
121HPA Get OOF Policy
122 Sleep 5s
123 Get OOF HPA Policy
124
HOCKLA3e332f42019-02-20 09:32:19 -0600125ListPolicy
126 ListPolicy test com.Config_Sample.1.xml
127
HOCKLA092093d2019-04-05 13:00:50 -0500128Multiple Push Policy
129 ${MULTIPLE_PUSH_POLICY_NAME1}= Create Ops VDNS Policy
130 ${MULTIPLE_PUSH_POLICY_NAME2}= Create Ops VDNS Policy
131 ${MULTIPLE_PUSH_POLICY_NAME3}= Create Ops VDNS Policy
132 Push Multiple Policy test ${MULTIPLE_PUSH_POLICY_NAME1} ${MULTIPLE_PUSH_POLICY_NAME2} ${MULTIPLE_PUSH_POLICY_NAME3} ${OPS_POLICY_VDNS_TYPE}
133 Sleep 5s
134 Delete Multiple Policy test ${MULTIPLE_PUSH_POLICY_NAME1} ${MULTIPLE_PUSH_POLICY_NAME2} ${MULTIPLE_PUSH_POLICY_NAME3} ${OPS_POLICY_VDNS_TYPE}
135
Gary Wu9abb61c2018-09-27 10:38:50 -0700136*** Keywords ***
137
138VFW Policy Tests
139 ${CONFIG_POLICY_VFW_NAME}= Create Config VFW Policy
140 Push Config Policy ${CONFIG_POLICY_VFW_NAME} ${CONFIG_POLICY_VFW_TYPE}
141 Get Configs VFW Policy
142 ${OPS_POLICY_VFW_NAME}= Create Ops VFW Policy
143 Push Ops Policy ${OPS_POLICY_VFW_NAME} ${OPS_POLICY_VFW_TYPE}
144 ${SDNC_POLICY_VFW_NAME}= Create VFW SDNC Naming Policy
145 Push Config Policy ${CONFIG_POLICY_VFW_NAME} ${CONFIG_POLICY_VFW_TYPE}
146
147VDNS Policy Tests
148 ${CONFIG_POLICY_VDNS_NAME}= Create Config VDNS Policy
149 Push Config Policy ${CONFIG_POLICY_VDNS_NAME} ${CONFIG_POLICY_VDNS_TYPE}
150 Get Configs VDNS Policy
151 ${OPS_POLICY_VDNS_NAME}= Create Ops VDNS Policy
152 Push Ops Policy ${OPS_POLICY_VDNS_NAME} ${OPS_POLICY_VDNS_TYPE}
153
154VCPE Policy Tests
155 ${CONFIG_POLICY_VCPE_NAME}= Create Config VCPE Policy
156 Push Config Policy ${CONFIG_POLICY_VCPE_NAME} ${CONFIG_POLICY_VCPE_TYPE}
157 Get Configs VCPE Policy
158 ${OPS_POLICY_VCPE_NAME}= Create Ops VCPE Policy
159 Push Ops Policy ${OPS_POLICY_VCPE_NAME} ${OPS_POLICY_VCPE_TYPE}
160
161VPG Policy Tests
162 ${SDNC_POLICY_VPG_NAME}= Create VPG SDNC Naming Policy
163 Push Config Policy ${SDNC_POLICY_VPG_NAME} ${CONFIG_POLICY_VFW_TYPE}
164
165VOLTE Policy Tests
166 ${OPS_POLICY_VOLTE_NAME}= Create Ops VOLTE Policy
167 Push Ops Policy ${OPS_POLICY_VOLTE_NAME} ${OPS_POLICY_VOLTE_TYPE}
168
169HPA Policy Tests
170 ${OOF_POLICY_HPA_NAME}= Create OOF HPA Policy
171 Push Config Policy ${OOF_POLICY_HPA_NAME} ${OOF_POLICY_HPA_TYPE}
172 Get OOF HPA Policy
173
174Get Configs VFW Policy
175 [Documentation] Get Config Policy for VFW
DR695H1a207a42019-06-20 17:20:56 -0400176 Create Environment policy ${CURDIR}
Gary Wu9abb61c2018-09-27 10:38:50 -0700177 ${getconfigpolicy}= Catenate .*${CONFIG_POLICY_VFW_NAME}*
178 ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy}
DR695H1a207a42019-06-20 17:20:56 -0400179 ${output} = Apply Template policy ${GETCONFIG_TEMPLATE} ${configpolicy_name}
Gary Wu9abb61c2018-09-27 10:38:50 -0700180 ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output}
181 Should Be Equal As Strings ${get_resp.status_code} 200
182
183Create OOF HPA Policy
184 [Documentation] Create OOF Policy
DR695H1a207a42019-06-20 17:20:56 -0400185 Create Environment policy ${CURDIR}
Gary Wu9abb61c2018-09-27 10:38:50 -0700186 ${randompolicyname} = Create Policy Name
187 ${policyname1}= Catenate com.${randompolicyname}_HPA
188 ${OOF_POLICY_HPA_NAME}= Set Test Variable ${policyname1}
189 ${hpapolicy}= Create Dictionary policy_name=${policyname1}
DR695H1a207a42019-06-20 17:20:56 -0400190 ${output} = Apply Template policy ${CREATE_OOF_HPA_TEMPLATE} ${hpapolicy}
Gary Wu9abb61c2018-09-27 10:38:50 -0700191 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
192 Log ${put_resp}
193 Should Be Equal As Strings ${put_resp.status_code} 200
194 [Return] ${policyname1}
195
196Get OOF HPA Policy
197 [Documentation] Get OOF Policy for HPA
DR695H1a207a42019-06-20 17:20:56 -0400198 Create Environment policy ${CURDIR}
Gary Wu9abb61c2018-09-27 10:38:50 -0700199 ${gethpapolicy}= Catenate .*${OOF_POLICY_HPA_NAME}*
200 ${hpapolicy_name}= Create Dictionary oof_policy_name=${gethpapolicy}
DR695H1a207a42019-06-20 17:20:56 -0400201 ${output} = Apply Template policy ${GETOOF_TEMPLATE} ${hpapolicy_name}
Gary Wu9abb61c2018-09-27 10:38:50 -0700202 ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output}
203 Should Be Equal As Strings ${get_resp.status_code} 200
204
205Create Config VFW Policy
206 [Documentation] Create Config Policy
DR695H1a207a42019-06-20 17:20:56 -0400207 Create Environment policy ${CURDIR}
Gary Wu9abb61c2018-09-27 10:38:50 -0700208 ${randompolicyname} = Create Policy Name
209 ${policyname1}= Catenate com.${randompolicyname}_vFirewall
210 ${CONFIG_POLICY_VFW_NAME}= Set Test Variable ${policyname1}
211 ${configpolicy}= Create Dictionary policy_name=${policyname1}
DR695H1a207a42019-06-20 17:20:56 -0400212 ${output} = Apply Template policy ${CREATE_CONFIG_VFW_TEMPLATE} ${configpolicy}
Gary Wu9abb61c2018-09-27 10:38:50 -0700213 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
214 Should Be Equal As Strings ${put_resp.status_code} 200
215 [Return] ${policyname1}
216
217Create VPG SDNC Naming Policy
218 [Documentation] Create VPG SDNC Naming Policy
DR695H1a207a42019-06-20 17:20:56 -0400219 Create Environment policy ${CURDIR}
Gary Wu9abb61c2018-09-27 10:38:50 -0700220 ${randompolicyname} = Create Policy Name
221 ${policyname1}= Catenate com.${randompolicyname}_ONAP_vPG_Naming
222 ${SDNC_POLICY_VPG_NAME}= Set Test Variable ${policyname1}
223 ${sdncpolicy}= Create Dictionary policy_name=${policyname1}
DR695H1a207a42019-06-20 17:20:56 -0400224 ${output} = Apply Template policy ${CREATE_SDNC_VPG_TEMPLATE} ${sdncpolicy}
Gary Wu9abb61c2018-09-27 10:38:50 -0700225 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
226 Should Be Equal As Strings ${put_resp.status_code} 200
227 [Return] ${policyname1}
228
229Create VFW SDNC Naming Policy
230 [Documentation] Create VFW SDNC Naming Policy
DR695H1a207a42019-06-20 17:20:56 -0400231 Create Environment policy ${CURDIR}
Gary Wu9abb61c2018-09-27 10:38:50 -0700232 ${randompolicyname} = Create Policy Name
233 ${policyname1}= Catenate com.${randompolicyname}_ONAP_vFW_Naming
234 ${SDNC_POLICY_VFW_NAME}= Set Test Variable ${policyname1}
235 ${sdncpolicy}= Create Dictionary policy_name=${policyname1}
DR695H1a207a42019-06-20 17:20:56 -0400236 ${output} = Apply Template policy ${CREATE_SDNC_VFW_TEMPLATE} ${sdncpolicy}
Gary Wu9abb61c2018-09-27 10:38:50 -0700237 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
238 Should Be Equal As Strings ${put_resp.status_code} 200
239 [Return] ${policyname1}
240
241Create Policy Name
242 [Documentation] Generate Policy Name
243 [Arguments] ${prefix}=CSIT_
244 ${random}= Generate Random String 15 [LOWER][NUMBERS]
245 ${policyname}= Catenate ${prefix}${random}
246 [Return] ${policyname}
247
248Create Ops VFW Policy
249 [Documentation] Create Operational Policy
DR695H1a207a42019-06-20 17:20:56 -0400250 Create Environment policy ${CURDIR}
Gary Wu9abb61c2018-09-27 10:38:50 -0700251 ${randompolicyname} = Create Policy Name
252 ${policyname1}= Catenate com.${randompolicyname}_vFirewall
253 ${OPS_POLICY_VFW_NAME}= Set Test Variable ${policyname1}
254 ${dict}= Create Dictionary policy_name=${policyname1}
DR695H1a207a42019-06-20 17:20:56 -0400255 ${output} = Apply Template policy ${CREATE_OPS_VFW_TEMPLATE} ${dict}
Gary Wu9abb61c2018-09-27 10:38:50 -0700256 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
257 Log ${put_resp}
258 Should Be Equal As Strings ${put_resp.status_code} 200
259 [Return] ${policyname1}
260
261Push Ops Policy
262 [Documentation] Push Ops Policy
263 [Arguments] ${policyname} ${policytype}
DR695H1a207a42019-06-20 17:20:56 -0400264 Create Environment policy ${CURDIR}
Gary Wu9abb61c2018-09-27 10:38:50 -0700265 ${dict}= Create Dictionary policy_name=${policyname} policy_type=${policytype}
DR695H1a207a42019-06-20 17:20:56 -0400266 ${output} = Apply Template policy ${PUSH_POLICY_TEMPLATE} ${dict}
Gary Wu9abb61c2018-09-27 10:38:50 -0700267 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE_PUSH} ${output}
268 Should Be Equal As Strings ${put_resp.status_code} 200
269
270Push Config Policy
271 [Documentation] Push Config Policy
272 [Arguments] ${policyname} ${policytype}
DR695H1a207a42019-06-20 17:20:56 -0400273 Create Environment policy ${CURDIR}
Gary Wu9abb61c2018-09-27 10:38:50 -0700274 ${dict}= Create Dictionary policy_name=${policyname} policy_type=${policytype}
DR695H1a207a42019-06-20 17:20:56 -0400275 ${output} = Apply Template policy ${PUSH_POLICY_TEMPLATE} ${dict}
Gary Wu9abb61c2018-09-27 10:38:50 -0700276 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE_PUSH} ${output}
277 Should Be Equal As Strings ${put_resp.status_code} 200
278
279Delete Ops Policy
280 [Documentation] Delete Config Policy
281 [Arguments] ${policy_name}
DR695H1a207a42019-06-20 17:20:56 -0400282 Create Environment policy ${CURDIR}
Gary Wu9abb61c2018-09-27 10:38:50 -0700283 ${policyname3}= Catenate com.Config_BRMS_Param_${policyname}.1.xml
284 ${dict}= Create Dictionary policy_name=${policyname3}
DR695H1a207a42019-06-20 17:20:56 -0400285 ${output} = Apply Template policy ${DEL_POLICY_TEMPLATE} ${dict}
Gary Wu9abb61c2018-09-27 10:38:50 -0700286 ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output}
287 Should Be Equal As Strings ${put_resp.status_code} 200
288
289Delete Config Policy
290 [Documentation] Delete Ops Policy
291 [Arguments] ${policy_name}
DR695H1a207a42019-06-20 17:20:56 -0400292 Create Environment policy ${CURDIR}
Gary Wu9abb61c2018-09-27 10:38:50 -0700293 ${policyname3}= Catenate com.Config_MS_com.${policy_name}.1.xml
294 ${dict}= Create Dictionary policy_name=${policyname3}
DR695H1a207a42019-06-20 17:20:56 -0400295 ${output} = Apply Template policy ${DEL_POLICY_TEMPLATE} ${dict}
Gary Wu9abb61c2018-09-27 10:38:50 -0700296 ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output}
297 Should Be Equal As Strings ${put_resp.status_code} 200
298
299Delete OOF Policy
300 [Documentation] Delete OOF Policy
301 [Arguments] ${policy_name}
DR695H1a207a42019-06-20 17:20:56 -0400302 Create Environment policy ${CURDIR}
Gary Wu9abb61c2018-09-27 10:38:50 -0700303 ${policyname3}= Catenate com.Config_OOF_${policy_name}.1.xml
304 ${dict}= Create Dictionary policy_name=${policyname3}
DR695H1a207a42019-06-20 17:20:56 -0400305 ${output} = Apply Template policy ${DEL_POLICY_TEMPLATE} ${dict}
Gary Wu9abb61c2018-09-27 10:38:50 -0700306 ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output}
307 Should Be Equal As Strings ${put_resp.status_code} 200
308
309Get Configs VDNS Policy
310 [Documentation] Get Config Policy for VDNS
DR695H1a207a42019-06-20 17:20:56 -0400311 Create Environment policy ${CURDIR}
Gary Wu9abb61c2018-09-27 10:38:50 -0700312 ${getconfigpolicy}= Catenate .*${CONFIG_POLICY_VDNS_NAME}*
313 ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy}
DR695H1a207a42019-06-20 17:20:56 -0400314 ${output} = Apply Template policy ${GETCONFIG_TEMPLATE} ${configpolicy_name}
Gary Wu9abb61c2018-09-27 10:38:50 -0700315 ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output}
316 Should Be Equal As Strings ${get_resp.status_code} 200
317
318Create Config VDNS Policy
319 [Documentation] Create Config Policy
DR695H1a207a42019-06-20 17:20:56 -0400320 Create Environment policy ${CURDIR}
Gary Wu9abb61c2018-09-27 10:38:50 -0700321 ${randompolicyname} = Create Policy Name
322 ${policyname1}= Catenate com.${randompolicyname}_vLoadBalancer
323 ${CONFIG_POLICY_VDNS_NAME}= Set Test Variable ${policyname1}
324 ${configpolicy}= Create Dictionary policy_name=${policyname1}
DR695H1a207a42019-06-20 17:20:56 -0400325 ${output} = Apply Template policy ${CREATE_CONFIG_VDNS_TEMPLATE} ${configpolicy}
Gary Wu9abb61c2018-09-27 10:38:50 -0700326 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
327 Should Be Equal As Strings ${put_resp.status_code} 200
328 [Return] ${policyname1}
329
330Create Ops VDNS Policy
331 [Documentation] Create Operational Policy
DR695H1a207a42019-06-20 17:20:56 -0400332 Create Environment policy ${CURDIR}
Gary Wu9abb61c2018-09-27 10:38:50 -0700333 ${randompolicyname} = Create Policy Name
334 ${policyname1}= Catenate com.${randompolicyname}_vLoadBalancer
335 ${OPS_POLICY_VDNS_NAME}= Set Test Variable ${policyname1}
336 ${dict}= Create Dictionary policy_name=${policyname1}
DR695H1a207a42019-06-20 17:20:56 -0400337 ${output} = Apply Template policy ${CREATE_OPS_VDNS_TEMPLATE} ${dict}
Gary Wu9abb61c2018-09-27 10:38:50 -0700338 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
339 Log ${put_resp}
340 Should Be Equal As Strings ${put_resp.status_code} 200
341 [Return] ${policyname1}
342
343Create Config VCPE Policy
344 [Documentation] Create Config Policy
DR695H1a207a42019-06-20 17:20:56 -0400345 Create Environment policy ${CURDIR}
Gary Wu9abb61c2018-09-27 10:38:50 -0700346 ${randompolicyname} = Create Policy Name
347 ${policyname1}= Catenate com.${randompolicyname}_vCPE
348 ${CONFIG_POLICY_VCPE_NAME}= Set Test Variable ${policyname1}
349 ${configpolicy}= Create Dictionary policy_name=${policyname1}
DR695H1a207a42019-06-20 17:20:56 -0400350 ${output} = Apply Template policy ${CREATE_CONFIG_VCPE_TEMPLATE} ${configpolicy}
Gary Wu9abb61c2018-09-27 10:38:50 -0700351 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
352 Should Be Equal As Strings ${put_resp.status_code} 200
353 [Return] ${policyname1}
354
355Get Configs VCPE Policy
356 [Documentation] Get Config Policy for VCPE
DR695H1a207a42019-06-20 17:20:56 -0400357 Create Environment policy ${CURDIR}
Gary Wu9abb61c2018-09-27 10:38:50 -0700358 ${getconfigpolicy}= Catenate .*${CONFIG_POLICY_VCPE_NAME}*
359 ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy}
DR695H1a207a42019-06-20 17:20:56 -0400360 ${output} = Apply Template policy ${GETCONFIG_TEMPLATE} ${configpolicy_name}
Gary Wu9abb61c2018-09-27 10:38:50 -0700361 ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output}
362 Should Be Equal As Strings ${get_resp.status_code} 200
363
364Create Ops vCPE Policy
365 [Documentation] Create Operational Policy
DR695H1a207a42019-06-20 17:20:56 -0400366 Create Environment policy ${CURDIR}
Gary Wu9abb61c2018-09-27 10:38:50 -0700367 ${randompolicyname} = Create Policy Name
368 ${policyname1}= Catenate com.${randompolicyname}_vCPE
369 ${OPS_POLICY_VCPE_NAME}= Set Test Variable ${policyname1}
370 ${dict}= Create Dictionary policy_name=${policyname1}
DR695H1a207a42019-06-20 17:20:56 -0400371 ${output} = Apply Template policy ${CREATE_OPS_VCPE_TEMPLATE} ${dict}
Gary Wu9abb61c2018-09-27 10:38:50 -0700372 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
373 Log ${put_resp}
374 Should Be Equal As Strings ${put_resp.status_code} 200
375 [Return] ${policyname1}
376
377Create Ops VolTE Policy
378 [Documentation] Create Operational Policy
DR695H1a207a42019-06-20 17:20:56 -0400379 Create Environment policy ${CURDIR}
Gary Wu9abb61c2018-09-27 10:38:50 -0700380 ${randompolicyname} = Create Policy Name
381 ${policyname1}= Catenate com.${randompolicyname}_VoLTE
382 ${dict}= Create Dictionary policy_name=${policyname1}
DR695H1a207a42019-06-20 17:20:56 -0400383 ${output} = Apply Template policy ${CREATE_OPS_VOLTE_TEMPLATE} ${dict}
Gary Wu9abb61c2018-09-27 10:38:50 -0700384 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
385 Log ${put_resp}
386 Should Be Equal As Strings ${put_resp.status_code} 200
387 [Return] ${policyname1}
388
389Upload DRL file
390 [Documentation] Upload DRL file1
391 ${file_data}= Get Binary File ${file_path}
392 ${files}= Create Dictionary file=${file_data}
393 #${CONFIG_POLICY_VDNS_NAME}= Set Test Variable ${policyname1}
394 # ${files2} = {'file': open('../testsuite/robot/assets/templates/ControlLoopDemo__closedLoopControlName.drl', 'rb')}
395 # ${files}= Create Dictionary file ${file_data}
396 ${put_resp} = Run Policy Post form Request ${RESOURCE_PATH_UPLOAD} ${files}
397 Should Be Equal As Strings ${put_resp.status_code} 200
HOCKLA3e332f42019-02-20 09:32:19 -0600398
399ListPolicy test
400 [Documentation] Listing Config Policies
401 [Arguments] ${policy_name}
DR695H1a207a42019-06-20 17:20:56 -0400402 Create Environment policy ${CURDIR}
HOCKLA3e332f42019-02-20 09:32:19 -0600403 ${dict}= Create Dictionary policy_name=${policy_name}
DR695H1a207a42019-06-20 17:20:56 -0400404 ${output} = Apply Template policy ${LISTPOLICY_TEMPLATE} ${dict}
HOCKLA3e332f42019-02-20 09:32:19 -0600405 ${put_resp} = policy_interface.Run Policy Post Request ${RESOURCE_PATH_LISTPOLICY} ${output}
406 Should Be Equal As Strings ${put_resp.status_code} 200
407
HOCKLA092093d2019-04-05 13:00:50 -0500408Push Multiple Policy test
409 [Documentation] Push Multiple Policy
410 [Arguments] ${policyname1} ${policyname2} ${policyname3} ${policytype}
DR695H1a207a42019-06-20 17:20:56 -0400411 Create Environment policy ${CURDIR}
HOCKLA092093d2019-04-05 13:00:50 -0500412 ${dict}= Create Dictionary policy_name1=${policyname1} policy_name2=${policyname2} policy_name3=${policyname3} policy_type=${policytype}
DR695H1a207a42019-06-20 17:20:56 -0400413 ${output} = Apply Template policy ${MULTIPLE_PUSH_POLICY_TEMPLATE} ${dict}
HOCKLA092093d2019-04-05 13:00:50 -0500414 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE_PUSH} ${output}
415 Should Be Equal As Strings ${put_resp.status_code} 200
416
417Delete Multiple Policy test
418 [Documentation] Delete Multiple Policy
419 [Arguments] ${policyname1} ${policyname2} ${policyname3} ${policytype}
DR695H1a207a42019-06-20 17:20:56 -0400420 Create Environment policy ${CURDIR}
HOCKLA092093d2019-04-05 13:00:50 -0500421 ${dict}= Create Dictionary policy_name1=${policyname1} policy_name2=${policyname2} policy_name3=${policyname3} policy_type=${policytype}
DR695H1a207a42019-06-20 17:20:56 -0400422 ${output} = Apply Template policy ${MULTIPLE_UNPUSH_POLICY_TEMPLATE} ${dict}
HOCKLA092093d2019-04-05 13:00:50 -0500423 ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output}
424 Should Be Equal As Strings ${put_resp.status_code} 200
425