Update Honeycomb persistence tests with new Vlan
[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.L2Util
18 | Library | resources.libraries.python.honeycomb.HcAPIKwInterfaces.InterfaceKeywords
19 | ...     | WITH NAME | InterfaceAPI
20 | Resource | resources/libraries/robot/honeycomb/bridge_domain.robot
21 | Documentation | Keywords used to manipulate sub-interfaces.
22
23 *** Keywords ***
24 | Honeycomb creates sub-interface
25 | | [Documentation] | Create a sub-interface using Honeycomb API.
26 | | ...
27 | | ... | *Arguments:*
28 | | ... | - node - Information about a DUT node. Type: dictionary
29 | | ... | - super_interface - Super-interface where a sub-interface will be\
30 | | ... | created. Type: string
31 | | ... | - match - Match type. Type: string
32 | | ... | - tags - List of tags to be set while creating the sub-interface.\
33 | | ... | Type: list
34 | | ... | - sub_interface_settings - Sub-inteface parameters to be set while\
35 | | ... | creating the sub-interface. Type: dictionary
36 | | ...
37 | | ... | *Example:*
38 | | ... | \| Honeycomb creates sub-interface\
39 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0\
40 | | ... | \| vlan-tagged-exact-match \| ${sub_if_1_tags}\
41 | | ... | \| ${sub_if_1_settings} \|
42 | | ...
43 | | [Arguments] | ${node} | ${super_interface}
44 | | ... | ${match} | ${tags} | ${sub_interface_settings}
45 | | ...
46 | | interfaceAPI.Create sub interface | ${node} | ${super_interface}
47 | | ... | ${match} | ${tags} | &{sub_interface_settings}
48
49 | Sub-interface configuration from Honeycomb should be
50 | | [Documentation] | Retrieves sub-interface configuration through Honeycomb\
51 | | ... | and compares it with settings supplied in argument.
52 | | ...
53 | | ... | *Arguments:*
54 | | ... | - node - Information about a DUT node. Type: dictionary
55 | | ... | - super_interface - Super-interface. Type: string
56 | | ... | - identifier - Sub-interface ID. Type: integer or string
57 | | ... | - sub_if_settings - Operational data for sub-interface to be checked.\
58 | | ... | Type: dictionary
59 | | ...
60 | | ... | *Example:*
61 | | ... | \| Sub-interface configuration from Honeycomb should be\
62 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1\
63 | | ... | \| ${sub_if_1_params} \|
64 | | ...
65 | | [Arguments] | ${node} | ${super_interface} | ${identifier}
66 | | ... | ${sub_if_settings}
67 | | ...
68 | | ${api_data}= | interfaceAPI.Get sub interface oper data
69 | | ... | ${node} | ${super_interface} | ${identifier}
70 | | interfaceAPI.Compare Data Structures | ${api_data} | ${sub_if_settings}
71
72 | Sub-interface configuration from VAT should be
73 | | [Documentation] | Retrieves sub-interface configuration through VAT and\
74 | | ... | compares it with settings supplied in argument.
75 | | ...
76 | | ... | *Arguments:*
77 | | ... | - node - Information about a DUT node. Type: dictionary
78 | | ... | - sub_interface - Name of an sub-interface on the specified node.\
79 | | ... | Type: string
80 | | ... | - sub_interface_settings - Operational data specific for a\
81 | | ... | sub-interface to be checked. Type: dictionary
82 | | ...
83 | | ... | *Example:*
84 | | ... | \| Sub-interface configuration from VAT should be\
85 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0.1 \| ${sub_if_1_params} \|
86 | | ...
87 | | [Arguments] | ${node} | ${sub_interface} | ${sub_interface_settings}
88 | | ...
89 | | ${vat_data}= | InterfaceCLI.VPP get interface data
90 | | ... | ${node} | ${sub_interface}
91 | | Should be equal as strings | ${vat_data['sub_id']}
92 | | ... | ${sub_interface_settings['identifier']}
93 | | Should be equal as strings
94 | | ... | ${vat_data['interface_name']} | ${sub_interface}
95 | | Run keyword if | ${vat_data['link_up_down']} == 0
96 | | ... | Should be equal as strings
97 | | ... | ${sub_interface_settings['oper-status']} | down
98 | | Run keyword if | ${vat_data['link_up_down']} == 1
99 | | ... | Should be equal as strings
100 | | ... | ${sub_interface_settings['oper-status']} | up
101
102 | Sub-interface indices from Honeycomb and VAT should correspond
103 | | [Documentation] | Uses VAT and Honeycomb to get operational data about the\
104 | | ... | given sub-interface and compares the interface indexes. The
105 | | ... | sub-interface index from Honeycomb should be greater than index from
106 | | ... | VAT by one.
107 | | ...
108 | | ... | *Arguments:*
109 | | ... | - node - Information about a DUT node. Type: dictionary
110 | | ... | - super_interface - Super-interface. Type: string
111 | | ... | - identifier - Sub-interface ID. Type: integer or string
112 | | ...
113 | | ... | *Example:*
114 | | ...
115 | | ... | \| Sub-interface indices from Honeycomb and VAT should correspond \
116 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \|
117 | | ...
118 | | [Arguments] | ${node} | ${super_interface} | ${identifier}
119 | | ...
120 | | ${api_data}= | interfaceAPI.Get sub interface oper data
121 | | ... | ${node} | ${super_interface} | ${identifier}
122 | | ${vat_data}= | InterfaceCLI.VPP get interface data
123 | | ... | ${node} | ${super_interface}.${identifier}
124 | | ${sw_if_index}= | EVALUATE | ${vat_data['sw_if_index']} + 1
125 | | Should be equal as strings
126 | | ... | ${api_data['if-index']} | ${sw_if_index}
127
128 | Honeycomb sets the sub-interface up
129 | | [Documentation] | Honeycomb sets the sub-interface up.
130 | | ...
131 | | ... | *Arguments:*
132 | | ... | - node - Information about a DUT node. Type: dictionary
133 | | ... | - super_interface - Super-interface. Type: string
134 | | ... | - identifier - Sub-interface ID. Type: integer or string
135 | | ...
136 | | ... | *Example:*
137 | | ... | Honeycomb sets the sub-interface up\
138 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \|
139 | | ...
140 | | [Arguments] | ${node} | ${super_interface} | ${identifier}
141 | | ...
142 | | interfaceAPI.Set sub interface state
143 | | ... | ${node} | ${super_interface} | ${identifier} | up
144
145 | Honeycomb sets the sub-interface down
146 | | [Documentation] | Honeycomb sets the sub-interface down.
147 | | ...
148 | | ... | *Arguments:*
149 | | ... | - node - Information about a DUT node. Type: dictionary
150 | | ... | - super_interface - Super-interface. Type: string
151 | | ... | - identifier - Sub-interface ID. Type: integer or string
152 | | ...
153 | | ... | *Example:*
154 | | ... | Honeycomb sets the sub-interface down\
155 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \|
156 | | ...
157 | | [Arguments] | ${node} | ${super_interface} | ${identifier}
158 | | ...
159 | | interfaceAPI.Set sub interface state
160 | | ... | ${node} | ${super_interface} | ${identifier} | down
161
162 | Honeycomb fails to set sub-interface up
163 | | [Documentation] | Honeycomb tries to set sub-interface up and expects error.
164 | | ...
165 | | ... | *Arguments:*
166 | | ... | - node - Information about a DUT node. Type: dictionary
167 | | ... | - super_interface - Super-interface. Type: string
168 | | ... | - identifier - Sub-interface ID. Type: integer or string
169 | | ...
170 | | ... | *Example:*
171 | | ... | \| Honeycomb fails to set sub-interface up\
172 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \|
173 | | ...
174 | | [Arguments] | ${node} | ${super_interface} | ${identifier}
175 | | ...
176 | | Run keyword and expect error | *HoneycombError: * was not successful. * 500.
177 | | ... | interfaceAPI.Set sub interface state
178 | | ... | ${node} | ${super_interface} | ${identifier} | up
179
180 | Honeycomb adds sub-interface to bridge domain
181 | | [Documentation] | Honeycomb adds the given sub-interface to bridge domain.
182 | | ...
183 | | ... | *Arguments:*
184 | | ... | - node - Information about a DUT node. Type: dictionary
185 | | ... | - super_if - Super-interface. Type: string
186 | | ... | - identifier - Sub-interface ID. Type: integer or string
187 | | ... | - sub_bd_setings - Bridge domain parameters to be set while adding\
188 | | ... | the sub-interface to the bridge domain. Type: dictionary
189 | | ...
190 | | ... | *Example:*
191 | | ... | \| Honeycomb adds sub-interface to bridge domain\
192 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \| ${bd_settings} \|
193 | | ...
194 | | [Arguments] | ${node} | ${super_if} | ${identifier} | ${sub_bd_setings}
195 | | ...
196 | | interfaceAPI.Add bridge domain to sub interface
197 | | ... | ${node} | ${super_if} | ${identifier} | ${sub_bd_setings}
198
199 | Sub-interface bridge domain configuration from Honeycomb should be
200 | | [Documentation] | Uses Honeycomb API to verify sub-interface assignment to\
201 | | ... | a bridge domain.
202 | | ...
203 | | ... | *Arguments:*
204 | | ... | - node - Information about a DUT node. Type: dictionary
205 | | ... | - super_if - Super-interface. Type: string
206 | | ... | - identifier - Sub-interface ID. Type: integer or string
207 | | ... | - settings - Bridge domain parameters to be checked. Type: dictionary
208 | | ...
209 | | ... | *Example:*
210 | | ... | \| Sub-interface bridge domain configuration from Honeycomb should be\
211 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \| ${bd_settings} \|
212 | | ...
213 | | [Arguments] | ${node} | ${super_if} | ${identifier} | ${settings}
214 | | ...
215 | | ${if_data}= | interfaceAPI.Get BD data from sub interface
216 | | ... | ${node} | ${super_if} | ${identifier}
217 | | Should be equal | ${if_data['bridge-domain']}
218 | | ... | ${settings['bridge-domain']}
219
220 | Sub-interface bridge domain configuration from VAT should be
221 | | [Documentation] | Uses VAT to verify sub-interface assignment to a bridge\
222 | | ... | domain.
223 | | ...
224 | | ... | *Arguments:*
225 | | ... | - node - Information about a DUT node. Type: dictionary
226 | | ... | - interface - Name of a sub-interface on the specified node. Type:\
227 | | ... | string
228 | | ... | - setings - Parameters to be checked. Type: dictionary
229 | | ...
230 | | ... | *Example:*
231 | | ... | \| Sub-interface bridge domain configuration from VAT should be\
232 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0.1 \| ${sub_bd_setings} \|
233 | | ...
234 | | [Arguments] | ${node} | ${interface} | ${settings}
235 | | ...
236 | | ${bd_data}= | VPP get bridge domain data | ${node}
237 | | ${bd_intf}= | Set Variable | ${bd_data[0]}
238 | | ${sw_if_data}= | Set Variable | ${bd_intf['sw_if'][0]}
239 | | Should be equal as integers | ${bd_intf['flood']} | ${bd_settings['flood']}
240 | | Should be equal as integers | ${bd_intf['forward']}
241 | | ... | ${bd_settings['forward']}
242 | | Should be equal as integers | ${bd_intf['learn']} | ${bd_settings['learn']}
243 | | Should be equal as strings | ${sw_if_data['shg']}
244 | | ... | ${settings['split-horizon-group']}
245
246 | Honeycomb fails to remove all sub-interfaces
247 | | [Documentation] | Honeycomb tries to remove all sub-interfaces using\
248 | | ... | Honeycomb API. This operation must fail.
249 | | ...
250 | | ... | *Arguments:*
251 | | ... | - node - Information about a DUT node. Type: dictionary
252 | | ... | - super_if - Super-interface. Type: string
253 | | ...
254 | | ... | *Example:*
255 | | ... | \| Honeycomb fails to remove all sub-interfaces\
256 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \|
257 | | ...
258 | | [Arguments] | ${node} | ${super_if}
259 | | ...
260 | | Run keyword and expect error | *HoneycombError:*not successful. * code: 500.
261 | | ... | interfaceAPI.Remove all sub interfaces
262 | | ... | ${node} | ${super_if}
263
264 | Honeycomb configures tag rewrite
265 | | [Documentation] | Honeycomb configures tag-rewrite
266 | | ...
267 | | ... | *Arguments:*
268 | | ... | - node - Information about a DUT node. Type: dictionary
269 | | ... | - super_if - Super-interface. Type: string
270 | | ... | - identifier - Sub-interface ID. Type: integer or string
271 | | ... | - settings - tag-rewrite parameters. Type: dictionary.
272 | | ...
273 | | ... | *Example:*
274 | | ... | \| Honeycomb configures tag rewrite\
275 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1\
276 | | ... | \| ${tag_rewrite_push} \|
277 | | ...
278 | | [Arguments] | ${node} | ${super_if} | ${identifier} | ${settings}
279 | | ...
280 | | interfaceAPI.Configure tag rewrite
281 | | ... | ${node} | ${super_if} | ${identifier} | ${settings}
282
283 | Rewrite tag from Honeycomb should be empty
284 | | [Documentation] | Checks if the tag-rewrite is empty or does not exist.
285 | | ...
286 | | ... | *Arguments:*
287 | | ... | - node - Information about a DUT node. Type: dictionary
288 | | ... | - super_if - Super-interface. Type: string
289 | | ... | - identifier - Sub-interface ID. Type: integer or string
290 | | ...
291 | | ... | *Example:*
292 | | ... | \| Rewrite tag from Honeycomb should be empty\
293 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \|
294 | | ...
295 | | [Arguments] | ${node} | ${super_if} | ${identifier}
296 | | ...
297 | | Run keyword and expect error | *Hon*Error*oper*does not contain*tag-rewrite*
298 | | ... | interfaceAPI.Get tag rewrite oper data
299 | | ... | ${node} | ${super_if} | ${identifier}
300
301 | Rewrite tag from Honeycomb should be
302 | | [Documentation] | Checks if the operational data retrieved from Honeycomb\
303 | | ... | are as expected.
304 | | ...
305 | | ... | *Arguments:*
306 | | ... | - node - Information about a DUT node. Type: dictionary
307 | | ... | - super_if - Super-interface. Type: string
308 | | ... | - identifier - Sub-interface ID. Type: integer or string
309 | | ... | - settings - tag-rewrite operational parameters to be checked.\
310 | | ... | Type: dictionary.
311 | | ...
312 | | ... | *Example:*
313 | | ... | \| Rewrite tag from Honeycomb should be\
314 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1\
315 | | ... | \| ${tag_rewrite_push_oper} \|
316 | | ...
317 | | [Arguments] | ${node} | ${super_if} | ${identifier} | ${settings}
318 | | ${api_data}= | interfaceAPI.Get tag rewrite oper data
319 | | ... | ${node} | ${super_if} | ${identifier}
320 | | interfaceAPI.Compare Data Structures | ${api_data} | ${settings}
321
322 | Rewrite tag from VAT should be
323 | | [Documentation] | Retrieves sub-interface configuration through VAT and\
324 | | ... | compares values of rewrite tag parameters with settings supplied in\
325 | | ... | argument.
326 | | ...
327 | | ... | *Arguments:*
328 | | ... | - node - information about a DUT node. Type: dictionary
329 | | ... | - interface - name of a sub-interface on the specified node.\
330 | | ... | Type: string
331 | | ... | - rw_settings - Parameters to be set while setting the rewrite tag.\
332 | | ... | Type: dictionary
333 | | ...
334 | | ... | *Example:*
335 | | ... | \| Rewrite tag from VAT should be\
336 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0.1 \| ${rw_params} \|
337 | | ...
338 | | [Arguments] | ${node} | ${interface} | ${rw_settings}
339 | | ${vat_data}= | InterfaceCLI.VPP get interface data | ${node} | ${interface}
340 | | interfaceAPI.Compare Data Structures | ${vat_data} | ${rw_settings}
341
342 | Honeycomb fails to set wrong rewrite tag
343 | | [Documentation] | Honeycomb tries to set wrong rewrite tag and expects\
344 | | ... | an error.
345 | | ...
346 | | ... | *Arguments:*
347 | | ... | - node - Information about a DUT node. Type: dictionary
348 | | ... | - super_if - Super-interface. Type: string
349 | | ... | - identifier - Sub-interface ID. Type: integer or string
350 | | ... | - settings - tag-rewrite parameters. Type: dictionary.
351 | | ...
352 | | ... | *Example:*
353 | | ... | \| Honeycomb fails to set wrong rewrite tag\
354 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1\
355 | | ... | \| ${tag_rewrite_push_WRONG} \|
356 | | ...
357 | | [Arguments] | ${node} | ${super_if} | ${identifier} | ${settings}
358 | | Run keyword and expect error | *HoneycombError: * was not successful. *00.
359 | | ... | interfaceAPI.Configure tag rewrite
360 | | ... | ${node} | ${super_if} | ${identifier} | ${settings}
361
362 | VAT disables tag-rewrite
363 | | [Documentation] | The keyword disables the tag-rewrite using VAT.
364 | | ...
365 | | ... | *Arguments:*
366 | | ... | - node - Information about a DUT node. Type: dictionary
367 | | ... | - sub_interface - Name of an sub-interface on the specified node.\
368 | | ... | Type: string
369 | | ...
370 | | ... | *Example:*
371 | | ... | \| VAT disables tag-rewrite\
372 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0.1 \|
373 | | ...
374 | | [Arguments] | ${node} | ${sub_interface}
375 | | ...
376 | | ${sw_if_index}= | interfaceCLI.Get sw if index | ${node} | ${sub_interface}
377 | | L2 tag rewrite | ${node} | ${sw_if_index} | disable