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