Naman Navin Hegde | 9e8c0d8 | 2019-08-11 15:22:44 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
| 3 | Documentation Module to test IPMI network functionality. |
| 4 | Resource ../lib/ipmi_client.robot |
| 5 | Resource ../lib/openbmc_ffdc.robot |
| 6 | Library ../lib/ipmi_utils.py |
| 7 | Library ../lib/gen_robot_valid.py |
| 8 | |
| 9 | Test Teardown FFDC On Test Case Fail |
| 10 | |
| 11 | Force Tags IPMI_Network |
| 12 | |
Rahul Maheshwari | df04d92 | 2019-07-30 12:15:36 -0500 | [diff] [blame^] | 13 | |
Naman Navin Hegde | 9e8c0d8 | 2019-08-11 15:22:44 -0500 | [diff] [blame] | 14 | *** Variables *** |
| 15 | |
| 16 | ${initial_lan_config} &{EMPTY} |
| 17 | |
| 18 | |
| 19 | *** Test Cases *** |
| 20 | |
Rahul Maheshwari | df04d92 | 2019-07-30 12:15:36 -0500 | [diff] [blame^] | 21 | Retrieve IP Address Via IPMI And Verify Using Redfish |
| 22 | [Documentation] Retrieve IP address using IPMI and verify using Redfish. |
| 23 | [Tags] Retrieve_IP_Address_Via_IPMI_And_Verify_Using_Redish |
| 24 | |
| 25 | ${lan_print_ipmi}= Get LAN Print Dict |
| 26 | |
| 27 | # Fetch IP address list using redfish. |
| 28 | ${ip_list_redfish}= Create List |
| 29 | Redfish.Login |
| 30 | ${resp}= Redfish.Get ${REDFISH_NW_ETH0_URI} |
| 31 | @{network_config_redfish}= Get From Dictionary ${resp.dict} IPv4StaticAddresses |
| 32 | : FOR ${network_config_redfish} IN @{network_config_redfish} |
| 33 | \ Append To List ${ip_list_redfish} ${network_config_redfish['Address']} |
| 34 | |
| 35 | Valid Value lan_print_ipmi['IP Address'] ${ip_list_redfish} |
| 36 | |
| 37 | |
| 38 | Retrieve Default Gateway Via IPMI And Verify Using Redfish |
| 39 | [Documentation] Retrieve default gateway via IPMI and verify using Redfish. |
| 40 | [Tags] Retrieve_Default_Gateway_Via_IPMI_And_Verify_Using_Redfish |
| 41 | |
| 42 | ${lan_print_ipmi}= Get LAN Print Dict |
| 43 | |
| 44 | # Fetch gateway address list using redfish. |
| 45 | ${gateway_list_redfish}= Create List |
| 46 | Redfish.Login |
| 47 | ${resp}= Redfish.Get ${REDFISH_NW_ETH0_URI} |
| 48 | @{network_config_redfish}= Get From Dictionary ${resp.dict} IPv4StaticAddresses |
| 49 | : FOR ${network_config_redfish} IN @{network_config_redfish} |
| 50 | \ Append To List ${gateway_list_redfish} ${network_config_redfish['Gateway']} |
| 51 | |
| 52 | Valid Value lan_print_ipmi['Default Gateway IP'] ${gateway_list_redfish} |
| 53 | |
| 54 | |
| 55 | Retrieve MAC Address Via IPMI And Verify Using Redfish |
| 56 | [Documentation] Retrieve MAC address via IPMI and verify using Redfish. |
| 57 | [Tags] Retrieve_MAC_Address_Via_IPMI_And_Verify_Using_Redfish |
| 58 | |
| 59 | ${lan_print_ipmi}= Get LAN Print Dict |
| 60 | |
| 61 | Redfish.Login |
| 62 | ${resp}= Redfish.Get ${REDFISH_NW_ETH0_URI} |
| 63 | ${mac_address_redfish}= Get From Dictionary ${resp.dict} MACAddress |
| 64 | |
| 65 | Valid Value lan_print_ipmi['MAC Address'] ${mac_address_redfish} |
| 66 | |
| 67 | |
Naman Navin Hegde | 9e8c0d8 | 2019-08-11 15:22:44 -0500 | [diff] [blame] | 68 | Verify IPMI Inband Network Configuration |
| 69 | [Documentation] Verify BMC network configuration via inband IPMI. |
| 70 | [Tags] Verify_IPMI_Inband_Network_Configuration |
| 71 | [Teardown] Run Keywords Restore Configuration AND FFDC On Test Case Fail |
| 72 | |
| 73 | Redfish Power On |
| 74 | ${initial_lan_config}= Get LAN Print Dict inband |
| 75 | Set Suite Variable ${initial_lan_config} |
| 76 | |
| 77 | Set IPMI Inband Network Configuration 10.10.10.10 255.255.255.0 10.10.10.10 |
| 78 | Sleep 10 |
| 79 | |
| 80 | ${lan_print_output}= Get LAN Print Dict inband |
| 81 | Valid Value lan_print_output['IP Address'] ["10.10.10.10"] |
| 82 | Valid Value lan_print_output['Subnet Mask'] ["255.255.255.0"] |
| 83 | Valid Value lan_print_output['Default Gateway IP'] ["10.10.10.10"] |
| 84 | |
| 85 | |
| 86 | *** Keywords *** |
| 87 | |
| 88 | Set IPMI Inband Network Configuration |
| 89 | [Documentation] Run sequence of standard IPMI command in-band and set |
| 90 | ... the IP configuration. |
| 91 | [Arguments] ${ip} ${netmask} ${gateway} ${login}=${1} |
| 92 | |
| 93 | # Description of argument(s): |
| 94 | # ip The IP address to be set using ipmitool-inband. |
| 95 | # netmask The Netmask to be set using ipmitool-inband. |
| 96 | # gateway The Gateway address to be set using ipmitool-inband. |
| 97 | |
| 98 | Run Inband IPMI Standard Command |
| 99 | ... lan set 1 ipsrc static login_host=${login} |
| 100 | Run Inband IPMI Standard Command |
| 101 | ... lan set 1 ipaddr ${ip} login_host=${0} |
| 102 | Run Inband IPMI Standard Command |
| 103 | ... lan set 1 netmask ${netmask} login_host=${0} |
| 104 | Run Inband IPMI Standard Command |
| 105 | ... lan set 1 defgw ipaddr ${gateway} login_host=${0} |
| 106 | |
| 107 | |
| 108 | Restore Configuration |
| 109 | [Documentation] Restore the configuration to its pre-test state |
Naman Navin Hegde | 9e8c0d8 | 2019-08-11 15:22:44 -0500 | [diff] [blame] | 110 | ${length}= Get Length ${initial_lan_config} |
| 111 | Return From Keyword If ${length} == ${0} |
| 112 | |
| 113 | Set IPMI Inband Network Configuration ${initial_lan_config['IP Address']} |
| 114 | ... ${initial_lan_config['Subnet Mask']} |
| 115 | ... ${initial_lan_config['Default Gateway IP']} login=${0} |
Rahul Maheshwari | df04d92 | 2019-07-30 12:15:36 -0500 | [diff] [blame^] | 116 | |