aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/robot/honeycomb/sub_interface.robot
blob: 6e60b23c37737ba0214a50a2b7272ec60acf0baa (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
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
# 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
| Library | resources.libraries.python.L2Util
| Library | resources.libraries.python.honeycomb.HcAPIKwInterfaces.InterfaceKeywords
| 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}
| | ...
| | Honeycomb Create sub interface | ${node} | ${super_interface}
| | ... | ${match} | ${tags} | &{sub_interface_settings}

| Sub-interface Operational Data 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 Operational Data From Honeycomb Should Be\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1\
| | ... | \| ${sub_if_1_params} \|
| | ...
| | [Arguments] | ${node} | ${super_interface} | ${identifier}
| | ... | ${sub_if_settings}
| | ...
| | ${api_data}= | Get sub interface oper data
| | ... | ${node} | ${super_interface} | ${identifier}
| | Compare Data Structures | ${api_data} | ${sub_if_settings}

| Sub-interface Operational Data From Honeycomb Should Be empty
| | [Documentation] | Retrieves sub-interface configuration through Honeycomb \
| | ... | and expects no data.
| | ...
| | ... | *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 Operational Data From Honeycomb Should Be empty\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \|
| | ...
| | [Arguments] | ${node} | ${super_interface} | ${identifier}
| | ...
| | Run keyword and expect error | *KeyError: 'vpp-vlan:sub-interfaces'*
| | ... | Get sub interface oper data
| | ... | ${node} | ${super_interface} | ${identifier}

| Sub-interface state from Honeycomb should be
| | [Documentation] | Retrieves sub-interface configuration through Honeycomb \
| | ... | and checks the administrative and operational state.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - super_interface - Super-interface. Type: string
| | ... | - identifier - Sub-interface ID. Type: integer or string
| | ... | - admin_state - Required administrative state - up or down. \
| | ... | Type: string
| | ... | - oper_state - Required operational state - up or down. Type: string
| | ...
| | ... | *Example:*
| | ... | \| Sub-interface state from Honeycomb should be\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \| up \| up \|
| | ...
| | [Arguments] | ${node} | ${super_interface} | ${identifier}
| | ... | ${admin_state} | ${oper_state}
| | ...
| | ${api_data}= | Get sub interface oper data
| | ... | ${node} | ${super_interface} | ${identifier}
| | Should be equal | ${api_data['admin-status']} | ${admin_state}
| | Should be equal | ${api_data['oper-status']} | ${oper_state}

| Sub-interface Operational Data 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 Operational Data From VAT Should Be\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0.1 \| ${sub_if_1_params} \|
| | ...
| | [Arguments] | ${node} | ${sub_interface} | ${sub_interface_settings}
| | ...
| | ${vat_data}= | 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 state from VAT should be
| | [Documentation] | Retrieves sub-interface configuration through VAT and \
| | ... | checks the administrative and operational state.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - sub_interface - Name of an sub-interface on the specified node. \
| | ... | Type: string
| | ... | - admin_state - Required administrative state - up or down. \
| | ... | Type: string
| | ... | - oper_state - Required operational state - up or down. Type: string
| | ...
| | ... | *Example:*
| | ... | \| Sub-interface state from VAT should be \
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0.1 \| up \| up \|
| | ...
| | [Arguments] | ${node} | ${sub_interface} | ${admin_state} | ${oper_state}
| | ...
| | ${vat_data}= | VPP get interface data
| | ... | ${node} | ${sub_interface}
| | Run keyword if | '${admin_state}' == 'down'
| | ... | Should be equal as strings | ${vat_data['admin_up_down']} | 0
| | Run keyword if | '${admin_state}' == 'up'
| | ... | Should be equal as strings | ${vat_data['admin_up_down']} | 1
| | Run keyword if | '${oper_state}' == 'down'
| | ... | Should be equal as strings | ${vat_data['link_up_down']} | 0
| | Run keyword if | '${oper_state}' == 'up'
| | ... | Should be equal as strings | ${vat_data['link_up_down']} | 1

| 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}= | Get sub interface oper data
| | ... | ${node} | ${super_interface} | ${identifier}
| | ${vat_data}= | 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}
| | ...
| | 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}
| | ...
| | 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.
| | ... | 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}
| | ...
| | Add bridge domain to sub interface
| | ... | ${node} | ${super_if} | ${identifier} | ${sub_bd_setings}

| Sub-interface bridge domain Operational Data 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 Operational Data From Honeycomb Should Be\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 1 \| ${bd_settings} \|
| | ...
| | [Arguments] | ${node} | ${super_if} | ${identifier} | ${settings}
| | ...
| | ${if_data}= | Get BD data from sub interface
| | ... | ${node} | ${super_if} | ${identifier}
| | Should be equal | ${if_data['bridge-domain']}
| | ... | ${settings['bridge-domain']}

