aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/robot/honeycomb/sub_interface.robot
blob: c21b860f648b2b97e6905aaf7b91438d1279a72f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
# Copyright (c) 2016 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

*** Settings ***
| Library | resources.libraries.python.InterfaceUtil
| ...     | WITH NAME | interfaceCLI
| Library | resources.libraries.python.L2Util
| Library | resources.libraries.python.honeycomb.HcAPIKwInterfaces.InterfaceKeywords
| ...     | WITH NAME | InterfaceAPI
| Resource | resources/libraries/robot/honeycomb/bridge_domain.robot
| Documentation | Keywords used to manipulate sub-interfaces.

*** Keywords ***
| Honeycomb creates sub-interface
| | [Documentation] | Create a sub-interface using Honeycomb API.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - super_interface - Super-interface where a sub-interface will be\
| | ... | created. Type: string
| | ... | - match - Match type. Type: string
| | ... | - tags - List of tags to be set while creating the sub-interface.\
| | ... | Type: list
| | ... | - sub_interface_settings - Sub-inteface parameters to be set while\
| | ... | creating the sub-interface. Type: dictionary
| | ...
| | ... | *Example:*
| | ... | \| Honeycomb creates sub-interface\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0\
| | ... | \| vlan-tagged-exact-match \| ${sub_if_1_tags}\
| | ... | \| ${sub_if_1_settings} \|
| | ...
| | [Arguments] | ${node} | ${super_interface}
| | ... | ${match} | ${tags} | ${sub_interface_settings}
| | ...
| | interfaceAPI.Create sub interface | ${node} | ${super_interface}
| | ... | ${match} | ${tags} | &{sub_interface_settings}

| Sub-interface configuration from Honeycomb should be
| | [Documentation] | Retrieves sub-interface configuration through Honeycomb\
| | ... | and compares it with settings supplied in argument.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - super_interface - Super-interface. Type: string
| | ... | - identifier - Sub-interface ID. Type: integer or string
| | ... | - sub_if_settings - Operational data for sub-interface to be checked.\
| | ... | Type: dictionary
| | ...
| | ... | *Example:*
| | ... | \| Sub-interface configuration from Honeycomb should be\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1\
| | ... | \| ${sub_if_1_params} \|
| | ...
| | [Arguments] | ${node} | ${super_interface} | ${identifier}
| | ... | ${sub_if_settings}
| | ...
| | ${api_data}= | interfaceAPI.Get sub interface oper data
| | ... | ${node} | ${super_interface} | ${identifier}
| | interfaceAPI.Compare Data Structures | ${api_data} | ${sub_if_settings}

| Sub-interface configuration from VAT should be
| | [Documentation] | Retrieves sub-interface configuration through VAT and\
| | ... | compares it with settings supplied in argument.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - sub_interface - Name of an sub-interface on the specified node.\
| | ... | Type: string
| | ... | - sub_interface_settings - Operational data specific for a\
| | ... | sub-interface to be checked. Type: dictionary
| | ...
| | ... | *Example:*
| | ... | \| Sub-interface configuration from VAT should be\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0.1 \| ${sub_if_1_params} \|
| | ...
| | [Arguments] | ${node} | ${sub_interface} | ${sub_interface_settings}
| | ...
| | ${vat_data}= | InterfaceCLI.VPP get interface data
| | ... | ${node} | ${sub_interface}
| | Should be equal as strings | ${vat_data['sub_id']}
| | ... | ${sub_interface_settings['identifier']}
| | Should be equal as strings
| | ... | ${vat_data['interface_name']} | ${sub_interface}
| | Run keyword if | ${vat_data['link_up_down']} == 0
| | ... | Should be equal as strings
| | ... | ${sub_interface_settings['oper-status']} | down
| | Run keyword if | ${vat_data['link_up_down']} == 1
| | ... | Should be equal as strings
| | ... | ${sub_interface_settings['oper-status']} | up

| Sub-interface indices from Honeycomb and VAT should correspond
| | [Documentation] | Uses VAT and Honeycomb to get operational data about the\
| | ... | given sub-interface and compares the interface indexes. The
| | ... | sub-interface index from Honeycomb should be greater than index from
| | ... | VAT by one.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - super_interface - Super-interface. Type: string
| | ... | - identifier - Sub-interface ID. Type: integer or string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Sub-interface indices from Honeycomb and VAT should correspond \
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \|
| | ...
| | [Arguments] | ${node} | ${super_interface} | ${identifier}
| | ...
| | ${api_data}= | interfaceAPI.Get sub interface oper data
| | ... | ${node} | ${super_interface} | ${identifier}
| | ${vat_data}= | InterfaceCLI.VPP get interface data
| | ... | ${node} | ${super_interface}.${identifier}
| | ${sw_if_index}= | EVALUATE | ${vat_data['sw_if_index']} + 1
| | Should be equal as strings
| | ... | ${api_data['if-index']} | ${sw_if_index}

