DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Policy Closed Loop Test cases |
| 3 | |
Brian Freeman | 20f11e4 | 2018-07-26 13:55:28 -0500 | [diff] [blame] | 4 | Resource ../policy_interface.robot |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 5 | Resource ../stack_validation/policy_check_vfw.robot |
Brian Freeman | 20f11e4 | 2018-07-26 13:55:28 -0500 | [diff] [blame] | 6 | Resource ../stack_validation/packet_generator_interface.robot |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 7 | Resource vnf_orchestration_test_template.robot |
Brian Freeman | 20f11e4 | 2018-07-26 13:55:28 -0500 | [diff] [blame] | 8 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 9 | Library String |
| 10 | Library HttpLibrary.HTTP |
| 11 | LIbrary Process |
| 12 | |
| 13 | *** Variables *** |
Jerry Flood | a9ee25c | 2017-05-31 14:50:37 -0400 | [diff] [blame] | 14 | ${RESOURCE_PATH_CREATE} /pdp/createPolicy |
| 15 | ${RESOURCE_PATH_CREATE_PUSH} /pdp/pushPolicy |
| 16 | ${RESOURCE_PATH_CREATE_DELETE} /pdp/deletePolicy |
| 17 | ${RESOURCE_PATH_GET_CONFIG} /pdp/getConfig |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 18 | ${CREATE_CONFIG_TEMPLATE} robot/assets/templates/policy/closedloop_configpolicy.template |
| 19 | ${CREATE_OPS_TEMPLATE} robot/assets/templates/policy/closedloop_opspolicy.template |
| 20 | ${PUSH_POLICY_TEMPLATE} robot/assets/templates/policy/closedloop_pushpolicy.template |
| 21 | ${DEL_POLICY_TEMPLATE} robot/assets/templates/policy/closedloop_deletepolicy.template |
| 22 | ${GECONFIG_VFW_TEMPLATE} robot/assets/templates/policy/closedloop_getconfigpolicy.template |
| 23 | |
| 24 | # 'Normal' number of pg streams that will be set when policy is triggered |
| 25 | ${VFWPOLICYRATE} 5 |
| 26 | |
| 27 | # Max nslookup requests per second before triggering event. |
| 28 | ${VLBPOLICYRATE} 20 |
| 29 | |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 30 | ${CONFIG_POLICY_NAME} vFirewall |
| 31 | ${CONFIG_POLICY_TYPE} Unknown |
| 32 | ${OPS_POLICY_NAME} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 33 | ${OPS_POLICY_TYPE} BRMS_PARAM |
| 34 | |
| 35 | # VFW low threshold |
| 36 | ${Expected_Severity_1} MAJOR |
| 37 | ${Expected_Threshold_1} 300 |
| 38 | ${Expected_Direction_1} LESS_OR_EQUAL |
| 39 | |
| 40 | # VFW high threshold |
| 41 | ${Expected_Severity_2} CRITICAL |
| 42 | ${Expected_Threshold_2} 700 |
| 43 | ${Expected_Direction_2} GREATER_OR_EQUAL |
| 44 | |
| 45 | # VDNS High threshold |
| 46 | ${Expected_Severity_3} MAJOR |
| 47 | ${Expected_Threshold_3} 200 |
| 48 | ${Expected_Direction_3} GREATER_OR_EQUAL |
| 49 | |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 50 | #********** Test Case Variables ************ |
| 51 | ${DNSSCALINGSTACK} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 52 | |
| 53 | *** Keywords *** |
| 54 | VFW Policy |
| 55 | Log Suite name ${SUITE NAME} ${TEST NAME} ${PREV TEST NAME} |
| 56 | Initialize VFW Policy |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 57 | ${stackname}= Orchestrate VNF vFW closedloop |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 58 | Policy Check Firewall Stack ${stackname} ${VFWPOLICYRATE} |
Jerry Flood | 8877bca | 2017-03-14 07:34:41 -0400 | [diff] [blame] | 59 | Delete VNF |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 60 | |
| 61 | VDNS Policy |
| 62 | Initialize VDNS Policy |
| 63 | ${stackname}= Orchestrate VNF vDNS closedloop |
| 64 | ${dnsscaling}= Policy Check vLB Stack ${stackname} ${VLBPOLICYRATE} |
| 65 | Set Test Variable ${DNSSCALINGSTACK} ${dnsscaling} |
Jerry Flood | 8877bca | 2017-03-14 07:34:41 -0400 | [diff] [blame] | 66 | Delete VNF |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 67 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 68 | Initialize VFW Policy |
| 69 | # Create Config Policy |
| 70 | # Push Config Policy ${CONFIG_POLICY_NAME} ${CONFIG_POLICY_TYPE} |
| 71 | # Create Ops Policy |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 72 | # Push Ops Policy ${OPS_POLICY_NAME} ${OPS_POLICY_TYPE} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 73 | Get Configs VFW Policy |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 74 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 75 | Initialize VDNS Policy |
| 76 | Get Configs VDNS Policy |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 77 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 78 | Get Configs VFW Policy |
| 79 | [Documentation] Get Config Policy for VFW |
| 80 | ${getconfigpolicy}= Catenate .*${CONFIG_POLICY_NAME}* |
| 81 | ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy} |
| 82 | ${output} = Fill JSON Template File ${GECONFIG_VFW_TEMPLATE} ${configpolicy_name} |
| 83 | ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output} |
| 84 | Should Be Equal As Strings ${get_resp.status_code} 200 |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 85 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 86 | ${json}= Parse Json ${get_resp.content} |
| 87 | ${config}= Parse Json ${json[0]["config"]} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 88 | |
| 89 | # Extract object1 from Array |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 90 | ${severity}= Get Variable Value ${config["content"]["thresholds"][0]["severity"]} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 91 | Should Be Equal ${severity} ${Expected_Severity_1} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 92 | ${Thresold_Value}= Get Variable Value ${config["content"]["thresholds"][0]["thresholdValue"]} |
Gary Wu | 8067611 | 2018-03-20 13:22:17 -0700 | [diff] [blame] | 93 | Should Be Equal As Integers ${Thresold_Value} ${Expected_Threshold_1} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 94 | ${direction}= Get Variable Value ${config["content"]["thresholds"][0]["direction"]} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 95 | Should Be Equal ${direction} ${Expected_Direction_1} |
| 96 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 97 | # Extract object2 from Array |
| 98 | ${severity_1}= Get Variable Value ${config["content"]["thresholds"][1]["severity"]} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 99 | Should Be Equal ${severity_1} ${Expected_Severity_2} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 100 | ${Thresold_Value_1}= Get Variable Value ${config["content"]["thresholds"][1]["thresholdValue"]} |
Gary Wu | 8067611 | 2018-03-20 13:22:17 -0700 | [diff] [blame] | 101 | Should Be Equal As Integers ${Thresold_Value_1} ${Expected_Threshold_2} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 102 | ${direction_1}= Get Variable Value ${config["content"]["thresholds"][1]["direction"]} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 103 | Should Be Equal ${direction_1} ${Expected_Direction_2} |
| 104 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 105 | Get Configs VDNS Policy |
| 106 | [Documentation] Get Config Policy for VDNS |
Gary Wu | 7cfa85a | 2018-03-20 11:36:23 -0700 | [diff] [blame] | 107 | ${getconfigpolicy}= Catenate .*MicroServicevDNS* |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 108 | ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy} |
| 109 | ${output} = Fill JSON Template File ${GECONFIG_VFW_TEMPLATE} ${configpolicy_name} |
| 110 | ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output} |
| 111 | Should Be Equal As Strings ${get_resp.status_code} 200 |
| 112 | ${json}= Parse Json ${get_resp.content} |
| 113 | ${config}= Parse Json ${json[0]["config"]} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 114 | |
| 115 | # Extract object1 from Array |
Pamela Dragosh | 51b6f5c | 2018-03-20 12:56:35 -0400 | [diff] [blame] | 116 | ${severity}= Get Variable Value ${config["content"]["tca_policy"]["metricsPerEventName"][0]["thresholds"][0]["severity"]} |
| 117 | Should Be Equal ${severity} ${Expected_Severity_2} |
| 118 | ${Thresold_Value}= Get Variable Value ${config["content"]["tca_policy"]["metricsPerEventName"][0]["thresholds"][0]["thresholdValue"]} |
Gary Wu | 8067611 | 2018-03-20 13:22:17 -0700 | [diff] [blame] | 119 | Should Be Equal As Integers ${Thresold_Value} ${Expected_Threshold_1} |
DR695H | ce07d41 | 2018-04-11 22:28:41 -0400 | [diff] [blame] | 120 | ${direction}= Get Variable Value ${config["content"]["tca_policy"]["metricsPerEventName"][0]["thresholds"][0]["direction"]} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 121 | Should Be Equal ${direction} ${Expected_Direction_3} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 122 | |
| 123 | Teardown Closed Loop |
| 124 | [Documentation] Tear down a closed loop test case |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 125 | Terminate All Processes |
| 126 | Teardown VNF |
| 127 | Log Teardown complete |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 128 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 129 | Create Config Policy |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 130 | [Documentation] Create Config Policy |
| 131 | ${randompolicyname} = Create Policy Name |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 132 | ${policyname1}= Catenate com.${randompolicyname} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 133 | ${CONFIG_POLICY_NAME}= Set Test Variable ${policyname1} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 134 | ${configpolicy}= Create Dictionary policy_name=${CONFIG_POLICY_NAME} |
| 135 | ${output} = Fill JSON Template File ${CREATE_CONFIG_TEMPLATE} ${configpolicy} |
| 136 | ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} |
| 137 | Should Be Equal As Strings ${put_resp.status_code} 200 |
| 138 | |
| 139 | Create Policy Name |
| 140 | [Documentation] Generate Policy Name |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 141 | [Arguments] ${prefix}=ETE_ |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 142 | ${random}= Generate Random String 15 [LOWER][NUMBERS] |
| 143 | ${policyname}= Catenate ${prefix}${random} |
| 144 | [Return] ${policyname} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 145 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 146 | Create Ops Policy |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 147 | [Documentation] Create Opertional Policy |
| 148 | ${randompolicyname} = Create Policy Name |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 149 | ${policyname1}= Catenate com.${randompolicyname} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 150 | ${OPS_POLICY_NAME}= Set Test Variable ${policyname1} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 151 | ${dict}= Create Dictionary policy_name=${OPS_POLICY_NAME} |
| 152 | #${NEWPOLICY1}= Create Dictionary policy_name=com.${OPS_POLICY_NAME} |
| 153 | ${output} = Fill JSON Template File ${CREATE_OPS_TEMPLATE} ${dict} |
| 154 | ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} |
| 155 | Log ${put_resp} |
| 156 | Should Be Equal As Strings ${put_resp.status_code} 200 |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 157 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 158 | Push Ops Policy |
| 159 | [Documentation] Push Ops Policy |
| 160 | [Arguments] ${policyname} ${policytype} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 161 | ${dict}= Create Dictionary policy_name=${policyname} policy_type=${policytype} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 162 | ${output} = Fill JSON Template ${PUSH_POLICY_TEMPLATE} ${dict} |
| 163 | ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE_PUSH} ${output} |
| 164 | Should Be Equal As Strings ${put_resp.status_code} 200 |
| 165 | |
| 166 | Push Config Policy |
| 167 | [Documentation] Push Config Policy |
| 168 | [Arguments] ${policyname} ${policytype} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 169 | ${dict}= Create Dictionary policy_name=${policyname} policy_type=${policytype} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 170 | ${output} = Fill JSON Template ${PUSH_POLICY_TEMPLATE} ${dict} |
| 171 | ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE_PUSH} ${output} |
| 172 | Should Be Equal As Strings ${put_resp.status_code} 200 |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 173 | |
| 174 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 175 | Delete Config Policy |
| 176 | [Documentation] Delete Config Policy |
| 177 | [Arguments] ${policy_name} |
| 178 | ${policyname3}= Catenate com.Config_BRMS_Param_${policyname}.1.xml |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 179 | ${dict}= Create Dictionary policy_name=${policyname3} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 180 | ${output} = Fill JSON Template ${DEL_POLICY_TEMPLATE} ${dict} |
| 181 | ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 182 | Should Be Equal As Strings ${put_resp.status_code} 200 |
| 183 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 184 | Delete Ops Policy |
| 185 | [Documentation] Delete Ops Policy |
| 186 | [Arguments] ${policy_name} |
| 187 | ${policyname3}= Catenate com.Config_MS_com.vFirewall.1.xml |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 188 | ${dict}= Create Dictionary policy_name=${policyname3} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 189 | ${output} = Fill JSON Template ${DEL_POLICY_TEMPLATE} ${dict} |
| 190 | ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 191 | Should Be Equal As Strings ${put_resp.status_code} 200 |
| 192 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 193 | Orchestrate VNF vFW closedloop |
| 194 | [Documentation] VNF Orchestration for vFW |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 195 | Log VNF Orchestration flow TEST NAME=${TEST NAME} |
| 196 | Setup Orchestrate VNF ${GLOBAL_AAI_CLOUD_OWNER} SharedNode OwnerType v1 CloudZone |
Jerry Flood | 3a169a3 | 2017-12-01 12:39:10 -0500 | [diff] [blame] | 197 | ${stack_name} ${service}= Orchestrate VNF ETE_CLP vFWCL vFWCL ${TENANT_NAME} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 198 | [Return] ${stack_name} |
| 199 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 200 | Orchestrate VNF vDNS closedloop |
| 201 | [Documentation] VNF Orchestration for vLB |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 202 | Log VNF Orchestration flow TEST NAME=${TEST NAME} |
| 203 | Setup Orchestrate VNF ${GLOBAL_AAI_CLOUD_OWNER} SharedNode OwnerType v1 CloudZone |
| 204 | ${stack_name} ${service}= Orchestrate VNF ETE_CLP vLB vLB ${TENANT_NAME} |
| 205 | [Return] ${stack_name} |
Brian Freeman | 20f11e4 | 2018-07-26 13:55:28 -0500 | [diff] [blame] | 206 | |
| 207 | VFWCL High Test |
| 208 | [Documentation] Test Control Loop for High Traffic |
| 209 | [Arguments] ${pkg_host} |
| 210 | Enable Streams ${pkg_host} 10 |
| 211 | :FOR ${i} IN RANGE 8 |
| 212 | \ Sleep 15s |
| 213 | \ ${resp}= Get List Of Enabled Streams ${pkg_host} |
| 214 | \ ${stream_count}= Evaluate len(${resp['sample-plugin']['pg-streams']['pg-stream']}) |
| 215 | \ Log To Console Number of steam: ${stream_count} |
| 216 | \ Exit For Loop If '${stream_count}'=='5' |
| 217 | Should Be Equal As Integers ${stream_count} 5 |
| 218 | |
| 219 | VFWCL Low Test |
| 220 | [Documentation] Test Control Loop for Low Traffic |
| 221 | [Arguments] ${pkg_host} |
| 222 | Enable Streams ${pkg_host} 1 |
| 223 | Get List Of Enabled Streams ${pkg_host} |
| 224 | :FOR ${i} IN RANGE 8 |
| 225 | \ Sleep 15s |
| 226 | \ ${resp}= Get List Of Enabled Streams ${pkg_host} |
| 227 | \ ${stream_count}= Evaluate len(${resp['sample-plugin']['pg-streams']['pg-stream']}) |
| 228 | \ Log To Console Number of steam: ${stream_count} |
| 229 | \ Exit For Loop If '${stream_count}'=='5' |
| 230 | Should Be Equal As Integers ${stream_count} 5 |
| 231 | |
| 232 | |