| Sub-interface bridge domain Operational Data From PAPI 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 Operational Data From PAPI 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_details'][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']}
# interface[1] = sw_if_index, interface[2] = shg
| | Should be equal as strings | ${sw_if_data[2]}
| | ... | ${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.
| | ... | 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}
| | ...
| | 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*
| | ... | 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}= | Get tag rewrite oper data
| | ... | ${node} | ${super_if} | ${identifier}
| | 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}= | VPP get interface data | ${node} | ${interface}
| | 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.
| | ... | Configure tag rewrite
| | ... | ${node} | ${super_if} | ${identifier} | ${settings}

| Honeycomb sets sub-interface ipv4 address
| | [Documentation] | Uses Honeycomb API to configure an ipv4 address on the\
| | ... | spcified sub-interface. Replaces any existing ipv4 addresses.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - super_if - Super-interface. Type: string
| | ... | - identifier - Sub-interface ID. Type: integer or string
| | ... | - address - IPv4 address to set. Type: string
| | ... | - prefix - IPv4 network prefix length to set. Type: integer
| | ...
| | ... | *Example:*
| | ... | \| | Honeycomb sets sub-interface ipv4 address\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \
| | ... | \| 192.168.0.2 \| ${24} \|
| | ...
| | [Arguments] | ${node} | ${super_if} | ${identifier} | ${address} | ${prefix}
| | Add ip address to sub_interface
| | ... | ${node} | ${super_if} | ${identifier} | ${address} | ${prefix} | ipv4

| Sub-interface ipv4 address from Honeycomb should be
| | [Documentation] | Uses Honeycomb API to verify ipv4 address configuration\
| | ... | on the specified sub-interface.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - super_if - Super-interface. Type: string
| | ... | - identifier - Sub-interface ID. Type: integer or string
| | ... | - address - IPv4 address to expect. Type: string
| | ... | - prefix - IPv4 network prefix length to expect. Type: integer
| | ...
| | ... | *Example:*
| | ... | \| sub-interface ipv4 address from Honeycomb should be\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \
| | ... | \| 192.168.0.2 \| ${24} \|
| | ...
| | [Arguments] | ${node} | ${super_if} | ${identifier} | ${address} | ${prefix}
| | ${if_data}= | Get sub interface oper data
| | ... | ${node} | ${super_if} | ${identifier}
| | Should be equal
| | ... | ${if_data['ipv4']['address'][0]['ip']} | ${address}
| | Should be equal
| | ... | ${if_data['ipv4']['address'][0]['prefix-length']} | ${prefix}

| Sub-interface ipv4 address from VAT should be
| | [Documentation] | Uses VAT to verify ipv4 address configuration\
| | ... | on the specified sub-interface.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - sub_interface - Name of an sub-interface on the specified node.\
| | ... | Type: string
| | ... | - address - IPv4 address to expect. Type: string
| | ... | - prefix - IPv4 network prefix length to expect. Type: integer
| | ...
| | ... | *Example:*
| | ... | \| sub-interface ipv4 address from VAT should be\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0.1 \|
| | ...
| | [Arguments] | ${node} | ${sub_interface} | ${address} | ${prefix}
| | ${data}= | VPP get interface ip addresses
| | ... | ${node} | ${sub_interface} | ipv4
| | Should be equal | ${data[0]['ip']} | ${address}
| | Should be equal | ${data[0]['prefix_length']} | ${prefix}

| Honeycomb removes all sub-interface ipv4 addresses
| | [Documentation] | Uses Honeycomb API to remove all configured ipv4\
| | ... | addresses from the sub-interface.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - super_if - Super-interface. Type: string
| | ... | - identifier - Sub-interface ID. Type: integer or string
| | ...
| | ... | *Example:*
| | ... | \| Honeycomb removes all sub-interface ipv4 addresses\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \|
| | ...
| | [Arguments] | ${node} | ${super_if} | ${identifier}
| | Remove all ip addresses from sub_interface
| | ... | ${node} | ${super_if} | ${identifier} | ipv4

| Sub-interface ipv4 address from Honeycomb should be empty
| | [Documentation] | Uses Honeycomb API to verify that ipv4 address\
| | ... | configuration on the specified sub-interface is empty.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - super_if - Super-interface. Type: string
| | ... | - identifier - Sub-interface ID. Type: integer or string
| | ...
| | ... | *Example:*
| | ... | \| sub-interface ipv4 address from Honeycomb should be empty\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \|
| | ...
| | [Arguments] | ${node} | ${super_if} | ${identifier}
| | ${if_data}= | Get sub interface oper data
| | ... | ${node} | ${super_if} | ${identifier}
| | Run keyword and expect error | *KeyError: 'ipv4'*
| | ... | Set Variable | ${if_data['ipv4']['address'][0]['ip']}

| Sub-interface ipv4 address from VAT should be empty
| | [Documentation] | Uses VAT to verify that ipv4 address\
| | ... | configuration on the specified sub-interface is empty.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - sub_interface - Name of an sub-interface on the specified node.\
| | ... | Type: string
| | ...
| | ... | *Example:*
| | ... | \| sub-interface ipv4 address from VAT should be empty\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0.1 \|
| | ...
| | [Arguments] | ${node} | ${sub_interface}
| | ${data}= | VPP get interface ip addresses
| | ... | ${node} | ${sub_interface} | ipv4
| | Should be empty | ${data}

