ma987d | e38164b | 2017-09-28 16:33:03 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Policy ONAP CSIT Test cases |
| 3 | Library String |
| 4 | Library HttpLibrary.HTTP |
| 5 | LIbrary Process |
RAJU | 3f5fd66 | 2017-10-11 15:50:00 -0500 | [diff] [blame^] | 6 | Library BuiltIn |
ma987d | e38164b | 2017-09-28 16:33:03 -0500 | [diff] [blame] | 7 | Resource policy_interface.robot |
| 8 | Resource json_templater.robot |
| 9 | |
| 10 | *** Variables *** |
RAJU | 39e2774 | 2017-10-05 10:03:36 -0500 | [diff] [blame] | 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 |
ma987d | e38164b | 2017-09-28 16:33:03 -0500 | [diff] [blame] | 15 | ${CREATE_CONFIG_VFW_TEMPLATE} ${CURDIR}/configpolicy_vFW.template |
| 16 | ${CREATE_CONFIG_VDNS_TEMPLATE} ${CURDIR}/configpolicy_vDNS.template |
| 17 | ${CREATE_CONFIG_VCPE_TEMPLATE} ${CURDIR}/configpolicy_vCPE.template |
RAJU | 39e2774 | 2017-10-05 10:03:36 -0500 | [diff] [blame] | 18 | ${CREATE_OPS_VFW_TEMPLATE} ${CURDIR}/opspolicy_VFW_R1.template |
ma987d | e38164b | 2017-09-28 16:33:03 -0500 | [diff] [blame] | 19 | ${PUSH_POLICY_TEMPLATE} ${CURDIR}/pushpolicy.template |
RAJU | 39e2774 | 2017-10-05 10:03:36 -0500 | [diff] [blame] | 20 | ${CREATE_OPS_VDNS_TEMPLATE} ${CURDIR}/opspolicy_VDNS_R1.template |
ma987d | e38164b | 2017-09-28 16:33:03 -0500 | [diff] [blame] | 21 | ${DEL_POLICY_TEMPLATE} ${CURDIR}/deletepolicy.template |
| 22 | ${GETCONFIG_TEMPLATE} ${CURDIR}/getconfigpolicy.template |
| 23 | ${CONFIG_POLICY_VFW_NAME} vFirewall |
| 24 | ${CONFIG_POLICY_VFW_TYPE} MicroService |
| 25 | ${CONFIG_POLICY_VDNS_NAME} vLoadBalancer |
| 26 | ${CONFIG_POLICY_VDNS_TYPE} MicroService |
| 27 | ${OPS_POLICY_VFW_NAME} vFirewall |
| 28 | ${OPS_POLICY_VFW_TYPE} BRMS_PARAM |
| 29 | ${OPS_POLICY_VDNS_NAME} vLoadBalancer |
| 30 | ${OPS_POLICY_VDNS_TYPE} BRMS_PARAM |
| 31 | ${CONFIG_POLICY_VCPE_NAME} vCPE |
| 32 | ${CONFIG_POLICY_VCPE_TYPE} MicroService |
| 33 | ${OPS_POLICY_VCPE_NAME} vCPE |
| 34 | ${OPS_POLICY_VCPE_TYPE} BRMS_PARAM |
| 35 | ${OPS_POLICY_VOLTE_NAME} VoLTE |
| 36 | ${OPS_POLICY_VOLTE_TYPE} BRMS_PARAM |
| 37 | ${file_path} ../testsuite/robot/assets/templates/ControlLoopDemo__closedLoopControlName.drl |
| 38 | ${RESOURCE_PATH_UPLOAD} /pdp/api/policyEngineImport?importParametersJson=%7B%22serviceName%22%3A%22Manyu456%22%2C%20%22serviceType%22%3A%22BRMSPARAM%22%7D |
| 39 | ${CREATE_OPS_VCPE_TEMPLATE} ${CURDIR}/opspolicy_vCPE.template |
| 40 | ${CREATE_OPS_VOLTE_TEMPLATE} ${CURDIR}/opspolicy_vOLTE.template |
| 41 | |
| 42 | |
| 43 | *** Test Cases *** |
| 44 | Policy Health check |
| 45 | Run Policy Health Check |
| 46 | |
| 47 | VFW Config Policy |
| 48 | ${CONFIG_POLICY_VFW_NAME}= Create Config VFW Policy |
RAJU | 3f5fd66 | 2017-10-11 15:50:00 -0500 | [diff] [blame^] | 49 | Push Config Policy ${CONFIG_POLICY_VFW_NAME} ${CONFIG_POLICY_VFW_TYPE} |
ma987d | e38164b | 2017-09-28 16:33:03 -0500 | [diff] [blame] | 50 | #VFW Policy Tests |
| 51 | |
| 52 | VDNS Config Policy |
| 53 | ${CONFIG_POLICY_VDNS_NAME}= Create Config VDNS Policy |
| 54 | Push Config Policy ${CONFIG_POLICY_VDNS_NAME} ${CONFIG_POLICY_VDNS_TYPE} |
RAJU | 3f5fd66 | 2017-10-11 15:50:00 -0500 | [diff] [blame^] | 55 | #VDNS Policy Tests |
| 56 | |
ma987d | e38164b | 2017-09-28 16:33:03 -0500 | [diff] [blame] | 57 | VCPE Config Policy |
| 58 | ${CONFIG_POLICY_VCPE_NAME}= Create Config VCPE Policy |
| 59 | Push Config Policy ${CONFIG_POLICY_VCPE_NAME} ${CONFIG_POLICY_VCPE_TYPE} |
| 60 | #VCPE Policy Tests |
RAJU | 3f5fd66 | 2017-10-11 15:50:00 -0500 | [diff] [blame^] | 61 | |
RAJU | 39e2774 | 2017-10-05 10:03:36 -0500 | [diff] [blame] | 62 | VFW Ops Policy |
| 63 | ${OPS_POLICY_VFW_NAME}= Create Ops VFW Policy |
| 64 | Push Ops Policy ${OPS_POLICY_VFW_NAME} ${OPS_POLICY_VFW_TYPE} |
| 65 | |
| 66 | VDNS Ops Policy |
| 67 | ${OPS_POLICY_VDNS_NAME}= Create Ops VDNS Policy |
| 68 | Push Ops Policy ${OPS_POLICY_VDNS_NAME} ${OPS_POLICY_VDNS_TYPE} |
| 69 | |
| 70 | VCPE Ops Policy |
| 71 | ${OPS_POLICY_VCPE_NAME}= Create Ops VCPE Policy |
| 72 | Push Ops Policy ${OPS_POLICY_VCPE_NAME} ${OPS_POLICY_VCPE_TYPE} |
| 73 | |
| 74 | VOLTE Ops Policy |
| 75 | ${OPS_POLICY_VOLTE_NAME}= Create Ops VOLTE Policy |
| 76 | Push Ops Policy ${OPS_POLICY_VOLTE_NAME} ${OPS_POLICY_VOLTE_TYPE} |
ma987d | e38164b | 2017-09-28 16:33:03 -0500 | [diff] [blame] | 77 | #VOLTE Policy Tests |
RAJU | 3f5fd66 | 2017-10-11 15:50:00 -0500 | [diff] [blame^] | 78 | VFW Get Configs Policy |
| 79 | Sleep 5s |
| 80 | Get Configs VFW Policy |
| 81 | |
| 82 | VDNS Get Configs Policy |
| 83 | Sleep 5s |
| 84 | Get Configs VDNS Policy |
| 85 | |
| 86 | VCPE Get Configs Policy |
| 87 | Sleep 5s |
| 88 | Get Configs VCPE Policy |
ma987d | e38164b | 2017-09-28 16:33:03 -0500 | [diff] [blame] | 89 | |
| 90 | *** Keywords *** |
| 91 | |
| 92 | VFW Policy Tests |
| 93 | ${CONFIG_POLICY_VFW_NAME}= Create Config VFW Policy |
| 94 | Push Config Policy ${CONFIG_POLICY_VFW_NAME} ${CONFIG_POLICY_VFW_TYPE} |
| 95 | Get Configs VFW Policy |
| 96 | ${OPS_POLICY_VFW_NAME}= Create Ops VFW Policy |
| 97 | Push Ops Policy ${OPS_POLICY_VFW_NAME} ${OPS_POLICY_VFW_TYPE} |
| 98 | |
| 99 | VDNS Policy Tests |
| 100 | ${CONFIG_POLICY_VDNS_NAME}= Create Config VDNS Policy |
| 101 | Push Config Policy ${CONFIG_POLICY_VDNS_NAME} ${CONFIG_POLICY_VDNS_TYPE} |
| 102 | Get Configs VDNS Policy |
| 103 | ${OPS_POLICY_VDNS_NAME}= Create Ops VDNS Policy |
| 104 | Push Ops Policy ${OPS_POLICY_VDNS_NAME} ${OPS_POLICY_VDNS_TYPE} |
| 105 | |
| 106 | VCPE Policy Tests |
| 107 | ${CONFIG_POLICY_VCPE_NAME}= Create Config VCPE Policy |
| 108 | Push Config Policy ${CONFIG_POLICY_VCPE_NAME} ${CONFIG_POLICY_VCPE_TYPE} |
| 109 | Get Configs VCPE Policy |
| 110 | ${OPS_POLICY_VCPE_NAME}= Create Ops VCPE Policy |
| 111 | Push Ops Policy ${OPS_POLICY_VCPE_NAME} ${OPS_POLICY_VCPE_TYPE} |
| 112 | |
| 113 | VOLTE Policy Tests |
| 114 | ${OPS_POLICY_VOLTE_NAME}= Create Ops VOLTE Policy |
| 115 | Push Ops Policy ${OPS_POLICY_VOLTE_NAME} ${OPS_POLICY_VOLTE_TYPE} |
| 116 | |
| 117 | Get Configs VFW Policy |
| 118 | [Documentation] Get Config Policy for VFW |
| 119 | ${getconfigpolicy}= Catenate .*${CONFIG_POLICY_VFW_NAME}* |
| 120 | ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy} |
| 121 | ${output} = Fill JSON Template File ${GETCONFIG_TEMPLATE} ${configpolicy_name} |
| 122 | ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output} |
| 123 | Should Be Equal As Strings ${get_resp.status_code} 200 |
| 124 | |
| 125 | Create Config VFW Policy |
| 126 | [Documentation] Create Config Policy |
| 127 | ${randompolicyname} = Create Policy Name |
| 128 | ${policyname1}= Catenate com.${randompolicyname}_vFirewall |
| 129 | ${CONFIG_POLICY_VFW_NAME}= Set Test Variable ${policyname1} |
| 130 | ${configpolicy}= Create Dictionary policy_name=${policyname1} |
| 131 | ${output} = Fill JSON Template File ${CREATE_CONFIG_VFW_TEMPLATE} ${configpolicy} |
| 132 | ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} |
| 133 | Should Be Equal As Strings ${put_resp.status_code} 200 |
| 134 | [Return] ${policyname1} |
| 135 | |
| 136 | Create Policy Name |
| 137 | [Documentation] Generate Policy Name |
| 138 | [Arguments] ${prefix}=CSIT_ |
| 139 | ${random}= Generate Random String 15 [LOWER][NUMBERS] |
| 140 | ${policyname}= Catenate ${prefix}${random} |
| 141 | [Return] ${policyname} |
| 142 | |
| 143 | Create Ops VFW Policy |
| 144 | [Documentation] Create Opertional Policy |
| 145 | ${randompolicyname} = Create Policy Name |
| 146 | ${policyname1}= Catenate com.${randompolicyname}_vFirewall |
| 147 | ${OPS_POLICY_VFW_NAME}= Set Test Variable ${policyname1} |
| 148 | ${dict}= Create Dictionary policy_name=${policyname1} |
| 149 | ${output} = Fill JSON Template File ${CREATE_OPS_VFW_TEMPLATE} ${dict} |
| 150 | ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} |
| 151 | Log ${put_resp} |
| 152 | Should Be Equal As Strings ${put_resp.status_code} 200 |
| 153 | [Return] ${policyname1} |
| 154 | |
| 155 | Push Ops Policy |
| 156 | [Documentation] Push Ops Policy |
| 157 | [Arguments] ${policyname} ${policytype} |
| 158 | ${dict}= Create Dictionary policy_name=${policyname} policy_type=${policytype} |
| 159 | ${output} = Fill JSON Template File ${PUSH_POLICY_TEMPLATE} ${dict} |
| 160 | ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE_PUSH} ${output} |
| 161 | Should Be Equal As Strings ${put_resp.status_code} 200 |
| 162 | |
| 163 | Push Config Policy |
| 164 | [Documentation] Push Config Policy |
| 165 | [Arguments] ${policyname} ${policytype} |
| 166 | ${dict}= Create Dictionary policy_name=${policyname} policy_type=${policytype} |
| 167 | ${output} = Fill JSON Template File ${PUSH_POLICY_TEMPLATE} ${dict} |
| 168 | ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE_PUSH} ${output} |
| 169 | Should Be Equal As Strings ${put_resp.status_code} 200 |
| 170 | |
| 171 | Delete Ops Policy |
| 172 | [Documentation] Delete Config Policy |
| 173 | [Arguments] ${policy_name} |
| 174 | ${policyname3}= Catenate com.Config_BRMS_Param_${policyname}.1.xml |
| 175 | ${dict}= Create Dictionary policy_name=${policyname3} |
| 176 | ${output} = Fill JSON Template ${DEL_POLICY_TEMPLATE} ${dict} |
| 177 | ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output} |
| 178 | Should Be Equal As Strings ${put_resp.status_code} 200 |
| 179 | |
| 180 | Delete Config Policy |
| 181 | [Documentation] Delete Ops Policy |
| 182 | [Arguments] ${policy_name} |
| 183 | ${policyname3}= Catenate com.Config_MS_com.${policy_name}.1.xml |
| 184 | ${dict}= Create Dictionary policy_name=${policyname3} |
| 185 | ${output} = Fill JSON Template ${DEL_POLICY_TEMPLATE} ${dict} |
| 186 | ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output} |
| 187 | Should Be Equal As Strings ${put_resp.status_code} 200 |
| 188 | |
| 189 | Get Configs VDNS Policy |
| 190 | [Documentation] Get Config Policy for VDNS |
| 191 | ${getconfigpolicy}= Catenate .*${CONFIG_POLICY_VDNS_NAME}* |
| 192 | ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy} |
| 193 | ${output} = Fill JSON Template File ${GETCONFIG_TEMPLATE} ${configpolicy_name} |
| 194 | ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output} |
| 195 | Should Be Equal As Strings ${get_resp.status_code} 200 |
| 196 | |
| 197 | Create Config VDNS Policy |
| 198 | [Documentation] Create Config Policy |
| 199 | ${randompolicyname} = Create Policy Name |
| 200 | ${policyname1}= Catenate com.${randompolicyname}_vLoadBalancer |
| 201 | ${CONFIG_POLICY_VDNS_NAME}= Set Test Variable ${policyname1} |
| 202 | ${configpolicy}= Create Dictionary policy_name=${policyname1} |
| 203 | ${output} = Fill JSON Template File ${CREATE_CONFIG_VDNS_TEMPLATE} ${configpolicy} |
| 204 | ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} |
| 205 | Should Be Equal As Strings ${put_resp.status_code} 200 |
| 206 | [Return] ${policyname1} |
| 207 | |
| 208 | Create Ops VDNS Policy |
| 209 | [Documentation] Create Opertional Policy |
| 210 | ${randompolicyname} = Create Policy Name |
| 211 | ${policyname1}= Catenate com.${randompolicyname}_vLoadBalancer |
| 212 | ${OPS_POLICY_VDNS_NAME}= Set Test Variable ${policyname1} |
| 213 | ${dict}= Create Dictionary policy_name=${policyname1} |
| 214 | ${output} = Fill JSON Template File ${CREATE_OPS_VDNS_TEMPLATE} ${dict} |
| 215 | ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} |
| 216 | Log ${put_resp} |
| 217 | Should Be Equal As Strings ${put_resp.status_code} 200 |
| 218 | [Return] ${policyname1} |
| 219 | |
| 220 | Create Config VCPE Policy |
| 221 | [Documentation] Create Config Policy |
| 222 | ${randompolicyname} = Create Policy Name |
| 223 | ${policyname1}= Catenate com.${randompolicyname}_vFirewall |
| 224 | ${CONFIG_POLICY_VCPE_NAME}= Set Test Variable ${policyname1} |
| 225 | ${configpolicy}= Create Dictionary policy_name=${policyname1} |
| 226 | ${output} = Fill JSON Template File ${CREATE_CONFIG_VCPE_TEMPLATE} ${configpolicy} |
| 227 | ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} |
| 228 | Should Be Equal As Strings ${put_resp.status_code} 200 |
| 229 | [Return] ${policyname1} |
| 230 | |
| 231 | Get Configs VCPE Policy |
| 232 | [Documentation] Get Config Policy for VCPE |
| 233 | ${getconfigpolicy}= Catenate .*${CONFIG_POLICY_VCPE_NAME}* |
| 234 | ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy} |
| 235 | ${output} = Fill JSON Template File ${GETCONFIG_TEMPLATE} ${configpolicy_name} |
| 236 | ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output} |
| 237 | Should Be Equal As Strings ${get_resp.status_code} 200 |
| 238 | |
| 239 | Create Ops vCPE Policy |
| 240 | [Documentation] Create Opertional Policy |
| 241 | ${randompolicyname} = Create Policy Name |
| 242 | ${policyname1}= Catenate com.${randompolicyname} |
RAJU | 39e2774 | 2017-10-05 10:03:36 -0500 | [diff] [blame] | 243 | ${OPS_POLICY_VCPE_NAME}= Set Test Variable ${policyname1} |
| 244 | ${dict}= Create Dictionary policy_name=${policyname1} |
ma987d | e38164b | 2017-09-28 16:33:03 -0500 | [diff] [blame] | 245 | ${output} = Fill JSON Template File ${CREATE_OPS_VCPE_TEMPLATE} ${dict} |
| 246 | ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} |
| 247 | Log ${put_resp} |
| 248 | Should Be Equal As Strings ${put_resp.status_code} 200 |
RAJU | 39e2774 | 2017-10-05 10:03:36 -0500 | [diff] [blame] | 249 | [Return] ${policyname1} |
ma987d | e38164b | 2017-09-28 16:33:03 -0500 | [diff] [blame] | 250 | |
| 251 | Create Ops VolTE Policy |
| 252 | [Documentation] Create Opertional Policy |
| 253 | ${randompolicyname} = Create Policy Name |
RAJU | 39e2774 | 2017-10-05 10:03:36 -0500 | [diff] [blame] | 254 | ${policyname1}= Catenate com.${randompolicyname} |
| 255 | ${dict}= Create Dictionary policy_name=${policyname1} |
ma987d | e38164b | 2017-09-28 16:33:03 -0500 | [diff] [blame] | 256 | ${output} = Fill JSON Template File ${CREATE_OPS_VOLTE_TEMPLATE} ${dict} |
| 257 | ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} |
| 258 | Log ${put_resp} |
| 259 | Should Be Equal As Strings ${put_resp.status_code} 200 |
RAJU | 39e2774 | 2017-10-05 10:03:36 -0500 | [diff] [blame] | 260 | [Return] ${policyname1} |
ma987d | e38164b | 2017-09-28 16:33:03 -0500 | [diff] [blame] | 261 | |
| 262 | Upload DRL file |
| 263 | [Documentation] Upload DRL file1 |
| 264 | ${file_data}= Get Binary File ${file_path} |
| 265 | ${files}= Create Dictionary file=${file_data} |
| 266 | #${CONFIG_POLICY_VDNS_NAME}= Set Test Variable ${policyname1} |
| 267 | # ${files2} = {'file': open('../testsuite/robot/assets/templates/ControlLoopDemo__closedLoopControlName.drl', 'rb')} |
| 268 | # ${files}= Create Dictionary file ${file_data} |
| 269 | ${put_resp} = Run Policy Post form Request ${RESOURCE_PATH_UPLOAD} ${files} |
| 270 | Should Be Equal As Strings ${put_resp.status_code} 200 |