Add Tests for Honeycomb VxLAN GPE support
[csit.git] / resources / libraries / robot / honeycomb / sub_interface.robot
1 # Copyright (c) 2016 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13
14 *** Settings ***
15 | Library | resources.libraries.python.InterfaceUtil
16 | ...     | WITH NAME | interfaceCLI
17 | Library | resources.libraries.python.honeycomb.HcAPIKwInterfaces.InterfaceKeywords
18 | ...     | WITH NAME | InterfaceAPI
19 | Resource | resources/libraries/robot/honeycomb/bridge_domain.robot
20 | Documentation | Keywords used to manipulate sub-interfaces.
21
22 *** Variables ***
23 # Translation table used to convert values received from Honeycomb to values
24 # received from VAT.
25 | &{rewrite_operations}=
26 | ... | disabled=0
27 | ... | push-1=1
28 | ... | push-2=2
29 | ... | pop-1=3
30 | ... | pop-2=4
31 | ... | translate-1-to-1=5
32 | ... | translate-1-to-2=6
33 | ... | translate-2-to-1=7
34 | ... | translate-2-to-2=8
35
36 *** Keywords ***
37 | Honeycomb creates sub-interface
38 | | [Documentation] | Create a sub-interface using Honeycomb API.
39 | | ...
40 | | ... | *Arguments:*
41 | | ... | - node - information about a DUT node. Type: dictionary
42 | | ... | - interface - name of an interface on the specified node. Type: string
43 | | ... | - identifier - ID of sub-interface to be created. Type: integer
44 | | ... | - sub_interface_base_settings - Configuration data for sub-interface.\
45 | | ... | Type: dictionary
46 | | ... | - sub_interface_settings - Configuration data specific for a\
47 | | ... | sub-interface. Type: dictionary
48 | | ...
49 | | ... | *Example:*
50 | | ... | \| Honeycomb creates sub-interface\
51 | | ... | \| ${nodes['DUT1']} \| sub_test \| 10 \| ${sub_interface_settings} \|
52 | | ...
53 | | [Arguments] | ${node} | ${interface} | ${identifier}
54 | | ... | ${sub_interface_base_settings} | ${sub_interface_settings}
55 | | interfaceAPI.Create sub interface | ${node} | ${interface}
56 | | ... | &{sub_interface_base_settings} | &{sub_interface_settings}
57
58 | Honeycomb fails to remove sub-interface
59 | | [Documentation] | Honeycomb tries to remove sub-interface using Honeycomb\
60 | | ... | API. This operation must fail.
61 | | ...
62 | | ... | *Arguments:*
63 | | ... | - node - information about a DUT node. Type: dictionary
64 | | ... | - interface - name of a sub-interface on the specified node.
65 | | ... | Type: string
66 | | ...
67 | | ... | *Example:*
68 | | ... | \| Honeycomb fails to remove sub-interface\
69 | | ... | \| ${nodes['DUT1']} \| sub_test \|
70 | | ...
71 | | [Arguments] | ${node} | ${interface}
72 | | Run keyword and expect error | *HoneycombError: Not possible to remove* 500.
73 | | ... | interfaceAPI.Delete interface | ${node} | ${interface}
74
75 | Sub-interface configuration from Honeycomb should be
76 | | [Documentation] | Retrieves sub-interface configuration through Honeycomb\
77 | | ... | and compares it with settings supplied in argument.
78 | | ...
79 | | ... | *Arguments:*
80 | | ... | - node - information about a DUT node. Type: dictionary
81 | | ... | - interface - name of an interface on the specified node. Type: string
82 | | ... | - base_settings - Configuration data for sub-interface.\
83 | | ... | Type: dictionary
84 | | ... | - sub_settings - Configuration data specific for a sub-interface.\
85 | | ... | Type: dictionary
86 | | ...
87 | | ... | *Example:*
88 | | ... | \| Sub-interface configuration from Honeycomb should be\
89 | | ... | \| ${nodes['DUT1']} \| sub_test \| ${sub_interface_base_settings}\
90 | | ... | \| ${sub_interface_settings} \|
91 | | ...
92 | | [Arguments] | ${node} | ${interface} | ${base_settings} | ${sub_settings}
93 | | ${api_data}= | interfaceAPI.Get interface oper data | ${node} | ${interface}
94 | | ${api_sub}= | Set Variable | ${api_data['v3po:sub-interface']}
95 | | :FOR | ${key} | IN | @{base_settings.keys()}
96 | | | Should be equal | ${api_data['${key}']} | ${base_settings['${key}']}
97 | | Should be equal as strings
98 | | ... | ${api_sub['super-interface']} | ${sub_settings['super-interface']}
99 | | Should be equal as strings
100 | | ... | ${api_sub['identifier']} | ${sub_settings['identifier']}
101 | | Should be equal as strings
102 | | ... | ${api_sub['vlan-type']} | ${sub_settings['vlan-type']}
103 | | Should be equal as strings
104 | | ... | ${api_sub['number-of-tags']} | ${sub_settings['number-of-tags']}
105 | | Run keyword if | ${sub_settings['match-any-outer-id']} == ${TRUE}
106 | | ... | Should be equal | ${api_sub['match-any-outer-id'][0]} | ${None}
107 | | Run keyword if | ${sub_settings['match-any-inner-id']} == ${TRUE}
108 | | ... | Should be equal | ${api_sub['match-any-inner-id'][0]} | ${None}
109 | | Run keyword if | ${sub_settings['exact-match']} == ${TRUE}
110 | | ... | Should be equal | ${api_sub['exact-match'][0]} | ${None}
111 | | Run keyword if | ${sub_settings['default-subif']} == ${TRUE}
112 | | ... | Should be equal | ${api_sub['default-subif'][0]} | ${None}
113
114 | Sub-interface configuration from VAT should be
115 | | [Documentation] | Retrieves sub-interface configuration through VAT and\
116 | | ... | compares it with settings supplied in argument.
117 | | ...
118 | | ... | *Arguments:*
119 | | ... | - node - information about a DUT node. Type: dictionary
120 | | ... | - interface - name of an interface on the specified node. Type: string
121 | | ... | - sub_settings - Configuration data specific for a sub-interface.\
122 | | ... | Type: dictionary
123 | | ...
124 | | ... | *Example:*
125 | | ... | \| Sub-interface configuration from VAT should be\
126 | | ... | \| ${nodes['DUT1']} \| sub_test \| ${sub_interface_base_settings}\
127 | | ... | \| ${sub_interface_settings} \|
128 | | ...
129 | | [Arguments] | ${node} | ${interface} | ${sub_settings}
130 | | ${vat_data}= | InterfaceCLI.VPP get interface data | ${node} | ${interface}
131 | | Should be equal as strings | ${vat_data['sub_id']}
132 | | ... | ${sub_settings['identifier']}
133 | | Should be equal as strings | ${vat_data['sub_number_of_tags']}
134 | | ... | ${sub_settings['number-of-tags']}
135 | | Run keyword if | ${sub_settings['match-any-outer-id']} == ${TRUE}
136 | | ... | Should be equal as integers | ${vat_data['sub_outer_vlan_id_any']}
137 | | ... | ${sub_settings['match-any-outer-id']}
138 | | Run keyword if | ${sub_settings['match-any-inner-id']} == ${TRUE}
139 | | ... | Should be equal as integers | ${vat_data['sub_inner_vlan_id_any']}
140 | | ... | ${sub_settings['match-any-inner-id']}
141 | | Run keyword if | ${sub_settings['exact-match']} == ${TRUE}
142 | | ... | Should be equal as integers | ${vat_data['sub_exact_match']}
143 | | ... | ${sub_settings['exact-match']}
144 | | Run keyword if | ${sub_settings['default-subif']} == ${TRUE}
145 | | ... | Should be equal as integers | ${vat_data['sub_default']}
146 | | ... | ${sub_settings['default-subif']}
147
148 | Honeycomb adds sub-interface to bridge domain
149 | | [Documentation] | Honeycomb adds the given sub-interface to bridge domain.
150 | | ...
151 | | ... | *Arguments:*
152 | | ... | - node - information about a DUT node. Type: dictionary
153 | | ... | - interface - name of an sub-interface on the specified node. Type:\
154 | | ... | string
155 | | ... | - bd_name - The name of bridge domain where the sub-interface will be\
156 | | ... | added. Type: string
157 | | ... | - sub_bd_setings - Parameters to be set while adding the\
158 | | ... | sub-interface to the bridge domain. Type: dictionary
159 | | ...
160 | | ... | *Example:*
161 | | ... | \| Honeycomb adds sub-interface to bridge domain\
162 | | ... | \| ${nodes['DUT1']} \| sub_test \| test_bd \| ${sub_bd_setings} \|
163 | | ...
164 | | [Arguments] | ${node} | ${interface} | ${bd_name} | ${sub_bd_setings}
165 | | interfaceAPI.Add bridge domain to interface
166 | | ... | ${node} | ${interface} | ${bd_name}
167 | | ... | split_horizon_group=${sub_bd_setings['split-horizon-group']}
168 | | ... | bvi=${sub_bd_setings['bridged-virtual-interface']}
169
170 | Sub-interface bridge domain configuration from Honeycomb should be
171 | | [Documentation] | Uses Honeycomb API to verify sub-interface assignment to\
172 | | ... | a bridge domain.
173 | | ...
174 | | ... | *Arguments:*
175 | | ... | - node - information about a DUT node. Type: dictionary
176 | | ... | - interface - name of a sub-interface on the specified node. Type:\
177 | | ... | string
178 | | ... | - setings - Parameters to be checked. Type: dictionary
179 | | ...
180 | | ... | *Example:*
181 | | ... | \| Sub-interface bridge domain configuration from Honeycomb should be\
182 | | ... | \| ${nodes['DUT1']} \| sub_test \| ${sub_bd_setings} \|
183 | | ...
184 | | [Arguments] | ${node} | ${interface} | ${settings}
185 | | ${if_data}= | interfaceAPI.Get interface oper data | ${node} | ${interface}
186 | | Should be equal | ${if_data['v3po:l2']['bridge-domain']}
187 | | ... | ${settings['bridge-domain']}
188 | | Should be equal | disabled
189 | | ... | ${if_data['v3po:l2']['vlan-tag-rewrite']['rewrite-operation']}
190
191 | Sub-interface bridge domain configuration from VAT should be
192 | | [Documentation] | Uses VAT to verify sub-interface assignment to a bridge\
193 | | ... | domain.
194 | | ...
195 | | ... | *Arguments:*
196 | | ... | - node - information about a DUT node. Type: dictionary
197 | | ... | - interface - name of a sub-interface on the specified node. Type:\
198 | | ... | string
199 | | ... | - setings - Parameters to be checked. Type: dictionary
200 | | ...
201 | | ... | *Example:*
202 | | ... | \| Sub-interface bridge domain configuration from VAT should be\
203 | | ... | \| ${nodes['DUT1']} \| sub_test \| ${sub_bd_setings} \|
204 | | ...
205 | | [Arguments] | ${node} | ${interface} | ${settings}
206 | | ${bd_data}= | VPP get bridge domain data | ${node}
207 | | ${bd_intf}= | Set Variable | ${bd_data[0]}
208 | | ${sw_if_data}= | Set Variable | ${bd_intf['sw_if'][0]}
209 | | Should be equal as integers | ${bd_intf['flood']} | ${bd_settings['flood']}
210 | | Should be equal as integers | ${bd_intf['forward']}
211 | | ... | ${bd_settings['forward']}
212 | | Should be equal as integers | ${bd_intf['learn']} | ${bd_settings['learn']}
213 | | Should be equal as strings | ${sw_if_data['shg']}
214 | | ... | ${settings['split-horizon-group']}
215
216 | Sub-interface configuration with bd and rw from Honeycomb should be
217 | | [Documentation] | Retrieves sub-interface configuration through Honeycomb\
218 | | ... | and compares it with settings supplied in argument.
219 | | ...
220 | | ... | *Arguments:*
221 | | ... | - node - information about a DUT node. Type: dictionary
222 | | ... | - interface - name of an interface on the specified node. Type: string
223 | | ... | - base_settings - Configuration data for sub-interface.\
224 | | ... | Type: dictionary
225 | | ... | - sub_settings - Configuration data specific for a sub-interface.\
226 | | ... | Type: dictionary
227 | | ...
228 | | ... | *Example:*
229 | | ... | \| Sub-interface configuration with bd and rw from Honeycomb should be\
230 | | ... | \| ${nodes['DUT1']} \| sub_test \| ${sub_interface_base_settings}\
231 | | ... | \| ${sub_interface_settings} \|
232 | | ...
233 | | [Arguments] | ${node} | ${interface} | ${base_settings} | ${sub_settings}
234 | | ${api_data}= | interfaceAPI.Get interface oper data | ${node} | ${interface}
235 | | ${api_sub}= | Set Variable | ${api_data['v3po:sub-interface']}
236 | | Should be equal as strings | ${api_data['name']} | ${base_settings['name']}
237 | | Should be equal as strings | ${api_data['type']} | ${base_settings['type']}
238 | | Should be equal as strings
239 | | ... | ${api_sub['super-interface']} | ${sub_settings['super-interface']}
240 | | Should be equal as strings
241 | | ... | ${api_sub['identifier']} | ${sub_settings['identifier']}
242 | | Should be equal as strings
243 | | ... | ${api_sub['vlan-type']} | ${sub_settings['vlan-type']}
244 | | Should be equal as strings
245 | | ... | ${api_sub['number-of-tags']} | ${sub_settings['number-of-tags']}
246 | | Run keyword if | ${sub_settings['match-any-outer-id']} == ${TRUE}
247 | | ... | Should be equal | ${api_sub['match-any-outer-id'][0]} | ${None}
248 | | Run keyword if | ${sub_settings['match-any-inner-id']} == ${TRUE}
249 | | ... | Should be equal | ${api_sub['match-any-inner-id'][0]} | ${None}
250 | | Run keyword if | ${sub_settings['exact-match']} == ${TRUE}
251 | | ... | Should be equal | ${api_sub['exact-match'][0]} | ${None}
252 | | Run keyword if | ${sub_settings['default-subif']} == ${TRUE}
253 | | ... | Should be equal | ${api_sub['default-subif'][0]} | ${None}
254 | | Should be equal | ${api_data['v3po:l2']['bridge-domain']}
255 | | ... | ${base_settings['v3po:l2']['bridge-domain']}
256 | | ${rw_data}= | Set Variable | ${api_data['v3po:l2']['vlan-tag-rewrite']}
257 | | ${rw_params}= | Set Variable
258 | | ... | ${base_settings['v3po:l2']['vlan-tag-rewrite']}
259 | | Should be equal as strings | ${rw_data['rewrite-operation']}
260 | | ... | ${rw_params['rewrite-operation']}
261 | | Should be equal as strings | ${rw_data['first-pushed']}
262 | | ... | ${rw_params['first-pushed']}
263
264 | Rewrite tag configuration from VAT should be
265 | | [Documentation] | Retrieves sub-interface configuration through VAT and\
266 | | ... | compares values of rewrite tag parameters with settings supplied in\
267 | | ... | argument.
268 | | ...
269 | | ... | *Arguments:*
270 | | ... | - node - information about a DUT node. Type: dictionary
271 | | ... | - interface - name of an interface on the specified node. Type: string
272 | | ... | - rw_settings - Parameters to be set while setting the rewrite tag.\
273 | | ... | Type: dictionary
274 | | ...
275 | | ... | *Example:*
276 | | ... | \| Rewrite tag configuration from VAT should be\
277 | | ... | \| ${nodes['DUT1']} \| sub_test \| ${rw_params} \|
278 | | ...
279 | | [Arguments] | ${node} | ${interface} | ${rw_settings}
280 | | ${vat_data}= | InterfaceCLI.VPP get interface data | ${node} | ${interface}
281 | | Should be equal as strings | ${vat_data['vtr_op']}
282 | | ... | ${rewrite_operations['${rw_settings['rewrite-operation']}']}
283 | | Run keyword if | '${rw_settings['rewrite-operation']}' == 'push-1'
284 | | ... | Should be equal as strings
285 | | ... | ${vat_data['vtr_tag1']} | ${rw_settings['tag1']}
286
287 | Honeycomb sets rewrite tag
288 | | [Documentation] | Set the rewrite tag for sub-interface using Honeycomb API.
289 | | ...
290 | | ... | *Arguments:*
291 | | ... | - node - information about a DUT node. Type: dictionary
292 | | ... | - sub_interface - name of an sub-interface on the specified node.\
293 | | ... | Type: string
294 | | ... | - rw_params - Parameters to be set while setting the rewrite tag.\
295 | | ... | Type: dictionary
296 | | ...
297 | | ... | *Example:*
298 | | ... | \| Honeycomb sets rewrite tag\
299 | | ... | \| ${nodes['DUT1']} \| sub_test \| ${rw_params} \|
300 | | ...
301 | | [Arguments] | ${node} | ${sub_interface} | ${rw_params}
302 | | interfaceAPI.Add vlan tag rewrite to sub interface
303 | | ... | ${node} | ${sub_interface} | &{rw_params}
304
305 | Honeycomb removes rewrite tag
306 | | [Documentation] | Remove the rewrite tag from sub-interface using Honeycomb\
307 | | ... | API.
308 | | ...
309 | | ... | *Arguments:*
310 | | ... | - node - information about a DUT node. Type: dictionary
311 | | ... | - sub_interface - name of an sub-interface on the specified node.\
312 | | ... | Type: string
313 | | ...
314 | | ... | *Example:*
315 | | ... | \| Honeycomb removes rewrite tag \| ${nodes['DUT1']} \| sub_test \|
316 | | ...
317 | | [Arguments] | ${node} | ${sub_interface}
318 | | interfaceAPI.Remove vlan tag rewrite from sub interface
319 | | ... | ${node} | ${sub_interface}
320
321 | Rewrite tag from Honeycomb should be
322 | | [Documentation] | Uses Honeycomb API to verify if the rewrite tag is set\
323 | | ... | with correct parameters.
324 | | ...
325 | | ... | *Arguments:*
326 | | ... | - node - information about a DUT node. Type: dictionary
327 | | ... | - sub_interface - name of an sub-interface on the specified node.\
328 | | ... | Type: string
329 | | ... | - rw_params - Parameters to be checked. Type: dictionary
330 | | ...
331 | | ... | *Example:*
332 | | ... | \| Rewrite tag from Honeycomb should be\
333 | | ... | \| ${nodes['DUT1']} \| sub_test \| ${rw_params} \|
334 | | ...
335 | | [Arguments] | ${node} | ${sub_interface} | ${rw_params}
336 | | ${if_data}= | interfaceAPI.Get interface oper data | ${node}
337 | | ... | ${sub_interface}
338 | | ${rw_data}= | Set Variable | ${if_data['v3po:l2']["vlan-tag-rewrite"]}
339 | | Should be equal as strings | ${rw_data['rewrite-operation']}
340 | | ... | ${rw_params['rewrite-operation']}
341 | | Should be equal as strings | ${rw_data['first-pushed']}
342 | | ... | ${rw_params['first-pushed']}
343
344 | Honeycomb fails to set wrong rewrite tag
345 | | [Documentation] | Honeycomb tries to set wrong rewrite tag and expects\
346 | | ... | error.
347 | | ...
348 | | ... | *Arguments:*
349 | | ... | - node - information about a DUT node. Type: dictionary
350 | | ... | - sub_interface - name of an sub-interface on the specified node.\
351 | | ... | Type: string
352 | | ... | - rw_params - Parameters to be set while setting the rewrite tag.\
353 | | ... | Type: dictionary
354 | | ...
355 | | ... | *Example:*
356 | | ... | \| Honeycomb fails to set wrong rewrite tag\
357 | | ... | \| ${nodes['DUT1']} \| sub_test \| ${rw_params} \|
358 | | ...
359 | | [Arguments] | ${node} | ${sub_interface} | ${rw_params}
360 | | Run keyword and expect error | *HoneycombError: * was not successful. * 400.
361 | | ... | interfaceAPI.Add vlan tag rewrite to sub interface | ${node}
362 | | ... | ${sub_interface} | &{rw_params}
363
364 | Honeycomb fails to set sub-interface up
365 | | [Documentation] | Honeycomb tries to set sub-interface up and expects error.
366 | | ...
367 | | ... | *Arguments:*
368 | | ... | - node - information about a DUT node. Type: dictionary
369 | | ... | - sub_interface - name of an sub-interface on the specified node.\
370 | | ... | Type: string
371 | | ...
372 | | ... | *Example:*
373 | | ... | \| Honeycomb fails to set sub-interface up\
374 | | ... | \| ${node} \| sub_test \|
375 | | ...
376 | | [Arguments] | ${node} | ${sub_interface}
377 | | Run keyword and expect error | *HoneycombError: * was not successful. * 500.
378 | | ... | interfaceAPI.Set interface up | ${node} | ${sub_interface}