Merge lp:~sophia-wu/opencompute/add-ocp-system-event-log-job into lp:opencompute/checkbox

Proposed by Sophia Wu
Status: Superseded
Proposed branch: lp:~sophia-wu/opencompute/add-ocp-system-event-log-job
Merge into: lp:opencompute/checkbox
Diff against target: 276 lines (+226/-0)
7 files modified
data/whitelists/opencompute-certify-remoteME.whitelist (+46/-0)
debian/changelog (+5/-0)
debian/checkbox.install (+1/-0)
debian/checkbox.postinst (+1/-0)
examples/me.cfg (+15/-0)
jobs/TC-002-0011-System_Log.txt (+11/-0)
scripts/ipmi_sel_entries (+147/-0)
To merge this branch: bzr merge lp:~sophia-wu/opencompute/add-ocp-system-event-log-job
Reviewer Review Type Date Requested Status
Jeff Lane  Needs Fixing
Review via email: mp+205966@code.launchpad.net

This proposal has been superseded by a proposal from 2014-02-14.

Description of the change

Verify the system event log must be capable of saving at least 256 entries

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

Hi Sophia.... thanks for submitting this. In general it looks good but there are a couple things:

1: Why is there a separate whitelist for this? Does this need it's own whitelist, or would this be in a general certification remote whitelist? If that's the case, the whitelist should simply be called opencompute-certify-remote.whitelist.

2: if you want the config file me.cfg to be installed, you need to add it to the approrpiate files in the debian directory. here are teh places where the examples directory is referenced:

debian/checkbox-hw-collection.install:usr/share/checkbox/examples/checkbox-hw-collection.ini
debian/checkbox.install:usr/share/checkbox/examples/checkbox.ini
debian/checkbox.install:usr/share/checkbox/examples/network.cfg
debian/checkbox.install:usr/share/checkbox/examples/virtualization.cfg
debian/checkbox.install:usr/share/checkbox/examples/org.freedesktop.policykit.checkbox.policy usr/share/polkit-1/actions/
debian/checkbox-ocp-cli.install:usr/share/checkbox/examples/checkbox-ocp-cli.ini
debian/checkbox-ocp-gtk.install:usr/share/checkbox/examples/checkbox-ocp-gtk.ini
debian/checkbox-ocp-qt.install:usr/share/checkbox/examples/checkbox-ocp-qt.ini
debian/checkbox-ocp-urwid.install:usr/share/checkbox/examples/checkbox-ocp-urwid.ini
debian/checkbox.postinst:cp /usr/share/checkbox/examples/network.cfg /etc/checkbox.d/
debian/checkbox.postinst:cp /usr/share/checkbox/examples/virtualization.cfg /etc/checkbox.d/

You're probably interested in checkbox.install and checkbox.postinst

Without adding it to those files, the config file will not be installed with the package.

3: in the ipmi_sel_entries script, you reference ../examples/me.cfg twice. The proper installed location is /etc/checkbox.d/ (See 2 above).

4: Finally, you also need to update debian/changelog and add an entry under your name that briefly describes the changes you've made. See other entries in the changelog for examples.

Fix those few items (and just let me know more about item 1) and I'll push this through.

Thanks!

review: Needs Fixing
Revision history for this message
Sophia Wu (sophia-wu) wrote :

Hi Jeff,

Thanks for your feedback. It's very helpful for me.

And about item 1,
Due to some other test cases that we haven't commit now, they will run ME stress test.
I think it's better to separate the whitelists, one is for retrieving ME data and another is for stressing ME.

Thanks,
Sophia

2170. By Nelson Chu

Adds OCP CPU and Memory tests and jobs

2171. By Jeff Lane 

Adds new job files to the setup.cfg file so they will be properly installed. This is just a cleanup of something I missed on initial review.

2172. By Nelson Chu

Add OCP hardware information job

2173. By Sophia Wu

resolve conflicts

2174. By Sophia Wu

