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