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 |
Gary Wu | 5323bc2 | 2018-11-02 11:27:28 -0700 | [diff] [blame] | 58 | Policy Check FirewallCL 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"]} |
Gary Wu | 5323bc2 | 2018-11-02 11:27:28 -0700 | [diff] [blame] | 88 | ${thresholds}= Get Variable Value ${config["content"]["tca_policy"]["metricsPerEventName"][0]["thresholds"]} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 89 | |
| 90 | # Extract object1 from Array |
Gary Wu | 5323bc2 | 2018-11-02 11:27:28 -0700 | [diff] [blame] | 91 | Should Be Equal ${thresholds[0]["severity"]} ${Expected_Severity_1} |
| 92 | Should Be Equal As Integers ${thresholds[0]["thresholdValue"]} ${Expected_Threshold_1} |
| 93 | Should Be Equal ${thresholds[0]["direction"]} ${Expected_Direction_1} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 94 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 95 | # Extract object2 from Array |
Gary Wu | 5323bc2 | 2018-11-02 11:27:28 -0700 | [diff] [blame] | 96 | Should Be Equal ${thresholds[1]["severity"]} ${Expected_Severity_2} |
| 97 | Should Be Equal As Integers ${thresholds[1]["thresholdValue"]} ${Expected_Threshold_2} |
| 98 | Should Be Equal ${thresholds[1]["direction"]} ${Expected_Direction_2} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 99 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 100 | Get Configs VDNS Policy |
| 101 | [Documentation] Get Config Policy for VDNS |
Gary Wu | 7cfa85a | 2018-03-20 11:36:23 -0700 | [diff] [blame] | 102 | ${getconfigpolicy}= Catenate .*MicroServicevDNS* |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 103 | ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy} |
| 104 | ${output} = Fill JSON Template File ${GECONFIG_VFW_TEMPLATE} ${configpolicy_name} |
| 105 | ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output} |
| 106 | Should Be Equal As Strings ${get_resp.status_code} 200 |
| 107 | ${json}= Parse Json ${get_resp.content} |
| 108 | ${config}= Parse Json ${json[0]["config"]} |
Gary Wu | 5323bc2 | 2018-11-02 11:27:28 -0700 | [diff] [blame] | 109 | ${thresholds}= Get Variable Value ${config["content"]["tca_policy"]["metricsPerEventName"][0]["thresholds"]} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 110 | |
| 111 | # Extract object1 from Array |
Gary Wu | 5323bc2 | 2018-11-02 11:27:28 -0700 | [diff] [blame] | 112 | Should Be Equal ${thresholds[0]["severity"]} ${Expected_Severity_2} |
| 113 | Should Be Equal As Integers ${thresholds[0]["thresholdValue"]} ${Expected_Threshold_1} |
| 114 | Should Be Equal ${thresholds[0]["direction"]} ${Expected_Direction_3} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 115 | |
| 116 | Teardown Closed Loop |
| 117 | [Documentation] Tear down a closed loop test case |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 118 | Terminate All Processes |
| 119 | Teardown VNF |
| 120 | Log Teardown complete |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 121 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 122 | Create Config Policy |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 123 | [Documentation] Create Config Policy |
| 124 | ${randompolicyname} = Create Policy Name |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 125 | ${policyname1}= Catenate com.${randompolicyname} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 126 | ${CONFIG_POLICY_NAME}= Set Test Variable ${policyname1} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 127 | ${configpolicy}= Create Dictionary policy_name=${CONFIG_POLICY_NAME} |
| 128 | ${output} = Fill JSON Template File ${CREATE_CONFIG_TEMPLATE} ${configpolicy} |
| 129 | ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} |
| 130 | Should Be Equal As Strings ${put_resp.status_code} 200 |
| 131 | |
| 132 | Create Policy Name |
| 133 | [Documentation] Generate Policy Name |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 134 | [Arguments] ${prefix}=ETE_ |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 135 | ${random}= Generate Random String 15 [LOWER][NUMBERS] |
| 136 | ${policyname}= Catenate ${prefix}${random} |
| 137 | [Return] ${policyname} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 138 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 139 | Create Ops Policy |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 140 | [Documentation] Create Opertional Policy |
| 141 | ${randompolicyname} = Create Policy Name |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 142 | ${policyname1}= Catenate com.${randompolicyname} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 143 | ${OPS_POLICY_NAME}= Set Test Variable ${policyname1} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 144 | ${dict}= Create Dictionary policy_name=${OPS_POLICY_NAME} |
| 145 | #${NEWPOLICY1}= Create Dictionary policy_name=com.${OPS_POLICY_NAME} |
| 146 | ${output} = Fill JSON Template File ${CREATE_OPS_TEMPLATE} ${dict} |
| 147 | ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} |
| 148 | Log ${put_resp} |
| 149 | Should Be Equal As Strings ${put_resp.status_code} 200 |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 150 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 151 | Push Ops Policy |
| 152 | [Documentation] Push Ops Policy |
| 153 | [Arguments] ${policyname} ${policytype} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 154 | ${dict}= Create Dictionary policy_name=${policyname} policy_type=${policytype} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 155 | ${output} = Fill JSON Template ${PUSH_POLICY_TEMPLATE} ${dict} |
| 156 | ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE_PUSH} ${output} |
| 157 | Should Be Equal As Strings ${put_resp.status_code} 200 |
| 158 | |
| 159 | Push Config Policy |
| 160 | [Documentation] Push Config Policy |
| 161 | [Arguments] ${policyname} ${policytype} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 162 | ${dict}= Create Dictionary policy_name=${policyname} policy_type=${policytype} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 163 | ${output} = Fill JSON Template ${PUSH_POLICY_TEMPLATE} ${dict} |
| 164 | ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE_PUSH} ${output} |
| 165 | Should Be Equal As Strings ${put_resp.status_code} 200 |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 166 | |
| 167 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 168 | Delete Config Policy |
| 169 | [Documentation] Delete Config Policy |
| 170 | [Arguments] ${policy_name} |
| 171 | ${policyname3}= Catenate com.Config_BRMS_Param_${policyname}.1.xml |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 172 | ${dict}= Create Dictionary policy_name=${policyname3} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 173 | ${output} = Fill JSON Template ${DEL_POLICY_TEMPLATE} ${dict} |
| 174 | ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 175 | Should Be Equal As Strings ${put_resp.status_code} 200 |
| 176 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 177 | Delete Ops Policy |
| 178 | [Documentation] Delete Ops Policy |
| 179 | [Arguments] ${policy_name} |
| 180 | ${policyname3}= Catenate com.Config_MS_com.vFirewall.1.xml |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 181 | ${dict}= Create Dictionary policy_name=${policyname3} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 182 | ${output} = Fill JSON Template ${DEL_POLICY_TEMPLATE} ${dict} |
| 183 | ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 184 | Should Be Equal As Strings ${put_resp.status_code} 200 |
| 185 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 186 | Orchestrate VNF vFW closedloop |
| 187 | [Documentation] VNF Orchestration for vFW |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 188 | Log VNF Orchestration flow TEST NAME=${TEST NAME} |
| 189 | Setup Orchestrate VNF ${GLOBAL_AAI_CLOUD_OWNER} SharedNode OwnerType v1 CloudZone |
Jerry Flood | 3a169a3 | 2017-12-01 12:39:10 -0500 | [diff] [blame] | 190 | ${stack_name} ${service}= Orchestrate VNF ETE_CLP vFWCL vFWCL ${TENANT_NAME} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 191 | [Return] ${stack_name} |
| 192 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 193 | Orchestrate VNF vDNS closedloop |
| 194 | [Documentation] VNF Orchestration for vLB |
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 |
| 197 | ${stack_name} ${service}= Orchestrate VNF ETE_CLP vLB vLB ${TENANT_NAME} |
| 198 | [Return] ${stack_name} |
Brian Freeman | 20f11e4 | 2018-07-26 13:55:28 -0500 | [diff] [blame] | 199 | |
| 200 | VFWCL High Test |
| 201 | [Documentation] Test Control Loop for High Traffic |
| 202 | [Arguments] ${pkg_host} |
| 203 | Enable Streams ${pkg_host} 10 |
Gary Wu | 9eb062d | 2018-11-09 20:10:10 -0800 | [diff] [blame] | 204 | Log To Console Set number of streams to 10 |
| 205 | :FOR ${i} IN RANGE 12 |
Brian Freeman | 20f11e4 | 2018-07-26 13:55:28 -0500 | [diff] [blame] | 206 | \ Sleep 15s |
| 207 | \ ${resp}= Get List Of Enabled Streams ${pkg_host} |
| 208 | \ ${stream_count}= Evaluate len(${resp['sample-plugin']['pg-streams']['pg-stream']}) |
Gary Wu | 9eb062d | 2018-11-09 20:10:10 -0800 | [diff] [blame] | 209 | \ Log To Console Number of streams: ${stream_count} |
| 210 | \ Exit For Loop If '${stream_count}'=='5' |
Brian Freeman | 20f11e4 | 2018-07-26 13:55:28 -0500 | [diff] [blame] | 211 | Should Be Equal As Integers ${stream_count} 5 |
| 212 | |
| 213 | VFWCL Low Test |
| 214 | [Documentation] Test Control Loop for Low Traffic |
| 215 | [Arguments] ${pkg_host} |
| 216 | Enable Streams ${pkg_host} 1 |
Gary Wu | 9eb062d | 2018-11-09 20:10:10 -0800 | [diff] [blame] | 217 | Log To Console Set number of streams to 1 |
Brian Freeman | 20f11e4 | 2018-07-26 13:55:28 -0500 | [diff] [blame] | 218 | Get List Of Enabled Streams ${pkg_host} |
Gary Wu | 9eb062d | 2018-11-09 20:10:10 -0800 | [diff] [blame] | 219 | :FOR ${i} IN RANGE 12 |
Brian Freeman | 20f11e4 | 2018-07-26 13:55:28 -0500 | [diff] [blame] | 220 | \ Sleep 15s |
| 221 | \ ${resp}= Get List Of Enabled Streams ${pkg_host} |
| 222 | \ ${stream_count}= Evaluate len(${resp['sample-plugin']['pg-streams']['pg-stream']}) |
Gary Wu | 9eb062d | 2018-11-09 20:10:10 -0800 | [diff] [blame] | 223 | \ Log To Console Number of streams: ${stream_count} |
| 224 | \ Exit For Loop If '${stream_count}'=='5' |
Brian Freeman | 20f11e4 | 2018-07-26 13:55:28 -0500 | [diff] [blame] | 225 | Should Be Equal As Integers ${stream_count} 5 |
| 226 | |
| 227 | |