blob: 0285d50117fa15cea2d561264bd4ea6d276793b9 [file] [log] [blame]
George Keishing364e93d2020-03-05 04:31:49 -06001*** Settings ***
2
3Documentation Module to test IPMI network functionality.
4Resource ../lib/ipmi_client.robot
5Resource ../lib/openbmc_ffdc.robot
6Resource ../lib/bmc_network_utils.robot
7Library ../lib/ipmi_utils.py
8Library ../lib/gen_robot_valid.py
9Library ../lib/var_funcs.py
10Library ../lib/bmc_network_utils.py
Tony Leec03c8e22020-03-25 13:41:07 +080011Variables ../data/ipmi_raw_cmd_table.py
George Keishing364e93d2020-03-05 04:31:49 -060012
13Suite Setup Redfish.Login
14Test Setup Printn
15Test Teardown FFDC On Test Case Fail
16
17Force Tags IPMI_Network_Verify
18
19*** Test Cases ***
20
21Retrieve 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 ${active_channel_config}= Get Active Channel Config
26 FOR ${channel_number} IN @{active_channel_config.keys()}
27 Verify Channel Info ${channel_number} IPv4StaticAddresses ${active_channel_config}
28 END
29
30Retrieve Default Gateway Via IPMI And Verify
31 [Documentation] Retrieve default gateway via IPMI and verify it's existence on the BMC.
32 [Tags] Retrieve_Default_Gateway_Via_IPMI_And_Verify
33
34 ${lan_print_ipmi}= Get LAN Print Dict
35
36 Verify Gateway On BMC ${lan_print_ipmi['Default Gateway IP']}
37
38
39Retrieve MAC Address Via IPMI And Verify Using Redfish
40 [Documentation] Retrieve MAC address via IPMI and verify using Redfish.
41 [Tags] Retrieve_MAC_Address_Via_IPMI_And_Verify_Using_Redfish
42
43 ${active_channel_config}= Get Active Channel Config
44 FOR ${channel_number} IN @{active_channel_config.keys()}
45 Verify Channel Info ${channel_number} MACAddress ${active_channel_config}
46 END
47
48
49Test Valid IPMI Channels Supported
50 [Documentation] Verify IPMI channels supported on a given system.
51 [Tags] Test_Valid_IPMI_Channels_Supported
52
53 ${channel_count}= Get Physical Network Interface Count
54
55 # Note: IPMI network channel logically starts from 1.
56 FOR ${channel_number} IN RANGE 1 ${channel_count}
57 Run IPMI Standard Command lan print ${channel_number}
58 END
59
60
61Test Invalid IPMI Channel Response
62 [Documentation] Verify invalid IPMI channels supported response.
63 [Tags] Test_Invalid_IPMI_Channel_Response
64
65 ${channel_count}= Get Physical Network Interface Count
66
67 # To target invalid channel, increment count.
68 ${channel_number}= Evaluate ${channel_count} + 1
69
70 # Example of invalid channel:
71 # $ ipmitool -I lanplus -H xx.xx.xx.xx -P password lan print 3
72 # Get Channel Info command failed: Parameter out of range
73 # Invalid channel: 3
74
75 ${stdout}= Run External IPMI Standard Command
76 ... lan print ${channel_number} fail_on_err=${0}
77 Should Contain ${stdout} Invalid channel
78 ... msg=IPMI channel ${channel_number} is invalid but seen working.
79
80
81Get IP Address Source And Verify Using Redfish
82 [Documentation] Get IP address source and verify it using Redfish.
83 [Tags] Get_IP_Address_Source_And_Verify_Using_Redfish
84
85 ${active_channel_config}= Get Active Channel Config
86 ${lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER}
87
88 ${ipv4_addresses}= Redfish.Get Attribute
89 ... /redfish/v1/Managers/bmc/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
90 ... IPv4Addresses
91
92 FOR ${ipv4_address} IN @{ipv4_addresses}
93 ${ip_address_source}=
94 ... Set Variable if '${ipv4_address['Address']}' == '${lan_config['IP Address']}'
95 ... ${ipv4_address['AddressOrigin']} Address
96 Exit For Loop IF "${ip_address_source}" != 'None'
97 END
98
99 Valid Value lan_config['IP Address Source'] ['${ip_address_source}']
100
101
Tony Leec03c8e22020-03-25 13:41:07 +0800102Verify Get Set In Progress
103 [Documentation] Verify Get Set In Progress which belongs to LAN Configuration Parameters
104 ... via IPMI raw Command.
Tony Lee5e735522020-05-13 20:23:38 +0800105 [Tags] Verify_Get_Set_In_Progress
Tony Leec03c8e22020-03-25 13:41:07 +0800106
107 ${ipmi_output}= Run IPMI Command
108 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x00 0x00 0x00
109
110 ${ipmi_output}= Split String ${ipmi_output}
111 ${set_in_progress_value}= Set Variable ${ipmi_output[1]}
112
113 # 00b = set complete.
114 # 01b = set in progress.
115 Should Contain Any ${set_in_progress_value} 00 01
116
117
118Verify Cipher Suite Entry Count
119 [Documentation] Verify cipher suite entry count which belongs to LAN Configuration Parameters
120 ... via IPMI raw Command.
Tony Lee5e735522020-05-13 20:23:38 +0800121 [Tags] Verify_Cipher_Suite_Entry_Count
Tony Leec03c8e22020-03-25 13:41:07 +0800122
123 ${ipmi_output}= Run IPMI Command
124 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x16 0x00 0x00
125 ${cipher_suite_entry_count}= Split String ${ipmi_output}
126
127 # Convert minor cipher suite entry count from BCD format to integer. i.e. 01 to 1.
128 ${cipher_suite_entry_count[1]}= Convert To Integer ${cipher_suite_entry_count[1]}
129 ${cnt}= Get length ${valid_ciphers}
130
131 Should be Equal ${cipher_suite_entry_count[1]} ${cnt}
132
133
134Verify Authentication Type Support
135 [Documentation] Verify authentication type support which belongs to LAN Configuration Parameters
136 ... via IPMI raw Command.
Tony Lee5e735522020-05-13 20:23:38 +0800137 [Tags] Verify_Authentication_Type_Support
Tony Leec03c8e22020-03-25 13:41:07 +0800138
139 ${ipmi_output}= Run IPMI Command
140 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x01 0x00 0x00
141
142 ${authentication_type_support}= Split String ${ipmi_output}
143 # All bits:
144 # 1b = supported
145 # 0b = authentication type not available for use
146 # [5] - OEM proprietary (per OEM identified by the IANA OEM ID in the RMCP Ping Response)
147 # [4] - straight password / key
148 # [3] - reserved
149 # [2] - MD5
150 # [1] - MD2
151 # [0] - none
152 Should Contain Any ${authentication_type_support[1]} 00 01 02 03 04 05
153
154
George Keishing364e93d2020-03-05 04:31:49 -0600155*** Keywords ***
156
157Get Physical Network Interface Count
158 [Documentation] Return valid physical network interfaces count.
159 # Example:
160 # link/ether 22:3a:7f:70:92:cb brd ff:ff:ff:ff:ff:ff
161 # link/ether 0e:8e:0d:6b:e9:e4 brd ff:ff:ff:ff:ff:ff
162
163 ${mac_entry_list}= Get BMC MAC Address List
164 ${mac_unique_list}= Remove Duplicates ${mac_entry_list}
165 ${physical_interface_count}= Get Length ${mac_unique_list}
166
167 [Return] ${physical_interface_count}
168
169
170Verify Channel Info
171 [Documentation] Verify the channel info.
172 [Arguments] ${channel_number} ${network_parameter} ${active_channel_config}
173
174 Run Keyword If '${network_parameter}' == 'IPv4StaticAddresses'
175 ... Verify IPv4 Static Address ${channel_number} ${active_channel_config}
176 ... ELSE IF '${network_parameter}' == 'MACAddress'
177 ... Verify MAC Address ${channel_number} ${active_channel_config}
178
179
180Verify IPv4 Static Address
181 [Documentation] Verify the IPv4 Static Address.
182 [Arguments] ${channel_number} ${active_channel_config}
183
184 ${lan_print_ipmi}= Get LAN Print Dict ${channel_number}
185 ${ipv4_static_addresses}= Redfish.Get Attribute
186 ... ${REDFISH_NW_ETH_IFACE}${active_channel_config['${channel_number}']['name']} IPv4StaticAddresses
187 ${redfish_ips}= Nested Get Address ${ipv4_static_addresses}
188 Rprint Vars lan_print_ipmi ipv4_static_addresses redfish_ips
189 Valid Value lan_print_ipmi['IP Address'] ${redfish_ips}
190
191
192Verify MAC Address
193 [Documentation] Verify the MAC Address.
194 [Arguments] ${channel_number} ${active_channel_config}
195
196 ${lan_print_ipmi}= Get LAN Print Dict ${channel_number}
197 ${redfish_mac_address}= Redfish.Get Attribute
198 ... ${REDFISH_NW_ETH_IFACE}${active_channel_config['${channel_number}']['name']} MACAddress
199 Rprint Vars lan_print_ipmi redfish_mac_address
200 Valid Value lan_print_ipmi['MAC Address'] ['${redfish_mac_address}']