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