blob: e6cb1cc3faeccf0ad12d71f823bd55bb41f633d9 [file] [log] [blame]
Rahul Maheshwarid4d43fc2019-06-24 00:54:19 -05001*** Settings ***
2Documentation Module to test IPMI chipher functionality.
Sridevi Ramesh934d3b02025-04-25 04:59:43 -05003
Rahul Maheshwarid4d43fc2019-06-24 00:54:19 -05004Resource ../lib/ipmi_client.robot
5Resource ../lib/openbmc_ffdc.robot
nagarjunb227fabf792022-04-19 11:09:29 +05306Resource ../lib/bmc_network_utils.robot
Rahul Maheshwarid4d43fc2019-06-24 00:54:19 -05007Library ../lib/ipmi_utils.py
George Keishing45511e82019-10-15 01:26:55 -05008Library ../lib/var_funcs.py
Rahul Maheshwarid4d43fc2019-06-24 00:54:19 -05009Variables ../data/ipmi_raw_cmd_table.py
George Keishing45511e82019-10-15 01:26:55 -050010Library String
Rahul Maheshwarid4d43fc2019-06-24 00:54:19 -050011
nagarjunb227fabf792022-04-19 11:09:29 +053012
13Suite Setup IPMI Cipher Suite Setup
George Keishing45511e82019-10-15 01:26:55 -050014Test Setup Printn
Rahul Maheshwarid4d43fc2019-06-24 00:54:19 -050015Test Teardown FFDC On Test Case Fail
16
Matt Fischer6fb70d92023-10-24 19:06:33 -060017Test Tags IPMI_Cipher
nagarjunb227fabf792022-04-19 11:09:29 +053018
19*** Variables ***
20${cipher_suite} standard
21&{payload_type} ipmi=0 sol=1
22@{list_index_value} 0x80 0x00
23
24
Rahul Maheshwarid4d43fc2019-06-24 00:54:19 -050025*** Test Cases ***
26
George Keishing45511e82019-10-15 01:26:55 -050027Verify Supported Ciphers
28 [Documentation] Execute all supported ciphers and verify.
29 [Tags] Verify_Supported_Ciphers
30 FOR ${cipher} IN @{valid_ciphers}
31 Run External IPMI Standard Command power status C=${cipher}
32 END
Rahul Maheshwarid4d43fc2019-06-24 00:54:19 -050033
34
George Keishing45511e82019-10-15 01:26:55 -050035Verify Unsupported Ciphers
36 [Documentation] Execute all unsupported ciphers and verify error.
37 [Tags] Verify_Unsupported_Ciphers
38 FOR ${cipher} IN @{unsupported_ciphers}
39 Run Keyword And Expect Error *invalid * algorithm*
40 ... Run External IPMI Standard Command power status C=${cipher}
41 END
Rahul Maheshwarid4d43fc2019-06-24 00:54:19 -050042
43
George Keishing45511e82019-10-15 01:26:55 -050044Verify Supported Ciphers Via Lan Print
45 [Documentation] Verify supported ciphers via IPMI lan print command.
46 [Tags] Verify_Supported_Ciphers_Via_Lan_Print
47
48 ${lan_print}= Get Lan Print Dict
Rahul Maheshwarid4d43fc2019-06-24 00:54:19 -050049 # Example 'RMCP+ Cipher Suites' entry: 3,17
George Keishing45511e82019-10-15 01:26:55 -050050 ${ciphers}= Split String ${lan_print['RMCP+ Cipher Suites']} ,
51 Rprint Vars ciphers
52 Valid List ciphers valid_values=${valid_ciphers}
Rahul Maheshwarid4d43fc2019-06-24 00:54:19 -050053
54
55Verify Supported Cipher Via Getciphers
George Keishing13b7afd2022-05-23 07:36:16 -050056 [Documentation] Verify supported cihpers via IPMI getciphers command.
Rahul Maheshwarid4d43fc2019-06-24 00:54:19 -050057 [Tags] Verify_Supported_Cipher_Via_Getciphers
Rahul Maheshwarid4d43fc2019-06-24 00:54:19 -050058
George Keishing45511e82019-10-15 01:26:55 -050059 # Example output from 'Channel Getciphers IPMI':
60 # ipmi_channel_ciphers:
61 # [0]:
62 # [id]: 3
63 # [iana]: N/A
64 # [auth_alg]: hmac_sha1
65 # [integrity_alg]: hmac_sha1_96
66 # [confidentiality_alg]: aes_cbc_128
67 # [1]:
68 # [id]: 17
69 # [iana]: N/A
70 # [auth_alg]: hmac_sha256
71 # [integrity_alg]: sha256_128
72 # [confidentiality_alg]: aes_cbc_128
Rahul Maheshwarid4d43fc2019-06-24 00:54:19 -050073
George Keishing45511e82019-10-15 01:26:55 -050074 ${ipmi_channel_ciphers}= Channel Getciphers IPMI
75 # Example cipher entry: 3 17
76 Rprint Vars ipmi_channel_ciphers
77 ${ipmi_channel_cipher_ids}= Nested Get id ${ipmi_channel_ciphers}
78 Rpvars ipmi_channel_cipher_ids
79 Valid List ipmi_channel_cipher_ids valid_values=${valid_ciphers}
nagarjunb227fabf792022-04-19 11:09:29 +053080
81
82Verify Cipher Suite And Supported Algorithms Via IPMI Raw Command
Sridevi Ramesh934d3b02025-04-25 04:59:43 -050083 [Documentation] Verify cipher ID and Supported Algorithms for all Available
84 ... Channels.
nagarjunb227fabf792022-04-19 11:09:29 +053085 [Tags] Verify_Cipher_Suite_And_Supported_Algorithms_Via_IPMI_Raw_Command
86 [Template] Verify Cipher ID and Supported Algorithm For Channel
87
88 FOR ${channel} IN @{active_channel_list}
89 FOR ${name} ${type} IN &{payload_type}
90 FOR ${index_value} IN @{list_index_value}
91 # Input Channel Payload type Index value 0x80 or 0x00
92 ${channel} ${type} ${index_value}
93 END
94 END
95 END
96
97
98Verify Get Cipher Suite Command For Invalid Channels
99 [Documentation] Verify Get Cipher Suite Command For all Invalid Channels.
100 [Tags] Verify_Get_Cipher_Suite_Command_For_Invalid_Channels
101 [Template] Verify Cipher Suite For Invalid Channel
102
103 FOR ${channel} IN @{inactive_channel_list}
104 # Input Channel
105 ${channel}
106 END
107
108
109Verify Get Cipher Suite Raw Command With Invalid Data Length
110 [Documentation] Verify Get Cipher Suite Raw Command With One Extra and Less Byte.
111 [Tags] Verify_Get_Cipher_Suite_Raw_Command_With_Invalid_Data_Length
112 [Template] Verify Cipher Suite Command for Invalid Request Data
113
114 # Byte
115 less
116 extra
117
118
119*** Keywords ***
120
121IPMI Cipher Suite Setup
122 [Documentation] Get active and inactive/invalid channels from channel_config.json file
123 ... in list type and set it as suite variable.
124
125 # Get active channel list and set as a suite variable.
126 @{active_channel_list}= Get Active Ethernet Channel List current_channel=1
127 Set Suite Variable @{active_channel_list}
128
129 # Get Inactive/Invalid channel list and set as a suite variable.
130 @{inactive_channel_list}= Get Invalid Channel Number List
131 Set Suite Variable @{inactive_channel_list}
132
133Verify Standard Cipher Suite For Channel
134 [Documentation] Get the supported algorithms from data/ipmi_raw_cmd_table.py and
135 ... split into list and compare it with the given data list.
136 [Arguments] ${data_list} ${channel_number}
137
138 # Description of argument(s):
Sridevi Ramesh934d3b02025-04-25 04:59:43 -0500139 # data_list cipher suite records in list
140 # e.g [01, c0, 11, 03, 44, 81]
141 # channel_number Interface channel number
nagarjunb227fabf792022-04-19 11:09:29 +0530142
143 ${supported_algorithms}= Split String ${IPMI_RAW_CMD['Cipher Suite']['get'][1]}
144 ${cipher_suite_id}= Convert To Integer ${data_list}[2] base=16
145
146 Should Be Equal ${data_list}[0] ${channel_number}
147 Should Be Equal ${data_list}[1] c0
148 Should Be Equal As Integers ${cipher_suite_id} ${valid_ciphers}[0]
149 List Should Contain Value ${supported_algorithms} ${data_list}[3]
150 List Should Contain Value ${supported_algorithms} ${data_list}[4]
151 List Should Contain Value ${supported_algorithms} ${data_list}[5]
152
153Verify Algorithm by Cipher Suite For Channel
154 [Documentation] Spilt the given response data, store it in a list.
155 [Arguments] ${response_data} ${channel_number}
156
157 # Description of argument(s):
Sridevi Ramesh934d3b02025-04-25 04:59:43 -0500158 # response_data Response data of get channel cipher suite IPMI raw command
nagarjunb227fabf792022-04-19 11:09:29 +0530159 # e.g 01 c0 11 03 44 81 ---> list of algorithms by cipher suite (0x80 in request data 3rd byte)
Sridevi Ramesh934d3b02025-04-25 04:59:43 -0500160 # channel_number Interface channel number
nagarjunb227fabf792022-04-19 11:09:29 +0530161
162 @{expected_data_list}= Split String ${response_data}
163
164 Run Keyword If '${cipher_suite}' == 'standard'
165 ... Verify Standard Cipher Suite For Channel ${expected_data_list} ${channel_number}
166
167Verify Supported Algorithm For Channel
168 [Documentation] Compare the supported algorithms got from ipmi_raw_cmd_table with
George Keishing13b7afd2022-05-23 07:36:16 -0500169 ... given response.
nagarjunb227fabf792022-04-19 11:09:29 +0530170 [Arguments] ${response_data} ${channel_number}
171
172 # Description of argument(s):
Sridevi Ramesh934d3b02025-04-25 04:59:43 -0500173 # response_data response data of get channel cipher suite IPMI raw command.
nagarjunb227fabf792022-04-19 11:09:29 +0530174 # channel_number Interface Channel Number.
175
176 # expected data will be like " 01 03 44 81 ".
177 ${expected_data}= Catenate ${channel_number} ${IPMI_RAW_CMD['Cipher Suite']['get'][1]}
178
179 Should Be Equal ${expected_data} ${response_data}
180
181Verify Cipher ID and Supported Algorithm For Channel
182 [Documentation] Verify Cipher ID and Supported Algorithm on given channel.
183 [Arguments] ${channel_num} ${payload_type} ${index_value}
184
185 # Description of argument(s):
Sridevi Ramesh934d3b02025-04-25 04:59:43 -0500186 # channel_num Interface channel number.
187 # payload_type IPMI(0x00) or SOL(0x01).
nagarjunb227fabf792022-04-19 11:09:29 +0530188 # index_value 0x80 for list algorithm by cipher suite.
189 # 0x00 for supported algorithms.
190
191 ${cmd}= Catenate ${IPMI_RAW_CMD['Cipher Suite']['get'][0]}
192 ... ${channel_num} ${payload_type} ${index_value}
193
ishwaryamathim372cd862023-11-14 18:12:23 +0000194 ${resp}= Run IPMI Command ${cmd}
nagarjunb227fabf792022-04-19 11:09:29 +0530195 ${resp}= Strip String ${resp}
196
197 # channel 14 represents current channel in which we send request.
198 ${channel_num}= Run Keyword If '${channel_num}' == '14'
199 ... Convert To Hex ${CHANNEL_NUMBER} length=2
200 ... ELSE
201 ... Convert To Hex ${channel_num} length=2
202
203 Run Keyword If '${index_value}' == '0x80'
204 ... Verify Algorithm by Cipher Suite For Channel ${resp} ${channel_num}
205 ... ELSE
206 ... Verify Supported Algorithm For Channel ${resp} ${channel_num}
207
208Verify Cipher Suite For Invalid Channel
209 [Documentation] Execute cipher suite ipmi cmd for invalid channel and verify Error code.
210 [Arguments] ${channel_number}
211
212 # Description of argument(s):
213 # channel_number Interface channel number.
214
215 ${cmd}= Catenate ${IPMI_RAW_CMD['Cipher Suite']['get'][0]} ${channel_number} 00 00
216
217 Verify Invalid IPMI Command ${cmd} 0xcc
218
219Verify Cipher Suite Command for Invalid Request Data
220 [Documentation] Verify Cipher Suite Command with Invalid data Length.
221 [Arguments] ${byte_length}
222
223 # Description of argument(s):
224 # byte_length extra or less.
225
226 ${req_cmd}= Run Keyword If '${byte_length}' == 'less'
227 ... Catenate ${IPMI_RAW_CMD['Cipher Suite']['get'][0]} ${CHANNEL_NUMBER} 00
228 ... ELSE
229 ... Catenate ${IPMI_RAW_CMD['Cipher Suite']['get'][0]} ${CHANNEL_NUMBER} 00 00 01
230
231 Verify Invalid IPMI Command ${req_cmd} 0xc7