blob: 37698425f2bdaa8fa15f8088e74deb043f7360fe [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
24
25*** Test Cases ***
26
27Get Device ID Via IPMI
28 [Documentation] Verify Get Device ID using IPMI and check whether a response is received.
29 [Tags] Get_Device_ID_Via_IPMI
30
31 # Verify Get Device ID.
32 ${resp}= Run External IPMI Raw Command
33 ... ${IPMI_RAW_CMD['Device ID']['Get'][0]}
34 Should Not Contain ${resp} ${IPMI_RAW_CMD['Device ID']['Get'][1]}
35
36
37Verify Get Device ID With Invalid Data Request
38 [Documentation] Verify Get Device ID with invalid data request via IPMI.
39 [Tags] Verify_Get_Device_ID_With_Invalid_Data_Request
40
41 # Run IPMI Get Device ID command with invalid request data byte.
42 ${resp}= Run Keyword and Expect Error *Request data length invalid*
43 ... Run External IPMI Raw Command ${IPMI_RAW_CMD['Device ID']['Get'][0]} 0x00
44 # Verify error code in 'rsp='.
45 Should Contain ${resp} ${IPMI_RAW_CMD['Device ID']['Get'][2]}
46
47
48Verify Device ID Response Data Via IPMI
49 [Documentation] Verify Get Device ID response data bytes using IPMI.
50 [Tags] Verify_Device_ID_Response_Data_Via_IPMI
51
52 # Get Device ID IPMI command.
53 ${resp}= Run External IPMI Raw Command
54 ... ${IPMI_RAW_CMD['Device ID']['Get'][0]}
55
56 # Split each and every byte and form list.
57 ${resp}= Split String ${resp}
58
59 # Checking Device ID.
60 Run Keyword And Continue On Failure Should Not Be Equal ${resp[0]} 00
61 ... msg=Device ID cannot be Unspecified
62
63 # Verify Device Revision.
64 ${device_rev}= Set Variable ${resp[1]}
65 ${device_rev}= Convert To Binary ${device_rev} base=16
66 ${device_rev}= Zfill Data ${device_rev} 8
67 # Comparing the reserved bits from Device Revision.
68 Run Keyword And Continue On Failure Should Be Equal As Strings ${device_rev[1:4]} 000
69
70 # Get version details from /etc/os-release.
71 ${os_release}= Get BMC OS Release Details
ganesanbbd187d22023-05-03 11:00:18 +000072 ${version}= Get Bmc Major Minor Version ${os_release['version']}
chithrag8a17c492022-03-01 12:53:44 +000073
74 # Verify Firmware Revision 1.
75 ${firmware_rev1}= Set Variable ${version[0]}
ganesanbbd187d22023-05-03 11:00:18 +000076 ${ipmi_rsp_firmware_rev1}= Convert To Integer ${resp[2]} base=16
77 Run Keyword And Continue On Failure Should Be Equal As Integers
78 ... ${ipmi_rsp_firmware_rev1} ${firmware_rev1}
chithrag8a17c492022-03-01 12:53:44 +000079
80 # Verify Firmware Revision 2.
81 ${firmware_rev2}= Set Variable ${version[1]}
ganesanbbd187d22023-05-03 11:00:18 +000082 ${ipmi_rsp_firmware_rev2}= Convert To Integer ${resp[3]} base=16
83 Run Keyword And Continue On Failure Should Be Equal As Integers
84 ... ${ipmi_rsp_firmware_rev2} ${firmware_rev2}
chithrag8a17c492022-03-01 12:53:44 +000085
86 # Verify IPMI Version.
87 Run Keyword And Continue On Failure Should Be Equal ${resp[4]} 02
88
89 # Verify Manufacture ID.
90 ${manufacture_id}= Set Variable ${resp[6:9]}
91 ${manufacture_id}= Evaluate "".join(${manufacture_id})
92 ${manufacture_data}= Convert To Binary ${manufacture_id} base=16
93 # Manufacure ID has Most significant four bits - reserved (0000b)
94 Run Keyword And Continue On Failure Should Be Equal ${manufacture_data[-5:-1]} 0000
95
96 # Verify Product ID.
97 ${product_id}= Set Variable ${resp[9:11]}
98 ${product_id}= Evaluate "".join(${product_id})
99 Run Keyword And Continue On Failure Should Not Be Equal ${product_id} 0000
100 ... msg=Product ID cannot be Zero
101
chithrag8a17c492022-03-01 12:53:44 +0000102 # Get Auxiliary Firmware Revision Information from IPMI response.
103 ${auxiliary_rev_version}= Set Variable ${resp[11:]}
104 Reverse List ${auxiliary_rev_version}
105 ${auxiliary_rev_version}= Evaluate "".join(${auxiliary_rev_version})
106 ${auxiliary_rev_version}= Convert To Integer ${auxiliary_rev_version} 16
107
108 # Compare both IPMI aux version and dev_id.json aux version.
109 ${dev_id_data}= Get Device Info From BMC
110 ${aux_info}= Get From Dictionary ${dev_id_data} aux
111 Run Keyword And Continue On Failure Should Be Equal ${aux_info} ${auxiliary_rev_version}
112
chithrag8a17c492022-03-01 12:53:44 +0000113
114*** Keywords ***
115
116Get BMC OS Release Details
117 [Documentation] To get the release details from bmc etc/os-release.
118
119 # The BMC OS Release information will be,
120 # for example,
121 # ID=openbmc-phosphor
122 # NAME="ADCD EFG BMC (OpenBMC Project Reference Distro)"
123 # VERSION="2.9.1-2719"
124 # VERSION_ID=2.9.1-2719-xxxxxxxx
125 # PRETTY_NAME="ABCD EFG BMC (OpenBMC Project Reference Distro) 2.9.1-2719"
126 # BUILD_ID="xxxxxxxxxx"
127 # OPENBMC_TARGET_MACHINE="efg"
128
129 ${os_release}= Get BMC Release Info
130 ${os_release}= Convert To Dictionary ${os_release}
131
132 [Return] ${os_release}
133
134
chithrag8a17c492022-03-01 12:53:44 +0000135Get Device Info From BMC
136 [Documentation] To get the device information from BMC.
137
138 # Get Device ID information from BMC.
139 ${data}= Bmc Execute Command cat /usr/share/ipmi-providers/dev_id.json
140 ${data}= Convert To List ${data}
141
142 # Fetching dictionary from the response.
143 ${info}= Set Variable ${data[0]}
144 ${info}= Evaluate dict(${info})
145
146 [Return] ${info}