← Back to team overview

opencompute-developers team mailing list archive

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

 

Nelson Chu has proposed merging lp:~nelson-chu/opencompute/add-ocp-hardware-information-job into lp:opencompute/checkbox.

Requested reviews:
  Open Compute Developers (opencompute-developers)

For more details, see:
https://code.launchpad.net/~nelson-chu/opencompute/add-ocp-hardware-information-job/+merge/205905

Add OCP hardware information job
-- 
https://code.launchpad.net/~nelson-chu/opencompute/add-ocp-hardware-information-job/+merge/205905
Your team Open Compute Developers is requested to review the proposed merge of lp:~nelson-chu/opencompute/add-ocp-hardware-information-job into lp:opencompute/checkbox.
=== modified file 'data/whitelists/opencompute-certify-local.whitelist'
--- data/whitelists/opencompute-certify-local.whitelist	2014-02-11 12:16:41 +0000
+++ data/whitelists/opencompute-certify-local.whitelist	2014-02-12 06:22:38 +0000
@@ -41,3 +41,11 @@
 __TC-001-0002-Platform_Controller_Hub__
 TC-001-0002-001-SATA_port
 TC-001-0002-002-USB_2.0
+__TC-003-0001-Hardware_Information__
+TC-003-0001-001-CPU_Information
+TC-003-0001-002-Memory_Information
+TC-003-0001-003-Disk_Information
+TC-003-0001-004-BIOS_Information
+TC-003-0001-005-ME_Information
+TC-003-0001-006-NIC_Information
+TC-003-0001-007-RAID_Card_Information

=== removed file 'jobs/TC-001-0002-Platform_Controller_Hub.txt'
--- jobs/TC-001-0002-Platform_Controller_Hub.txt	2014-02-11 12:16:41 +0000
+++ jobs/TC-001-0002-Platform_Controller_Hub.txt	1970-01-01 00:00:00 +0000
@@ -1,13 +0,0 @@
-plugin: shell
-name: TC-001-0002-001-SATA_port
-command: check_sata_port
-description:
- 1. Use dmesg command to gather SATA information.
- 2. Criteria: SATA port speed up to 6.0Gps.
-
-plugin: shell
-name: TC-001-0002-002-USB_2.0
-command: check_usb_port
-description:
- 1. Use dmesg command to gather USB information.
- 2. Criteria: USB version must be 2.0.

=== added file 'jobs/TC-001-0002-Platform_Controller_Hub.txt.in'
--- jobs/TC-001-0002-Platform_Controller_Hub.txt.in	1970-01-01 00:00:00 +0000
+++ jobs/TC-001-0002-Platform_Controller_Hub.txt.in	2014-02-12 06:22:38 +0000
@@ -0,0 +1,13 @@
+plugin: shell
+name: TC-001-0002-001-SATA_port
+command: check_sata_port
+description:
+ 1. Use dmesg command to gather SATA information.
+ 2. Criteria: SATA port speed up to 6.0Gps.
+
+plugin: shell
+name: TC-001-0002-002-USB_2.0
+command: check_usb_port
+description:
+ 1. Use dmesg command to gather USB information.
+ 2. Criteria: USB version must be 2.0.

=== added file 'jobs/TC-003-0001-Hardware_Information.txt.in'
--- jobs/TC-003-0001-Hardware_Information.txt.in	1970-01-01 00:00:00 +0000
+++ jobs/TC-003-0001-Hardware_Information.txt.in	2014-02-12 06:22:38 +0000
@@ -0,0 +1,57 @@
+plugin: shell
+name: TC-003-0001-001-CPU_Information
+command: echo "Refers to TC-001-0001-001-CPU_Information"
+description:
+ Refers to TC-001-0001-001-CPU_Information
+
+plugin: shell
+name: TC-003-0001-002-Memory_Information
+command: echo "Refers to TC-001-0001-003-Memory_Information"
+description:
+ Refers to TC-001-0001-003-Memory_Information
+
+plugin: shell
+name: TC-003-0001-003-Disk_Information
+requires: package.name == 'lshw'
+user: root
+command: disk_info
+description:
+ 1. Use lshw command to gather disk information. 
+ 2. The program will output disk type, vendor, product, capacity.
+ 3. Criteria: must be able to retrieve disk information.
+
+plugin: shell
+name: TC-003-0001-004-BIOS_Information
+requires: package.name == 'lshw'
+user: root
+command: bios_info
+description:
+ 1. Use lshw command to gather BIOS information. 
+ 2. The program will output BIOS vendor, version and release date.
+ 3. Criteria: must be able to retrieve BIOS information.
+
+plugin: shell
+name: TC-003-0001-005-ME_Information
+command: echo "Refers to TC-002-0010-001-Inventory_Infomation"
+description:
+ Refers to TC-002-0010-001-Inventory_Infomation
+
+plugin: shell
+name: TC-003-0001-006-NIC_Information
+command: network_device_info
+description:
+ 1. Use udevadm command to gather NIC information.
+ 2. The program will output Interface, product, vendor, driver, device path.
+ 3. Criteria: must be able to retrieve NIC information.
+
+plugin: shell
+name: TC-003-0001-007-RAID_Card_Information
+requires:
+ package.name == 'megacli'
+ package.name == 'megactl'
+user: root
+command: raid_info
+description:
+ 1. Use megasasctl command to gather LSI RAID card information.
+ 2. The program will output adapter, product name, memory, BBU, serial no.
+ 3. Criteria: All information listed in item 2 must have value to show that RAID card exists.