| Honeycomb sets the sub-interface up
| | [Documentation] | Honeycomb sets the sub-interface up.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - super_interface - Super-interface. Type: string
| | ... | - identifier - Sub-interface ID. Type: integer or string
| | ...
| | ... | *Example:*
| | ... | Honeycomb sets the sub-interface up\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \|
| | ...
| | [Arguments] | ${node} | ${super_interface} | ${identifier}
| | ...
| | interfaceAPI.Set sub interface state
| | ... | ${node} | ${super_interface} | ${identifier} | up

| Honeycomb sets the sub-interface down
| | [Documentation] | Honeycomb sets the sub-interface down.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - super_interface - Super-interface. Type: string
| | ... | - identifier - Sub-interface ID. Type: integer or string
| | ...
| | ... | *Example:*
| | ... | Honeycomb sets the sub-interface down\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \|
| | ...
| | [Arguments] | ${node} | ${super_interface} | ${identifier}
| | ...
| | interfaceAPI.Set sub interface state
| | ... | ${node} | ${super_interface} | ${identifier} | down

| Honeycomb fails to set sub-interface up
| | [Documentation] | Honeycomb tries to set sub-interface up and expects error.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - super_interface - Super-interface. Type: string
| | ... | - identifier - Sub-interface ID. Type: integer or string
| | ...
| | ... | *Example:*
| | ... | \| Honeycomb fails to set sub-interface up\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \|
| | ...
| | [Arguments] | ${node} | ${super_interface} | ${identifier}
| | ...
| | Run keyword and expect error | *HoneycombError: * was not successful. * 500.
| | ... | interfaceAPI.Set sub interface state
| | ... | ${node} | ${super_interface} | ${identifier} | up

| Honeycomb adds sub-interface to bridge domain
| | [Documentation] | Honeycomb adds the given sub-interface to bridge domain.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - super_if - Super-interface. Type: string
| | ... | - identifier - Sub-interface ID. Type: integer or string
| | ... | - sub_bd_setings - Bridge domain parameters to be set while adding\
| | ... | the sub-interface to the bridge domain. Type: dictionary
| | ...
| | ... | *Example:*
| | ... | \| Honeycomb adds sub-interface to bridge domain\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \| ${bd_settings} \|
| | ...
| | [Arguments] | ${node} | ${super_if} | ${identifier} | ${sub_bd_setings}
| | ...
| | interfaceAPI.Add bridge domain to sub interface
| | ... | ${node} | ${super_if} | ${identifier} | ${sub_bd_setings}

| Sub-interface bridge domain configuration from Honeycomb should be
| | [Documentation] | Uses Honeycomb API to verify sub-interface assignment to\
| | ... | a bridge domain.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - super_if - Super-interface. Type: string
| | ... | - identifier - Sub-interface ID. Type: integer or string
| | ... | - settings - Bridge domain parameters to be checked. Type: dictionary
| | ...
| | ... | *Example:*
| | ... | \| Sub-interface bridge domain configuration from Honeycomb should be\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \| ${bd_settings} \|
| | ...
| | [Arguments] | ${node} | ${super_if} | ${identifier} | ${settings}
| | ...
| | ${if_data}= | interfaceAPI.Get BD data from sub interface
| | ... | ${node} | ${super_if} | ${identifier}
| | Should be equal | ${if_data['bridge-domain']}
| | ... | ${settings['bridge-domain']}

| Sub-interface bridge domain configuration from VAT should be
| | [Documentation] | Uses VAT to verify sub-interface assignment to a bridge\
| | ... | domain.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - interface - Name of a sub-interface on the specified node. Type:\
| | ... | string
| | ... | - setings - Parameters to be checked. Type: dictionary
| | ...
| | ... | *Example:*
| | ... | \| Sub-interface bridge domain configuration from VAT should be\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0.1 \| ${sub_bd_setings} \|
| | ...
| | [Arguments] | ${node} | ${interface} | ${settings}
| | ...
| | ${bd_data}= | VPP get bridge domain data | ${node}
| | ${bd_intf}= | Set Variable | ${bd_data[0]}
| | ${sw_if_data}= | Set Variable | ${bd_intf['sw_if'][0]}
| | Should be equal as integers | ${bd_intf['flood']} | ${bd_settings['flood']}
| | Should be equal as integers | ${bd_intf['forward']}
| | ... | ${bd_settings['forward']}
| | Should be equal as integers | ${bd_intf['learn']} | ${bd_settings['learn']}
| | Should be equal as strings | ${sw_if_data['shg']}
| | ... | ${settings['split-horizon-group']}

