go.ligato.io/vpp-agent/v3@v3.5.0/tests/robot/suites/crudIPv6/ip_route_crudIPv6.robot (about)

     1  *** Settings ***
     2  
     3  Library     OperatingSystem
     4  Library     String
     5  #Library     RequestsLibrary
     6  
     7  Resource     ../../variables/${VARIABLES}_variables.robot
     8  Resource    ../../libraries/all_libs.robot
     9  Resource    ../../libraries/pretty_keywords.robot
    10  Resource     ../../libraries/interface/vxlan.robot
    11  
    12  Force Tags        crud     IPv6
    13  Suite Setup       Run Keywords    Discard old results
    14  
    15  *** Variables ***
    16  ${VARIABLES}=          common
    17  ${ENV}=                common
    18  ${IP1}=                fd31::1:1:0:0:1
    19  ${IP2}=                fd31::1:1:0:0:2
    20  ${IPNET1}=             fd30:0:0:1::
    21  ${IPNET2}=             fd31:0:0:1::
    22  ${WAIT_TIMEOUT}=       10s
    23  ${SYNC_SLEEP}=         1s
    24  
    25  *** Test Cases ***
    26  # CRUD tests for routing
    27  Add Route, Then Delete Route And Again Add Route For Default VRF
    28      [Setup]      Test Setup
    29      [Teardown]   Test Teardown
    30  
    31      Given Add Agent VPP Node                 agent_vpp_1
    32      Then IP6 Fib On agent_vpp_1 Should Not Contain Route With IP ${IPNET1}/64
    33      Then Create Route On agent_vpp_1 With IP ${IPNET1}/64 With Next Hop ${IP1} And Vrf Id 0
    34      Then Show Interfaces On agent_vpp_1
    35      Then IP6 Fib On agent_vpp_1 Should Contain Route With IP ${IPNET1}/64
    36      Then Delete Routes On agent_vpp_1 And Vrf Id 0
    37      Then IP6 Fib On agent_vpp_1 Should Not Contain Route With IP ${IPNET1}/64
    38      Then Create Route On agent_vpp_1 With IP ${IPNET1}/64 With Next Hop ${IP1} And Vrf Id 0
    39  
    40  Add Route, Then Delete Route And Again Add Route For Non Default VRF
    41      [Setup]      Test Setup
    42      [Teardown]   Test Teardown
    43  
    44      Given Add Agent VPP Node                 agent_vpp_1
    45      Then IP6 Fib On agent_vpp_1 Should Not Contain Route With IP ${IPNET2}/64
    46      Then Create VRF Table    node=agent_vpp_1    id=2    protocol=ipv6
    47      Then Create Route On agent_vpp_1 With IP ${IPNET1}/64 With Next Hop ${IP1} And Vrf Id 2
    48      Then Show Interfaces On agent_vpp_1
    49      Then IP6 Fib On agent_vpp_1 Should Contain Route With IP ${IPNET1}/64
    50      Then IP6 Fib Table 0 On agent_vpp_1 Should Not Contain Route With IP ${IPNET1}/64
    51      Then IP6 Fib Table 2 On agent_vpp_1 Should Contain Route With IP ${IPNET1}/64
    52      Then Delete Routes On agent_vpp_1 And Vrf Id 2
    53      Then IP6 Fib On agent_vpp_1 Should Not Contain Route With IP ${IPNET1}/64
    54      Then IP6 Fib Table 2 On agent_vpp_1 Should Not Contain Route With IP ${IPNET1}/64
    55      Then Create Route On agent_vpp_1 With IP ${IPNET1}/64 With Next Hop ${IP1} And Vrf Id 2
    56      Then IP6 Fib On agent_vpp_1 Should Contain Route With IP ${IPNET1}/64
    57      Then IP6 Fib Table 0 On agent_vpp_1 Should Not Contain Route With IP ${IPNET1}/64
    58      Then IP6 Fib Table 2 On agent_vpp_1 Should Contain Route With IP ${IPNET1}/64
    59  
    60  # CRUD tests for VRF - automatically added with creating of interface - delete is not implemented
    61  Add VRF Table In Background While Creating Interface Memif
    62      [Setup]      Test Setup
    63      [Teardown]   Test Teardown
    64  
    65      Given Add Agent VPP Node                 agent_vpp_1
    66      # create memif interface in default vrf
    67      Then Create Master memif0 on agent_vpp_1 with IP ${IP1}, MAC 02:f1:be:90:00:00, key 1 and m0.sock socket
    68      Then Show Interfaces On agent_vpp_1
    69      Then IP6 Fib Table 2 On agent_vpp_1 Should Be Empty
    70      Then Create VRF Table    node=agent_vpp_1    id=1    protocol=ipv6
    71      Then Create VRF Table    node=agent_vpp_1    id=2    protocol=ipv6
    72      Then IP6 Fib Table 0 On agent_vpp_1 Should Contain Route With IP ${IP1}/128
    73      # this will transfer interface to newly-in-background-created non default vrf table
    74      Then Create Master memif0 on agent_vpp_1 with VRF 2, IP ${IP1}, MAC 02:f1:be:90:00:00, key 1 and m0.sock socket
    75      IP6 Fib Table 2 On agent_vpp_1 Should Contain Route With IP ${IP1}/128
    76      Then IP6 Fib Table 0 On agent_vpp_1 Should Not Contain Route With IP ${IP1}/128
    77      # this will transfer interface to other newly-in-background-created non default vrf table
    78      Then Create Master memif0 on agent_vpp_1 with VRF 1, IP ${IP1}, MAC 02:f1:be:90:00:00, key 1 and m0.sock socket
    79      IP6 Fib Table 1 On agent_vpp_1 Should Contain Route With IP ${IP1}/128
    80      Then IP6 Fib Table 0 On agent_vpp_1 Should Not Contain Route With IP ${IP1}/128
    81      # this will remove non default vrf table in background - N/A
    82      # Then IP6 Fib Table 2 On agent_vpp_1 Should Be Empty - N/A
    83      Then IP6 Fib Table 2 On agent_vpp_1 Should Not Contain Route With IP ${IP1}/128
    84      # this will transfer interface to existing non default vrf table
    85      Then Create Master memif0 on agent_vpp_1 with VRF 2, IP ${IP1}, MAC 02:f1:be:90:00:00, key 1 and m0.sock socket
    86      IP6 Fib Table 2 On agent_vpp_1 Should Contain Route With IP ${IP1}/128
    87      Then IP6 Fib Table 0 On agent_vpp_1 Should Not Contain Route With IP ${IP1}/128
    88      Then IP6 Fib Table 1 On agent_vpp_1 Should Not Contain Route With IP ${IP1}/128
    89      # this will transfer interface to default vrf table
    90      Then Create Master memif0 on agent_vpp_1 with IP ${IP1}, MAC 02:f1:be:90:00:00, key 1 and m0.sock socket
    91      # 10 nov 2017 this will fail for memif - reason is that Create Master memif0 does not transfer interface to the VRF table 0
    92      IP6 Fib Table 0 On agent_vpp_1 Should Contain Route With IP ${IP1}/128
    93      Then IP6 Fib Table 1 On agent_vpp_1 Should Not Contain Route With IP ${IP1}/128
    94      # 10 nov 2017 this will fail for memif - reason is that Create Master memif0 does not transfer interface to the VRF table 0
    95      Then IP6 Fib Table 2 On agent_vpp_1 Should Not Contain Route With IP ${IP1}/128
    96  
    97  Add VRF Table In Background While Creating Interface Tap
    98      [Setup]      Test Setup
    99      [Teardown]   Test Teardown
   100  
   101      Given Add Agent VPP Node                 agent_vpp_1
   102      # create Tap interface in default vrf
   103      Then Create Tapv2 Interface tap0 On agent_vpp_1 With Vrf 0, IP ${IP1}, MAC 02:f1:be:90:00:00 And HostIfName linux_tap0
   104      Then Show Interfaces On agent_vpp_1
   105      Then IP6 Fib Table 2 On agent_vpp_1 Should Be Empty
   106      Then Create VRF Table    node=agent_vpp_1    id=1    protocol=ipv6
   107      Then Create VRF Table    node=agent_vpp_1    id=2    protocol=ipv6
   108      Then IP6 Fib Table 0 On agent_vpp_1 Should Contain Route With IP ${IP1}/128
   109      # this will transfer interface to newly-in-background-created non default vrf table
   110      Then Create Tapv2 Interface tap0 On agent_vpp_1 With Vrf 2, IP ${IP1}, MAC 02:f1:be:90:00:00 And HostIfName linux_tap0
   111      IP6 Fib Table 2 On agent_vpp_1 Should Contain Route With IP ${IP1}/128
   112      Then IP6 Fib Table 0 On agent_vpp_1 Should Not Contain Route With IP ${IP1}/128
   113      # this will transfer interface to other newly-in-background-created non default vrf table
   114      Then Create Tapv2 Interface tap0 On agent_vpp_1 With Vrf 1, IP ${IP1}, MAC 02:f1:be:90:00:00 And HostIfName linux_tap0
   115      IP6 Fib Table 1 On agent_vpp_1 Should Contain Route With IP ${IP1}/128
   116      Then IP6 Fib Table 0 On agent_vpp_1 Should Not Contain Route With IP ${IP1}/128
   117      # this will remove non default vrf table in background - N/A
   118      # Then IP6 Fib Table 2 On agent_vpp_1 Should Be Empty - N/A
   119      Then IP6 Fib Table 2 On agent_vpp_1 Should Not Contain Route With IP ${IP1}/128
   120      # this will transfer interface to existing non default vrf table
   121      Then Create Tapv2 Interface tap0 On agent_vpp_1 With Vrf 2, IP ${IP1}, MAC 02:f1:be:90:00:00 And HostIfName linux_tap0
   122      IP6 Fib Table 2 On agent_vpp_1 Should Contain Route With IP ${IP1}/128
   123      Then IP6 Fib Table 0 On agent_vpp_1 Should Not Contain Route With IP ${IP1}/128
   124      Then IP6 Fib Table 1 On agent_vpp_1 Should Not Contain Route With IP ${IP1}/128
   125      # this will transfer interface to default vrf table
   126      Then Create Tapv2 Interface tap0 On agent_vpp_1 With Vrf 0, IP ${IP1}, MAC 02:f1:be:90:00:00 And HostIfName linux_tap0
   127      IP6 Fib Table 0 On agent_vpp_1 Should Contain Route With IP ${IP1}/128
   128      Then IP6 Fib Table 1 On agent_vpp_1 Should Not Contain Route With IP ${IP1}/128
   129      Then IP6 Fib Table 2 On agent_vpp_1 Should Not Contain Route With IP ${IP1}/128
   130  
   131  Add VRF Table In Background While Creating Interface VXLAN
   132      [Setup]      Test Setup
   133      [Teardown]   Test Teardown
   134  
   135      Add Agent VPP Node                 agent_vpp_1
   136      Sleep    10
   137      # create VXLan interface in default vrf
   138      Put VXLan Interface    node=agent_vpp_1    name=vpp1_vxlan1    src=${IP1}    dst=${IP2}    vni=5    vrf=0
   139      Write To Machine    agent_vpp_1_term    show vxlan tunnel
   140      Create VRF Table    node=agent_vpp_1    id=1    protocol=ipv6
   141      Create VRF Table    node=agent_vpp_1    id=2    protocol=ipv6
   142      Show IP6 Fib On agent_vpp_1
   143      Show Interfaces Address On agent_vpp_1
   144      IP6 Fib Table 0 On agent_vpp_1 Should Contain Route With IP ${IP2}/128
   145      # this will transfer interface to newly-in-background-created non default vrf table
   146      Put VXLan Interface    node=agent_vpp_1    name=vpp1_vxlan1    src=${IP1}    dst=${IP2}    vni=5    vrf=2
   147      Write To Machine    agent_vpp_1_term    show vxlan tunnel
   148      Show IP6 Fib On agent_vpp_1
   149      Show Interfaces Address On agent_vpp_1
   150      IP6 Fib Table 2 On agent_vpp_1 Should Contain Route With IP ${IP2}/128
   151      # this will transfer interface to other newly-in-background-created non default vrf table
   152      Put VXLan Interface    node=agent_vpp_1    name=vpp1_vxlan1    src=${IP1}    dst=${IP2}    vni=5    vrf=1
   153      Write To Machine    agent_vpp_1_term    show vxlan tunnel
   154      Show IP6 Fib On agent_vpp_1
   155      Show Interfaces Address On agent_vpp_1
   156      IP6 Fib Table 1 On agent_vpp_1 Should Contain Route With IP ${IP2}/128
   157      # this will transfer interface to existing non default vrf table
   158      Put VXLan Interface    node=agent_vpp_1    name=vpp1_vxlan1    src=${IP1}    dst=${IP2}    vni=5    vrf=2
   159      Write To Machine    agent_vpp_1_term    show vxlan tunnel
   160      Show IP6 Fib On agent_vpp_1
   161      Show Interfaces Address On agent_vpp_1
   162      IP6 Fib Table 2 On agent_vpp_1 Should Contain Route With IP ${IP2}/128
   163      # this will transfer interface to default vrf table
   164      Put VXLan Interface    node=agent_vpp_1    name=vpp1_vxlan1    src=${IP1}    dst=${IP2}    vni=5    vrf=0
   165      Write To Machine    agent_vpp_1_term    show vxlan tunnel
   166      Show IP6 Fib On agent_vpp_1
   167      Show Interfaces Address On agent_vpp_1
   168      IP6 Fib Table 0 On agent_vpp_1 Should Contain Route With IP ${IP2}/128
   169  
   170  *** Keywords ***
   171  IP6 Fib On ${node} Should Not Contain Route With IP ${ip}/${prefix}
   172      Wait Until Keyword Succeeds    ${WAIT_TIMEOUT}    ${SYNC_SLEEP}
   173      ...    Check Route Is Not In IP6 FIB Table    ${node}    ${ip}    ${prefix}
   174  
   175  IP6 Fib On ${node} Should Contain Route With IP ${ip}/${prefix}
   176      Wait Until Keyword Succeeds    ${WAIT_TIMEOUT}    ${SYNC_SLEEP}
   177      ...    Check Route Is In IP6 FIB Table    ${node}    ${ip}    ${prefix}
   178  
   179  Check Route Is In IP6 FIB Table
   180      [Arguments]    ${node}    ${ip}    ${prefix}
   181      ${out}=    vpp_term: Show IP6 Fib    ${node}
   182      Should Match Regexp        ${out}  ${ip}\\/${prefix}\\s*unicast\\-ip6-chain\\s*\\[\\@0\\]:\\ dpo-load-balance:\\ \\[proto:ip6\\ index:\\d+\\ buckets:\\d+\\ uRPF:\\d+\\ to:\\[0:0\\]\\]
   183  
   184  Check Route Is Not In IP6 FIB Table
   185      [Arguments]    ${node}    ${ip}    ${prefix}
   186      ${out}=    vpp_term: Show IP6 Fib    ${node}
   187      Should Not Match Regexp    ${out}  ${ip}\\/${prefix}\\s*unicast\\-ip6-chain\\s*\\[\\@0\\]:\\ dpo-load-balance:\\ \\[proto:ip6\\ index:\\d+\\ buckets:\\d+\\ uRPF:\\d+\\ to:\\[0:0\\]\\]