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:
6 # http://www.apache.org/licenses/LICENSE-2.0
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.
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.
24 | Honeycomb creates sub-interface
25 | | [Documentation] | Create a sub-interface using Honeycomb API.
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.\
34 | | ... | - sub_interface_settings - Sub-inteface parameters to be set while\
35 | | ... | creating the sub-interface. Type: dictionary
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} \|
43 | | [Arguments] | ${node} | ${super_interface}
44 | | ... | ${match} | ${tags} | ${sub_interface_settings}
46 | | interfaceAPI.Create sub interface | ${node} | ${super_interface}
47 | | ... | ${match} | ${tags} | &{sub_interface_settings}
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.
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
61 | | ... | \| Sub-interface configuration from Honeycomb should be\
62 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1\
63 | | ... | \| ${sub_if_1_params} \|
65 | | [Arguments] | ${node} | ${super_interface} | ${identifier}
66 | | ... | ${sub_if_settings}
68 | | ${api_data}= | interfaceAPI.Get sub interface oper data
69 | | ... | ${node} | ${super_interface} | ${identifier}
70 | | interfaceAPI.Compare Data Structures | ${api_data} | ${sub_if_settings}
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.
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
84 | | ... | \| Sub-interface configuration from VAT should be\
85 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0.1 \| ${sub_if_1_params} \|
87 | | [Arguments] | ${node} | ${sub_interface} | ${sub_interface_settings}
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
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.
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
115 | | ... | \| Sub-interface indices from Honeycomb and VAT should correspond \
116 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \|
118 | | [Arguments] | ${node} | ${super_interface} | ${identifier}
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}
128 | Honeycomb sets the sub-interface up
129 | | [Documentation] | Honeycomb sets the sub-interface up.
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
137 | | ... | Honeycomb sets the sub-interface up\
138 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \|
140 | | [Arguments] | ${node} | ${super_interface} | ${identifier}
142 | | interfaceAPI.Set sub interface state
143 | | ... | ${node} | ${super_interface} | ${identifier} | up
145 | Honeycomb sets the sub-interface down
146 | | [Documentation] | Honeycomb sets the sub-interface down.
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
154 | | ... | Honeycomb sets the sub-interface down\
155 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \|
157 | | [Arguments] | ${node} | ${super_interface} | ${identifier}
159 | | interfaceAPI.Set sub interface state
160 | | ... | ${node} | ${super_interface} | ${identifier} | down
162 | Honeycomb fails to set sub-interface up
163 | | [Documentation] | Honeycomb tries to set sub-interface up and expects error.
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
171 | | ... | \| Honeycomb fails to set sub-interface up\
172 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \|
174 | | [Arguments] | ${node} | ${super_interface} | ${identifier}
176 | | Run keyword and expect error | *HoneycombError: * was not successful. * 500.
177 | | ... | interfaceAPI.Set sub interface state
178 | | ... | ${node} | ${super_interface} | ${identifier} | up
180 | Honeycomb adds sub-interface to bridge domain
181 | | [Documentation] | Honeycomb adds the given sub-interface to bridge domain.
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
191 | | ... | \| Honeycomb adds sub-interface to bridge domain\
192 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \| ${bd_settings} \|
194 | | [Arguments] | ${node} | ${super_if} | ${identifier} | ${sub_bd_setings}
196 | | interfaceAPI.Add bridge domain to sub interface
197 | | ... | ${node} | ${super_if} | ${identifier} | ${sub_bd_setings}
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.
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
210 | | ... | \| Sub-interface bridge domain configuration from Honeycomb should be\
211 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \| ${bd_settings} \|
213 | | [Arguments] | ${node} | ${super_if} | ${identifier} | ${settings}
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']}
220 | Sub-interface bridge domain configuration from VAT should be
221 | | [Documentation] | Uses VAT to verify sub-interface assignment to a bridge\
224 | | ... | *Arguments:*
225 | | ... | - node - Information about a DUT node. Type: dictionary
226 | | ... | - interface - Name of a sub-interface on the specified node. Type:\
228 | | ... | - setings - Parameters to be checked. Type: dictionary
231 | | ... | \| Sub-interface bridge domain configuration from VAT should be\
232 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0.1 \| ${sub_bd_setings} \|
234 | | [Arguments] | ${node} | ${interface} | ${settings}
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']}
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.
250 | | ... | *Arguments:*
251 | | ... | - node - Information about a DUT node. Type: dictionary
252 | | ... | - super_if - Super-interface. Type: string
255 | | ... | \| Honeycomb fails to remove all sub-interfaces\
256 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \|
258 | | [Arguments] | ${node} | ${super_if}
260 | | Run keyword and expect error | *HoneycombError:*not successful. * code: 500.
261 | | ... | interfaceAPI.Remove all sub interfaces
262 | | ... | ${node} | ${super_if}
264 | Honeycomb configures tag rewrite
265 | | [Documentation] | Honeycomb configures tag-rewrite
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.
274 | | ... | \| Honeycomb configures tag rewrite\
275 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1\
276 | | ... | \| ${tag_rewrite_push} \|
278 | | [Arguments] | ${node} | ${super_if} | ${identifier} | ${settings}
280 | | interfaceAPI.Configure tag rewrite
281 | | ... | ${node} | ${super_if} | ${identifier} | ${settings}
283 | Rewrite tag from Honeycomb should be empty
284 | | [Documentation] | Checks if the tag-rewrite is empty or does not exist.
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
292 | | ... | \| Rewrite tag from Honeycomb should be empty\
293 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \|
295 | | [Arguments] | ${node} | ${super_if} | ${identifier}
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}
301 | Rewrite tag from Honeycomb should be
302 | | [Documentation] | Checks if the operational data retrieved from Honeycomb\
303 | | ... | are as expected.
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.
313 | | ... | \| Rewrite tag from Honeycomb should be\
314 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1\
315 | | ... | \| ${tag_rewrite_push_oper} \|
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}
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\
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
335 | | ... | \| Rewrite tag from VAT should be\
336 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0.1 \| ${rw_params} \|
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}
342 | Honeycomb fails to set wrong rewrite tag
343 | | [Documentation] | Honeycomb tries to set wrong rewrite tag and expects\
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.
353 | | ... | \| Honeycomb fails to set wrong rewrite tag\
354 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1\
355 | | ... | \| ${tag_rewrite_push_WRONG} \|
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}
362 | VAT disables tag-rewrite
363 | | [Documentation] | The keyword disables the tag-rewrite using VAT.
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
371 | | ... | \| VAT disables tag-rewrite\
372 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0.1 \|
374 | | [Arguments] | ${node} | ${sub_interface}
376 | | ${sw_if_index}= | interfaceCLI.Get sw if index | ${node} | ${sub_interface}
377 | | L2 tag rewrite | ${node} | ${sw_if_index} | disable