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

     1  [Documentation]     Keywords for working with bridge domains using VPP API
     2  
     3  *** Settings ***
     4  
     5  Library    bridge_utils.py
     6  Library    Collections
     7  
     8  *** Variables ***
     9  
    10  *** Keywords ***
    11  
    12  
    13  vpp_api: Bridge Domain Dump
    14      [Arguments]        ${node}
    15      [Documentation]    Executing command bridge_domain_dump
    16      ${out}=            Bridge Domain Dump    ${DOCKER_HOST_IP}    ${DOCKER_HOST_USER}    ${DOCKER_HOST_PSWD}    ${node}
    17      [Return]           ${out}
    18      
    19  vpp_api: Check Bridge Domain State
    20      [Arguments]          ${node}    ${bd}    &{desired_state}
    21      ${bd_id}=            Get Bridge Domain ID    ${node}    ${bd}
    22      ${bd_dump}=          vpp_api: Bridge Domain Dump    ${node}
    23      ${data}=             Filter Bridge Domain Dump By ID   ${bd_dump}    ${bd_id}
    24      ${flood}=                              Set Variable    ${data["flood"]}
    25      ${forward}=                            Set Variable    ${data["forward"]}
    26      ${learn}=                              Set Variable    ${data["learn"]}
    27      ${arp_termination}=                    Set Variable    ${data["arp_term"]}
    28      ${unknown_unicast_flood}=              Set Variable    ${data["uu_flood"]}
    29      ${bridged_virtual_interface}=          Set Variable If    ${data["bvi_sw_if_index"]} == 4294967295
    30      ...    none    ${data["bvi_sw_if_index"]}
    31      ${actual_state}=     Create Dictionary
    32      ...    flood=${flood}    forward=${forward}    learn=${learn}    arp_term=${arp_termination}
    33      ...    unicast=${unknown_unicast_flood}    bvi_int=${bridged_virtual_interface}
    34      ${actual_state_interfaces}=    Create List
    35      :FOR    ${interface}    IN    @{data["sw_if_details"]}
    36      \    ${internal_name}=    vpp_api: Get Interface Name    ${node}    ${interface["sw_if_index"]}
    37      \    Append To List    ${actual_state_interfaces}    ${internal_name}
    38      Set To Dictionary    ${actual_state}    interfaces    ${actual_state_interfaces}
    39      ${internal_names}=    Create List
    40      :FOR    ${interface}    IN    @{desired_state["interfaces"]}
    41      \    ${internal_name}=    Get Interface Internal Name    ${node}    ${interface}
    42      \    Append To List    ${internal_names}    ${internal_name}
    43      Set To Dictionary    ${desired_state}    interfaces    ${internal_names}
    44      List Should Contain Sub List    ${actual_state}    ${desired_state}
    45  
    46  vpp_api: Check Bridge Domain Presence
    47      [Arguments]          ${node}    ${bd_name}
    48      ${bd_id}=    Get Bridge Domain ID    ${node}    ${bd_name}
    49      ${output}=    vpp_api: Bridge Domain Dump    ${node}
    50      ${data}=     Filter Bridge Domain Dump By ID   ${output}    ${bd_id}
    51  
    52  vpp_api: BD Is Created
    53      [Arguments]    ${node}    ${bd_name}
    54      Wait Until Keyword Succeeds    ${bd_timeout}   3s    vpp_api: Check Bridge Domain Presence    ${node}    ${bd_name}
    55  
    56  vpp_api: BD Is Deleted
    57      [Arguments]    ${node}    ${bd_name}
    58      Run Keyword And Expect Error    *Bridge domain not found by id 0.*
    59      ...    vpp_api: BD Is Created    ${node}    ${bd_name}
    60  
    61  vpp_api: BD Not Exists
    62      [Arguments]    ${node}    ${bd_name}
    63      ${bd_id}=    Get Bridge Domain ID    ${node}    ${bd_name}
    64      Should Be Equal    ${bd_id}    0
    65  
    66  vpp_api: No Bridge Domains Exist
    67      [Arguments]    ${node}
    68      ${data}=    vpp_api: Bridge Domain Dump    ${node}
    69      Should Be Empty    ${data}
    70  
    71  vpp_api: Check BD Presence
    72      [Arguments]        ${node}     ${interfaces}    ${status}=${TRUE}
    73      ${indexes}=    Create List
    74      :FOR    ${int}    IN    @{interfaces}
    75      \    ${sw_if_index}=    Get Interface Sw If Index    ${node}    ${int}
    76      \    Append To List    ${indexes}    ${sw_if_index}
    77      ${bd_dump}=        vpp_api: Bridge Domain Dump    ${node}
    78      ${result}=         Check BD Presence    ${bd_dump}    ${indexes}
    79      Should Be Equal    ${result}    ${status}