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

     1  *** Settings ***
     2  Library      OperatingSystem
     3  #Library      RequestsLibrary
     4  #Library      SSHLibrary      timeout=60s
     5  #Library      String
     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       Testsuite Setup
    13  Suite Teardown    Testsuite Teardown
    14  Test Setup        TestSetup
    15  Test Teardown     TestTeardown
    16  
    17  *** Variables ***
    18  ${VARIABLES}=               common
    19  ${ENV}=                     common
    20  ${NAME_VPP1_TAP1}=          vpp1_tap1
    21  ${NAME_VPP2_TAP1}=          vpp2_tap1
    22  ${MAC_VPP1_TAP1}=           12:21:21:11:11:11
    23  ${MAC_VPP2_TAP1}=           22:21:21:22:22:22
    24  ${IP_VPP1_TAP1}=            10.10.1.1
    25  ${IP_VPP2_TAP1}=            20.20.1.1
    26  ${IP_LINUX_VPP1_TAP1}=      10.10.1.2
    27  ${IP_LINUX_VPP2_TAP1}=      20.20.1.2
    28  ${IP_VPP1_TAP1_NETWORK}=    10.10.1.0
    29  ${IP_VPP2_TAP1_NETWORK}=    20.20.1.0
    30  ${NAME_VPP1_MEMIF1}=        vpp1_memif1
    31  ${NAME_VPP2_MEMIF1}=        vpp2_memif1
    32  ${MAC_VPP1_MEMIF1}=         13:21:21:11:11:11
    33  ${MAC_VPP2_MEMIF1}=         23:21:21:22:22:22
    34  ${IP_VPP1_MEMIF1}=          192.168.1.1
    35  ${IP_VPP2_MEMIF1}=          192.168.1.2
    36  ${PREFIX}=                  24
    37  ${UP_STATE}=                up
    38  ${WAIT_TIMEOUT}=     20s
    39  ${SYNC_SLEEP}=       3s
    40  # wait for resync vpps after restart
    41  ${RESYNC_WAIT}=        50s
    42  
    43  *** Test Cases ***
    44  Configure Environment
    45      [Tags]    setup
    46      Configure Environment 1
    47  
    48  Show Interfaces Before Setup
    49      vpp_term: Show Interfaces    agent_vpp_1
    50      vpp_term: Show Interfaces    agent_vpp_2
    51  
    52  Add VPP1_TAP1 Interface
    53      vpp_term: Interface Not Exists  node=agent_vpp_1    mac=${MAC_VPP1_TAP1}
    54      Put TAPv2 Interface With IP    node=agent_vpp_1    name=${NAME_VPP1_TAP1}    mac=${MAC_VPP1_TAP1}    ip=${IP_VPP1_TAP1}    prefix=${PREFIX}    host_if_name=linux_${NAME_VPP1_TAP1}
    55      linux: Set Host TAP Interface    node=agent_vpp_1    host_if_name=linux_${NAME_VPP1_TAP1}    ip=${IP_LINUX_VPP1_TAP1}    prefix=${PREFIX}
    56  
    57  Check VPP1_TAP1 Interface Is Created
    58      ${interfaces}=       vat_term: Interfaces Dump    node=agent_vpp_1
    59      Wait Until Keyword Succeeds   ${WAIT_TIMEOUT}   ${SYNC_SLEEP}    vpp_term: Interface Is Created    node=agent_vpp_1    mac=${MAC_VPP1_TAP1}
    60      ${actual_state}=    vpp_term: Check TAP interface State    agent_vpp_1    ${NAME_VPP1_TAP1}    mac=${MAC_VPP1_TAP1}    ipv4=${IP_VPP1_TAP1}/${PREFIX}    state=${UP_STATE}
    61  
    62  Check Ping Between VPP1 and linux_VPP1_TAP1 Interface
    63      linux: Check Ping    node=agent_vpp_1    ip=${IP_VPP1_TAP1}
    64      vpp_term: Check Ping    node=agent_vpp_1    ip=${IP_LINUX_VPP1_TAP1}
    65  
    66  Add VPP1_memif1 Interface
    67      vpp_term: Interface Not Exists    node=agent_vpp_1    mac=${MAC_VPP1_MEMIF1}
    68      Put Memif Interface With IP    node=agent_vpp_1    name=${NAME_VPP1_MEMIF1}    mac=${MAC_VPP1_MEMIF1}    master=true    id=1    ip=${IP_VPP1_MEMIF1}    prefix=24    socket=memif.sock
    69      Wait Until Keyword Succeeds   ${WAIT_TIMEOUT}   ${SYNC_SLEEP}    vpp_term: Interface Is Created    node=agent_vpp_1    mac=${MAC_VPP1_MEMIF1}
    70  
    71  Add VPP2_TAP1 Interface
    72      vpp_term: Interface Not Exists  node=agent_vpp_2    mac=${MAC_VPP2_TAP1}
    73      Put TAPv2 Interface With IP    node=agent_vpp_2    name=${NAME_VPP2_TAP1}    mac=${MAC_VPP2_TAP1}    ip=${IP_VPP2_TAP1}    prefix=${PREFIX}    host_if_name=linux_${NAME_VPP2_TAP1}
    74      linux: Set Host TAP Interface    node=agent_vpp_2    host_if_name=linux_${NAME_VPP2_TAP1}    ip=${IP_LINUX_VPP2_TAP1}    prefix=${PREFIX}
    75  
    76  Check VPP2_TAP1 Interface Is Created
    77      ${interfaces}=       vat_term: Interfaces Dump    node=agent_vpp_1
    78      Wait Until Keyword Succeeds   ${WAIT_TIMEOUT}   ${SYNC_SLEEP}    vpp_term: Interface Is Created    node=agent_vpp_2    mac=${MAC_VPP2_TAP1}
    79      ${actual_state}=    Wait Until Keyword Succeeds   ${WAIT_TIMEOUT}   ${SYNC_SLEEP}    vpp_term: Check TAP interface State    agent_vpp_2    ${NAME_VPP2_TAP1}    mac=${MAC_VPP2_TAP1}    ipv4=${IP_VPP2_TAP1}/${PREFIX}    state=${UP_STATE}
    80  
    81  Check Ping Between VPP2 And linux_VPP2_TAP1 Interface
    82      linux: Check Ping    node=agent_vpp_2    ip=${IP_VPP2_TAP1}
    83      vpp_term: Check Ping    node=agent_vpp_2    ip=${IP_LINUX_VPP2_TAP1}
    84  
    85  Add VPP2_memif1 Interface
    86      vpp_term: Interface Not Exists    node=agent_vpp_2    mac=${MAC_VPP2_MEMIF1}
    87      Put Memif Interface With IP    node=agent_vpp_2    name=${NAME_VPP2_MEMIF1}    mac=${MAC_VPP2_MEMIF1}    master=false    id=1    ip=${IP_VPP2_MEMIF1}    prefix=24    socket=memif.sock
    88      Wait Until Keyword Succeeds   ${WAIT_TIMEOUT}   ${SYNC_SLEEP}    vpp_term: Interface Is Created    node=agent_vpp_1    mac=${MAC_VPP1_MEMIF1}
    89  
    90  Check Ping From VPP1 To VPP2_memif1
    91      vpp_term: Check Ping    node=agent_vpp_1    ip=${IP_VPP2_MEMIF1}
    92  
    93  Check Ping From VPP2 To VPP1_memif1
    94      vpp_term: Check Ping    node=agent_vpp_2    ip=${IP_VPP1_MEMIF1}
    95  
    96  Ping From VPP1 Linux To VPP2_TAP1 And LINUX_VPP2_TAP1 Should Not Pass
    97      ${status1}=    Run Keyword And Return Status    linux: Check Ping    node=agent_vpp_1    ip=${IP_VPP2_TAP1}
    98      ${status2}=    Run Keyword And Return Status    linux: Check Ping    node=agent_vpp_1    ip=${IP_LINUX_VPP2_TAP1}
    99      Should Be Equal As Strings    ${status1}    False
   100      Should Be Equal As Strings    ${status2}    False
   101  
   102  Ping From VPP2 Linux To VPP1_TAP1 And LINUX_VPP1_TAP1 Should Not Pass
   103      ${status1}=    Run Keyword And Return Status    linux: Check Ping    node=agent_vpp_2    ip=${IP_VPP1_TAP1}
   104      ${status2}=    Run Keyword And Return Status    linux: Check Ping    node=agent_vpp_2    ip=${IP_LINUX_VPP1_TAP1}
   105      Should Be Equal As Strings    ${status1}    False
   106      Should Be Equal As Strings    ${status2}    False
   107  
   108  Add Static Route From VPP1 Linux To VPP2
   109      linux: Add Route    node=agent_vpp_1    destination_ip=${IP_VPP2_TAP1_NETWORK}    prefix=${PREFIX}    next_hop_ip=${IP_VPP1_TAP1}
   110  
   111  Add Static Route From VPP1 To VPP2
   112      Create Route On agent_vpp_1 With IP ${IP_VPP2_TAP1_NETWORK}/${PREFIX} With Next Hop ${IP_VPP2_MEMIF1} And Vrf Id 0
   113  
   114  Add Static Route From VPP2 Linux To VPP1
   115      linux: Add Route    node=agent_vpp_2    destination_ip=${IP_VPP1_TAP1_NETWORK}    prefix=${PREFIX}    next_hop_ip=${IP_VPP2_TAP1}
   116  
   117  Add Static Route From VPP2 To VPP1
   118      Create Route On agent_vpp_2 With IP ${IP_VPP1_TAP1_NETWORK}/${PREFIX} With Next Hop ${IP_VPP1_MEMIF1} And Vrf Id 0
   119       Sleep     ${SYNC_SLEEP}
   120  
   121  Check Ping From VPP1 Linux To VPP2_TAP1 And LINUX_VPP2_TAP1
   122      linux: Check Ping    node=agent_vpp_1    ip=${IP_VPP2_TAP1}
   123      linux: Check Ping    node=agent_vpp_1    ip=${IP_LINUX_VPP2_TAP1}
   124  
   125  Check Ping From VPP2 Linux To VPP1_TAP1 And LINUX_VPP1_TAP1
   126      linux: Check Ping    node=agent_vpp_2    ip=${IP_VPP1_TAP1}
   127      linux: Check Ping    node=agent_vpp_2    ip=${IP_LINUX_VPP1_TAP1}
   128  
   129  Remove VPP Nodes
   130      Remove All Nodes
   131      Sleep    ${SYNC_SLEEP}
   132  
   133  Start VPP1 And VPP2 Again
   134      Add Agent VPP Node    agent_vpp_1
   135      Add Agent VPP Node    agent_vpp_2
   136      Sleep    ${RESYNC_WAIT}
   137  
   138  Create linux_VPP1_TAP1 And linux_VPP2_TAP1 Interfaces After Resync
   139      linux: Set Host TAP Interface    node=agent_vpp_1    host_if_name=linux_${NAME_VPP1_TAP1}    ip=${IP_LINUX_VPP1_TAP1}    prefix=${PREFIX}
   140      linux: Set Host TAP Interface    node=agent_vpp_2    host_if_name=linux_${NAME_VPP2_TAP1}    ip=${IP_LINUX_VPP2_TAP1}    prefix=${PREFIX}
   141  
   142  Check Linux Interfaces On VPP1 After Resync
   143      ${out}=    Execute In Container    agent_vpp_1    ip a
   144      Should Contain    ${out}    linux_${NAME_VPP1_TAP1}
   145  
   146  Check Interfaces On VPP1 After Resync
   147      ${out}=    vpp_term: Show Interfaces    agent_vpp_1
   148      ${int}=    Get Interface Internal Name    node=agent_vpp_1    interface=${NAME_VPP1_MEMIF1}
   149      Should Contain    ${out}    ${int}
   150      ${int}=    Get Interface Internal Name    node=agent_vpp_1    interface=${NAME_VPP1_TAP1}
   151      Should Contain    ${out}    ${int}
   152  TestSetup
   153      Make Datastore Snapshots    ${TEST_NAME}_test_setup
   154  
   155  TestTeardown
   156      Make Datastore Snapshots    ${TEST_NAME}_test_teardown
   157  Check Linux Interfaces On VPP2 After Resync
   158      ${out}=    Execute In Container    agent_vpp_2    ip a
   159      Should Contain    ${out}    linux_${NAME_VPP2_TAP1}
   160  
   161  Check Interfaces On VPP2 After Resync
   162      ${out}=    vpp_term: Show Interfaces    agent_vpp_2
   163      ${int}=    Get Interface Internal Name    node=agent_vpp_2    interface=${NAME_VPP2_MEMIF1}
   164      Should Contain    ${out}    ${int}
   165      ${int}=    Get Interface Internal Name    node=agent_vpp_2    interface=${NAME_VPP2_TAP1}
   166      Should Contain    ${out}    ${int}
   167  
   168  Add Static Route From VPP1 Linux To VPP2 After Resync
   169      linux: Add Route    node=agent_vpp_1    destination_ip=${IP_VPP2_TAP1_NETWORK}    prefix=${PREFIX}    next_hop_ip=${IP_VPP1_TAP1}
   170  
   171  Add Static Route From VPP2 Linux To VPP1 After Resync
   172      linux: Add Route    node=agent_vpp_2    destination_ip=${IP_VPP1_TAP1_NETWORK}    prefix=${PREFIX}    next_hop_ip=${IP_VPP2_TAP1}
   173      Sleep       ${SYNC_SLEEP}
   174  
   175  Check Ping From VPP1 Linux To VPP2_TAP1 And LINUX_VPP2_TAP1 After Resync
   176      linux: Check Ping    node=agent_vpp_1    ip=${IP_VPP2_TAP1}
   177      linux: Check Ping    node=agent_vpp_1    ip=${IP_LINUX_VPP2_TAP1}
   178  
   179  Check Ping From VPP2 Linux To VPP1_TAP1 And LINUX_VPP1_TAP1 After Resync
   180      linux: Check Ping    node=agent_vpp_2    ip=${IP_VPP1_TAP1}
   181      linux: Check Ping    node=agent_vpp_2    ip=${IP_LINUX_VPP1_TAP1}
   182  
   183  *** Keywords ***
   184  TestSetup
   185      Make Datastore Snapshots    ${TEST_NAME}_test_setup
   186  
   187  TestTeardown
   188      Make Datastore Snapshots    ${TEST_NAME}_test_teardown