summaryrefslogtreecommitdiffstats
path: root/src/vnet/dpo/dvr_dpo.c
AgeCommit message (Collapse)AuthorFilesLines
2019-06-06DVR: Control the reinject as L2 or L3 based on the output interface typeNeale Ranns1-10/+66
Change-Id: Ib4cdbe8a6a1d10a643941c13aa0acbed410f876c Type: Feature Signed-off-by: Neale Ranns <nranns@cisco.com>
2019-03-11dpo: migrate old MULTIARCH macros to VLIB_NODE_FNFilip Tehlar1-18/+9
Change-Id: I3043112c3e7584f61e64dc6d20d57604ebceb76a Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
2019-02-14Add -fno-common compile optionBenoît Ganne1-0/+2
-fno-common makes sure we do not have multiple declarations of the same global symbol across compilation units. It helps debug nasty linkage bugs by guaranteeing that all reference to a global symbol use the same underlying object. It also helps avoiding benign mistakes such as declaring enum as global objects instead of types in headers (hence the minor fixes scattered across the source). Change-Id: I55c16406dc54ff8a6860238b90ca990fa6b179f1 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2018-07-19Remove unused argument to vlib_feature_nextDamjan Marion1-6/+3
Change-Id: Ieb8b53977fc8484c19780941e232ee072b667de3 Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-04-09DVR: save the rewrite length in packet meta-data for featuresNeale Ranns1-3/+9
Change-Id: I0efd03bdb84bc9ff2334d398bfdb82486228114a Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
2018-02-07Refactor vlib_buffer flagsDamjan Marion1-6/+6
Change-Id: I853386aebfe488ebb10328435b81b6e3403c5dd0 Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-01-09DVR: run L3 output featuresNeale Ranns1-0/+591
- rename l2_bridged to is_dvr. Including on the ip.api this was new in the 18.01 release so no compatability issues. - steal the free space in vnet_buffer_opaque_t for use with flags. - run the ipX-output feature arc from the DVR DPO Change-Id: I040e5976d1dbe076fcdda3a40a7804f56337ce3f Signed-off-by: Neale Ranns <nranns@cisco.com>
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 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813
# 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.honeycomb.HcAPIKwInterfaces.InterfaceKeywords
| Library | resources.libraries.python.IPUtil
| Library | resources.libraries.python.TrafficScriptExecutor

*** Keywords ***
| Honeycomb configures interface state
| | [Documentation] | Uses Honeycomb API to change the admin state\
| | ... | of the specified interface.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - state - state to set on interface. Type:string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb configures interface state \| ${nodes['DUT1']} \
| | ... | \| GigabitEthernet0/8/0 \| up \|
| | [Arguments] | ${node} | ${interface} | ${state}
| | Honeycomb Set Interface State | ${node} | ${interface} | ${state}

| Interface state from Honeycomb should be
| | [Documentation] | Retrieves interface admin state through Honeycomb and\
| | ... | compares with state supplied in argument.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - state - expected interface state. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Interface state from Honeycomb should be \| ${nodes['DUT1']} \
| | ... | \| GigabitEthernet0/8/0 \| up \|
| | [Arguments] | ${node} | ${interface} | ${state}
| | ${api_data}= | Get interface oper data | ${node} | ${interface}
| | ${api_state}= | Set Variable | ${api_data['admin-status']}
| | Should be equal | ${api_state} | ${state}

| Interface state from VAT should be
| | [Documentation] | Retrieves interface admin state through VAT and compares\
| | ... | with state supplied in argument.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - state - expected interface state. Type: string
| | ...
| | ... | _NOTE:_ Vat returns state as int (1/0) instead of string (up/down).
| | ... | This keyword also handles translation.
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Interface state from VAT should be \| ${nodes['DUT1']} \
| | ... | \| GigabitEthernet0/8/0 \| up \|
| | [Arguments] | ${node} | ${interface} | ${state}
| | ${vat_data}= | VPP get interface data | ${node} | ${interface}
| | ${vat_state}= | Set Variable if
| | ... | ${vat_data['admin_up_down']} == 1 | up | down
| | Should be equal | ${vat_state} | ${state}

