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