| Honeycomb fails to remove all sub-interfaces
| | [Documentation] | Honeycomb tries to remove all sub-interfaces using\
| | ... | Honeycomb API. This operation must fail.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - super_if - Super-interface. Type: string
| | ...
| | ... | *Example:*
| | ... | \| Honeycomb fails to remove all sub-interfaces\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \|
| | ...
| | [Arguments] | ${node} | ${super_if}
| | ...
| | Run keyword and expect error | *HoneycombError:*not successful. * code: 500.
| | ... | interfaceAPI.Remove all sub interfaces
| | ... | ${node} | ${super_if}

| Honeycomb configures tag rewrite
| | [Documentation] | Honeycomb configures tag-rewrite
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - super_if - Super-interface. Type: string
| | ... | - identifier - Sub-interface ID. Type: integer or string
| | ... | - settings - tag-rewrite parameters. Type: dictionary.
| | ...
| | ... | *Example:*
| | ... | \| Honeycomb configures tag rewrite\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1\
| | ... | \| ${tag_rewrite_push} \|
| | ...
| | [Arguments] | ${node} | ${super_if} | ${identifier} | ${settings}
| | ...
| | interfaceAPI.Configure tag rewrite
| | ... | ${node} | ${super_if} | ${identifier} | ${settings}

| Rewrite tag from Honeycomb should be empty
| | [Documentation] | Checks if the tag-rewrite is empty or does not exist.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - super_if - Super-interface. Type: string
| | ... | - identifier - Sub-interface ID. Type: integer or string
| | ...
| | ... | *Example:*
| | ... | \| Rewrite tag from Honeycomb should be empty\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \|
| | ...
| | [Arguments] | ${node} | ${super_if} | ${identifier}
| | ...
| | Run keyword and expect error | *Hon*Error*oper*does not contain*tag-rewrite*
| | ... | interfaceAPI.Get tag rewrite oper data
| | ... | ${node} | ${super_if} | ${identifier}

| Rewrite tag from Honeycomb should be
| | [Documentation] | Checks if the operational data retrieved from Honeycomb\
| | ... | are as expected.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - super_if - Super-interface. Type: string
| | ... | - identifier - Sub-interface ID. Type: integer or string
| | ... | - settings - tag-rewrite operational parameters to be checked.\
| | ... | Type: dictionary.
| | ...
| | ... | *Example:*
| | ... | \| Rewrite tag from Honeycomb should be\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1\
| | ... | \| ${tag_rewrite_push_oper} \|
| | ...
| | [Arguments] | ${node} | ${super_if} | ${identifier} | ${settings}
| | ${api_data}= | interfaceAPI.Get tag rewrite oper data
| | ... | ${node} | ${super_if} | ${identifier}
| | interfaceAPI.Compare Data Structures | ${api_data} | ${settings}

| Rewrite tag from VAT should be
| | [Documentation] | Retrieves sub-interface configuration through VAT and\
| | ... | compares values of rewrite tag parameters with settings supplied in\
| | ... | argument.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of a sub-interface on the specified node.\
| | ... | Type: string
| | ... | - rw_settings - Parameters to be set while setting the rewrite tag.\
| | ... | Type: dictionary
| | ...
| | ... | *Example:*
| | ... | \| Rewrite tag from VAT should be\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0.1 \| ${rw_params} \|
| | ...
| | [Arguments] | ${node} | ${interface} | ${rw_settings}
| | ${vat_data}= | InterfaceCLI.VPP get interface data | ${node} | ${interface}
| | interfaceAPI.Compare Data Structures | ${vat_data} | ${rw_settings}

| Honeycomb fails to set wrong rewrite tag
| | [Documentation] | Honeycomb tries to set wrong rewrite tag and expects\
| | ... | an error.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - super_if - Super-interface. Type: string
| | ... | - identifier - Sub-interface ID. Type: integer or string
| | ... | - settings - tag-rewrite parameters. Type: dictionary.
| | ...
| | ... | *Example:*
| | ... | \| Honeycomb fails to set wrong rewrite tag\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1\
| | ... | \| ${tag_rewrite_push_WRONG} \|
| | ...
| | [Arguments] | ${node} | ${super_if} | ${identifier} | ${settings}
| | Run keyword and expect error | *HoneycombError: * was not successful. *00.
| | ... | interfaceAPI.Configure tag rewrite
| | ... | ${node} | ${super_if} | ${identifier} | ${settings}

| VAT disables tag-rewrite
| | [Documentation] | The keyword disables the tag-rewrite using VAT.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - sub_interface - Name of an sub-interface on the specified node.\
| | ... | Type: string
| | ...
| | ... | *Example:*
| | ... | \| VAT disables tag-rewrite\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0.1 \|
| | ...
| | [Arguments] | ${node} | ${sub_interface}
| | ...
| | ${sw_if_index}= | interfaceCLI.Get sw if index | ${node} | ${sub_interface}
| | L2 tag rewrite | ${node} | ${sw_if_index} | disable