| Honeycomb sets interface IPv4 address
| | [Documentation] | Uses Honeycomb API to change ipv4 address\
| | ... | of the specified interface. Any existing addresses will be removed.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - address - IP address to set. Type: string
| | ... | - netmask - subnet mask to set. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb sets interface IPv4 address \| ${nodes['DUT1']} \
| | ... | \| GigabitEthernet0/8/0 \| 192.168.0.2 \| 255.255.255.0 \|
| | [Arguments] | ${node} | ${interface} | ${address} | ${netmask}
| | Add first ipv4 address
| | ... | ${node} | ${interface} | ${address} | ${netmask}

| Honeycomb sets interface IPv4 address with prefix
| | [Documentation] | Uses Honeycomb API to assign an ipv4 address to the\
| | ... | specified interface. Any existing addresses will be removed.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - address - IP address to set. Type: string
| | ... | - prefix - length of address network prefix. Type: integer
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb sets interface IPv4 address with prefix \
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 192.168.0.2 \| 24 \|
| | [Arguments] | ${node} | ${interface} | ${address} | ${prefix}
| | Add first ipv4 address
| | ... | ${node} | ${interface} | ${address} | ${prefix}

| Honeycomb adds interface IPv4 address
| | [Documentation] | Uses Honeycomb API to add an ipv4 address to the\
| | ... | specified interface, without removing existing addresses.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - address - IP address to set. Type: string
| | ... | - prefix - length of address network prefix. Type: integer
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb adds interface IPv4 address \
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 192.168.0.2 \| 24 \|
| | [Arguments] | ${node} | ${interface} | ${address} | ${prefix}
| | Add ipv4 address
| | ... | ${node} | ${interface} | ${address} | ${prefix}

| Honeycomb fails to add interface IPv4 address
| | [Documentation] | Uses Honeycomb API to add an ipv4 address to the\
| | ... | specified interface, and expects to fail with code 500.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - address - IP address to set. Type: string
| | ... | - prefix - length of address network prefix. Type: integer
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb fails to add interface IPv4 address \
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 192.168.0.2 \| 24 \|
| | [Arguments] | ${node} | ${interface} | ${address} | ${prefix}
| | Run Keyword and Expect Error | *not successful. Status code: 500.
| | ... | Honeycomb adds interface IPv4 address
| | ... | ${node} | ${interface} | ${address} | ${prefix}

| IPv4 address from Honeycomb should be
| | [Documentation] | Retrieves interface ipv4 address through Honeycomb\
| | ... | and compares with state supplied in argument.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - address - IP address to expect. Type: string
| | ... | - prefix - prefix length to expect. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| IPv4 address from Honeycomb should be \| ${nodes['DUT1']} \
| | ... | \| GigabitEthernet0/8/0 \| 192.168.0.2 \| ${24} \|
| | [Arguments] | ${node} | ${interface} | ${address} | ${prefix}
| | ${api_data}= | Get interface oper data | ${node} | ${interface}
| | ${settings}= | Create Dictionary
| | ... | ip=${address} | prefix-length=${prefix}
| | Should contain | ${api_data['ietf-ip:ipv4']['address']} | ${settings}

| IPv4 address from VAT should be
| | [Documentation] | Retrieves interface ipv4 address through VAT and\
| | ... | compares with state supplied in argument.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - address - IP address to expect. Type: string
| | ... | - prefix - prefix length to expect. Type: string
| | ... | - netmask - subnet mask to expect. Type: string
| | ... | - sw_if_index - Index of interface. Type: integer
| | ...
| | ... | *Example:*
| | ...
| | ... | \| IPv4 address from VAT should be \| ${nodes['DUT1']} \
| | ... | \| GigabitEthernet0/8/0 \| 192.168.0.2 \| ${24} \| 255.255.255.0 \|
| | [Arguments] | ${node} | ${interface} | ${address} | ${prefix} | ${netmask}
| | ${sw_if_index}= | Vpp Get Interface Sw Index | ${node} | ${interface}
| | ${vpp_data}= | VPP get interface ip addresses
| | ... | ${node} | ${interface} | ipv4
| | ${settings}= | Create Dictionary
| | ... | ip=${address} | netmask=${netmask} | sw_if_index=${sw_if_index}
| | ... | prefix_length=${prefix} | is_ipv6=${0}
| | Should contain | ${vpp_data} | ${settings}

