2 Documentation Policy Closed Loop Test cases
4 Resource ../policy_interface.robot
5 Resource ../stack_validation/policy_check_vfw.robot
6 Resource ../stack_validation/packet_generator_interface.robot
7 Resource vnf_orchestration_test_template.robot
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
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
23 # 'Normal' number of pg streams that will be set when policy is triggered
26 # Max nslookup requests per second before triggering event.
29 ${CONFIG_POLICY_NAME} vFirewall
30 ${CONFIG_POLICY_TYPE} Unknown
32 ${OPS_POLICY_TYPE} BRMS_PARAM
35 ${Expected_Severity_1} MAJOR
36 ${Expected_Threshold_1} 300
37 ${Expected_Direction_1} LESS_OR_EQUAL
40 ${Expected_Severity_2} CRITICAL
41 ${Expected_Threshold_2} 700
42 ${Expected_Direction_2} GREATER_OR_EQUAL
45 ${Expected_Severity_3} MAJOR
46 ${Expected_Threshold_3} 200
47 ${Expected_Direction_3} GREATER_OR_EQUAL
49 #********** Test Case Variables ************
54 Log Suite name ${SUITE NAME} ${TEST NAME} ${PREV TEST NAME}
56 ${stackname}= Orchestrate VNF vFW closedloop
57 Policy Check FirewallCL Stack ${stackname} ${VFWPOLICYRATE}
61 Initialize VDNS Policy
62 ${stackname}= Orchestrate VNF vDNS closedloop
63 ${dnsscaling}= Policy Check vLB Stack ${stackname} ${VLBPOLICYRATE}
64 Set Test Variable ${DNSSCALINGSTACK} ${dnsscaling}
68 # Create Config Policy
69 # Push Config Policy ${CONFIG_POLICY_NAME} ${CONFIG_POLICY_TYPE}
71 # Push Ops Policy ${OPS_POLICY_NAME} ${OPS_POLICY_TYPE}
72 Get Configs VFW Policy
74 Initialize VDNS Policy
75 Get Configs VDNS Policy
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
84 ${config}= Catenate ${get_resp.json()[0]["config"]}
85 ${thresholds}= Get Variable Value ${config["content"]["tca_policy"]["metricsPerEventName"][0]["thresholds"]}
87 # Extract object1 from Array
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}
92 # Extract object2 from Array
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}
97 Get Configs VDNS Policy
98 [Documentation] Get Config Policy for VDNS
99 ${getconfigpolicy}= Catenate .*MicroServicevDNS*
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
104 ${config}= Catenate ${get_resp.json()[0]["config"]}
105 ${thresholds}= Get Variable Value ${config["content"]["tca_policy"]["metricsPerEventName"][0]["thresholds"]}
107 # Extract object1 from Array
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}
113 [Documentation] Tear down a closed loop test case
114 Terminate All Processes
116 Log Teardown complete
119 [Documentation] Create Config Policy
120 ${randompolicyname} = Create Policy Name
121 ${policyname1}= Catenate com.${randompolicyname}
122 ${CONFIG_POLICY_NAME}= Set Test Variable ${policyname1}
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
129 [Documentation] Generate Policy Name
130 [Arguments] ${prefix}=ETE_
131 ${random}= Generate Random String 15 [LOWER][NUMBERS]
132 ${policyname}= Catenate ${prefix}${random}
133 [Return] ${policyname}
136 [Documentation] Create Opertional Policy
137 ${randompolicyname} = Create Policy Name
138 ${policyname1}= Catenate com.${randompolicyname}
139 ${OPS_POLICY_NAME}= Set Test Variable ${policyname1}
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}
145 Should Be Equal As Strings ${put_resp.status_code} 200
148 [Documentation] Push Ops Policy
149 [Arguments] ${policyname} ${policytype}
150 ${dict}= Create Dictionary policy_name=${policyname} policy_type=${policytype}
151 ${output} = Fill JSON Template File ${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
156 [Documentation] Push Config Policy
157 [Arguments] ${policyname} ${policytype}
158 ${dict}= Create Dictionary policy_name=${policyname} policy_type=${policytype}
159 ${output} = Fill JSON Template File ${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
165 [Documentation] Delete Config Policy
166 [Arguments] ${policy_name}
167 ${policyname3}= Catenate com.Config_BRMS_Param_${policyname}.1.xml
168 ${dict}= Create Dictionary policy_name=${policyname3}
169 ${output} = Fill JSON Template File ${DEL_POLICY_TEMPLATE} ${dict}
170 ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output}
171 Should Be Equal As Strings ${put_resp.status_code} 200
174 [Documentation] Delete Ops Policy
175 [Arguments] ${policy_name}
176 ${policyname3}= Catenate com.Config_MS_com.vFirewall.1.xml
177 ${dict}= Create Dictionary policy_name=${policyname3}
178 ${output} = Fill JSON Template File ${DEL_POLICY_TEMPLATE} ${dict}
179 ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output}
180 Should Be Equal As Strings ${put_resp.status_code} 200
182 Orchestrate VNF vFW closedloop
183 [Documentation] VNF Orchestration for vFW
184 Log VNF Orchestration flow TEST NAME=${TEST NAME}
185 Setup Orchestrate VNF ${GLOBAL_AAI_CLOUD_OWNER} SharedNode OwnerType v1 CloudZone
186 ${stack_name} ${service}= Orchestrate VNF ETE_CLP vFWCL vFWCL ${TENANT_NAME}
187 [Return] ${stack_name}
189 Orchestrate VNF vDNS closedloop
190 [Documentation] VNF Orchestration for vLB
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}
197 [Documentation] Test Control Loop for High Traffic
198 [Arguments] ${pkg_host}
199 Enable Streams V2 ${pkg_host} 10
200 Log To Console Set number of streams to 10
201 :FOR ${i} IN RANGE 12
203 \ ${resp}= Get List Of Enabled Streams V2 ${pkg_host}
204 \ ${stream_count}= Set Variable ${resp['stream-count']['streams']['active-streams']}
205 \ Log To Console Number of streams: ${stream_count}
206 \ Exit For Loop If '${stream_count}'=='5'
207 Should Be Equal As Integers ${stream_count} 5
210 [Documentation] Test Control Loop for Low Traffic
211 [Arguments] ${pkg_host}
212 Enable Streams V2 ${pkg_host} 1
213 Log To Console Set number of streams to 1
214 :FOR ${i} IN RANGE 12
216 \ ${resp}= Get List Of Enabled Streams V2 ${pkg_host}
217 \ ${stream_count}= Set Variable ${resp['stream-count']['streams']['active-streams']}
218 \ Log To Console Number of streams: ${stream_count}
219 \ Exit For Loop If '${stream_count}'=='5'
220 Should Be Equal As Integers ${stream_count} 5
223 [Documentation] Set flows to Medium to turn off control loop
224 [Arguments] ${pkg_host}
225 Enable Streams V2 ${pkg_host} 5