Merge lp:~nelson-chu/opencompute/add-ocp-hardware-information-job into lp:opencompute/checkbox

Proposed by Nelson Chu
Status: Merged
Approved by: Jeff Lane 
Approved revision: 2171
Merged at revision: 2172
Proposed branch: lp:~nelson-chu/opencompute/add-ocp-hardware-information-job
Merge into: lp:opencompute/checkbox
Diff against target: 339 lines (+257/-13)
8 files modified
data/whitelists/opencompute-certify-local.whitelist (+8/-0)
debian/changelog (+8/-0)
jobs/TC-001-0002-Platform_Controller_Hub.txt.in (+0/-13)
jobs/TC-003-0001-Hardware_Information.txt.in (+57/-0)
jobs/local.txt.in (+7/-0)
scripts/bios_info (+61/-0)
scripts/disk_info (+65/-0)
scripts/raid_info (+51/-0)
To merge this branch: bzr merge lp:~nelson-chu/opencompute/add-ocp-hardware-information-job
Reviewer Review Type Date Requested Status
Jeff Lane  Approve
Nelson Chu Needs Resubmitting
Review via email: mp+205905@code.launchpad.net

Description of the change

Add OCP hardware information job

To post a comment you must log in.
Revision history for this message
Jeff Lane  (bladernr) wrote :

Looks good. I don't have anything with a MegaRAID controller so I can't test the megacli script, but that's up to you.

For future reference, you don't have to delete and re-add files when you want to rename them. 'bzr rename' will do the trick.

And thanks for catching that missing .in description.

Revision history for this message
Jeff Lane  (bladernr) wrote :

Needs Fixing. You need to do one more thing though... and I have a feeling you'll need to do this for all your merge requests.

You need to edit the file debian/changelog and follow the format you see contained inside.

Always put your changelog entries under your name and use a brief summary. Do NOT change the version or date stamp info and always put your entries in the top most stanza of the changelog.

For example, you should change the change log to add something like this:

 [ Nelson Chu ]
 * data/whitelists/opencompute-certify-local.whitelist - Added new jobs to certification whitelist
 * jobs/TC-001-0002-Platform_Controller_Hub.txt.in - renamed file to match correct naming scheme
 * jobs/TC-003-0001-Hardware_Information.txt.in - added new jobs for Hardware Info test cases
 * scripts/bios_info - new script to gather bios data
 * scripts/disk_info - new script to gather disk information
 * scripts/raid_info - new script to get info on MegaRAID storage devices
 * jobs/local.txt.in - Added job to parse new hardware information job file

And please do likewise with all your other merge requests.

review: Needs Fixing
2171. By Nelson Chu

Update debian/changelog file

Revision history for this message
Nelson Chu (nelson-chu) wrote :

I had modify debian/changelog
please help me to review it
thanks

review: Needs Resubmitting
Revision history for this message
Jeff Lane  (bladernr) wrote :