| Honeycomb removes interface IPv4 addresses
| | [Documentation] | Removes all configured ipv4 addresses from the specified\
| | ... | interface.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb removes interface IPv4 addresses \| ${nodes['DUT1']} \
| | ... | \| GigabitEthernet0/8/0 \|
| | [Arguments] | ${node} | ${interface}
| | Remove all ipv4 addresses | ${node} | ${interface}

| IPv4 address from Honeycomb should be empty
| | [Documentation] | Retrieves interface ipv4 configuration through Honeycomb\
| | ... | and expects to find no IPv4 addresses.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| IPv4 address from Honeycomb should be empty\| ${nodes['DUT1']} \
| | ... | \| GigabitEthernet0/8/0 \|
| | [Arguments] | ${node} | ${interface}
| | ${api_data}= | Get interface oper data | ${node} | ${interface}
| | Run keyword and expect error | *KeyError:*
| | ... | Set Variable | ${api_data['ietf-ip:ipv4']['address']}

| IPv4 address from VAT should be empty
| | [Documentation] | Retrieves interface ipv4 configuration through VAT and\
| | ... | and expects to find no ipv4 addresses.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| IPv4 config from VAT should be empty \| ${nodes['DUT1']} \
| | ... | \| GigabitEthernet0/8/0 \|
| | [Arguments] | ${node} | ${interface}
| | ${data}= | VPP get interface ip addresses | ${node} | ${interface} | ipv4
| | Should be empty | ${data}

| Honeycomb adds interface IPv4 neighbor
| | [Documentation] | Uses Honeycomb API to assign an ipv4 neighbor to the\
| | ... | specified interface.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - fib_address - IP address to add to fib table. Type: string
| | ... | - fib_mac - MAC address to add to fib table. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb adds interface IPv4 neighbor \| ${nodes['DUT1']} \
| | ... | \| GigabitEthernet0/8/0 \| 192.168.0.3 \| 08:00:27:c0:5d:37 \
| | [Arguments] | ${node} | ${interface} | ${fib_address} | ${fib_mac}
| | Add ipv4 neighbor
| | ... | ${node} | ${interface} | ${fib_address} | ${fib_mac}

| IPv4 neighbor from Honeycomb should be
| | [Documentation] | Retrieves ipv4 neighbor list through Honeycomb\
| | ... | and checks if it contains address supplied in arguments.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - ip_address - ipv4 address of expected neighbor entry. Type: string
| | ... | - mac_address - MAC address of expected neighbor entry. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| IPv4 neighbor from Honeycomb should be \| ${nodes['DUT1']} \
| | ... | \| GigabitEthernet0/8/0 \| 192.168.0.4 \| 08:00:27:60:26:ab \|
| | [Arguments] | ${node} | ${interface} | ${ip_address} | ${mac_address}
| | ${api_data}= | Get interface oper data | ${node} | ${interface}
| | ${settings}= | Create Dictionary
| | ... | ip=${ip_address} | link-layer-address=${mac_address} | origin=static
| | Should contain | ${api_data['ietf-ip:ipv4']['neighbor']} | ${settings}

| Honeycomb clears all interface IPv4 neighbors
| | [Documentation] | Uses Honeycomb API to remove all ipv4 neighbors from the\
| | ... | specified interface.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb clears all interface IPv4 neighbors \| ${nodes['DUT1']} \
| | ... | \| GigabitEthernet0/8/0 \|
| | [Arguments] | ${node} | ${interface}
| | Remove all ipv4 neighbors | ${node} | ${interface}

| IPv4 neighbor from Honeycomb should be empty
| | [Documentation] | Retrieves ipv4 neighbor list through Honeycomb\
| | ... | and expects to find no ipv4 neighbors.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| IPv4 neighbor from Honeycomb should be empty \| ${nodes['DUT1']} \
| | ... | \| GigabitEthernet0/8/0 \|
| | [Arguments] | ${node} | ${interface}
| | ${api_data}= | Get interface oper data | ${node} | ${interface}
| | Run keyword and expect error | *KeyError:*
| | ... | Set Variable | ${api_data['ietf-ip:ipv4']['neighbor'][0]['ip']}

