blob: d82f7859aad575c5ef7dd60ea9f968fd399e99b7 [file] [log] [blame]
chithrag8a17c492022-03-01 12:53:44 +00001*** Settings ***
2Documentation This suite tests IPMI Payload in OpenBMC.
3... This script verifies Get Device ID IPMI command.
4...
5... Response data validated for each and every byte,
6... with respect to expected response.
7...
8... Following data validated in response bytes :
9... Device ID, Device Revision, Firmware Revision 1 & 2,
10... IPMI Version, Manufacture ID, Product ID,
11... Auxiliary Firmware Revision Information
12...
13... Request Data for Get Device ID defined under,
14... - data/ipmi_raw_cmd_table.py
15
16
ganesanbd0c4b802023-04-28 18:29:38 +000017Resource ../lib/ipmi_client.robot
18Resource ../lib/openbmc_ffdc.robot
chithrag8a17c492022-03-01 12:53:44 +000019Library Collections
20Library ../lib/ipmi_utils.py
21Library ../lib/var_funcs.py
chithrag8a17c492022-03-01 12:53:44 +000022Variables ../data/ipmi_raw_cmd_table.py
23
George Keishing87dc4422023-10-20 12:56:30 +053024Force Tags IPMI_Device_ID
chithrag8a17c492022-03-01 12:53:44 +000025
26*** Test Cases ***
27
28Get Device ID Via IPMI
29 [Documentation] Verify Get Device ID using IPMI and check whether a response is received.
30 [Tags] Get_Device_ID_Via_IPMI
31
32 # Verify Get Device ID.
ishwaryamathim372cd862023-11-14 18:12:23 +000033 ${resp}= Run IPMI Command
chithrag8a17c492022-03-01 12:53:44 +000034 ... ${IPMI_RAW_CMD['Device ID']['Get'][0]}
35 Should Not Contain ${resp} ${IPMI_RAW_CMD['Device ID']['Get'][1]}
36
37
38Verify Get Device ID With Invalid Data Request
39 [Documentation] Verify Get Device ID with invalid data request via IPMI.
40 [Tags] Verify_Get_Device_ID_With_Invalid_Data_Request
41
42 # Run IPMI Get Device ID command with invalid request data byte.
43 ${resp}= Run Keyword and Expect Error *Request data length invalid*
ishwaryamathim372cd862023-11-14 18:12:23 +000044 ... Run IPMI Command ${IPMI_RAW_CMD['Device ID']['Get'][0]} 0x00
chithrag8a17c492022-03-01 12:53:44 +000045 # Verify error code in 'rsp='.
46 Should Contain ${resp} ${IPMI_RAW_CMD['Device ID']['Get'][2]}
47
48
49Verify Device ID Response Data Via IPMI
50 [Documentation] Verify Get Device ID response data bytes using IPMI.
51 [Tags] Verify_Device_ID_Response_Data_Via_IPMI
52
53 # Get Device ID IPMI command.
ishwaryamathim372cd862023-11-14 18:12:23 +000054 ${resp}= Run IPMI Command
chithrag8a17c492022-03-01 12:53:44 +000055 ... ${IPMI_RAW_CMD['Device ID']['Get'][0]}
56
57 # Split each and every byte and form list.
58 ${resp}= Split String ${resp}
59
60 # Checking Device ID.
61 Run Keyword And Continue On Failure Should Not Be Equal ${resp[0]} 00
62 ... msg=Device ID cannot be Unspecified
63
64 # Verify Device Revision.
65 ${device_rev}= Set Variable ${resp[1]}
66 ${device_rev}= Convert To Binary ${device_rev} base=16
67 ${device_rev}= Zfill Data ${device_rev} 8
68 # Comparing the reserved bits from Device Revision.
69 Run Keyword And Continue On Failure Should Be Equal As Strings ${device_rev[1:4]} 000
70
71 # Get version details from /etc/os-release.
72 ${os_release}= Get BMC OS Release Details
ganesanbbd187d22023-05-03 11:00:18 +000073 ${version}= Get Bmc Major Minor Version ${os_release['version']}
chithrag8a17c492022-03-01 12:53:44 +000074
75 # Verify Firmware Revision 1.
76 ${firmware_rev1}= Set Variable ${version[0]}
ganesanbbd187d22023-05-03 11:00:18 +000077 ${ipmi_rsp_firmware_rev1}= Convert To Integer ${resp[2]} base=16
78 Run Keyword And Continue On Failure Should Be Equal As Integers
79 ... ${ipmi_rsp_firmware_rev1} ${firmware_rev1}
chithrag8a17c492022-03-01 12:53:44 +000080
81 # Verify Firmware Revision 2.
82 ${firmware_rev2}= Set Variable ${version[1]}
ganesanbbd187d22023-05-03 11:00:18 +000083 ${ipmi_rsp_firmware_rev2}= Convert To Integer ${resp[3]} base=16
84 Run Keyword And Continue On Failure Should Be Equal As Integers
85 ... ${ipmi_rsp_firmware_rev2} ${firmware_rev2}
chithrag8a17c492022-03-01 12:53:44 +000086
87 # Verify IPMI Version.
88 Run Keyword And Continue On Failure Should Be Equal ${resp[4]} 02
89
90 # Verify Manufacture ID.
91 ${manufacture_id}= Set Variable ${resp[6:9]}
92 ${manufacture_id}= Evaluate "".join(${manufacture_id})
93 ${manufacture_data}= Convert To Binary ${manufacture_id} base=16
94 # Manufacure ID has Most significant four bits - reserved (0000b)
95 Run Keyword And Continue On Failure Should Be Equal ${manufacture_data[-5:-1]} 0000
96
97 # Verify Product ID.
98 ${product_id}= Set Variable ${resp[9:11]}
99 ${product_id}= Evaluate "".join(${product_id})
100 Run Keyword And Continue On Failure Should Not Be Equal ${product_id} 0000
101 ... msg=Product ID cannot be Zero
102
chithrag8a17c492022-03-01 12:53:44 +0000103 # Get Auxiliary Firmware Revision Information from IPMI response.
104 ${auxiliary_rev_version}= Set Variable ${resp[11:]}
105 Reverse List ${auxiliary_rev_version}
106 ${auxiliary_rev_version}= Evaluate "".join(${auxiliary_rev_version})
107 ${auxiliary_rev_version}= Convert To Integer ${auxiliary_rev_version} 16
108
109 # Compare both IPMI aux version and dev_id.json aux version.
110 ${dev_id_data}= Get Device Info From BMC
111 ${aux_info}= Get From Dictionary ${dev_id_data} aux
112 Run Keyword And Continue On Failure Should Be Equal ${aux_info} ${auxiliary_rev_version}
113
chithrag8a17c492022-03-01 12:53:44 +0000114
115*** Keywords ***
116
117Get BMC OS Release Details
118 [Documentation] To get the release details from bmc etc/os-release.
119
120 # The BMC OS Release information will be,
121 # for example,
122 # ID=openbmc-phosphor
123 # NAME="ADCD EFG BMC (OpenBMC Project Reference Distro)"
124 # VERSION="2.9.1-2719"
125 # VERSION_ID=2.9.1-2719-xxxxxxxx
126 # PRETTY_NAME="ABCD EFG BMC (OpenBMC Project Reference Distro) 2.9.1-2719"
127 # BUILD_ID="xxxxxxxxxx"
128 # OPENBMC_TARGET_MACHINE="efg"
129
130 ${os_release}= Get BMC Release Info
131 ${os_release}= Convert To Dictionary ${os_release}
132
133 [Return] ${os_release}
134
135
chithrag8a17c492022-03-01 12:53:44 +0000136Get Device Info From BMC
137 [Documentation] To get the device information from BMC.
138
139 # Get Device ID information from BMC.
140 ${data}= Bmc Execute Command cat /usr/share/ipmi-providers/dev_id.json
141 ${data}= Convert To List ${data}
142
143 # Fetching dictionary from the response.
144 ${info}= Set Variable ${data[0]}
145 ${info}= Evaluate dict(${info})
146
147 [Return] ${info}