blob: 8f6088925b4e326ae6a8f7f4a17b09fd8198c729 [file] [log] [blame]
Naman Navin Hegde9e8c0d82019-08-11 15:22:44 -05001*** Settings ***
2
3Documentation Module to test IPMI network functionality.
4Resource ../lib/ipmi_client.robot
5Resource ../lib/openbmc_ffdc.robot
Rahul Maheshwaria7c39032019-09-18 02:15:01 -05006Resource ../lib/bmc_network_utils.robot
Naman Navin Hegde9e8c0d82019-08-11 15:22:44 -05007Library ../lib/ipmi_utils.py
8Library ../lib/gen_robot_valid.py
Tony Leeea741302019-11-08 11:01:58 +08009Library ../lib/var_funcs.py
10Library ../lib/bmc_network_utils.py
Naman Navin Hegde9e8c0d82019-08-11 15:22:44 -050011
Tony Leeea741302019-11-08 11:01:58 +080012Suite Setup Redfish.Login
13Test Setup Printn
Naman Navin Hegde9e8c0d82019-08-11 15:22:44 -050014Test Teardown FFDC On Test Case Fail
15
16Force Tags IPMI_Network
17
Rahul Maheshwaridf04d922019-07-30 12:15:36 -050018
Naman Navin Hegde9e8c0d82019-08-11 15:22:44 -050019*** Variables ***
20
21${initial_lan_config} &{EMPTY}
22
23
24*** Test Cases ***
25
Rahul Maheshwaridf04d922019-07-30 12:15:36 -050026Retrieve IP Address Via IPMI And Verify Using Redfish
27 [Documentation] Retrieve IP address using IPMI and verify using Redfish.
28 [Tags] Retrieve_IP_Address_Via_IPMI_And_Verify_Using_Redish
29
Tony Leeea741302019-11-08 11:01:58 +080030 ${active_channel_config}= Get Active Channel Config
Rahul Maheshwari3a1d9912020-02-25 03:13:14 -060031 FOR ${channel_number} IN @{active_channel_config.keys()}
32 Verify Channel Info ${channel_number} IPv4StaticAddresses ${active_channel_config}
Tony Leeea741302019-11-08 11:01:58 +080033 END
Rahul Maheshwaridf04d922019-07-30 12:15:36 -050034
Rahul Maheshwari3a1d9912020-02-25 03:13:14 -060035
Prashanth Katti9bebccb2019-09-25 06:38:04 -050036Retrieve Default Gateway Via IPMI And Verify
37 [Documentation] Retrieve default gateway via IPMI and verify it's existence on the BMC.
38 [Tags] Retrieve_Default_Gateway_Via_IPMI_And_Verify
Rahul Maheshwaridf04d922019-07-30 12:15:36 -050039
40 ${lan_print_ipmi}= Get LAN Print Dict
41
Prashanth Katti9bebccb2019-09-25 06:38:04 -050042 Verify Gateway On BMC ${lan_print_ipmi['Default Gateway IP']}
Rahul Maheshwaridf04d922019-07-30 12:15:36 -050043
44
45Retrieve MAC Address Via IPMI And Verify Using Redfish
46 [Documentation] Retrieve MAC address via IPMI and verify using Redfish.
47 [Tags] Retrieve_MAC_Address_Via_IPMI_And_Verify_Using_Redfish
48
Tony Leeea741302019-11-08 11:01:58 +080049 ${active_channel_config}= Get Active Channel Config
Rahul Maheshwari3a1d9912020-02-25 03:13:14 -060050 FOR ${channel_number} IN @{active_channel_config.keys()}
51 Verify Channel Info ${channel_number} MACAddress ${active_channel_config}
Tony Leeea741302019-11-08 11:01:58 +080052 END
Rahul Maheshwaridf04d922019-07-30 12:15:36 -050053
54
Rahul Maheshwaria7c39032019-09-18 02:15:01 -050055Test Valid IPMI Channels Supported
56 [Documentation] Verify IPMI channels supported on a given system.
57 [Tags] Test_Valid_IPMI_Channels_Supported
58
59 ${channel_count}= Get Physical Network Interface Count
60
61 # Note: IPMI network channel logically starts from 1.
Rahul Maheshwari3a1d9912020-02-25 03:13:14 -060062 FOR ${channel_number} IN RANGE 1 ${channel_count}
63 Run IPMI Standard Command lan print ${channel_number}
64 END
Rahul Maheshwaria7c39032019-09-18 02:15:01 -050065
66
67Test Invalid IPMI Channel Response
68 [Documentation] Verify invalid IPMI channels supported response.
69 [Tags] Test_Invalid_IPMI_Channel_Response
70
71 ${channel_count}= Get Physical Network Interface Count
72
73 # To target invalid channel, increment count.
74 ${channel_number}= Evaluate ${channel_count} + 1
75
76 # Example of invalid channel:
77 # $ ipmitool -I lanplus -H xx.xx.xx.xx -P password lan print 3
78 # Get Channel Info command failed: Parameter out of range
79 # Invalid channel: 3
80
81 ${stdout}= Run External IPMI Standard Command
82 ... lan print ${channel_number} fail_on_err=${0}
83 Should Contain ${stdout} Invalid channel
84 ... msg=IPMI channel ${channel_number} is invalid but seen working.
85
86
Naman Navin Hegde9e8c0d82019-08-11 15:22:44 -050087Verify IPMI Inband Network Configuration
88 [Documentation] Verify BMC network configuration via inband IPMI.
89 [Tags] Verify_IPMI_Inband_Network_Configuration
90 [Teardown] Run Keywords Restore Configuration AND FFDC On Test Case Fail
91
92 Redfish Power On
Tony Leec762a7a2019-12-30 17:12:50 +080093 ${initial_lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband
Naman Navin Hegde9e8c0d82019-08-11 15:22:44 -050094 Set Suite Variable ${initial_lan_config}
95
96 Set IPMI Inband Network Configuration 10.10.10.10 255.255.255.0 10.10.10.10
97 Sleep 10
98
Tony Leec762a7a2019-12-30 17:12:50 +080099 ${lan_print_output}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband
Naman Navin Hegde9e8c0d82019-08-11 15:22:44 -0500100 Valid Value lan_print_output['IP Address'] ["10.10.10.10"]
101 Valid Value lan_print_output['Subnet Mask'] ["255.255.255.0"]
102 Valid Value lan_print_output['Default Gateway IP'] ["10.10.10.10"]
103
104
Sushma M M08adaa02020-01-23 03:25:19 -0600105Get IP Address Source And Verify Using Redfish
106 [Documentation] Get IP address source and verify it using Redfish.
107 [Tags] Get_IP_Address_Source_And_Verify_Using_Redfish
108
Tony Lee5a200142020-02-11 13:33:05 +0800109 ${active_channel_config}= Get Active Channel Config
110 ${lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER}
111
112 ${ipv4_addresses}= Redfish.Get Attribute
George Keishing093c1bd2020-02-10 09:47:34 -0600113 ... /redfish/v1/Managers/bmc/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
114 ... IPv4Addresses
Tony Lee5a200142020-02-11 13:33:05 +0800115
116 FOR ${ipv4_address} IN @{ipv4_addresses}
Rahul Maheshwari3a1d9912020-02-25 03:13:14 -0600117 ${ip_address_source}=
118 ... Set Variable if '${ipv4_address['Address']}' == '${lan_config['IP Address']}'
119 ... ${ipv4_address['AddressOrigin']} Address
120 Exit For Loop IF "${ip_address_source}" != 'None'
Tony Lee5a200142020-02-11 13:33:05 +0800121 END
122
Tony Lee4b7fd152020-02-24 14:10:33 +0800123 Valid Value lan_config['IP Address Source'] ['${ip_address_source}']
Sushma M M08adaa02020-01-23 03:25:19 -0600124
125
Naman Navin Hegde9e8c0d82019-08-11 15:22:44 -0500126*** Keywords ***
127
Rahul Maheshwaria7c39032019-09-18 02:15:01 -0500128Get Physical Network Interface Count
129 [Documentation] Return valid physical network interfaces count.
130 # Example:
131 # link/ether 22:3a:7f:70:92:cb brd ff:ff:ff:ff:ff:ff
132 # link/ether 0e:8e:0d:6b:e9:e4 brd ff:ff:ff:ff:ff:ff
133
134 ${mac_entry_list}= Get BMC MAC Address List
135 ${mac_unique_list}= Remove Duplicates ${mac_entry_list}
136 ${physical_interface_count}= Get Length ${mac_unique_list}
137
138 [Return] ${physical_interface_count}
139
140
Naman Navin Hegde9e8c0d82019-08-11 15:22:44 -0500141Set IPMI Inband Network Configuration
142 [Documentation] Run sequence of standard IPMI command in-band and set
143 ... the IP configuration.
144 [Arguments] ${ip} ${netmask} ${gateway} ${login}=${1}
145
146 # Description of argument(s):
147 # ip The IP address to be set using ipmitool-inband.
148 # netmask The Netmask to be set using ipmitool-inband.
149 # gateway The Gateway address to be set using ipmitool-inband.
150
151 Run Inband IPMI Standard Command
Tony Leec762a7a2019-12-30 17:12:50 +0800152 ... lan set ${CHANNEL_NUMBER} ipsrc static login_host=${login}
Naman Navin Hegde9e8c0d82019-08-11 15:22:44 -0500153 Run Inband IPMI Standard Command
Tony Leec762a7a2019-12-30 17:12:50 +0800154 ... lan set ${CHANNEL_NUMBER} ipaddr ${ip} login_host=${0}
Naman Navin Hegde9e8c0d82019-08-11 15:22:44 -0500155 Run Inband IPMI Standard Command
Tony Leec762a7a2019-12-30 17:12:50 +0800156 ... lan set ${CHANNEL_NUMBER} netmask ${netmask} login_host=${0}
Naman Navin Hegde9e8c0d82019-08-11 15:22:44 -0500157 Run Inband IPMI Standard Command
Tony Leec762a7a2019-12-30 17:12:50 +0800158 ... lan set ${CHANNEL_NUMBER} defgw ipaddr ${gateway} login_host=${0}
Naman Navin Hegde9e8c0d82019-08-11 15:22:44 -0500159
160
161Restore Configuration
162 [Documentation] Restore the configuration to its pre-test state
Naman Navin Hegde9e8c0d82019-08-11 15:22:44 -0500163 ${length}= Get Length ${initial_lan_config}
164 Return From Keyword If ${length} == ${0}
165
166 Set IPMI Inband Network Configuration ${initial_lan_config['IP Address']}
167 ... ${initial_lan_config['Subnet Mask']}
168 ... ${initial_lan_config['Default Gateway IP']} login=${0}
Rahul Maheshwaridf04d922019-07-30 12:15:36 -0500169
Tony Leeea741302019-11-08 11:01:58 +0800170
171Verify Channel Info
172 [Documentation] Verify the channel info.
173 [Arguments] ${channel_number} ${network_parameter} ${active_channel_config}
174
175 Run Keyword If '${network_parameter}' == 'IPv4StaticAddresses'
176 ... Verify IPv4 Static Address ${channel_number} ${active_channel_config}
177 ... ELSE IF '${network_parameter}' == 'MACAddress'
178 ... Verify MAC Address ${channel_number} ${active_channel_config}
179
180
181Verify IPv4 Static Address
182 [Documentation] Verify the IPv4 Static Address.
183 [Arguments] ${channel_number} ${active_channel_config}
184
185 ${lan_print_ipmi}= Get LAN Print Dict ${channel_number}
186 ${ipv4_static_addresses}= Redfish.Get Attribute
187 ... ${REDFISH_NW_ETH_IFACE}${active_channel_config['${channel_number}']['name']} IPv4StaticAddresses
188 ${redfish_ips}= Nested Get Address ${ipv4_static_addresses}
189 Rprint Vars lan_print_ipmi ipv4_static_addresses redfish_ips
190 Valid Value lan_print_ipmi['IP Address'] ${redfish_ips}
191
192
193Verify MAC Address
194 [Documentation] Verify the MAC Address.
195 [Arguments] ${channel_number} ${active_channel_config}
196
197 ${lan_print_ipmi}= Get LAN Print Dict ${channel_number}
198 ${redfish_mac_address}= Redfish.Get Attribute
199 ... ${REDFISH_NW_ETH_IFACE}${active_channel_config['${channel_number}']['name']} MACAddress
200 Rprint Vars lan_print_ipmi redfish_mac_address
201 Valid Value lan_print_ipmi['MAC Address'] ['${redfish_mac_address}']