| Honeycomb sets interface IPv6 address
| | [Documentation] | Uses Honeycomb API to change ipv6 address\
| | ... | of the specified interface. Existing IPv6 addresses will be removed,\
| | ... | with the exception of self-configured link-layer IPv6.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - address - IP address to set. Type: string
| | ... | - prefix - length of subnet prefix to set. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb sets interface IPv6 address \| ${nodes['DUT1']} \
| | ... | \| GigabitEthernet0/8/0 \| 10::10 \| 64 \|
| | [Arguments] | ${node} | ${interface} | ${address} | ${prefix}
| | Add first ipv6 address
| | ... | ${node} | ${interface} | ${address} | ${prefix}

| Honeycomb adds interface IPv6 address
| | [Documentation] | Uses Honeycomb API to add an ipv6 address\
| | ... | to the specified interface.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - address - IP address to set. Type: string
| | ... | - prefix - length of subnet prefix to set. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb adds interface IPv6 address \| ${nodes['DUT1']} \
| | ... | \| GigabitEthernet0/8/0 \| 10::10 \| 64 \|
| | [Arguments] | ${node} | ${interface} | ${address} | ${prefix}
| | Add ipv6 address
| | ... | ${node} | ${interface} | ${address} | ${prefix}

| Honeycomb fails to add interface IPv6 address
| | [Documentation] | Uses Honeycomb API to add an ipv6 address to the\
| | ... | specified interface, and expects to fail with code 500.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - address - IP address to set. Type: string
| | ... | - prefix - length of address network prefix. Type:integer
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb fails to add interface IPv6 address \
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 10::10 \| 64 \|
| | [Arguments] | ${node} | ${interface} | ${address} | ${prefix}
| | Run Keyword and Expect Error | *not successful. Status code: 500.
| | ... | Honeycomb adds interface IPv6 address
| | ... | ${node} | ${interface} | ${address} | ${prefix}

| IPv6 address from Honeycomb should contain
| | [Documentation] | Retrieves interface ipv6 address through Honeycomb\
| | ... | and compares with state supplied in argument.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - address - IP address to expect. Type: string
| | ... | - prefix - length of subnet prefix to expect. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| IPv6 address from Honeycomb should contain \| ${nodes['DUT1']} \
| | ... | \| GigabitEthernet0/8/0 \| 10::10 \| 64 \|
| | [Arguments] | ${node} | ${interface} | ${address} | ${prefix}
| | ${api_data}= | Get interface oper data | ${node} | ${interface}
| | ${settings}= | Create Dictionary
| | ... | ip=${address} | prefix-length=${prefix}
| | Should contain | ${api_data['ietf-ip:ipv6']['address']} | ${settings}

| IPv6 address from VAT should contain
| | [Documentation] | Retrieves interface ipv6 address through VAT and\
| | ... | compares with state supplied in argument.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - address - IP address to expect. Type: string
| | ... | - prefix - length of subnet prefix to expect. Type: string
| | ... | - sw_if_index - index of interface. Type: integer
| | ...
| | ... | *Example:*
| | ...
| | ... | \| IPv6 address from VAT should contain \| ${nodes['DUT1']} \
| | ... | \| GigabitEthernet0/8/0 \| 10::10 \| 64 \|
| | [Arguments] | ${node} | ${interface} | ${address} | ${prefix} | ${netmask}
| | ${sw_if_index}= | Vpp Get Interface Sw Index | ${node} | ${interface}
| | ${vpp_data}= | VPP get interface ip addresses
| | ... | ${node} | ${interface} | ipv6
| | ${settings}= | Create Dictionary
| | ... | ip=${address} | netmask=${netmask} | sw_if_index=${sw_if_index}
| | ... | prefix_length=${prefix} | is_ipv6=${1}
| | Should contain | ${vpp_data} | ${settings}

| Honeycomb removes interface IPv6 addresses
| | [Documentation] | Removes all configured ipv6 addresses from the specified\
| | ... | interface.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb removes interface IPv6 addresses \| ${nodes['DUT1']} \
| | ... | \| GigabitEthernet0/8/0 \|
| | [Arguments] | ${node} | ${interface}
| | Remove all ipv6 addresses | ${node} | ${interface}

| IPv6 address from Honeycomb should be empty
| | [Documentation] | Retrieves interface ipv6 configuration through Honeycomb\
| | ... | and expects to find no IPv6 addresses.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| IPv6 address from Honeycomb should be empty\| ${nodes['DUT1']} \
| | ... | \| GigabitEthernet0/8/0 \|
| | [Arguments] | ${node} | ${interface}
| | ${api_data}= | Get interface oper data | ${node} | ${interface}
| | Run keyword and expect error | *KeyError:*
| | ... | Set Variable | ${api_data['ietf-ip:ipv6']['address']}

