blob: 91ec890cabebd284fb0b801ca0f332e18bc90045 [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
George Keishing24da2652021-12-21 22:33:01 -060054 Should Be True ${channel_count} > 0
55 ... msg=IPMI Lan channel support expected > 0 but found ${channel_count}
56 ${channel_count}= Evaluate ${channel_count} + 1
George Keishing364e93d2020-03-05 04:31:49 -060057
58 # Note: IPMI network channel logically starts from 1.
59 FOR ${channel_number} IN RANGE 1 ${channel_count}
60 Run IPMI Standard Command lan print ${channel_number}
61 END
62
63
64Test Invalid IPMI Channel Response
65 [Documentation] Verify invalid IPMI channels supported response.
66 [Tags] Test_Invalid_IPMI_Channel_Response
67
68 ${channel_count}= Get Physical Network Interface Count
69
70 # To target invalid channel, increment count.
71 ${channel_number}= Evaluate ${channel_count} + 1
72
73 # Example of invalid channel:
74 # $ ipmitool -I lanplus -H xx.xx.xx.xx -P password lan print 3
75 # Get Channel Info command failed: Parameter out of range
76 # Invalid channel: 3
77
78 ${stdout}= Run External IPMI Standard Command
79 ... lan print ${channel_number} fail_on_err=${0}
80 Should Contain ${stdout} Invalid channel
81 ... msg=IPMI channel ${channel_number} is invalid but seen working.
82
83
84Get IP Address Source And Verify Using Redfish
85 [Documentation] Get IP address source and verify it using Redfish.
86 [Tags] Get_IP_Address_Source_And_Verify_Using_Redfish
87
88 ${active_channel_config}= Get Active Channel Config
89 ${lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER}
90
91 ${ipv4_addresses}= Redfish.Get Attribute
92 ... /redfish/v1/Managers/bmc/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
93 ... IPv4Addresses
94
95 FOR ${ipv4_address} IN @{ipv4_addresses}
96 ${ip_address_source}=
97 ... Set Variable if '${ipv4_address['Address']}' == '${lan_config['IP Address']}'
98 ... ${ipv4_address['AddressOrigin']} Address
99 Exit For Loop IF "${ip_address_source}" != 'None'
100 END
101
102 Valid Value lan_config['IP Address Source'] ['${ip_address_source}']
103
104
Tony Leec03c8e22020-03-25 13:41:07 +0800105Verify Get Set In Progress
106 [Documentation] Verify Get Set In Progress which belongs to LAN Configuration Parameters
107 ... via IPMI raw Command.
Tony Lee5e735522020-05-13 20:23:38 +0800108 [Tags] Verify_Get_Set_In_Progress
Tony Leec03c8e22020-03-25 13:41:07 +0800109
110 ${ipmi_output}= Run IPMI Command
111 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x00 0x00 0x00
112
113 ${ipmi_output}= Split String ${ipmi_output}
114 ${set_in_progress_value}= Set Variable ${ipmi_output[1]}
115
116 # 00b = set complete.
117 # 01b = set in progress.
118 Should Contain Any ${set_in_progress_value} 00 01
119
120
121Verify Cipher Suite Entry Count
122 [Documentation] Verify cipher suite entry count which belongs to LAN Configuration Parameters
123 ... via IPMI raw Command.
Tony Lee5e735522020-05-13 20:23:38 +0800124 [Tags] Verify_Cipher_Suite_Entry_Count
Tony Leec03c8e22020-03-25 13:41:07 +0800125
126 ${ipmi_output}= Run IPMI Command
127 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x16 0x00 0x00
128 ${cipher_suite_entry_count}= Split String ${ipmi_output}
129
130 # Convert minor cipher suite entry count from BCD format to integer. i.e. 01 to 1.
131 ${cipher_suite_entry_count[1]}= Convert To Integer ${cipher_suite_entry_count[1]}
132 ${cnt}= Get length ${valid_ciphers}
133
134 Should be Equal ${cipher_suite_entry_count[1]} ${cnt}
135
136
137Verify Authentication Type Support
138 [Documentation] Verify authentication type support which belongs to LAN Configuration Parameters
139 ... via IPMI raw Command.
Tony Lee5e735522020-05-13 20:23:38 +0800140 [Tags] Verify_Authentication_Type_Support
Tony Leec03c8e22020-03-25 13:41:07 +0800141
142 ${ipmi_output}= Run IPMI Command
143 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x01 0x00 0x00
144
145 ${authentication_type_support}= Split String ${ipmi_output}
146 # All bits:
147 # 1b = supported
148 # 0b = authentication type not available for use
149 # [5] - OEM proprietary (per OEM identified by the IANA OEM ID in the RMCP Ping Response)
150 # [4] - straight password / key
151 # [3] - reserved
152 # [2] - MD5
153 # [1] - MD2
154 # [0] - none
155 Should Contain Any ${authentication_type_support[1]} 00 01 02 03 04 05
156
157
George Keishing364e93d2020-03-05 04:31:49 -0600158*** Keywords ***
159
160Get Physical Network Interface Count
161 [Documentation] Return valid physical network interfaces count.
162 # Example:
163 # link/ether 22:3a:7f:70:92:cb brd ff:ff:ff:ff:ff:ff
164 # link/ether 0e:8e:0d:6b:e9:e4 brd ff:ff:ff:ff:ff:ff
165
166 ${mac_entry_list}= Get BMC MAC Address List
167 ${mac_unique_list}= Remove Duplicates ${mac_entry_list}
168 ${physical_interface_count}= Get Length ${mac_unique_list}
169
170 [Return] ${physical_interface_count}
171
172
173Verify Channel Info
174 [Documentation] Verify the channel info.
175 [Arguments] ${channel_number} ${network_parameter} ${active_channel_config}
176
177 Run Keyword If '${network_parameter}' == 'IPv4StaticAddresses'
178 ... Verify IPv4 Static Address ${channel_number} ${active_channel_config}
179 ... ELSE IF '${network_parameter}' == 'MACAddress'
180 ... Verify MAC Address ${channel_number} ${active_channel_config}
181
182
183Verify IPv4 Static Address
184 [Documentation] Verify the IPv4 Static Address.
185 [Arguments] ${channel_number} ${active_channel_config}
186
187 ${lan_print_ipmi}= Get LAN Print Dict ${channel_number}
188 ${ipv4_static_addresses}= Redfish.Get Attribute
189 ... ${REDFISH_NW_ETH_IFACE}${active_channel_config['${channel_number}']['name']} IPv4StaticAddresses
190 ${redfish_ips}= Nested Get Address ${ipv4_static_addresses}
191 Rprint Vars lan_print_ipmi ipv4_static_addresses redfish_ips
192 Valid Value lan_print_ipmi['IP Address'] ${redfish_ips}
193
194
195Verify MAC Address
196 [Documentation] Verify the MAC Address.
197 [Arguments] ${channel_number} ${active_channel_config}
198
199 ${lan_print_ipmi}= Get LAN Print Dict ${channel_number}
200 ${redfish_mac_address}= Redfish.Get Attribute
201 ... ${REDFISH_NW_ETH_IFACE}${active_channel_config['${channel_number}']['name']} MACAddress
202 Rprint Vars lan_print_ipmi redfish_mac_address
203 Valid Value lan_print_ipmi['MAC Address'] ['${redfish_mac_address}']