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

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