| IPv6 address from VAT should be empty
| | [Documentation] | Retrieves interface ipv6 configuration through VAT and\
| | ... | expects to find no ipv6 addresses.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| IPv6 config from VAT should be empty \| ${nodes['DUT1']} \
| | ... | \| GigabitEthernet0/8/0 \|
| | [Arguments] | ${node} | ${interface}
| | ${data}= | VPP get interface ip addresses | ${node} | ${interface} | ipv6
| | Should be empty | ${data}

| Honeycomb adds interface IPv6 neighbor
| | [Documentation] | Uses Honeycomb API to assign an ipv6 neighbor to the\
| | ... | specified interface.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - fib_address - IP address to add to fib table. Type: string
| | ... | - fib_mac - MAC address to add to fib table. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb adds interface IPv6 neighbor \| ${nodes['DUT1']} \
| | ... | \| GigabitEthernet0/8/0 \| 192.168.0.3 \| 08:00:27:c0:5d:37 \|
| | [Arguments] | ${node} | ${interface} | ${fib_address} | ${fib_mac}
| | Add ipv6 neighbor
| | ... | ${node} | ${interface} | ${fib_address} | ${fib_mac}

| IPv6 neighbor from Honeycomb should be
| | [Documentation] | Retrieves ipv6 neighbor list through Honeycomb\
| | ... | and checks if it contains address supplied in arguments.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - ip_address - ipv6 address of expected neighbor entry. Type: string
| | ... | - mac_address - MAC address of expected neighbor entry. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| IPv6 neighbor from Honeycomb should be \| ${nodes['DUT1']} \
| | ... | \| GigabitEthernet0/8/0 \| 192.168.0.4 \| 08:00:27:60:26:ab \|
| | [Arguments] | ${node} | ${interface} | ${ip_address} | ${mac_address}
| | ${api_data}= | Get interface oper data | ${node} | ${interface}
| | ${settings}= | Create Dictionary
| | ... | ip=${ip_address} | link-layer-address=${mac_address} | origin=static
| | Should contain | ${api_data['ietf-ip:ipv6']['neighbor']} | ${settings}

| Honeycomb clears all interface IPv6 neighbors
| | [Documentation] | Uses Honeycomb API to remove all ipv6 neighbors from the\
| | ... | specified interface.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb clears all interface IPv6 neighbors \| ${nodes['DUT1']} \
| | ... | \| GigabitEthernet0/8/0 \|
| | [Arguments] | ${node} | ${interface}
| | Remove all ipv6 neighbors | ${node} | ${interface}

| IPv6 neighbor from Honeycomb should be empty
| | [Documentation] | Retrieves ipv6 neighbor list through Honeycomb\
| | ... | and expects to find no ipv6 neighbors.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| IPv6 neighbor from Honeycomb should be empty \| ${nodes['DUT1']} \
| | ... | \| GigabitEthernet0/8/0 \|
| | [Arguments] | ${node} | ${interface}
| | ${api_data}= | Get interface oper data | ${node} | ${interface}
| | Run keyword and expect error | *KeyError:*
| | ... | Set Variable | ${api_data['ietf-ip:ipv6']['neighbor'][0]['ip']}

| Honeycomb sets interface ethernet configuration
| | [Documentation] | Uses Honeycomb API to change interface ethernet\
| | ... | configuration.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - ethernet - interface ethernet settings. Type: dictionary
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb sets interface ethernet configuration \
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${{'mtu': 1500}} \
| | [Arguments] | ${node} | ${interface} | ${ethernet}
| | :FOR | ${key} | IN | @{ethernet.keys()}
| | | Configure interface ethernet
| | | ... | ${node} | ${interface} | ${key} | ${ethernet['${key}']}

| Interface ethernet Operational Data From Honeycomb Should Be
| | [Documentation] | Retrieves interface ethernet configuration\
| | ... | through Honeycomb and compares with settings supplied in arguments.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - ethernet - interface ethernet settings. Type: dictionary
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Interface ethernet Operational Data From Honeycomb Should Be \
| | ... | should be \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \
| | ... | \| ${{'mtu': 1500}} \|
| | [Arguments] | ${node} | ${interface} | ${ethernet}
| | ${api_data}= | Get interface oper data | ${node} | ${interface}
| | :FOR | ${key} | IN | @{ethernet.keys()}
| | | Should be equal
| | | ... | ${api_data['v3po:ethernet']['${key}']} | ${ethernet['${key}']}

