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 *** |
| 12 | ${RESOURCE_PATH_CREATE} /PyPDPServer/createPolicy |
| 13 | ${RESOURCE_PATH_CREATE_PUSH} /PyPDPServer/pushPolicy |
| 14 | ${RESOURCE_PATH_CREATE_DELETE} /PyPDPServer/deletePolicy |
| 15 | ${RESOURCE_PATH_GET_CONFIG} /PyPDPServer/getConfig |
| 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} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame^] | 57 | |
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} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame^] | 64 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 65 | Initialize VFW Policy |
| 66 | # Create Config Policy |
| 67 | # Push Config Policy ${CONFIG_POLICY_NAME} ${CONFIG_POLICY_TYPE} |
| 68 | # Create Ops Policy |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame^] | 69 | # Push Ops Policy ${OPS_POLICY_NAME} ${OPS_POLICY_TYPE} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 70 | Get Configs VFW Policy |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame^] | 71 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 72 | Initialize VDNS Policy |
| 73 | Get Configs VDNS 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 | Get Configs VFW Policy |
| 76 | [Documentation] Get Config Policy for VFW |
| 77 | ${getconfigpolicy}= Catenate .*${CONFIG_POLICY_NAME}* |
| 78 | ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy} |
| 79 | ${output} = Fill JSON Template File ${GECONFIG_VFW_TEMPLATE} ${configpolicy_name} |
| 80 | ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output} |
| 81 | Should Be Equal As Strings ${get_resp.status_code} 200 |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame^] | 82 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 83 | ${json}= Parse Json ${get_resp.content} |
| 84 | ${config}= Parse Json ${json[0]["config"]} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame^] | 85 | |
| 86 | # Extract object1 from Array |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 87 | ${severity}= Get Variable Value ${config["content"]["thresholds"][0]["severity"]} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame^] | 88 | Should Be Equal ${severity} ${Expected_Severity_1} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 89 | ${Thresold_Value}= Get Variable Value ${config["content"]["thresholds"][0]["thresholdValue"]} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame^] | 90 | Should Be Equal ${Thresold_Value} ${Expected_Threshold_1} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 91 | ${direction}= Get Variable Value ${config["content"]["thresholds"][0]["direction"]} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame^] | 92 | Should Be Equal ${direction} ${Expected_Direction_1} |
| 93 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 94 | # Extract object2 from Array |
| 95 | ${severity_1}= Get Variable Value ${config["content"]["thresholds"][1]["severity"]} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame^] | 96 | Should Be Equal ${severity_1} ${Expected_Severity_2} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 97 | ${Thresold_Value_1}= Get Variable Value ${config["content"]["thresholds"][1]["thresholdValue"]} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame^] | 98 | Should Be Equal ${Thresold_Value_1} ${Expected_Threshold_2} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 99 | ${direction_1}= Get Variable Value ${config["content"]["thresholds"][1]["direction"]} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame^] | 100 | Should Be Equal ${direction_1} ${Expected_Direction_2} |
| 101 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 102 | Get Configs VDNS Policy |
| 103 | [Documentation] Get Config Policy for VDNS |
| 104 | ${getconfigpolicy}= Catenate .*vLoadBalancer* |
| 105 | ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy} |
| 106 | ${output} = Fill JSON Template File ${GECONFIG_VFW_TEMPLATE} ${configpolicy_name} |
| 107 | ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output} |
| 108 | Should Be Equal As Strings ${get_resp.status_code} 200 |
| 109 | ${json}= Parse Json ${get_resp.content} |
| 110 | ${config}= Parse Json ${json[0]["config"]} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame^] | 111 | |
| 112 | # Extract object1 from Array |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 113 | ${severity}= Get Variable Value ${config["content"]["thresholds"][0]["severity"]} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame^] | 114 | Should Be Equal ${severity} ${Expected_Severity_3} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 115 | ${Thresold_Value}= Get Variable Value ${config["content"]["thresholds"][0]["thresholdValue"]} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame^] | 116 | Should Be Equal ${Thresold_Value} ${Expected_Threshold_3} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 117 | ${direction}= Get Variable Value ${config["content"]["thresholds"][0]["direction"]} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame^] | 118 | Should Be Equal ${direction} ${Expected_Direction_3} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 119 | |
| 120 | Teardown Closed Loop |
| 121 | [Documentation] Tear down a closed loop test case |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame^] | 122 | Terminate All Processes |
| 123 | Teardown VNF |
| 124 | Log Teardown complete |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 125 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 126 | Create Config Policy |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame^] | 127 | [Documentation] Create Config Policy |
| 128 | ${randompolicyname} = Create Policy Name |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 129 | ${policyname1}= Catenate com.${randompolicyname} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame^] | 130 | ${CONFIG_POLICY_NAME}= Set Test Variable ${policyname1} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 131 | ${configpolicy}= Create Dictionary policy_name=${CONFIG_POLICY_NAME} |
| 132 | ${output} = Fill JSON Template File ${CREATE_CONFIG_TEMPLATE} ${configpolicy} |
| 133 | ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} |
| 134 | Should Be Equal As Strings ${put_resp.status_code} 200 |
| 135 | |
| 136 | Create Policy Name |
| 137 | [Documentation] Generate Policy Name |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame^] | 138 | [Arguments] ${prefix}=ETE_ |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 139 | ${random}= Generate Random String 15 [LOWER][NUMBERS] |
| 140 | ${policyname}= Catenate ${prefix}${random} |
| 141 | [Return] ${policyname} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame^] | 142 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 143 | Create Ops Policy |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame^] | 144 | [Documentation] Create Opertional Policy |
| 145 | ${randompolicyname} = Create Policy Name |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 146 | ${policyname1}= Catenate com.${randompolicyname} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame^] | 147 | ${OPS_POLICY_NAME}= Set Test Variable ${policyname1} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 148 | ${dict}= Create Dictionary policy_name=${OPS_POLICY_NAME} |
| 149 | #${NEWPOLICY1}= Create Dictionary policy_name=com.${OPS_POLICY_NAME} |
| 150 | ${output} = Fill JSON Template File ${CREATE_OPS_TEMPLATE} ${dict} |
| 151 | ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} |
| 152 | Log ${put_resp} |
| 153 | Should Be Equal As Strings ${put_resp.status_code} 200 |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame^] | 154 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 155 | Push Ops Policy |
| 156 | [Documentation] Push Ops 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 |
| 162 | |
| 163 | Push Config Policy |
| 164 | [Documentation] Push Config Policy |
| 165 | [Arguments] ${policyname} ${policytype} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame^] | 166 | ${dict}= Create Dictionary policy_name=${policyname} policy_type=${policytype} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 167 | ${output} = Fill JSON Template ${PUSH_POLICY_TEMPLATE} ${dict} |
| 168 | ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE_PUSH} ${output} |
| 169 | Should Be Equal As Strings ${put_resp.status_code} 200 |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame^] | 170 | |
| 171 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 172 | Delete Config Policy |
| 173 | [Documentation] Delete Config Policy |
| 174 | [Arguments] ${policy_name} |
| 175 | ${policyname3}= Catenate com.Config_BRMS_Param_${policyname}.1.xml |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame^] | 176 | ${dict}= Create Dictionary policy_name=${policyname3} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 177 | ${output} = Fill JSON Template ${DEL_POLICY_TEMPLATE} ${dict} |
| 178 | ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame^] | 179 | Should Be Equal As Strings ${put_resp.status_code} 200 |
| 180 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 181 | Delete Ops Policy |
| 182 | [Documentation] Delete Ops Policy |
| 183 | [Arguments] ${policy_name} |
| 184 | ${policyname3}= Catenate com.Config_MS_com.vFirewall.1.xml |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame^] | 185 | ${dict}= Create Dictionary policy_name=${policyname3} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 186 | ${output} = Fill JSON Template ${DEL_POLICY_TEMPLATE} ${dict} |
| 187 | ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame^] | 188 | Should Be Equal As Strings ${put_resp.status_code} 200 |
| 189 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 190 | Orchestrate VNF vFW closedloop |
| 191 | [Documentation] VNF Orchestration for vFW |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame^] | 192 | Log VNF Orchestration flow TEST NAME=${TEST NAME} |
| 193 | Setup Orchestrate VNF ${GLOBAL_AAI_CLOUD_OWNER} SharedNode OwnerType v1 CloudZone |
| 194 | ${stack_name} ${service}= Orchestrate VNF ETE_CLP vFW vFW ${TENANT_NAME} |
| 195 | [Return] ${stack_name} |
| 196 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 197 | Orchestrate VNF vDNS closedloop |
| 198 | [Documentation] VNF Orchestration for vLB |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame^] | 199 | Log VNF Orchestration flow TEST NAME=${TEST NAME} |
| 200 | Setup Orchestrate VNF ${GLOBAL_AAI_CLOUD_OWNER} SharedNode OwnerType v1 CloudZone |
| 201 | ${stack_name} ${service}= Orchestrate VNF ETE_CLP vLB vLB ${TENANT_NAME} |
| 202 | [Return] ${stack_name} |