Add OCP system event log job

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'data/whitelists/opencompute-certify-remoteME.whitelist'
2--- data/whitelists/opencompute-certify-remoteME.whitelist 1970-01-01 00:00:00 +0000
3+++ data/whitelists/opencompute-certify-remoteME.whitelist 2014-02-14 09:48:31 +0000
4@@ -0,0 +1,46 @@
5+## This whitelist is intended for use inside Canonical's test labs. The tests
6+## conained in this list are the same as those contained in the
7+## server-selftest.whitelist file that OEMs may use. The difference here is that
8+## some of these tests depend on a specific network environment and may not run
9+## properly in your test environment. To avoid false failures, please use the
10+## server-selftest.whitelist instead.
11+# Resource Jobs
12+block_device
13+cdimage
14+cpuinfo
15+device
16+dmi
17+dpkg
18+efi
19+environment
20+gconf
21+lsb
22+meminfo
23+module
24+optical_drive
25+package
26+sleep
27+uname
28+#Info attachment jobs
29+__info__
30+cpuinfo_attachment
31+dmesg_attachment
32+dmi_attachment
33+dmidecode_attachment
34+efi_attachment
35+lspci_attachment
36+meminfo_attachment
37+modprobe_attachment
38+modules_attachment
39+sysctl_attachment
40+sysfs_attachment
41+udev_attachment
42+lsmod_attachment
43+acpi_sleep_attachment
44+info/hdparm
45+info/hdparm_.*.txt
46+installer_debug.gz
47+info/disk_partitions
48+# Actual test cases
49+__TC-002-0011-System_Log__
50+TC-002-0011-001-System_Log_Entries
51
52=== modified file 'debian/changelog'
53--- debian/changelog 2013-11-05 20:04:15 +0000
54+++ debian/changelog 2014-02-14 09:48:31 +0000
55@@ -1,5 +1,10 @@
56 checkbox (1.16.13~OCP) UNRELEASED; urgency=low
57
58+ [ Sophia Wu ]
59+ * jobs/TC-002-0011-System_Log.txt - added new IPMI out-of-band test for Intel ME
60+ * examples/me.cfg - added new config file for DCMI/IPMI test
61+
62+
63 [ Jeff Marcom ]
64 * Updated scripts/network script from lp:checkbox
65
66
67=== modified file 'debian/checkbox.install'
68--- debian/checkbox.install 2013-07-05 20:01:00 +0000
69+++ debian/checkbox.install 2014-02-14 09:48:31 +0000
70@@ -8,6 +8,7 @@
71 usr/share/checkbox/examples/checkbox.ini
72 usr/share/checkbox/examples/network.cfg
73 usr/share/checkbox/examples/virtualization.cfg
74+usr/share/checkbox/examples/me.cfg
75 usr/share/checkbox/examples/org.freedesktop.policykit.checkbox.policy usr/share/polkit-1/actions/
76 usr/share/checkbox/install/*
77 usr/share/checkbox/jobs/*
78
79=== modified file 'debian/checkbox.postinst'
80--- debian/checkbox.postinst 2013-07-05 16:43:48 +0000
81+++ debian/checkbox.postinst 2014-02-14 09:48:31 +0000
82@@ -5,5 +5,6 @@
83
84 cp /usr/share/checkbox/examples/network.cfg /etc/checkbox.d/
85 cp /usr/share/checkbox/examples/virtualization.cfg /etc/checkbox.d/
86+cp /usr/share/checkbox/examples/me.cfg /etc/checkbox.d/
87
88 #DEBHELPER#
89
90=== added file 'examples/me.cfg'
91--- examples/me.cfg 1970-01-01 00:00:00 +0000
92+++ examples/me.cfg 2014-02-14 09:48:31 +0000
93@@ -0,0 +1,15 @@
94+#Please config ME IP of server that you want to test
95+#for example, if ME ip of your server is 10.0.0.1,
96+#then you must replace x.x.x.x to 10.0.0.1 in [Targets]
97+
98+[Targets]
99+Target1: x.x.x.x
100+
101+#please config ME account(USER/PASSWORD) of server that you want to test
102+#for example, if ME account of your server is ADMIN/ADMIN,
103+#then you must replace OCP/OCP to ADMIN/ADMIN in [Account]
104+
105+[Account]
106+USER: OCP
107+PASSWORD: OCP
108+
109
110=== added file 'jobs/TC-002-0011-System_Log.txt'
111--- jobs/TC-002-0011-System_Log.txt 1970-01-01 00:00:00 +0000
112+++ jobs/TC-002-0011-System_Log.txt 2014-02-14 09:48:31 +0000
113@@ -0,0 +1,11 @@
114+plugin: shell
115+name: TC-002-0011-001-System_Log_Entries
116+requires: package.name == 'ipmitool'
117+user: root
118+command: ipmi_sel_entries
119+description:
120+ 1. Use ipmitool to collect event log information
121+ 2. Calculate entries number of system event log
122+ 3. Criteria: the A log must be capable of saving at least 256 entries
123+
124+
125
126=== added file 'scripts/ipmi_sel_entries'
127--- scripts/ipmi_sel_entries 1970-01-01 00:00:00 +0000
128+++ scripts/ipmi_sel_entries 2014-02-14 09:48:31 +0000
129@@ -0,0 +1,147 @@
130+#!/usr/bin/env python3
131+"""
132+Copyright (C) 2010-2013 by Cloud Computing Center for Mobile Applications
133+Industrial Technology Research Institute
134+
135+File Name
136+ ipmi_sel_entries
137+ 1. Use ipmitool to collect event log information
138+ 2. Calculate entries number of system event log
139+ 3. Criteria: the A log must be capable of saving at least 256 entries
140+
141+Description
142+ Use ipmitool to get system event log info and calculate whether
143+ total number of entries is more than 256.
144+
145+Authors
146+ Sophia Wu <Sophia.Wu@itri.org.tw>
147+
148+This program is free software: you can redistribute it and/or modify
149+it under the terms of the GNU General Public License version 3,
150+as published by the Free Software Foundation.
151+
152+This program is distributed in the hope that it will be useful,
153+but WITHOUT ANY WARRANTY; without even the implied warranty of
154+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
155+GNU General Public License for more details.
156+
157+You should have received a copy of the GNU General Public License
158+along with this program. If not, see <http://www.gnu.org/licenses/>.
159+
160+"""
161+import sys
162+import time
163+import shlex
164+import re
165+import subprocess
166+from subprocess import (
167+ CalledProcessError,
168+ check_call,
169+ check_output
170+)
171+from argparse import (
172+ ArgumentParser,
173+ RawTextHelpFormatter
174+)
175+import configparser
176+
177+#Retrieve entries number that already used
178+def get_entry_used(output):
179+ entry_used = re.search(r'Entries\D*([0-9 ]+)', output)
180+ return entry_used.group(1).strip()
181+
182+#Retrieve free entries that available
183+def get_entry_free(output):
184+ entry_free = re.search(r'# Free Units\D*([0-9 ]+)', output)
185+ return entry_free.group(1).strip()
186+
187+#Use ipmitool to retrieve sel information
188+def get_sel_info(host_ip, user, password):
189+ cmd = 'ipmitool -H {} -U {} -P {} sel'.format(host_ip, user, password)
190+ ipmi_sel_return = check_output(shlex.split(cmd), universal_newlines=True)
191+ return ipmi_sel_return
192+
193+def sel_entry_test(args):
194+
195+ #Default config file to config requirement info for DCMI in-band/out-of-band access
196+ DEFAULT_CFG = "/etc/checkbox.d/me.cfg"
197+ if not "config" in vars(args):
198+ config_file = DEFAULT_CFG
199+ else:
200+ config_file = args.config
201+
202+ config = configparser.RawConfigParser()
203+
204+ try:
205+ config.readfp(open(config_file))
206+ except IOError:
207+ print("No config file found")
208+ return 10
209+
210+ # Acquire ME IP/Credential parameters from config file
211+ try:
212+ targets_options = config.options('Targets')
213+ targets_list = []
214+ for target_key in targets_options:
215+ targets_list.append(config.get('Targets', target_key))
216+ if not targets_list:
217+ print("Invalid or Empty targets")
218+ return 20
219+ except configparser.Error:
220+ print("Invalid or Empty targets")
221+ return 30
222+
223+ try:
224+ user_value = config.get('Account', 'USER')
225+ passwd_value = config.get('Account', 'PASSWORD')
226+ except configparser.Error:
227+ print("Invalid or Empty credential info")
228+ return 40
229+
230+ for target in targets_list:
231+
232+ if not target or not user_value or not passwd_value:
233+ print("Require Taget IP, Account(USER/PASSWORD) for DCMI out-of-band access")
234+ return 50
235+ else:
236+ print("SUT =", target)
237+
238+ try:
239+ sel_return = get_sel_info(target, user_value, passwd_value)
240+ time.sleep(5)
241+ except CalledProcessError as command_exception:
242+ print("Failed executing ipmi command, Reason: %s." %(command_exception))
243+ return 60
244+
245+ try:
246+ print("Used Entry:", int(get_entry_used(sel_return)))
247+ print("Free Entry:", int(get_entry_free(sel_return)))
248+ except:
249+ print("Error to parse SEL info")
250+ return 70
251+
252+ try:
253+ entry_space = int(get_entry_used(sel_return))+int(get_entry_free(sel_return))
254+ except ArithmeticError:
255+ print("Arithmetic Error")
256+ return 80
257+
258+ if entry_space < 256:
259+ print("Entries Number:", int(entry_space), "Entries Number is less than 256")
260+ return 90
261+ else:
262+ print("Entries Number of SUT is more than 256.")
263+ return 0
264+
265+def main():
266+
267+ intro_message = "Default config location is /etc/checkbox.d/me.cfg"
268+ parser = ArgumentParser(description=intro_message,
269+ formatter_class=RawTextHelpFormatter)
270+ parser.add_argument('--config', default="/etc/checkbox.d/me.cfg",
271+ help="Supply config file for getting default credential")
272+ args = parser.parse_args()
273+ return sel_entry_test(args)
274+
275+if __name__ == "__main__":
276+ sys.exit(main())

Subscribers

People subscribed via source and target branches