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

     1  *** Settings ***
     2  Documentation    IPsec CRUD
     3  Library     OperatingSystem
     4  Library     String
     5  
     6  Resource     ../../variables/${VARIABLES}_variables.robot
     7  Resource    ../../libraries/all_libs.robot
     8  Resource    ../../libraries/pretty_keywords.robot
     9  
    10  Force Tags        crud     IPv6
    11  Suite Setup       Testsuite Setup
    12  Suite Teardown    Testsuite Teardown
    13  
    14  *** Variables ***
    15  ${ENV}=                common
    16  ${REMOTE_ADDR_1}=      fd30::1:1:0:0:1
    17  ${LOCAL_ADDR_1}=       fd30::1:1:0:0:2
    18  ${REMOTE_ADDR_2}=      fd30::1:1:0:0:3
    19  ${LOCAL_ADDR_2}=       fd30::1:1:0:0:4
    20  ${WAIT_TIMEOUT}=     20s
    21  ${SYNC_SLEEP}=       3s
    22  
    23  *** Test Cases ***
    24  # CRUD tests for IPsec
    25  Add Agent Vpp Node
    26      Add Agent VPP Node                 agent_vpp_1
    27  
    28  Add SA1 Into VPP
    29      IP Sec On agent_vpp_1 Should Not Contain SA sa 1
    30      Create IPsec With SA And Json  agent_vpp_1   sa10   ipsec-sa.json  10  1001  4a506a794f574265564551694d653768  4339314b55523947594d6d3547666b45764e6a58
    31  #    Create IPsec On agent_vpp_1 With SA sa10 And Json ipsec-sa.json
    32      Wait Until Keyword Succeeds   ${WAIT_TIMEOUT}   ${SYNC_SLEEP}    IP Sec On agent_vpp_1 Should Contain SA [0] sa 10 (0xa) spi 1001
    33  
    34  Add SA2 Into VPP
    35      IP Sec On agent_vpp_1 Should Not Contain SA sa 2
    36      Create IPsec With SA And Json  agent_vpp_1   sa20   ipsec-sa.json  20  1000  4a506a794f574265564551694d653768  4339314b55523947594d6d3547666b45764e6a58
    37  #    Create IPsec On agent_vpp_1 With SA sa20 And Json ipsec-sa20.json
    38      Wait Until Keyword Succeeds   ${WAIT_TIMEOUT}   ${SYNC_SLEEP}    IP Sec On agent_vpp_1 Should Contain SA [1] sa 20 (0x14) spi 1000
    39  
    40  Add SPD1 Into VPP
    41      IP Sec On agent_vpp_1 Should Not Contain SA spd 1
    42      Create IPsec With SPD And Json  agent_vpp_1    1    ipsec-spd.json    afp1    ${REMOTE_ADDR_1}    ${LOCAL_ADDR_1}    10  20
    43      Wait Until Keyword Succeeds   ${WAIT_TIMEOUT}   ${SYNC_SLEEP}    IP Sec On agent_vpp_1 Should Contain SA spd 1
    44  
    45  Check IPsec config_1 On VPP
    46      Wait Until Keyword Succeeds   ${WAIT_TIMEOUT}   ${SYNC_SLEEP}    IP Sec Should Contain  agent_vpp_1  sa 1  sa 2  spd 1  ip4-outbound   ip4-inbound-protect
    47  
    48  Add SA3 Into VPP
    49      IP Sec On agent_vpp_1 Should Not Contain SA sa 3
    50      Create IPsec With SA And Json  agent_vpp_1   sa30   ipsec-sa.json  30  1003  4a506a794f574265564551694d653770  4339314b55523947594d6d3547666b45764e6a60
    51      Wait Until Keyword Succeeds   ${WAIT_TIMEOUT}   ${SYNC_SLEEP}    IP Sec On agent_vpp_1 Should Contain SA [2] sa 30 (0x1e) spi 1003
    52  
    53  Add SA4 Into VPP
    54      IP Sec On agent_vpp_1 Should Not Contain SA sa 4
    55      Create IPsec With SA And Json  agent_vpp_1   sa40   ipsec-sa.json  40  1002  4a506a794f574265564551694d653770  4339314b55523947594d6d3547666b45764e6a60
    56      Wait Until Keyword Succeeds   ${WAIT_TIMEOUT}   ${SYNC_SLEEP}    IP Sec On agent_vpp_1 Should Contain SA [3] sa 40 (0x28) spi 1002
    57  
    58  Add SPD2 Into VPP
    59      IP Sec On agent_vpp_1 Should Not Contain SA spd 2
    60      Create IPsec With SPD And Json  agent_vpp_1    2    ipsec-spd.json    afp2    ${REMOTE_ADDR_2}    ${LOCAL_ADDR_2}    30  40
    61      Wait Until Keyword Succeeds   ${WAIT_TIMEOUT}   ${SYNC_SLEEP}    IP Sec On agent_vpp_1 Should Contain SA spd 2
    62  
    63  Check IPsec config_1 On VPP After Add SPD2
    64      Wait Until Keyword Succeeds   ${WAIT_TIMEOUT}   ${SYNC_SLEEP}    IP Sec Should Contain  agent_vpp_1  sa 1  sa 2  spd 1  ip4-outbound   ip4-inbound-protect
    65  
    66  Check IPsec config_2 On VPP
    67      Wait Until Keyword Succeeds   ${WAIT_TIMEOUT}   ${SYNC_SLEEP}    IP Sec Should Contain  agent_vpp_1  sa 3  sa 4  spd 2  ip4-outbound   ip4-inbound-protect
    68  
    69  Delete SAs And SPD1 For Default IPsec
    70      Delete IPsec On agent_vpp_1 With Prefix sa And Index 10
    71      Delete IPsec On agent_vpp_1 With Prefix sa And Index 20
    72      Delete IPsec On agent_vpp_1 With Prefix spd And Index 1
    73      Wait Until Keyword Succeeds   ${WAIT_TIMEOUT}   ${SYNC_SLEEP}    IP Sec On agent_vpp_1 Should Not Contain SA sa 10
    74      Wait Until Keyword Succeeds   ${WAIT_TIMEOUT}   ${SYNC_SLEEP}    IP Sec On agent_vpp_1 Should Not Contain SA sa 20
    75      Wait Until Keyword Succeeds   ${WAIT_TIMEOUT}   ${SYNC_SLEEP}    IP Sec On agent_vpp_1 Should Not Contain SA spd 1
    76  
    77  Check IPsec config_2 On VPP After Delete SPD1
    78      Wait Until Keyword Succeeds   ${WAIT_TIMEOUT}   ${SYNC_SLEEP}    IP Sec Should Contain  agent_vpp_1  sa 3  sa 4  spd 2  ip4-outbound   ip4-inbound-protect
    79  
    80  Delete SAs And SPD2 For Default IPsec
    81      Delete IPsec On agent_vpp_1 With Prefix sa And Index 30
    82      Delete IPsec On agent_vpp_1 With Prefix sa And Index 40
    83      Delete IPsec On agent_vpp_1 With Prefix spd And Index 2
    84      Wait Until Keyword Succeeds   ${WAIT_TIMEOUT}   ${SYNC_SLEEP}    IP Sec On agent_vpp_1 Should Not Contain SA sa 30
    85      Wait Until Keyword Succeeds   ${WAIT_TIMEOUT}   ${SYNC_SLEEP}    IP Sec On agent_vpp_1 Should Not Contain SA sa 40
    86      Wait Until Keyword Succeeds   ${WAIT_TIMEOUT}   ${SYNC_SLEEP}    IP Sec On agent_vpp_1 Should Not Contain SA spd 2
    87  
    88  
    89  *** Keywords ***
    90  IP Sec On ${node} Should Not Contain SA ${sa}
    91      ${out}=    vpp_term: Show IPsec    ${node}
    92      Should Not Contain  ${out}  ${sa}
    93  
    94  IP Sec On ${node} Should Contain SA ${sa}
    95      ${out}=    vpp_term: Show IPsec    ${node}
    96      Should Contain  ${out}  ${sa}
    97  
    98  IP Sec Should Contain
    99      [Arguments]     ${node}  ${sa_name_1}  ${sa_name_2}  ${spd_name_1}  ${inbound_policies}  ${outbound_policies}
   100      ${out}=         vpp_term: Show IPsec    ${node}
   101      Run Keyword Unless  "${sa_name_1}" == "${EMPTY}"   Should Contain  ${out}  ${sa_name_1}
   102      Run Keyword Unless  "${sa_name_2}" == "${EMPTY}"   Should Contain  ${out}  ${sa_name_2}
   103      Run Keyword Unless  "${spd_name_1}" == "${EMPTY}"   Should Contain  ${out}  ${spd_name_1}
   104      Run Keyword Unless  "${inbound_policies}" == "${EMPTY}"   Should Contain  ${out}  ${inbound_policies}
   105      Run Keyword Unless  "${outbound_policies}" == "${EMPTY}"   Should Contain  ${out}  ${outbound_policies}