| Interface ethernet Operational Data From VAT Should Be
| | [Documentation] | Retrieves interface ethernet configuration\
| | ... | through VAT and compares with settings supplied in arguments.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - mtu - value of maximum transmission unit expected. Type: integer
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Interface ethernet Operational Data From VAT Should Be \
| | ... | should be \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1500} \|
| | [Arguments] | ${node} | ${interface} | ${mtu}
| | ${vat_data}= | VPP get interface data | ${node} | ${interface}
| | Should be equal | ${vat_data['mtu']} | ${mtu}

| Honeycomb sets interface VRF ID
| | [Documentation] | Uses Honeycomb API to change interface vrf\
| | ... | configuration.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - vrf_id - vrf ID to configure. Type:integer
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb sets interface VRF ID \
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \| ipv4 \|
| | [Arguments] | ${node} | ${interface} | ${vrf_id} | ${ip_version}
| | Configure interface routing
| | ... | ${node} | ${interface} | ${ip_version}-vrf-id | ${vrf_id}

| Interface VRF ID from Honeycomb should be
| | [Documentation] | Retrieves interface ethernet configuration\
| | ... | through Honeycomb and compares with settings supplied in arguments.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - vrf_id - vrf ID to expect. Type:integer
| | ... | - ip_version - IP protocol version, ipv4 or ipv6. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Interface VRF ID from Honeycomb should be \
| | ... | should be \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \
| | ... | \| ipv4 \|
| | [Arguments] | ${node} | ${interface} | ${vrf_id} | ${ip_version}
| | ${api_data}= | Get interface oper data | ${node} | ${interface} |
| | Should be equal
| | ... | ${api_data['v3po:routing']['${ip_version}-vrf-id']} | ${vrf_id}

| Interface VRF ID from VAT should be
| | [Documentation] | Retrieves interface ethernet configuration\
| | ... | through VAT and compares with settings supplied in arguments.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - vrf_id - vrf ID to expect. Type:integer
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Interface VRF ID from VAT should be \
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \|
| | [Arguments] | ${node} | ${interface} | ${vrf_id}
| | ${vat_data}= | get interface vrf table
| | ... | ${node} | ${interface}
| | Should be equal | ${vat_data} | ${vrf_id}

| Interface Operational Data From Honeycomb Should Be empty
| | [Documentation] | Attempts to retrieve interface configuration through\
| | ... | Honeycomb and expects to get empty dictionary.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of a interface on the specified node. Type:\
| | ... | string
| | ...
| | ... | *Example:*
| | ... | \| Interface Operational Data From Honeycomb Should Be empty\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \|
| | ...
| | [Arguments] | ${node} | ${interface}
| | ${api_data}= | Get interface oper data | ${node} | ${interface}
| | Should be empty | ${api_data}

| Interface Operational Data From VAT Should Be empty
| | [Documentation] | Attempts to retrieve Interface configuration through\
| | ... | VAT and expects to get empty dictionary.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of a Interface on the specified node. Type:\
| | ... | string
| | ...
| | ... | *Example:*
| | ... | \| Interface Operational Data From VAT Should Be empty\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \|
| | ...
| | [Arguments] | ${node} | ${interface} |
| | ${vat_data}= | VPP get interface data | ${node} | ${interface}
| | Should be empty | ${vat_data}

| Interface indices from Honeycomb and VAT should correspond
| | [Documentation] | Uses VAT and Honeycomb to get operational data about the\
| | ... | given interface and compares the interface indexes. The interface
| | ... | index from Honeycomb should be greater than index from VAT by one.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of the interface to be checked. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Interface indices from Honeycomb and VAT should correspond \
| | ... | \| ${nodes['DUT1']} \| vxlan_gpe_tunnel0 \|
| | ...
| | [Arguments] | ${node} | ${interface}
| | ...
| | ${api_data}= | Get interface oper data | ${node} | ${interface}
| | ${vat_data}= | VPP get interface data | ${node} | ${interface}
| | ${sw_if_index}= | EVALUATE | ${vat_data['sw_if_index']} + 1
| | Should be equal as strings
| | ... | ${api_data['if-index']} | ${sw_if_index}

