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 |
Rahul Maheshwari | a7c3903 | 2019-09-18 02:15:01 -0500 | [diff] [blame] | 6 | Resource ../lib/bmc_network_utils.robot |
Naman Navin Hegde | 9e8c0d8 | 2019-08-11 15:22:44 -0500 | [diff] [blame] | 7 | Library ../lib/ipmi_utils.py |
| 8 | Library ../lib/gen_robot_valid.py |
| 9 | |
| 10 | Test Teardown FFDC On Test Case Fail |
| 11 | |
| 12 | Force Tags IPMI_Network |
| 13 | |
Rahul Maheshwari | df04d92 | 2019-07-30 12:15:36 -0500 | [diff] [blame] | 14 | |
Naman Navin Hegde | 9e8c0d8 | 2019-08-11 15:22:44 -0500 | [diff] [blame] | 15 | *** Variables *** |
| 16 | |
| 17 | ${initial_lan_config} &{EMPTY} |
| 18 | |
| 19 | |
| 20 | *** Test Cases *** |
| 21 | |
Rahul Maheshwari | df04d92 | 2019-07-30 12:15:36 -0500 | [diff] [blame] | 22 | Retrieve IP Address Via IPMI And Verify Using Redfish |
| 23 | [Documentation] Retrieve IP address using IPMI and verify using Redfish. |
| 24 | [Tags] Retrieve_IP_Address_Via_IPMI_And_Verify_Using_Redish |
| 25 | |
| 26 | ${lan_print_ipmi}= Get LAN Print Dict |
| 27 | |
| 28 | # Fetch IP address list using redfish. |
| 29 | ${ip_list_redfish}= Create List |
| 30 | Redfish.Login |
| 31 | ${resp}= Redfish.Get ${REDFISH_NW_ETH0_URI} |
| 32 | @{network_config_redfish}= Get From Dictionary ${resp.dict} IPv4StaticAddresses |
| 33 | : FOR ${network_config_redfish} IN @{network_config_redfish} |
| 34 | \ Append To List ${ip_list_redfish} ${network_config_redfish['Address']} |
| 35 | |
| 36 | Valid Value lan_print_ipmi['IP Address'] ${ip_list_redfish} |
| 37 | |
| 38 | |
Prashanth Katti | 9bebccb | 2019-09-25 06:38:04 -0500 | [diff] [blame] | 39 | Retrieve Default Gateway Via IPMI And Verify |
| 40 | [Documentation] Retrieve default gateway via IPMI and verify it's existence on the BMC. |
| 41 | [Tags] Retrieve_Default_Gateway_Via_IPMI_And_Verify |
Rahul Maheshwari | df04d92 | 2019-07-30 12:15:36 -0500 | [diff] [blame] | 42 | |
| 43 | ${lan_print_ipmi}= Get LAN Print Dict |
| 44 | |
Prashanth Katti | 9bebccb | 2019-09-25 06:38:04 -0500 | [diff] [blame] | 45 | Verify Gateway On BMC ${lan_print_ipmi['Default Gateway IP']} |
Rahul Maheshwari | df04d92 | 2019-07-30 12:15:36 -0500 | [diff] [blame] | 46 | |
| 47 | |
| 48 | Retrieve MAC Address Via IPMI And Verify Using Redfish |
| 49 | [Documentation] Retrieve MAC address via IPMI and verify using Redfish. |
| 50 | [Tags] Retrieve_MAC_Address_Via_IPMI_And_Verify_Using_Redfish |
| 51 | |
| 52 | ${lan_print_ipmi}= Get LAN Print Dict |
| 53 | |
| 54 | Redfish.Login |
| 55 | ${resp}= Redfish.Get ${REDFISH_NW_ETH0_URI} |
| 56 | ${mac_address_redfish}= Get From Dictionary ${resp.dict} MACAddress |
| 57 | |
| 58 | Valid Value lan_print_ipmi['MAC Address'] ${mac_address_redfish} |
| 59 | |
| 60 | |
Rahul Maheshwari | a7c3903 | 2019-09-18 02:15:01 -0500 | [diff] [blame] | 61 | Test Valid IPMI Channels Supported |
| 62 | [Documentation] Verify IPMI channels supported on a given system. |
| 63 | [Tags] Test_Valid_IPMI_Channels_Supported |
| 64 | |
| 65 | ${channel_count}= Get Physical Network Interface Count |
| 66 | |
| 67 | # Note: IPMI network channel logically starts from 1. |
| 68 | :FOR ${channel_number} IN RANGE 1 ${channel_count} |
| 69 | \ Run IPMI Standard Command lan print ${channel_number} |
| 70 | |
| 71 | |
| 72 | Test Invalid IPMI Channel Response |
| 73 | [Documentation] Verify invalid IPMI channels supported response. |
| 74 | [Tags] Test_Invalid_IPMI_Channel_Response |
| 75 | |
| 76 | ${channel_count}= Get Physical Network Interface Count |
| 77 | |
| 78 | # To target invalid channel, increment count. |
| 79 | ${channel_number}= Evaluate ${channel_count} + 1 |
| 80 | |
| 81 | # Example of invalid channel: |
| 82 | # $ ipmitool -I lanplus -H xx.xx.xx.xx -P password lan print 3 |
| 83 | # Get Channel Info command failed: Parameter out of range |
| 84 | # Invalid channel: 3 |
| 85 | |
| 86 | ${stdout}= Run External IPMI Standard Command |
| 87 | ... lan print ${channel_number} fail_on_err=${0} |
| 88 | Should Contain ${stdout} Invalid channel |
| 89 | ... msg=IPMI channel ${channel_number} is invalid but seen working. |
| 90 | |
| 91 | |
Naman Navin Hegde | 9e8c0d8 | 2019-08-11 15:22:44 -0500 | [diff] [blame] | 92 | Verify IPMI Inband Network Configuration |
| 93 | [Documentation] Verify BMC network configuration via inband IPMI. |
| 94 | [Tags] Verify_IPMI_Inband_Network_Configuration |
| 95 | [Teardown] Run Keywords Restore Configuration AND FFDC On Test Case Fail |
| 96 | |
| 97 | Redfish Power On |
| 98 | ${initial_lan_config}= Get LAN Print Dict inband |
| 99 | Set Suite Variable ${initial_lan_config} |
| 100 | |
| 101 | Set IPMI Inband Network Configuration 10.10.10.10 255.255.255.0 10.10.10.10 |
| 102 | Sleep 10 |
| 103 | |
| 104 | ${lan_print_output}= Get LAN Print Dict inband |
| 105 | Valid Value lan_print_output['IP Address'] ["10.10.10.10"] |
| 106 | Valid Value lan_print_output['Subnet Mask'] ["255.255.255.0"] |
| 107 | Valid Value lan_print_output['Default Gateway IP'] ["10.10.10.10"] |
| 108 | |
| 109 | |
| 110 | *** Keywords *** |
| 111 | |
Rahul Maheshwari | a7c3903 | 2019-09-18 02:15:01 -0500 | [diff] [blame] | 112 | Get Physical Network Interface Count |
| 113 | [Documentation] Return valid physical network interfaces count. |
| 114 | # Example: |
| 115 | # link/ether 22:3a:7f:70:92:cb brd ff:ff:ff:ff:ff:ff |
| 116 | # link/ether 0e:8e:0d:6b:e9:e4 brd ff:ff:ff:ff:ff:ff |
| 117 | |
| 118 | ${mac_entry_list}= Get BMC MAC Address List |
| 119 | ${mac_unique_list}= Remove Duplicates ${mac_entry_list} |
| 120 | ${physical_interface_count}= Get Length ${mac_unique_list} |
| 121 | |
| 122 | [Return] ${physical_interface_count} |
| 123 | |
| 124 | |
Naman Navin Hegde | 9e8c0d8 | 2019-08-11 15:22:44 -0500 | [diff] [blame] | 125 | Set IPMI Inband Network Configuration |
| 126 | [Documentation] Run sequence of standard IPMI command in-band and set |
| 127 | ... the IP configuration. |
| 128 | [Arguments] ${ip} ${netmask} ${gateway} ${login}=${1} |
| 129 | |
| 130 | # Description of argument(s): |
| 131 | # ip The IP address to be set using ipmitool-inband. |
| 132 | # netmask The Netmask to be set using ipmitool-inband. |
| 133 | # gateway The Gateway address to be set using ipmitool-inband. |
| 134 | |
| 135 | Run Inband IPMI Standard Command |
| 136 | ... lan set 1 ipsrc static login_host=${login} |
| 137 | Run Inband IPMI Standard Command |
| 138 | ... lan set 1 ipaddr ${ip} login_host=${0} |
| 139 | Run Inband IPMI Standard Command |
| 140 | ... lan set 1 netmask ${netmask} login_host=${0} |
| 141 | Run Inband IPMI Standard Command |
| 142 | ... lan set 1 defgw ipaddr ${gateway} login_host=${0} |
| 143 | |
| 144 | |
| 145 | Restore Configuration |
| 146 | [Documentation] Restore the configuration to its pre-test state |
Naman Navin Hegde | 9e8c0d8 | 2019-08-11 15:22:44 -0500 | [diff] [blame] | 147 | ${length}= Get Length ${initial_lan_config} |
| 148 | Return From Keyword If ${length} == ${0} |
| 149 | |
| 150 | Set IPMI Inband Network Configuration ${initial_lan_config['IP Address']} |
| 151 | ... ${initial_lan_config['Subnet Mask']} |
| 152 | ... ${initial_lan_config['Default Gateway IP']} login=${0} |
Rahul Maheshwari | df04d92 | 2019-07-30 12:15:36 -0500 | [diff] [blame] | 153 | |