xref: /openbmc/openbmc-test-automation/redfish/managers/test_lldp_config.robot (revision adf3ba525cccdf3367622640a59d10b72d6648a4)
124401f3fSSweta Potthuri*** Settings ***
224401f3fSSweta PotthuriDocumentation  LLDP(Link Layer Discovery Protocol) Test Suite for configuration
324401f3fSSweta Potthuri               ...  and verification tests.
424401f3fSSweta Potthuri
524401f3fSSweta PotthuriResource        ../../lib/bmc_redfish_resource.robot
624401f3fSSweta PotthuriResource        ../../lib/bmc_network_utils.robot
724401f3fSSweta PotthuriResource        ../../lib/openbmc_ffdc.robot
824401f3fSSweta Potthuri
924401f3fSSweta PotthuriSuite Setup               Suite Setup Execution
106ab47615SGeorge KeishingSuite Teardown            Redfish.Logout
1124401f3fSSweta PotthuriTest Teardown             FFDC On Test Case Fail
1224401f3fSSweta Potthuri
1324401f3fSSweta PotthuriTest Tags     LLDP_config
1424401f3fSSweta Potthuri
1524401f3fSSweta Potthuri*** Test Cases ***
1624401f3fSSweta Potthuri
1724401f3fSSweta PotthuriEnable LLDP And Verify
1824401f3fSSweta Potthuri    [Documentation]  Enable LLDP and verify.
1924401f3fSSweta Potthuri    [Tags]  Enable_LLDP_And_Verify
2024401f3fSSweta Potthuri
2124401f3fSSweta Potthuri    # Set the LLDP enabled property as True.
2224401f3fSSweta Potthuri    Set LLDP Configuration State  ${True}
2324401f3fSSweta Potthuri
2424401f3fSSweta Potthuri    # Verify the LLDP state is set true
2524401f3fSSweta Potthuri    Verify LLDP Configuration State  ${True}
2624401f3fSSweta Potthuri
27*adf3ba52SkvishalDisable LLDP And Verify
28*adf3ba52Skvishal    [Documentation]  Disable LLDP and verify.
29*adf3ba52Skvishal    [Tags]  Disable_LLDP_And_Verify
30*adf3ba52Skvishal
31*adf3ba52Skvishal    # Set the LLDP enabled property as False.
32*adf3ba52Skvishal    Set LLDP Configuration State  ${False}
33*adf3ba52Skvishal
34*adf3ba52Skvishal    # Verify the LLDP state is set False
35*adf3ba52Skvishal    Verify LLDP Configuration State  ${False}
36*adf3ba52Skvishal
3724401f3fSSweta Potthuri*** Keywords ***
3824401f3fSSweta Potthuri
3924401f3fSSweta PotthuriSuite Setup Execution
4024401f3fSSweta Potthuri    [Documentation]  Do suite setup execution.
4124401f3fSSweta Potthuri
4224401f3fSSweta Potthuri    ${active_channel_config}=  Get Active Channel Config
4324401f3fSSweta Potthuri    ${ethernet_interface}=  Set Variable  ${active_channel_config['${CHANNEL_NUMBER}']['name']}
4424401f3fSSweta Potthuri    Set Suite variable  ${ethernet_interface}
4524401f3fSSweta Potthuri
4624401f3fSSweta Potthuri    Redfish.Login
4724401f3fSSweta Potthuri    ${initial_lldp_config}=  Get Initial LLDP Configuration
4824401f3fSSweta Potthuri    Set Suite Variable  ${initial_lldp_config}
4924401f3fSSweta Potthuri
5024401f3fSSweta PotthuriSet LLDP Configuration State
5124401f3fSSweta Potthuri    [Documentation]  Set LLDP configuration state.
5224401f3fSSweta Potthuri    [Arguments]  ${lldp_state}
5324401f3fSSweta Potthuri
5424401f3fSSweta Potthuri    # Description of argument(s):
5524401f3fSSweta Potthuri    # lldp_state          LLDP state('True' or 'False').
5624401f3fSSweta Potthuri
5724401f3fSSweta Potthuri    Redfish.Patch  ${REDFISH_LLDP_ETH_IFACE}${ethernet_interface}  body={'Ethernet':{'LLDPEnabled': ${lldp_state}}}
5824401f3fSSweta Potthuri    ...  valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}]
5924401f3fSSweta Potthuri
6024401f3fSSweta PotthuriGet Initial LLDP Configuration
6124401f3fSSweta Potthuri    [Documentation]  Get initial LLDP configuration.
6224401f3fSSweta Potthuri
6324401f3fSSweta Potthuri    ${resp}=  Redfish.Get  ${REDFISH_LLDP_ETH_IFACE}${ethernet_interface}
6424401f3fSSweta Potthuri
6524401f3fSSweta Potthuri    ${lldp_state}=  Get From Dictionary  ${resp.dict}  Ethernet
6624401f3fSSweta Potthuri    RETURN  ${lldp_state}
6724401f3fSSweta Potthuri
6824401f3fSSweta PotthuriVerify LLDP Configuration State
6924401f3fSSweta Potthuri    [Documentation]  Verify LLDP configuration state.
7024401f3fSSweta Potthuri    [Arguments]  ${lldp_state}
7124401f3fSSweta Potthuri
7224401f3fSSweta Potthuri    # Description of argument(s):
7324401f3fSSweta Potthuri    # lldp_state          LLDP state set('True' or 'False').
7424401f3fSSweta Potthuri
7524401f3fSSweta Potthuri    ${resp}=  Redfish.Get  ${REDFISH_LLDP_ETH_IFACE}${ethernet_interface}
7624401f3fSSweta Potthuri    ${lldp_state_expected}=  Get From Dictionary  ${resp.dict}  Ethernet
7724401f3fSSweta Potthuri
78e6e161e0SGeorge Keishing    IF  '${lldp_state}' != '${lldp_state_expected['LLDPEnabled']}'
79e6e161e0SGeorge Keishing        Fail  msg=LLDP value is not set correctly.
80e6e161e0SGeorge Keishing    END
81