blob: 5a1aaf62f5b0ddc6e73f25e04c01321ccf587549 [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.
105
106 ${ipmi_output}= Run IPMI Command
107 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x00 0x00 0x00
108
109 ${ipmi_output}= Split String ${ipmi_output}
110 ${set_in_progress_value}= Set Variable ${ipmi_output[1]}
111
112 # 00b = set complete.
113 # 01b = set in progress.
114 Should Contain Any ${set_in_progress_value} 00 01
115
116
117Verify Cipher Suite Entry Count
118 [Documentation] Verify cipher suite entry count which belongs to LAN Configuration Parameters
119 ... via IPMI raw Command.
120
121 ${ipmi_output}= Run IPMI Command
122 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x16 0x00 0x00
123 ${cipher_suite_entry_count}= Split String ${ipmi_output}
124
125 # Convert minor cipher suite entry count from BCD format to integer. i.e. 01 to 1.
126 ${cipher_suite_entry_count[1]}= Convert To Integer ${cipher_suite_entry_count[1]}
127 ${cnt}= Get length ${valid_ciphers}
128
129 Should be Equal ${cipher_suite_entry_count[1]} ${cnt}
130
131
132Verify Authentication Type Support
133 [Documentation] Verify authentication type support which belongs to LAN Configuration Parameters
134 ... via IPMI raw Command.
135
136 ${ipmi_output}= Run IPMI Command
137 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x01 0x00 0x00
138
139 ${authentication_type_support}= Split String ${ipmi_output}
140 # All bits:
141 # 1b = supported
142 # 0b = authentication type not available for use
143 # [5] - OEM proprietary (per OEM identified by the IANA OEM ID in the RMCP Ping Response)
144 # [4] - straight password / key
145 # [3] - reserved
146 # [2] - MD5
147 # [1] - MD2
148 # [0] - none
149 Should Contain Any ${authentication_type_support[1]} 00 01 02 03 04 05
150
151
George Keishing364e93d2020-03-05 04:31:49 -0600152*** Keywords ***
153
154Get Physical Network Interface Count
155 [Documentation] Return valid physical network interfaces count.
156 # Example:
157 # link/ether 22:3a:7f:70:92:cb brd ff:ff:ff:ff:ff:ff
158 # link/ether 0e:8e:0d:6b:e9:e4 brd ff:ff:ff:ff:ff:ff
159
160 ${mac_entry_list}= Get BMC MAC Address List
161 ${mac_unique_list}= Remove Duplicates ${mac_entry_list}
162 ${physical_interface_count}= Get Length ${mac_unique_list}
163
164 [Return] ${physical_interface_count}
165
166
167Verify Channel Info
168 [Documentation] Verify the channel info.
169 [Arguments] ${channel_number} ${network_parameter} ${active_channel_config}
170
171 Run Keyword If '${network_parameter}' == 'IPv4StaticAddresses'
172 ... Verify IPv4 Static Address ${channel_number} ${active_channel_config}
173 ... ELSE IF '${network_parameter}' == 'MACAddress'
174 ... Verify MAC Address ${channel_number} ${active_channel_config}
175
176
177Verify IPv4 Static Address
178 [Documentation] Verify the IPv4 Static Address.
179 [Arguments] ${channel_number} ${active_channel_config}
180
181 ${lan_print_ipmi}= Get LAN Print Dict ${channel_number}
182 ${ipv4_static_addresses}= Redfish.Get Attribute
183 ... ${REDFISH_NW_ETH_IFACE}${active_channel_config['${channel_number}']['name']} IPv4StaticAddresses
184 ${redfish_ips}= Nested Get Address ${ipv4_static_addresses}
185 Rprint Vars lan_print_ipmi ipv4_static_addresses redfish_ips
186 Valid Value lan_print_ipmi['IP Address'] ${redfish_ips}
187
188
189Verify MAC Address
190 [Documentation] Verify the MAC Address.
191 [Arguments] ${channel_number} ${active_channel_config}
192
193 ${lan_print_ipmi}= Get LAN Print Dict ${channel_number}
194 ${redfish_mac_address}= Redfish.Get Attribute
195 ... ${REDFISH_NW_ETH_IFACE}${active_channel_config['${channel_number}']['name']} MACAddress
196 Rprint Vars lan_print_ipmi redfish_mac_address
197 Valid Value lan_print_ipmi['MAC Address'] ['${redfish_mac_address}']