Sweta Potthuri | 24401f3 | 2025-03-02 23:54:37 -0600 | [diff] [blame^] | 1 | *** Settings *** |
| 2 | Documentation LLDP(Link Layer Discovery Protocol) Test Suite for configuration |
| 3 | ... and verification tests. |
| 4 | |
| 5 | Resource ../../lib/bmc_redfish_resource.robot |
| 6 | Resource ../../lib/bmc_network_utils.robot |
| 7 | Resource ../../lib/openbmc_ffdc.robot |
| 8 | |
| 9 | Suite Setup Suite Setup Execution |
| 10 | Suite Teardown Execution Redfish.Logout |
| 11 | Test Teardown FFDC On Test Case Fail |
| 12 | |
| 13 | Test Tags LLDP_config |
| 14 | |
| 15 | *** Test Cases *** |
| 16 | |
| 17 | Enable 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 | |
| 27 | *** Keywords *** |
| 28 | |
| 29 | Suite Setup Execution |
| 30 | [Documentation] Do suite setup execution. |
| 31 | |
| 32 | ${active_channel_config}= Get Active Channel Config |
| 33 | ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 34 | Set Suite variable ${ethernet_interface} |
| 35 | |
| 36 | Redfish.Login |
| 37 | ${initial_lldp_config}= Get Initial LLDP Configuration |
| 38 | Set Suite Variable ${initial_lldp_config} |
| 39 | |
| 40 | Set LLDP Configuration State |
| 41 | [Documentation] Set LLDP configuration state. |
| 42 | [Arguments] ${lldp_state} |
| 43 | |
| 44 | # Description of argument(s): |
| 45 | # lldp_state LLDP state('True' or 'False'). |
| 46 | |
| 47 | Redfish.Patch ${REDFISH_LLDP_ETH_IFACE}${ethernet_interface} body={'Ethernet':{'LLDPEnabled': ${lldp_state}}} |
| 48 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] |
| 49 | |
| 50 | Get Initial LLDP Configuration |
| 51 | [Documentation] Get initial LLDP configuration. |
| 52 | |
| 53 | ${resp}= Redfish.Get ${REDFISH_LLDP_ETH_IFACE}${ethernet_interface} |
| 54 | |
| 55 | ${lldp_state}= Get From Dictionary ${resp.dict} Ethernet |
| 56 | RETURN ${lldp_state} |
| 57 | |
| 58 | Verify LLDP Configuration State |
| 59 | [Documentation] Verify LLDP configuration state. |
| 60 | [Arguments] ${lldp_state} |
| 61 | |
| 62 | # Description of argument(s): |
| 63 | # lldp_state LLDP state set('True' or 'False'). |
| 64 | |
| 65 | ${resp}= Redfish.Get ${REDFISH_LLDP_ETH_IFACE}${ethernet_interface} |
| 66 | ${lldp_state_expected}= Get From Dictionary ${resp.dict} Ethernet |
| 67 | |
| 68 | Run Keyword If '${lldp_state}' != '${lldp_state_expected['LLDPEnabled']}' |
| 69 | ... Fail msg=LLDP value is not set correctly. |