| Get interface index from oper data
| | [Documentation] | Retrieves interface operational data and returns\
| | ... | if-index of the specified interface.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of the interface. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Get interface index from oper data \| ${nodes['DUT1']} \| local0 \|
| | [Arguments] | ${node} | ${interface}
| | ${data}= | Get interface oper data | ${node} | ${interface}
| | Return from keyword | ${data['if-index']}

| Honeycomb should show disabled interface in oper data
| | [Documentation] | Retrieves list of disabled interfaces\
| | ... | and verifies that there is at least one.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - index - index of the interface to be checked. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb should show disabled interface in oper data \
| | ... | \| ${nodes['DUT1']} \| ${vx_interface} \|
| | [Arguments] | ${node} | ${index}
| | check disabled interface | ${node} | ${index}

| Honeycomb should not show disabled interface in oper data
| | [Documentation] | Retrieves list of disabled interfaces\
| | ... | and expects to fail with a 404 - not found.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - index - index of the interface to be checked. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb should not show disabled interface in oper data \
| | ... | \| ${nodes['DUT1']} \| ${vx_interface} \|
| | [Arguments] | ${node} | ${index}
| | Run keyword and expect error | *
| | ... | Honeycomb should show disabled interface in oper data
| | ... | ${node} | ${index}

| Ping and verify IP address
| | [Documentation] | Sends ICMP packet from IP (with source mac) to IP
| | ... | (with dest mac), then waits for ICMP reply.
| | ...
| | ... | *Arguments:*
| | ...
| | ... | _NOTE:_ Arguments are based on topology:
| | ... | TG(if1)->(if1)DUT(if2)->TG(if2)
| | ...
| | ... | - tg_node - Node to execute scripts on (TG). Type: dictionary
| | ... | - src_ip - IP of source interface (TG-if1). Type: integer
| | ... | - dst_ip - IP of destination interface (TG-if2). Type: integer
| | ... | - tx_port - Source interface (TG-if1). Type: string
| | ... | - tx_mac - MAC address of source interface (TG-if1). Type: string
| | ... | - rx_port - Destionation interface (TG-if1). Type: string
| | ... | - rx_mac - MAC address of destination interface (TG-if1). Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Ping verify IP address \| ${nodes['TG']} \
| | ... | \| 16.0.0.1 \| 32.0.0.1 \| eth2 \| 08:00:27:cc:4f:54 \
| | ... | \| eth4 \| 08:00:27:c9:6a:d5 \|
| | ...
| | [Arguments] | ${tg_node} | ${src_ip} | ${dst_ip} | ${tx_port} |
| | ... | ${tx_mac} | ${rx_port} | ${rx_mac}
| | ${tx_port_name}= | Get interface name | ${tg_node} | ${tx_port}
| | ${rx_port_name}= | Get interface name | ${tg_node} | ${rx_port}
| | ${args}= | Catenate | --src_mac | ${tx_mac}
| | ...                 | --dst_mac | ${rx_mac}
| | ...                 | --src_ip | ${src_ip}
| | ...                 | --dst_ip | ${dst_ip}
| | ...                 | --tx_if | ${tx_port_name}
| | ...                 | --rx_if | ${rx_port_name}
| | ...                 | --timeout | ${5}
| | Run Traffic Script On Node | send_icmp_wait_for_reply.py
| | ... | ${tg_node} | ${args}

| Honeycomb adds unnumbered configuration to interface
| | [Documentation] | Adds unnumbered configuration to interface, borrowing IP
| | ... | address from the other specified interface.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - Name of the interface to be configured. Type: string
| | ... | - interface_src - Name of the interface to borrow IP address from.\
| | ... | Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb adds unnumbered configuration to interface \
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| GigabitEthernet0/9/0 \|
| | ...
| | [Arguments] | ${node} | ${Interface} | ${interface_src}
| | Configure interface unnumbered | ${node} | ${interface} | ${interface_src}

| Honeycomb removes unnumbered configuration from interface
| | [Documentation] | Removes unnumbered configuration from the specified
| | ... | interface.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - Name of the interface to be configured. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb adds unnumbered configuration to interface \
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \|
| | ...
| | [Arguments] | ${node} | ${Interface}
| | Configure interface unnumbered | ${node} | ${interface}