go.ligato.io/vpp-agent/v3@v3.5.0/tests/robot/suites/traffic/ip_route/test_ip_route.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  
    11  Force Tags        traffic     IPv4
    12  Suite Setup       Run Keywords    Discard old results
    13  
    14  *** Variables ***
    15  ${VARIABLES}=          common
    16  ${ENV}=                common
    17  
    18  *** Test Cases ***
    19  # Default VRF table ...
    20  Start Three Agents And Then Configure
    21      [Setup]         Test Setup
    22      [Teardown]      Test Teardown
    23      Add Agent VPP Node    agent_vpp_1
    24      Add Agent VPP Node    agent_vpp_2
    25      Add Agent VPP Node    agent_vpp_3
    26      #setup one side with agent2
    27      Create loopback interface bvi_loop0 on agent_vpp_1 with ip 10.1.1.1/24 and mac 8a:f1:be:90:00:00
    28      Create Master memif0 on agent_vpp_1 with MAC 02:f1:be:90:00:00, key 1 and m0.sock socket
    29      Create bridge domain bd1 With Autolearn on agent_vpp_1 with interfaces bvi_loop0, memif0
    30      #setup second side with agent3
    31      Create loopback interface bvi_loop1 on agent_vpp_1 with ip 20.1.1.1/24 and mac 8a:f1:be:90:02:00
    32      Create Master memif1 on agent_vpp_1 with MAC 02:f1:be:90:02:00, key 2 and m1.sock socket
    33      Create bridge domain bd2 With Autolearn on agent_vpp_1 with interfaces bvi_loop1, memif1
    34      # prepare second agent
    35      Create loopback interface bvi_loop0 on agent_vpp_2 with ip 10.1.1.2/24 and mac 8a:f1:be:90:00:02
    36      Create Slave memif0 on agent_vpp_2 with MAC 02:f1:be:90:00:02, key 1 and m0.sock socket
    37      Create bridge domain bd1 With Autolearn on agent_vpp_2 with interfaces bvi_loop0, memif0
    38      # prepare third agent
    39      Create loopback interface bvi_loop0 on agent_vpp_3 with ip 20.1.1.2/24 and mac 8a:f1:be:90:00:03
    40      Create Slave memif0 on agent_vpp_3 with MAC 02:f1:be:90:00:03, key 2 and m1.sock socket
    41      Create bridge domain bd1 With Autolearn on agent_vpp_3 with interfaces bvi_loop0, memif0
    42      # setup routes
    43      Create Route On agent_vpp_2 With IP 20.1.1.0/24 With Next Hop 10.1.1.1 And Vrf Id 0
    44      Create Route On agent_vpp_3 With IP 10.1.1.0/24 With Next Hop 20.1.1.1 And Vrf Id 0
    45  
    46      Sleep    10
    47  
    48      # try ping
    49      Ping From agent_vpp_1 To 10.1.1.2
    50      Ping From agent_vpp_1 To 20.1.1.2
    51      Ping From agent_vpp_2 To 20.1.1.2
    52      Ping From agent_vpp_3 To 10.1.1.2
    53  
    54  First Configure Three Agents And Then Start Agents
    55      [Setup]         Test Setup
    56      [Teardown]      Test Teardown
    57      #prepare first agent
    58      Create loopback interface bvi_loop0 on agent_vpp_1 with ip 10.1.1.1/24 and mac 8a:f1:be:90:00:00
    59      Create Master memif0 on agent_vpp_1 with MAC 02:f1:be:90:00:00, key 1 and m0.sock socket
    60      Create loopback interface bvi_loop1 on agent_vpp_1 with ip 20.1.1.1/24 and mac 8a:f1:be:90:02:00
    61      Create Master memif1 on agent_vpp_1 with MAC 02:f1:be:90:02:00, key 2 and m1.sock socket
    62      Create bridge domain bd1 With Autolearn on agent_vpp_1 with interfaces bvi_loop0, memif0
    63      Create bridge domain bd2 With Autolearn on agent_vpp_1 with interfaces bvi_loop1, memif1
    64      #prepare second agent
    65      Create loopback interface bvi_loop0 on agent_vpp_2 with ip 10.1.1.2/24 and mac 8a:f1:be:90:00:02
    66      Create Slave memif0 on agent_vpp_2 with MAC 02:f1:be:90:00:02, key 1 and m0.sock socket
    67      Create bridge domain bd1 With Autolearn on agent_vpp_2 with interfaces bvi_loop0, memif0
    68      #prepare third agent
    69      Create loopback interface bvi_loop0 on agent_vpp_3 with ip 20.1.1.2/24 and mac 8a:f1:be:90:00:03
    70      Create Slave memif0 on agent_vpp_3 with MAC 02:f1:be:90:00:03, key 2 and m1.sock socket
    71      Create bridge domain bd1 With Autolearn on agent_vpp_3 with interfaces bvi_loop0, memif0
    72      #setup routes
    73      Create Route On agent_vpp_2 With IP 20.1.1.0/24 With Next Hop 10.1.1.1 And Vrf Id 0
    74      Create Route On agent_vpp_3 With IP 10.1.1.0/24 With Next Hop 20.1.1.1 And Vrf Id 0
    75      #start agents
    76      Add Agent VPP Node    agent_vpp_1
    77      Add Agent VPP Node    agent_vpp_2
    78      Add Agent VPP Node    agent_vpp_3
    79  
    80      Sleep    10
    81  
    82      #check ping
    83      Ping From agent_vpp_1 To 10.1.1.2
    84      Ping From agent_vpp_1 To 20.1.1.2
    85      Ping From agent_vpp_2 To 20.1.1.2
    86      Ping From agent_vpp_3 To 10.1.1.2
    87  
    88  # Non default VRF table 2 used in Agent VPP Node agent_vpp_2
    89  Start Two Agents And Then Configure One With Non Default VRF
    90      [Setup]         Test Setup
    91      [Teardown]      Test Teardown
    92      Add Agent VPP Node    agent_vpp_1
    93      Add Agent VPP Node    agent_vpp_2
    94      Create Master memif0 on agent_vpp_1 with IP 10.1.1.1, MAC 02:f1:be:90:00:00, key 1 and m0.sock socket
    95      Create VRF Table    node=agent_vpp_2    id=2    protocol=ipv4
    96      Create Slave memif0 on agent_vpp_2 with VRF 2, IP 10.1.1.2, MAC 02:f1:be:90:00:02, key 1 and m0.sock socket
    97  
    98      Sleep    14
    99  
   100      List of interfaces On agent_vpp_1 Should Contain Interface memif1/1
   101      List of interfaces On agent_vpp_2 Should Contain Interface memif1/1
   102      IP Fib Table 2 On agent_vpp_2 Should Contain Route With IP 10.1.1.2/32
   103  
   104      # try ping
   105      Ping From agent_vpp_1 To 10.1.1.2
   106      # this does not work for non default vrf: Ping From agent_vpp_2 To 10.1.1.1
   107      ${int}=    Get Interface Internal Name    agent_vpp_2    memif0
   108      Ping On agent_vpp_2 With IP 10.1.1.1, Source ${int}
   109  
   110  # Non default VRF table 2 used in Agent VPP Node agent_vpp_2
   111  # Non default VRF table 3 used in Agent VPP Node agent_vpp_3
   112  Start Three Agents, Then Configure With Interfaces Assigned To Non Default VRF
   113      [Setup]         Test Setup
   114      [Teardown]      Test Teardown
   115      Add Agent VPP Node    agent_vpp_1
   116      Add Agent VPP Node    agent_vpp_2
   117      Add Agent VPP Node    agent_vpp_3
   118      #setup one side with agent2
   119      Create loopback interface bvi_loop0 on agent_vpp_1 with ip 10.1.1.1/24 and mac 8a:f1:be:90:00:00
   120      Create Master memif0 on agent_vpp_1 with MAC 02:f1:be:90:00:00, key 1 and m0.sock socket
   121      Create bridge domain bd1 With Autolearn on agent_vpp_1 with interfaces bvi_loop0, memif0
   122      #setup second side with agent3
   123      Create loopback interface bvi_loop1 on agent_vpp_1 with ip 20.1.1.1/24 and mac 8a:f1:be:90:02:00
   124      Create Master memif1 on agent_vpp_1 with MAC 02:f1:be:90:02:00, key 2 and m1.sock socket
   125      Create bridge domain bd2 With Autolearn on agent_vpp_1 with interfaces bvi_loop1, memif1
   126  
   127      # prepare second agent
   128      Create VRF Table    node=agent_vpp_2    id=2    protocol=ipv4
   129      Create loopback interface bvi_loop0 on agent_vpp_2 with VRF 2, ip 10.1.1.2/24 and mac 8a:f1:be:90:00:02
   130      Create Slave memif0 on agent_vpp_2 with MAC 02:f1:be:90:00:02, key 1 and m0.sock socket
   131      Create bridge domain bd1 With Autolearn on agent_vpp_2 with interfaces bvi_loop0, memif0
   132  
   133      # prepare third agent
   134      Create VRF Table    node=agent_vpp_3    id=3    protocol=ipv4
   135      Create loopback interface bvi_loop0 on agent_vpp_3 with VRF 3, ip 20.1.1.2/24 and mac 8a:f1:be:90:00:03
   136      Create Slave memif0 on agent_vpp_3 with MAC 02:f1:be:90:00:03, key 2 and m1.sock socket
   137      Create bridge domain bd1 With Autolearn on agent_vpp_3 with interfaces bvi_loop0, memif0
   138  
   139      # setup routes
   140      Create Route On agent_vpp_2 With IP 20.1.1.0/24 With Next Hop 10.1.1.1 And Vrf Id 2
   141      Create Route On agent_vpp_3 With IP 10.1.1.0/24 With Next Hop 20.1.1.1 And Vrf Id 3
   142  
   143      Sleep    10
   144  
   145      Show Interfaces On agent_vpp_1
   146      Show Interfaces Address On agent_vpp_2
   147      Show IP Fib On agent_vpp_2
   148      IP Fib Table 2 On agent_vpp_2 Should Contain Route With IP 20.1.1.0/24
   149      Show Interfaces Address On agent_vpp_3
   150      Show IP Fib On agent_vpp_3
   151      IP Fib Table 3 On agent_vpp_3 Should Contain Route With IP 10.1.1.0/24
   152  
   153      # try ping
   154      Ping From agent_vpp_1 To 10.1.1.2
   155      Ping From agent_vpp_1 To 20.1.1.2
   156      #Ping From agent_vpp_2 To 20.1.1.2
   157      ${int}=    Get Interface Internal Name    agent_vpp_2    bvi_loop0
   158      Ping On agent_vpp_2 With IP 20.1.1.2, Source ${int}
   159      #Ping From agent_vpp_3 To 10.1.1.2
   160      ${int}=    Get Interface Internal Name    agent_vpp_3    bvi_loop0
   161      Ping On agent_vpp_3 With IP 10.1.1.2, Source ${int}
   162  
   163  *** Keywords ***
   164  List of interfaces On ${node} Should Contain Interface ${int}
   165      ${out}=   vpp_term: Show Interfaces    ${node}
   166      Should Match Regexp        ${out}  ${int}