| Honeycomb sets sub-interface ipv6 address
| | [Documentation] | Uses Honeycomb API to configure an ipv6 address on the\
| | ... | spcified sub-interface. Replaces any existing ipv6 addresses.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - super_if - Super-interface. Type: string
| | ... | - identifier - Sub-interface ID. Type: integer or string
| | ... | - address - IPv6 address to set. Type: string
| | ... | - prefix - IPv6 network prefix length to set. Type: integer
| | ...
| | ... | *Example:*
| | ... | \| | Honeycomb sets sub-interface ipv6 address\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \
| | ... | \| 10::10 \| ${64} \|
| | ...
| | [Arguments] | ${node} | ${super_if} | ${identifier} | ${address} | ${prefix}
| | Add ip address to sub_interface
| | ... | ${node} | ${super_if} | ${identifier} | ${address} | ${prefix} | ipv6

| Sub-interface IPv6 address from Honeycomb should contain
| | [Documentation] | Uses Honeycomb API to verify ipv6 address configuration\
| | ... | on the specified sub-interface.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - super_if - Super-interface. Type: string
| | ... | - identifier - Sub-interface ID. Type: integer or string
| | ... | - address - IPv6 address to expect. Type: string
| | ... | - prefix - IPv6 network prefix length to expect. Type: integer
| | ...
| | ... | *Example:*
| | ... | \| sub-interface IPv6 address from Honeycomb should contain\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \
| | ... | \| 10::10 \| ${64} \|
| | ...
| | [Arguments] | ${node} | ${super_if} | ${identifier} | ${address} | ${prefix}
| | ${if_data}= | Get sub interface oper data
| | ... | ${node} | ${super_if} | ${identifier}
| | ${settings}= | Create Dictionary
| | ... | ip=${address} | prefix-length=${prefix}
| | Should contain | ${if_data['ipv6']['address']} | ${settings}

| Sub-interface IPv6 address from VAT should contain
| | [Documentation] | Uses VAT to verify ipv6 address configuration\
| | ... | on the specified sub-interface.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - sub_interface - Name of an sub-interface on the specified node.\
| | ... | Type: string
| | ... | - address - IPv6 address to expect. Type: string
| | ... | - prefix - IPv6 network prefix length to expect. Type: integer
| | ...
| | ... | *Example:*
| | ... | \| sub-interface IPv6 address from VAT should contain\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0.1 \|
| | ...
| | [Arguments] | ${node} | ${sub_interface} | ${address} | ${prefix}
| | ${data}= | VPP get interface ip addresses
| | ... | ${node} | ${sub_interface} | ipv6
| | Should be equal | ${data[0]['ip']} | ${address}
| | Should be equal | ${data[0]['prefix_length']} | ${prefix}

| Honeycomb removes all sub-interface ipv6 addresses
| | [Documentation] | Uses Honeycomb API to remove all configured ipv6\
| | ... | addresses from the sub-interface.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - super_if - Super-interface. Type: string
| | ... | - identifier - Sub-interface ID. Type: integer or string
| | ...
| | ... | *Example:*
| | ... | \| Honeycomb removes all sub-interface ipv6 addresses\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \|
| | ...
| | [Arguments] | ${node} | ${super_if} | ${identifier}
| | Remove all ip addresses from sub_interface
| | ... | ${node} | ${super_if} | ${identifier} | ipv6

| Sub-interface ipv6 address from Honeycomb should be empty
| | [Documentation] | Uses Honeycomb API to verify that ipv6 address\
| | ... | configuration on the specified sub-interface is empty.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - super_if - Super-interface. Type: string
| | ... | - identifier - Sub-interface ID. Type: integer or string
| | ...
| | ... | *Example:*
| | ... | \| sub-interface ipv6 address from Honeycomb should be empty\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \|
| | ...
| | [Arguments] | ${node} | ${super_if} | ${identifier}
| | ${if_data}= | Get sub interface oper data
| | ... | ${node} | ${super_if} | ${identifier}
| | Run keyword and expect error | *KeyError: 'ipv6'*
| | ... | Set Variable | ${if_data['ipv6']['address'][0]['ip']}

| Sub-interface ipv6 address from VAT should be empty
| | [Documentation] | Uses VAT to verify that ipv6 address\
| | ... | configuration on the specified sub-interface is empty.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - sub_interface - Name of an sub-interface on the specified node.\
| | ... | Type: string
| | ...
| | ... | *Example:*
| | ... | \| sub-interface ipv6 address from VAT should be empty\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0.1 \|
| | ...
| | [Arguments] | ${node} | ${sub_interface}
| | ${data}= | VPP get interface ip addresses
| | ... | ${node} | ${sub_interface} | ipv6
| | Should be empty | ${data}