go.ligato.io/vpp-agent/v3@v3.5.0/tests/robot/libraries/acl/acl_vpp.robot (about)

     1  [Documentation]     ACL-related keywords for working with VPP terminal
     2  
     3  *** Settings ***
     4  Library      Collections
     5  
     6  Library      ../vpp_term.py
     7  Library      acl_utils.py
     8  
     9  *** Variables ***
    10  
    11  *** Keywords ***
    12  
    13  vpp_term: ACL Dump
    14      [Arguments]        ${node}
    15      [Documentation]    Execute command acl_dump
    16      ${out}=            vpp_term: Issue Command  ${node}  show acl-plugin acl
    17      ${out_data_vpp}=   Strip String     ${out}
    18      ${out_data}=       Remove String     ${out_data_vpp}    vpp#${SPACE}   vpp#
    19      [Return]           ${out_data}
    20  
    21  Check ACL in VPP - TCP
    22      [Arguments]    ${node}    ${acl_name}    ${egr_intf1}   ${ingr_intf1}
    23      ...    ${acl_action}    ${dest_ntw}    ${src_ntw}    ${dest_port_low}
    24      ...    ${dest_port_high}    ${src_port_low}    ${src_port_high}
    25      ...    ${tcp_flags_mask}    ${tcp_flags_value}
    26      [Documentation]
    27      ...    Get ACL data from VPP API
    28      ...    and verify response against expected data.
    29      ${api_dump_list}=    vpp_api: ACL Dump                     ${node}
    30      ${api_dump}=         Filter ACL Dump By Name               ${api_dump_list}    ${acl_name}
    31      Should Be Equal                ${api_dump["acl_name"]}                ${acl_name}
    32      Should Be Equal As Integers    ${api_dump["acl_action"]}              ${acl_action}
    33      Should Be Equal As Integers    ${api_dump["protocol"]}                6
    34      Should Be Equal                ${api_dump["destination_network"]}     ${dest_ntw}
    35      Should Be Equal                ${api_dump["source_network"]}          ${src_ntw}
    36      Should Be Equal As Integers    ${api_dump["destination_port_low"]}    ${dest_port_low}
    37      Should Be Equal As Integers    ${api_dump["destination_port_high"]}   ${dest_port_high}
    38      Should Be Equal As Integers    ${api_dump["source_port_low"]}         ${src_port_low}
    39      Should Be Equal As Integers    ${api_dump["source_port_high"]}        ${src_port_high}
    40      Should Be Equal As Integers    ${api_dump["tcp_flags_mask"]}          ${tcp_flags_mask}
    41      Should Be Equal As Integers    ${api_dump["tcp_flags_value"]}         ${tcp_flags_value}
    42  
    43  Check ACL in VPP - UDP
    44      [Arguments]    ${node}    ${acl_name}    ${egr_intf1}   ${ingr_intf1}
    45      ...    ${egr_intf2}   ${ingr_intf2}
    46      ...    ${acl_action}    ${dest_ntw}    ${src_ntw}    ${dest_port_low}
    47      ...    ${dest_port_high}    ${src_port_low}    ${src_port_high}
    48      [Documentation]
    49      ...    Get ACL data from VPP API
    50      ...    and verify response against expected data.
    51      ${api_dump_list}=    vpp_api: ACL Dump     ${node}
    52      ${api_dump}=         Filter ACL Dump By Name    ${api_dump_list}      ${acl_name}
    53      Should Be Equal                ${api_dump["acl_name"]}                ${acl_name}
    54      Should Be Equal As Integers    ${api_dump["acl_action"]}              ${acl_action}
    55      Should Be Equal As Integers    ${api_dump["protocol"]}                17
    56      Should Be Equal                ${api_dump["destination_network"]}     ${dest_ntw}
    57      Should Be Equal                ${api_dump["source_network"]}          ${src_ntw}
    58      Should Be Equal As Integers    ${api_dump["destination_port_low"]}    ${dest_port_low}
    59      Should Be Equal As Integers    ${api_dump["destination_port_high"]}   ${dest_port_high}
    60      Should Be Equal As Integers    ${api_dump["source_port_low"]}         ${src_port_low}
    61      Should Be Equal As Integers    ${api_dump["source_port_high"]}        ${src_port_high}
    62  
    63  Check ACL in VPP - ICMP
    64      [Arguments]    ${node}    ${acl_name}    ${egr_intf1}   ${ingr_intf1}
    65      ...    ${acl_action}    ${dest_ntw}    ${src_ntw}
    66      ...    ${icmpv6}
    67      ...    ${icmp_code_low}    ${icmp_code_high}
    68      ...    ${icmp_type_low}    ${icmp_type_high}
    69      [Documentation]
    70      ...    Get ACL data from VPP API
    71      ...    and verify response against expected data.
    72      ${protocol}=    Set Variable If    "${icmpv6}" == "true"    58    1
    73      ${api_dump_list}=    vpp_api: ACL Dump     ${node}
    74      ${api_dump}=         Filter ACL Dump By Name    ${api_dump_list}    ${acl_name}
    75      Should Be Equal                ${api_dump["acl_name"]}                ${acl_name}
    76      Should Be Equal As Integers    ${api_dump["acl_action"]}              ${acl_action}
    77      Should Be Equal As Integers    ${api_dump["protocol"]}                ${protocol}
    78      Should Be Equal                ${api_dump["destination_network"]}     ${dest_ntw}
    79      Should Be Equal                ${api_dump["source_network"]}          ${src_ntw}
    80      Should Be Equal As Integers    ${api_dump["icmp_code_low"]}           ${icmp_code_low}
    81      Should Be Equal As Integers    ${api_dump["icmp_code_high"]}          ${icmp_code_high}
    82      Should Be Equal As Integers    ${api_dump["icmp_type_low"]}           ${icmp_type_low}
    83      Should Be Equal As Integers    ${api_dump["icmp_type_high"]}          ${icmp_type_high}
    84  
    85  ACL in VPP should not exist
    86      [Arguments]    ${node}    ${acl_name}
    87      ${term_d}=          vpp_api: ACL Dump     ${node}
    88      Run Keyword And Expect Error
    89      ...    ACL not found by name ${acl_name}.
    90      ...    Filter ACL Dump By Name    ${term_d}    ${acl_name}
    91  
    92  vpp_api: ACL Dump
    93      [Arguments]        ${node}
    94      [Documentation]    Executing command acl_dump
    95      ${out}=            ACL Dump    ${DOCKER_HOST_IP}    ${DOCKER_HOST_USER}    ${DOCKER_HOST_PSWD}    ${node}
    96      [Return]           ${out}