xref: /openbmc/openbmc-test-automation/redfish/managers/test_lldp_config.robot (revision adf3ba525cccdf3367622640a59d10b72d6648a4)
1*** Settings ***
2Documentation  LLDP(Link Layer Discovery Protocol) Test Suite for configuration
3               ...  and verification tests.
4
5Resource        ../../lib/bmc_redfish_resource.robot
6Resource        ../../lib/bmc_network_utils.robot
7Resource        ../../lib/openbmc_ffdc.robot
8
9Suite Setup               Suite Setup Execution
10Suite Teardown            Redfish.Logout
11Test Teardown             FFDC On Test Case Fail
12
13Test Tags     LLDP_config
14
15*** Test Cases ***
16
17Enable LLDP And Verify
18    [Documentation]  Enable LLDP and verify.
19    [Tags]  Enable_LLDP_And_Verify
20
21    # Set the LLDP enabled property as True.
22    Set LLDP Configuration State  ${True}
23
24    # Verify the LLDP state is set true
25    Verify LLDP Configuration State  ${True}
26
27Disable LLDP And Verify
28    [Documentation]  Disable LLDP and verify.
29    [Tags]  Disable_LLDP_And_Verify
30
31    # Set the LLDP enabled property as False.
32    Set LLDP Configuration State  ${False}
33
34    # Verify the LLDP state is set False
35    Verify LLDP Configuration State  ${False}
36
37*** Keywords ***
38
39Suite Setup Execution
40    [Documentation]  Do suite setup execution.
41
42    ${active_channel_config}=  Get Active Channel Config
43    ${ethernet_interface}=  Set Variable  ${active_channel_config['${CHANNEL_NUMBER}']['name']}
44    Set Suite variable  ${ethernet_interface}
45
46    Redfish.Login
47    ${initial_lldp_config}=  Get Initial LLDP Configuration
48    Set Suite Variable  ${initial_lldp_config}
49
50Set LLDP Configuration State
51    [Documentation]  Set LLDP configuration state.
52    [Arguments]  ${lldp_state}
53
54    # Description of argument(s):
55    # lldp_state          LLDP state('True' or 'False').
56
57    Redfish.Patch  ${REDFISH_LLDP_ETH_IFACE}${ethernet_interface}  body={'Ethernet':{'LLDPEnabled': ${lldp_state}}}
58    ...  valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}]
59
60Get Initial LLDP Configuration
61    [Documentation]  Get initial LLDP configuration.
62
63    ${resp}=  Redfish.Get  ${REDFISH_LLDP_ETH_IFACE}${ethernet_interface}
64
65    ${lldp_state}=  Get From Dictionary  ${resp.dict}  Ethernet
66    RETURN  ${lldp_state}
67
68Verify LLDP Configuration State
69    [Documentation]  Verify LLDP configuration state.
70    [Arguments]  ${lldp_state}
71
72    # Description of argument(s):
73    # lldp_state          LLDP state set('True' or 'False').
74
75    ${resp}=  Redfish.Get  ${REDFISH_LLDP_ETH_IFACE}${ethernet_interface}
76    ${lldp_state_expected}=  Get From Dictionary  ${resp.dict}  Ethernet
77
78    IF  '${lldp_state}' != '${lldp_state_expected['LLDPEnabled']}'
79        Fail  msg=LLDP value is not set correctly.
80    END
81