=== modified file 'jobs/local.txt.in'
--- jobs/local.txt.in	2014-02-11 12:16:41 +0000
+++ jobs/local.txt.in	2014-02-12 06:22:38 +0000
@@ -116,3 +116,10 @@
 command:
  shopt -s extglob
  cat $CHECKBOX_SHARE/jobs/TC-001-0002-Platform_Controller_Hub.txt?(.in)
+
+name: __TC-003-0001-Hardware_Information__
+plugin: local
+_description: Verify hardware information
+command:
+  shopt -s extglob
+  cat $CHECKBOX_SHARE/jobs/TC-003-0001-Hardware_Information.txt?(.in)

=== added file 'scripts/bios_info'
--- scripts/bios_info	1970-01-01 00:00:00 +0000
+++ scripts/bios_info	2014-02-12 06:22:38 +0000
@@ -0,0 +1,61 @@
+#!/usr/bin/env python3
+"""
+Copyright (C) 2010-2013 by Cloud Computing Center for Mobile Applications
+Industrial Technology Research Institute
+
+bios_info
+  1. Use lshw command to gather BIOS information.
+  2. The program will output BIOS vendor, version and release date.
+  3. Criteria: must be able to retrieve BIOS information.
+
+Authors
+  Nelson Chu <Nelson.Chu@xxxxxxxxxxx>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License version 3,
+as published by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+"""
+
+import os
+import sys
+import xml.etree.ElementTree as ET
+from subprocess import check_output
+
+def main():
+    attribute = ['vendor', 'version', 'date']
+    command = 'lshw -xml'
+    with open(os.devnull, "w") as NULL:
+       hwinfo_xml = check_output(command, stderr=NULL, shell=True)
+    root = ET.fromstring(hwinfo_xml)
+
+    # Parse lshw XML for gathering BIOS information.
+    bios_info = root.findall(".//node[@id='firmware']")
+
+    if not bios_info:
+        print("Cannot parse any BIOS information.")
+        return 10
+
+    for bios in bios_info:
+        for attr in attribute:
+            if bios.find(attr) is None:
+                print(("Cannot find BIOS %s") %attr)
+                return 20
+
+        for attr in attribute:
+            if attr == 'date':
+                print(("Release date=\"%s\"") %bios.find(attr).text)
+                continue
+            print(("%s=\"%s\"") %(attr.capitalize(), bios.find(attr).text))
+    return 0
+
+if __name__ == '__main__':
+    sys.exit(main())

=== added file 'scripts/disk_info'
--- scripts/disk_info	1970-01-01 00:00:00 +0000
+++ scripts/disk_info	2014-02-12 06:22:38 +0000
@@ -0,0 +1,65 @@
+#!/usr/bin/env python3
+"""
+Copyright (C) 2010-2013 by Cloud Computing Center for Mobile Applications
+Industrial Technology Research Institute
+
+disk_info
+  1. Use lshw command to gather disk information.
+  2. The program will output disk type, vendor, product, capacity.
+  3. Criteria: must be able to retrieve disk information.
+
+Authors
+  Nelson Chu <Nelson.Chu@xxxxxxxxxxx>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License version 3,
+as published by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+"""
+
+import sys
+import xml.etree.ElementTree as ET
+from subprocess import Popen, PIPE
+
+def main():
+    attribute = ['description', 'vendor', 'product', 'size']
+    command = 'lshw -xml'
+    hwinfo_xml = Popen(command, stdout=PIPE, stderr=PIPE,
+                       shell=True).communicate()[0]
+    root = ET.fromstring(hwinfo_xml)
+
+    # Parse lshw XML for gathering disk information.
+    disk_list = root.findall(".//node[@class='disk']")
+
+    if not disk_list:
+        print("Cannot parse any disk information.")
+        return 10
+
+    for disk in disk_list:
+        for attr in attribute:
+            if disk.find(attr) is None:
+                print(("Cannot found disk %s") %attr)
+                return 20
+
+        disk_size = int(disk.find('size').text) / (1000**3)
+        for attr in attribute:
+            if attr == 'description':
+                print(("Type=\"%s\"") %disk.find(attr).text)
+                continue
+            elif attr == 'size':
+                print(("%s=\"%dGB\"") %(attr.capitalize(), disk_size))
+                continue
+            else:
+                print(("%s=\"%s\"") %(attr.capitalize(), disk.find(attr).text))
+    return 0
+
+if __name__ == '__main__':
+    sys.exit(main())

=== added file 'scripts/raid_info'
--- scripts/raid_info	1970-01-01 00:00:00 +0000
+++ scripts/raid_info	2014-02-12 06:22:38 +0000
@@ -0,0 +1,51 @@
+#!/bin/bash
+#
+# Copyright (C) 2010-2013 by Cloud Computing Center for Mobile Applications
+# Industrial Technology Research Institute
+#
+# raid_info
+#   1. Use megasasctl command to gather LSI RAID card information.
+#   2. The program will output adapter, product name, memory, BBU, serial no.
+#   3. Criteria: All information listed in item 2 must have value to show that
+#                RAID card exists.
+#
+# Authors
+#   Nelson Chu <Nelson.Chu@xxxxxxxxxxx>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3,
+# as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+check_return_code() {
+    if [ "${1}" -ne "0" ]; then
+        echo "ERROR: ${2}" >&2
+        exit ${1}
+    fi
+}
+
+output=`megacli -CfgDsply -Aall|grep -E \
+    'Adapter:|Product Name:|Memory:|BBU:|Serial No:'`
+check_return_code $? "There is no LSI MegaRAID SAS card found."
+
+n=0
+echo "$output" | {
+    while IFS= read -r line; do
+	echo "$line"
+	n=$(($n + 1))
+    done
+
+    if [ "$n" -ne 5 ]; then
+	check_return_code 10 "RAID card attributes are not correct."
+    fi
+
+    exit 0
+}


Follow ups