Terriffic... thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/whitelists/opencompute-certify-local.whitelist'
2--- data/whitelists/opencompute-certify-local.whitelist 2014-02-13 07:32:54 +0000
3+++ data/whitelists/opencompute-certify-local.whitelist 2014-03-18 07:53:32 +0000
4@@ -45,3 +45,11 @@
5 __TC-001-0002-Platform_Controller_Hub__
6 TC-001-0002-001-SATA_port
7 TC-001-0002-002-USB_2.0
8+__TC-003-0001-Hardware_Information__
9+TC-003-0001-001-CPU_Information
10+TC-003-0001-002-Memory_Information
11+TC-003-0001-003-Disk_Information
12+TC-003-0001-004-BIOS_Information
13+TC-003-0001-005-ME_Information
14+TC-003-0001-006-NIC_Information
15+TC-003-0001-007-RAID_Card_Information
16
17=== modified file 'debian/changelog'
18--- debian/changelog 2014-02-21 09:49:16 +0000
19+++ debian/changelog 2014-03-18 07:53:32 +0000
20@@ -1,6 +1,14 @@
21 checkbox (1.16.13~OCP) UNRELEASED; urgency=low
22
23 [ Nelson Chu ]
24+ * data/whitelists/opencompute-certify-local.whitelist - Added Hardware
25+ Information jobs to OCP certification whitelist
26+ * jobs/TC-003-0001-Hardware_Information.txt - Added new jobs for Hardware
27+ Information test cases
28+ * jobs/local.txt.in - Added job to parse new Hardware Information job file
29+ * scripts/disk_info - new script to gather disk infomation
30+ * scripts/bios_info - new script to gather BIOS infomation
31+ * scripts/raid_info - new script to gather RAID infomation
32 * data/whitelists/opencompute-certify-local.whitelist - Added PCH jobs to
33 OCP certification whitelist
34 * jobs/TC-001-0002-Platform_Controller_Hub.txt - Added new jobs for PCH
35
36=== added file 'jobs/TC-001-0002-Platform_Controller_Hub.txt.in'
37--- jobs/TC-001-0002-Platform_Controller_Hub.txt.in 1970-01-01 00:00:00 +0000
38+++ jobs/TC-001-0002-Platform_Controller_Hub.txt.in 2014-03-18 07:53:32 +0000
39@@ -0,0 +1,13 @@
40+plugin: shell
41+name: TC-001-0002-001-SATA_port
42+command: check_sata_port
43+description:
44+ 1. Use dmesg command to gather SATA information.
45+ 2. Criteria: SATA port speed up to 6.0Gps.
46+
47+plugin: shell
48+name: TC-001-0002-002-USB_2.0
49+command: check_usb_port
50+description:
51+ 1. Use dmesg command to gather USB information.
52+ 2. Criteria: USB version must be 2.0.
53
54=== removed file 'jobs/TC-001-0002-Platform_Controller_Hub.txt.in'
55--- jobs/TC-001-0002-Platform_Controller_Hub.txt.in 2014-02-13 07:32:54 +0000
56+++ jobs/TC-001-0002-Platform_Controller_Hub.txt.in 1970-01-01 00:00:00 +0000
57@@ -1,13 +0,0 @@
58-plugin: shell
59-name: TC-001-0002-001-SATA_port
60-command: check_sata_port
61-description:
62- 1. Use dmesg command to gather SATA information.
63- 2. Criteria: SATA port speed up to 6.0Gps.
64-
65-plugin: shell
66-name: TC-001-0002-002-USB_2.0
67-command: check_usb_port
68-description:
69- 1. Use dmesg command to gather USB information.
70- 2. Criteria: USB version must be 2.0.
71
72=== added file 'jobs/TC-003-0001-Hardware_Information.txt.in'
73--- jobs/TC-003-0001-Hardware_Information.txt.in 1970-01-01 00:00:00 +0000
74+++ jobs/TC-003-0001-Hardware_Information.txt.in 2014-03-18 07:53:32 +0000
75@@ -0,0 +1,57 @@
76+plugin: shell
77+name: TC-003-0001-001-CPU_Information
78+command: echo "Refers to TC-001-0001-001-CPU_Information"
79+description:
80+ Refers to TC-001-0001-001-CPU_Information
81+
82+plugin: shell
83+name: TC-003-0001-002-Memory_Information
84+command: echo "Refers to TC-001-0001-003-Memory_Information"
85+description:
86+ Refers to TC-001-0001-003-Memory_Information
87+
88+plugin: shell
89+name: TC-003-0001-003-Disk_Information
90+requires: package.name == 'lshw'
91+user: root
92+command: disk_info
93+description:
94+ 1. Use lshw command to gather disk information.
95+ 2. The program will output disk type, vendor, product, capacity.
96+ 3. Criteria: must be able to retrieve disk information.
97+
98+plugin: shell
99+name: TC-003-0001-004-BIOS_Information
100+requires: package.name == 'lshw'
101+user: root
102+command: bios_info
103+description:
104+ 1. Use lshw command to gather BIOS information.
105+ 2. The program will output BIOS vendor, version and release date.
106+ 3. Criteria: must be able to retrieve BIOS information.
107+
108+plugin: shell
109+name: TC-003-0001-005-ME_Information
110+command: echo "Refers to TC-002-0010-001-Inventory_Infomation"
111+description:
112+ Refers to TC-002-0010-001-Inventory_Infomation
113+
114+plugin: shell
115+name: TC-003-0001-006-NIC_Information
116+command: network_device_info
117+description:
118+ 1. Use udevadm command to gather NIC information.
119+ 2. The program will output Interface, product, vendor, driver, device path.
120+ 3. Criteria: must be able to retrieve NIC information.
121+
122+plugin: shell
123+name: TC-003-0001-007-RAID_Card_Information
124+requires:
125+ package.name == 'megacli'
126+ package.name == 'megactl'
127+user: root
128+command: raid_info
129+description:
130+ 1. Use megasasctl command to gather LSI RAID card information.
131+ 2. The program will output adapter, product name, memory, BBU, serial no.
132+ 3. Criteria: All information listed in item 2 must have value to show that RAID card exists.
133
134=== modified file 'jobs/local.txt.in'
135--- jobs/local.txt.in 2014-02-13 07:32:54 +0000
136+++ jobs/local.txt.in 2014-03-18 07:53:32 +0000
137@@ -123,3 +123,10 @@
138 command:
139 shopt -s extglob
140 cat $CHECKBOX_SHARE/jobs/TC-001-0002-Platform_Controller_Hub.txt?(.in)
141+
142+name: __TC-003-0001-Hardware_Information__
143+plugin: local
144+_description: Verify hardware information
145+command:
146+ shopt -s extglob
147+ cat $CHECKBOX_SHARE/jobs/TC-003-0001-Hardware_Information.txt?(.in)
148
149=== added file 'scripts/bios_info'
150--- scripts/bios_info 1970-01-01 00:00:00 +0000
151+++ scripts/bios_info 2014-03-18 07:53:32 +0000
152@@ -0,0 +1,61 @@
153+#!/usr/bin/env python3
154+"""
155+Copyright (C) 2010-2013 by Cloud Computing Center for Mobile Applications
156+Industrial Technology Research Institute
157+
158+bios_info
159+ 1. Use lshw command to gather BIOS information.
160+ 2. The program will output BIOS vendor, version and release date.
161+ 3. Criteria: must be able to retrieve BIOS information.
162+
163+Authors
164+ Nelson Chu <Nelson.Chu@itri.org.tw>
165+
166+This program is free software: you can redistribute it and/or modify
167+it under the terms of the GNU General Public License version 3,
168+as published by the Free Software Foundation.
169+
170+This program is distributed in the hope that it will be useful,
171+but WITHOUT ANY WARRANTY; without even the implied warranty of
172+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
173+GNU General Public License for more details.
174+
175+You should have received a copy of the GNU General Public License
176+along with this program. If not, see <http://www.gnu.org/licenses/>.
177+
178+"""
179+
180+import os
181+import sys
182+import xml.etree.ElementTree as ET
183+from subprocess import check_output
184+
185+def main():
186+ attribute = ['vendor', 'version', 'date']
187+ command = 'lshw -xml'
188+ with open(os.devnull, "w") as NULL:
189+ hwinfo_xml = check_output(command, stderr=NULL, shell=True)
190+ root = ET.fromstring(hwinfo_xml)
191+
192+ # Parse lshw XML for gathering BIOS information.
193+ bios_info = root.findall(".//node[@id='firmware']")
194+
195+ if not bios_info:
196+ print("Cannot parse any BIOS information.", file=sys.stderr)
197+ return 10
198+
199+ for bios in bios_info:
200+ for attr in attribute:
201+ if bios.find(attr) is None:
202+ print(("Cannot find BIOS %s") %attr, file=sys.stderr)
203+ return 20
204+
205+ for attr in attribute:
206+ if attr == 'date':
207+ print(("Release date=\"%s\"") %bios.find(attr).text)
208+ continue
209+ print(("%s=\"%s\"") %(attr.capitalize(), bios.find(attr).text))
210+ return 0
211+
212+if __name__ == '__main__':
213+ sys.exit(main())
214
215=== added file 'scripts/disk_info'
216--- scripts/disk_info 1970-01-01 00:00:00 +0000
217+++ scripts/disk_info 2014-03-18 07:53:32 +0000
218@@ -0,0 +1,65 @@
219+#!/usr/bin/env python3
220+"""
221+Copyright (C) 2010-2013 by Cloud Computing Center for Mobile Applications
222+Industrial Technology Research Institute
223+
224+disk_info
225+ 1. Use lshw command to gather disk information.
226+ 2. The program will output disk type, vendor, product, capacity.
227+ 3. Criteria: must be able to retrieve disk information.
228+
229+Authors
230+ Nelson Chu <Nelson.Chu@itri.org.tw>
231+
232+This program is free software: you can redistribute it and/or modify
233+it under the terms of the GNU General Public License version 3,
234+as published by the Free Software Foundation.
235+
236+This program is distributed in the hope that it will be useful,
237+but WITHOUT ANY WARRANTY; without even the implied warranty of
238+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
239+GNU General Public License for more details.
240+
241+You should have received a copy of the GNU General Public License
242+along with this program. If not, see <http://www.gnu.org/licenses/>.
243+
244+"""
245+
246+import sys
247+import xml.etree.ElementTree as ET
248+from subprocess import Popen, PIPE
249+
250+def main():
251+ attribute = ['description', 'vendor', 'product', 'size']
252+ command = 'lshw -xml'
253+ hwinfo_xml = Popen(command, stdout=PIPE, stderr=PIPE,
254+ shell=True).communicate()[0]
255+ root = ET.fromstring(hwinfo_xml)
256+
257+ # Parse lshw XML for gathering disk information.
258+ disk_list = root.findall(".//node[@class='disk']")
259+
260+ if not disk_list:
261+ print("Cannot parse any disk information.", file=sys.stderr)
262+ return 10
263+
264+ for disk in disk_list:
265+ for attr in attribute:
266+ if disk.find(attr) is None:
267+ print(("Cannot found disk %s") %attr, file=sys.stderr)
268+ return 20
269+
270+ disk_size = int(disk.find('size').text) / (1000**3)
271+ for attr in attribute:
272+ if attr == 'description':
273+ print(("Type=\"%s\"") %disk.find(attr).text)
274+ continue
275+ elif attr == 'size':
276+ print(("%s=\"%dGB\"") %(attr.capitalize(), disk_size))
277+ continue
278+ else:
279+ print(("%s=\"%s\"") %(attr.capitalize(), disk.find(attr).text))
280+ return 0
281+
282+if __name__ == '__main__':
283+ sys.exit(main())
284
285=== added file 'scripts/raid_info'
286--- scripts/raid_info 1970-01-01 00:00:00 +0000
287+++ scripts/raid_info 2014-03-18 07:53:32 +0000
288@@ -0,0 +1,51 @@
289+#!/bin/bash
290+#
291+# Copyright (C) 2010-2013 by Cloud Computing Center for Mobile Applications
292+# Industrial Technology Research Institute
293+#
294+# raid_info
295+# 1. Use megasasctl command to gather LSI RAID card information.
296+# 2. The program will output adapter, product name, memory, BBU, serial no.
297+# 3. Criteria: All information listed in item 2 must have value to show that
298+# RAID card exists.
299+#
300+# Authors
301+# Nelson Chu <Nelson.Chu@itri.org.tw>
302+#
303+# This program is free software: you can redistribute it and/or modify
304+# it under the terms of the GNU General Public License version 3,
305+# as published by the Free Software Foundation.
306+#
307+# This program is distributed in the hope that it will be useful,
308+# but WITHOUT ANY WARRANTY; without even the implied warranty of
309+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
310+# GNU General Public License for more details.
311+#
312+# You should have received a copy of the GNU General Public License
313+# along with this program. If not, see <http://www.gnu.org/licenses/>.
314+#
315+
316+check_return_code() {
317+ if [ "${1}" -ne "0" ]; then
318+ echo "ERROR: ${2}" >&2
319+ exit ${1}
320+ fi
321+}
322+
323+output=`megacli -CfgDsply -Aall|grep -E \
324+ 'Adapter:|Product Name:|Memory:|BBU:|Serial No:'`
325+check_return_code $? "There is no LSI MegaRAID SAS card found."
326+
327+n=0
328+echo "$output" | {
329+ while IFS= read -r line; do
330+ echo "$line"
331+ n=$(($n + 1))
332+ done
333+
334+ if [ "$n" -ne 5 ]; then
335+ check_return_code 10 "RAID card attributes are not correct."
336+ fi
337+
338+ exit 0
339+}

Subscribers

People subscribed via source and target branches