Merge lp:~sophia-wu/opencompute/add-ocp-system-event-log-job into lp:opencompute/checkbox
- add-ocp-system-event-log-job
- Merge into checkbox
Status: | Merged |
---|---|
Approved by: | Jeff Lane |
Approved revision: | 2174 |
Merged at revision: | 2173 |
Proposed branch: | lp:~sophia-wu/opencompute/add-ocp-system-event-log-job |
Merge into: | lp:opencompute/checkbox |
Diff against target: |
459 lines (+230/-79) 8 files modified
data/whitelists/opencompute-certify-remoteME.whitelist (+46/-0) debian/changelog (+0/-79) debian/checkbox.install (+1/-0) debian/checkbox.postinst (+1/-0) examples/me.cfg (+15/-0) jobs/TC-002-0011-System_Log.txt.in (+11/-0) jobs/local.txt.in (+9/-0) scripts/ipmi_sel_entries (+147/-0) |
To merge this branch: | bzr merge lp:~sophia-wu/opencompute/add-ocp-system-event-log-job |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jeff Lane | Approve | ||
Review via email: mp+213419@code.launchpad.net |
This proposal supersedes a proposal from 2014-02-14.
Commit message
Description of the change
Verify the system event log must be capable of saving at least 256 entries
Jeff Lane (bladernr) wrote : Posted in a previous version of this proposal | # |
Sophia Wu (sophia-wu) wrote : Posted in a previous version of this proposal | # |
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
Jeff Lane (bladernr) wrote : Posted in a previous version of this proposal | # |
Hi Sophia...
I'm ready to pass this through and merge it, but I need one additional thing from you.
Whenver you do a merge request, please also update debian/changelog
See the current changelog for examples... So I need you to do the following:
1: update your branch to the latest trunk code using bzr pull:
cd your/local/
bzr pull #should update your branch with the latest trunk
edit /your/local/
Look at Nelson's entry and add a similar one to that below his... so ti should look something like this:
[Nelson Chu]
* Item 1
* Item 2
* Itme 3
[Sophia Wu]
* Item 1
* Item 2
If you can do that and resubmit, I'l approve and merge your branch as soon as I see the update.
Thanks!
Jeff
Jeff Lane (bladernr) wrote : Posted in a previous version of this proposal | # |
Thanks... and in the future, if I haven't gotten to something like this within a couple days, please ping me directly... sometimes these notices get lost in the noise (I get better than 1000 emails a day, most of whcih are automated from Launchpad).
Jeff Lane (bladernr) wrote : Posted in a previous version of this proposal | # |
Attempt to merge into lp:opencompute/checkbox failed due to conflicts:
duplicate in debian/
text conflict in jobs/local.txt.in
Jeff Lane (bladernr) wrote : Posted in a previous version of this proposal | # |
OK, so tarmac tried to merge the code and ran into some conflicts...
First, why did you add a brand new copy of the changelog, or more importantly, how did you manage to do that? You don't need to create a new changelog, simple edit the existing one...
So lets focus on getting this cleared up... do the following:
first, pull a fresh copy of the checkbox code:
bzr branch lp:opencompute/checkbox ocp-checkbox
Next, merge YOUR branch into that:
cd ocp-checkbox
bzr merge lp:~sophia-wu/opencompute/add-ocp-system-event-log-job
And you should see the following:
+N data/whitelists
+N debian/changelog
+N examples/me.cfg
+N jobs/TC-
+N scripts/
R debian/changelog => debian/
M debian/
M debian/
M jobs/local.txt.in
Conflict adding file debian/changelog. Moved existing file to debian/
Text conflict in jobs/local.txt.in
2 conflicts encountered.
The conflicts are what held this up. So first, fix the changelog. As I mentioned above, for some reason, it thinks you've added a brand new copy of the changelog. So we need to do the following:
cd debian
mv changelog changelog.sophia
mv changelog.moved changelog
then take the stuff you added (the Sophia section of changelog.sophia) and add that to changelog.
then delete changelog.sophia
rm changelog.sophia
Now you should be able to resolve the first conflict:
bzr resolve debian/changelog
which should give you this:
1 conflict resolved, 1 remaining
Now run bzr conflicts to see what's left:
Text conflict in jobs/local.txt.in
So lets now look at jobs/local.txt.in. The conflict is at the end:
<<<<<<< TREE
name: __TC-003-
=======
name: __TC-002-
>>>>>>> MERGE-SOURCE
plugin: local
<<<<<<< TREE
_description: Verify hardware information
=======
description: System Event Log
>>>>>>> MERGE-SOURCE
command:
<<<<<<< TREE
shopt -s extglob
cat $CHECKBOX_
=======
shopt -s extglob
cat $CHECKBOX_
>>>>>>> MERGE-SOURCE
So clean that up to look correct:
name: __TC-001-
plugin: local
_description: Verify platform controller hub functionality
command:
shopt -s extglob
cat $CHECKBOX_
name: __TC-002-
plugin: local
description: System Event Log
command:
shopt -s extglob
cat $CHECKBOX_
name: __TC-003-
plugin: local
_description: Verify hardware information
command:
shopt -s extglob
cat $CHECKBOX_
Save and exit that file and run bzr resolve and you should see this:
All conflicts resolved.
then resubmit and I'll approve and get this merged.
Jeff Lane (bladernr) wrote : | # |
Thanks, lets try this again and see what happens.
Preview Diff
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-03-31 08:50:05 +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 | === added file 'debian/changelog' |
53 | --- debian/changelog 1970-01-01 00:00:00 +0000 |
54 | +++ debian/changelog 2014-03-31 08:50:05 +0000 |
55 | @@ -0,0 +1,86 @@ |
56 | +checkbox (1.16.13~OCP) UNRELEASED; urgency=low |
57 | + |
58 | + [ Sophia Wu ] |
59 | + * data/whitelists/opencompute-certify-remoteME.whitelist - added a new whitelist for Intel ME |
60 | + * jobs/TC-002-0011-System_Log.txt - added a new IPMI out-of-band test which is related to system log on Intel ME |
61 | + * jobs/local.txt.in - added job to parse System Event Log job |
62 | + * scripts/ipmi_sel_entries - added a new script to verify entry number of system event log |
63 | + * examples/me.cfg - added new config file for Intel ME test |
64 | + |
65 | + [ Nelson Chu ] |
66 | + * data/whitelists/opencompute-certify-local.whitelist - Added Hardware |
67 | + Information jobs to OCP certification whitelist |
68 | + * jobs/TC-003-0001-Hardware_Information.txt - Added new jobs for Hardware |
69 | + Information test cases |
70 | + * jobs/local.txt.in - Added job to parse new Hardware Information job file |
71 | + * scripts/disk_info - new script to gather disk infomation |
72 | + * scripts/bios_info - new script to gather BIOS infomation |
73 | + * scripts/raid_info - new script to gather RAID infomation |
74 | + * data/whitelists/opencompute-certify-local.whitelist - Added PCH jobs to |
75 | + OCP certification whitelist |
76 | + * jobs/TC-001-0002-Platform_Controller_Hub.txt - Added new jobs for PCH |
77 | + test cases |
78 | + * jobs/local.txt.in - Added job to parse new PCH job file |
79 | + * scripts/check_sata_port - new script to verify SATA port speed |
80 | + * scripts/check_usb_port - new script to verify USB version |
81 | + * data/whitelists/opencompute-certify-local.whitelist - Added CPU and Memory |
82 | + jobs to OCP certification whitelist |
83 | + * jobs/TC-001-0001-CPU_Memory.txt.in - Added new jobs for CPU and Memory |
84 | + test cases |
85 | + * jobs/local.txt.in - Added job to parse new CPU and Memory job file |
86 | + * scripts/cpu_info - new script to gather CPU information |
87 | + * scripts/memory_info - new script to gather memory information |
88 | + * scripts/processor_topology - Revised script to match certification criteria |
89 | + |
90 | + [ Jeff Marcom ] |
91 | + * Updated scripts/network script from lp:checkbox |
92 | + |
93 | + -- Jeff Marcom <jeff.marcom@canonical.com> Tue, 5 Nov 2013 11:12:04 -0400 |
94 | + |
95 | +checkbox (1.16.12~OCP) UNRELEASED; urgency=low |
96 | + |
97 | + [ Jeff Marcom ] |
98 | + * Added googlestress app memory tests |
99 | + * Updated plainbox based on version 0.4.dev in lp:checkbox (16.12) |
100 | + * Updated checkbox OCP intro prompt |
101 | + * Updated Open Compute ready whitelist with new power management, cpu stress, and networking tests" |
102 | + * Added 12hr idle verification test and sylog check for PCI/Device errors |
103 | + * Removed launchpad prompt |
104 | + |
105 | + [ Jeff Lane ] |
106 | + * Updated OCP Checkbox to latest checkbox trunk, 0.16.11 revno 2353 |
107 | + * Enabled bonnie++ tests after noting that bonnie++ is available via yum and |
108 | + apt. Added new disk io_stress jobs and disk_stress script to add disk |
109 | + testing via stressapptest. |
110 | + * debian/control: promoted several packages from suggest to depends to ensure |
111 | + they are installed along with checkbox-ocp (LP: #1233333) |
112 | + * Cherry pick new iperf functionality in network testing from checkbox trunk |
113 | + |
114 | + -- Jeff Marcom <jeff.marcom@canonical.com> Wed, 2 Oct 2013 10:13:04 -0400 |
115 | + |
116 | +checkbox (1.16.6~OCP) UNRELEASED; urgency=low |
117 | + |
118 | + [ Jeff Marcom ] |
119 | + * Added checkbox-ocp package |
120 | + |
121 | + -- Jeff Marcom <jeff.marcom@canonical.com> Wed, 21 Aug 2013 12:20:24 -0400 |
122 | + |
123 | + |
124 | +checkbox (0.16.6~OCPubuntu1) UNRELEASED; urgency=low |
125 | + |
126 | + * INITIAL RELEASE: |
127 | + based on checkbox 0.16.6 from lp:checkbox with modificiations specific to |
128 | + the Open Compute Project |
129 | + |
130 | + [ Jeff Marcom ] |
131 | + * jobs/ipmi_out_of_band.txt.in - added new out of band ipmi tests |
132 | + * jobs/dcmi_in_band.txt.in - added new inband DCMI tests |
133 | + |
134 | + [ Jeff Lane ] |
135 | + * data/ - Cleanup, removed unnecessary data files, dirs and whitelists |
136 | + bin/ - all checkbox launchers now default to |
137 | + opencompute-ready-local.whitelist |
138 | + * jobs/, po/, scripts/ - Cleanup, removed unnecessary job and scritp files |
139 | + and their references in po/POTFILES.in |
140 | + checkbox/tests/ - Cleaned up unit tests that were looking for things |
141 | + removed in this merge. |
142 | |
143 | === removed file 'debian/changelog' |
144 | --- debian/changelog 2014-03-18 07:59:11 +0000 |
145 | +++ debian/changelog 1970-01-01 00:00:00 +0000 |
146 | @@ -1,79 +0,0 @@ |
147 | -checkbox (1.16.13~OCP) UNRELEASED; urgency=low |
148 | - |
149 | - [ Nelson Chu ] |
150 | - * data/whitelists/opencompute-certify-local.whitelist - Added Hardware |
151 | - Information jobs to OCP certification whitelist |
152 | - * jobs/TC-003-0001-Hardware_Information.txt - Added new jobs for Hardware |
153 | - Information test cases |
154 | - * jobs/local.txt.in - Added job to parse new Hardware Information job file |
155 | - * scripts/disk_info - new script to gather disk infomation |
156 | - * scripts/bios_info - new script to gather BIOS infomation |
157 | - * scripts/raid_info - new script to gather RAID infomation |
158 | - * data/whitelists/opencompute-certify-local.whitelist - Added PCH jobs to |
159 | - OCP certification whitelist |
160 | - * jobs/TC-001-0002-Platform_Controller_Hub.txt - Added new jobs for PCH |
161 | - test cases |
162 | - * jobs/local.txt.in - Added job to parse new PCH job file |
163 | - * scripts/check_sata_port - new script to verify SATA port speed |
164 | - * scripts/check_usb_port - new script to verify USB version |
165 | - * data/whitelists/opencompute-certify-local.whitelist - Added CPU and Memory |
166 | - jobs to OCP certification whitelist |
167 | - * jobs/TC-001-0001-CPU_Memory.txt.in - Added new jobs for CPU and Memory |
168 | - test cases |
169 | - * jobs/local.txt.in - Added job to parse new CPU and Memory job file |
170 | - * scripts/cpu_info - new script to gather CPU information |
171 | - * scripts/memory_info - new script to gather memory information |
172 | - * scripts/processor_topology - Revised script to match certification criteria |
173 | - |
174 | - [ Jeff Marcom ] |
175 | - * Updated scripts/network script from lp:checkbox |
176 | - |
177 | - -- Jeff Marcom <jeff.marcom@canonical.com> Tue, 5 Nov 2013 11:12:04 -0400 |
178 | - |
179 | -checkbox (1.16.12~OCP) UNRELEASED; urgency=low |
180 | - |
181 | - [ Jeff Marcom ] |
182 | - * Added googlestress app memory tests |
183 | - * Updated plainbox based on version 0.4.dev in lp:checkbox (16.12) |
184 | - * Updated checkbox OCP intro prompt |
185 | - * Updated Open Compute ready whitelist with new power management, cpu stress, and networking tests" |
186 | - * Added 12hr idle verification test and sylog check for PCI/Device errors |
187 | - * Removed launchpad prompt |
188 | - |
189 | - [ Jeff Lane ] |
190 | - * Updated OCP Checkbox to latest checkbox trunk, 0.16.11 revno 2353 |
191 | - * Enabled bonnie++ tests after noting that bonnie++ is available via yum and |
192 | - apt. Added new disk io_stress jobs and disk_stress script to add disk |
193 | - testing via stressapptest. |
194 | - * debian/control: promoted several packages from suggest to depends to ensure |
195 | - they are installed along with checkbox-ocp (LP: #1233333) |
196 | - * Cherry pick new iperf functionality in network testing from checkbox trunk |
197 | - |
198 | - -- Jeff Marcom <jeff.marcom@canonical.com> Wed, 2 Oct 2013 10:13:04 -0400 |
199 | - |
200 | -checkbox (1.16.6~OCP) UNRELEASED; urgency=low |
201 | - |
202 | - [ Jeff Marcom ] |
203 | - * Added checkbox-ocp package |
204 | - |
205 | - -- Jeff Marcom <jeff.marcom@canonical.com> Wed, 21 Aug 2013 12:20:24 -0400 |
206 | - |
207 | - |
208 | -checkbox (0.16.6~OCPubuntu1) UNRELEASED; urgency=low |
209 | - |
210 | - * INITIAL RELEASE: |
211 | - based on checkbox 0.16.6 from lp:checkbox with modificiations specific to |
212 | - the Open Compute Project |
213 | - |
214 | - [ Jeff Marcom ] |
215 | - * jobs/ipmi_out_of_band.txt.in - added new out of band ipmi tests |
216 | - * jobs/dcmi_in_band.txt.in - added new inband DCMI tests |
217 | - |
218 | - [ Jeff Lane ] |
219 | - * data/ - Cleanup, removed unnecessary data files, dirs and whitelists |
220 | - bin/ - all checkbox launchers now default to |
221 | - opencompute-ready-local.whitelist |
222 | - * jobs/, po/, scripts/ - Cleanup, removed unnecessary job and scritp files |
223 | - and their references in po/POTFILES.in |
224 | - checkbox/tests/ - Cleaned up unit tests that were looking for things |
225 | - removed in this merge. |
226 | |
227 | === modified file 'debian/checkbox.install' |
228 | --- debian/checkbox.install 2013-07-05 20:01:00 +0000 |
229 | +++ debian/checkbox.install 2014-03-31 08:50:05 +0000 |
230 | @@ -8,6 +8,7 @@ |
231 | usr/share/checkbox/examples/checkbox.ini |
232 | usr/share/checkbox/examples/network.cfg |
233 | usr/share/checkbox/examples/virtualization.cfg |
234 | +usr/share/checkbox/examples/me.cfg |
235 | usr/share/checkbox/examples/org.freedesktop.policykit.checkbox.policy usr/share/polkit-1/actions/ |
236 | usr/share/checkbox/install/* |
237 | usr/share/checkbox/jobs/* |
238 | |
239 | === modified file 'debian/checkbox.postinst' |
240 | --- debian/checkbox.postinst 2013-07-05 16:43:48 +0000 |
241 | +++ debian/checkbox.postinst 2014-03-31 08:50:05 +0000 |
242 | @@ -5,5 +5,6 @@ |
243 | |
244 | cp /usr/share/checkbox/examples/network.cfg /etc/checkbox.d/ |
245 | cp /usr/share/checkbox/examples/virtualization.cfg /etc/checkbox.d/ |
246 | +cp /usr/share/checkbox/examples/me.cfg /etc/checkbox.d/ |
247 | |
248 | #DEBHELPER# |
249 | |
250 | === added file 'examples/me.cfg' |
251 | --- examples/me.cfg 1970-01-01 00:00:00 +0000 |
252 | +++ examples/me.cfg 2014-03-31 08:50:05 +0000 |
253 | @@ -0,0 +1,15 @@ |
254 | +#Please config ME IP of server that you want to test |
255 | +#for example, if ME ip of your server is 10.0.0.1, |
256 | +#then you must replace x.x.x.x to 10.0.0.1 in [Targets] |
257 | + |
258 | +[Targets] |
259 | +Target1: x.x.x.x |
260 | + |
261 | +#please config ME account(USER/PASSWORD) of server that you want to test |
262 | +#for example, if ME account of your server is ADMIN/ADMIN, |
263 | +#then you must replace OCP/OCP to ADMIN/ADMIN in [Account] |
264 | + |
265 | +[Account] |
266 | +USER: OCP |
267 | +PASSWORD: OCP |
268 | + |
269 | |
270 | === added file 'jobs/TC-002-0011-System_Log.txt.in' |
271 | --- jobs/TC-002-0011-System_Log.txt.in 1970-01-01 00:00:00 +0000 |
272 | +++ jobs/TC-002-0011-System_Log.txt.in 2014-03-31 08:50:05 +0000 |
273 | @@ -0,0 +1,11 @@ |
274 | +plugin: shell |
275 | +name: TC-002-0011-001-System_Log_Entries |
276 | +requires: package.name == 'ipmitool' |
277 | +user: root |
278 | +command: ipmi_sel_entries |
279 | +description: |
280 | + 1. Use ipmitool to collect event log information |
281 | + 2. Calculate entries number of system event log |
282 | + 3. Criteria: the A log must be capable of saving at least 256 entries |
283 | + |
284 | + |
285 | |
286 | === modified file 'jobs/local.txt.in' |
287 | --- jobs/local.txt.in 2014-03-18 07:59:11 +0000 |
288 | +++ jobs/local.txt.in 2014-03-31 08:50:05 +0000 |
289 | @@ -124,9 +124,18 @@ |
290 | shopt -s extglob |
291 | cat $CHECKBOX_SHARE/jobs/TC-001-0002-Platform_Controller_Hub.txt?(.in) |
292 | |
293 | +name: __TC-002-0011-System_Log__ |
294 | +plugin: local |
295 | +_description: System Event Log |
296 | +command: |
297 | + shopt -s extglob |
298 | + cat $CHECKBOX_SHARE/jobs/TC-002-0011-System_Log.txt?(.in) |
299 | + |
300 | name: __TC-003-0001-Hardware_Information__ |
301 | plugin: local |
302 | _description: Verify hardware information |
303 | command: |
304 | shopt -s extglob |
305 | cat $CHECKBOX_SHARE/jobs/TC-003-0001-Hardware_Information.txt?(.in) |
306 | + |
307 | + |
308 | |
309 | === added file 'scripts/ipmi_sel_entries' |
310 | --- scripts/ipmi_sel_entries 1970-01-01 00:00:00 +0000 |
311 | +++ scripts/ipmi_sel_entries 2014-03-31 08:50:05 +0000 |
312 | @@ -0,0 +1,147 @@ |
313 | +#!/usr/bin/env python3 |
314 | +""" |
315 | +Copyright (C) 2010-2013 by Cloud Computing Center for Mobile Applications |
316 | +Industrial Technology Research Institute |
317 | + |
318 | +File Name |
319 | + ipmi_sel_entries |
320 | + 1. Use ipmitool to collect event log information |
321 | + 2. Calculate entries number of system event log |
322 | + 3. Criteria: the A log must be capable of saving at least 256 entries |
323 | + |
324 | +Description |
325 | + Use ipmitool to get system event log info and calculate whether |
326 | + total number of entries is more than 256. |
327 | + |
328 | +Authors |
329 | + Sophia Wu <Sophia.Wu@itri.org.tw> |
330 | + |
331 | +This program is free software: you can redistribute it and/or modify |
332 | +it under the terms of the GNU General Public License version 3, |
333 | +as published by the Free Software Foundation. |
334 | + |
335 | +This program is distributed in the hope that it will be useful, |
336 | +but WITHOUT ANY WARRANTY; without even the implied warranty of |
337 | +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
338 | +GNU General Public License for more details. |
339 | + |
340 | +You should have received a copy of the GNU General Public License |
341 | +along with this program. If not, see <http://www.gnu.org/licenses/>. |
342 | + |
343 | +""" |
344 | +import sys |
345 | +import time |
346 | +import shlex |
347 | +import re |
348 | +import subprocess |
349 | +from subprocess import ( |
350 | + CalledProcessError, |
351 | + check_call, |
352 | + check_output |
353 | +) |
354 | +from argparse import ( |
355 | + ArgumentParser, |
356 | + RawTextHelpFormatter |
357 | +) |
358 | +import configparser |
359 | + |
360 | +#Retrieve entries number that already used |
361 | +def get_entry_used(output): |
362 | + entry_used = re.search(r'Entries\D*([0-9 ]+)', output) |
363 | + return entry_used.group(1).strip() |
364 | + |
365 | +#Retrieve free entries that available |
366 | +def get_entry_free(output): |
367 | + entry_free = re.search(r'# Free Units\D*([0-9 ]+)', output) |
368 | + return entry_free.group(1).strip() |
369 | + |
370 | +#Use ipmitool to retrieve sel information |
371 | +def get_sel_info(host_ip, user, password): |
372 | + cmd = 'ipmitool -H {} -U {} -P {} sel'.format(host_ip, user, password) |
373 | + ipmi_sel_return = check_output(shlex.split(cmd), universal_newlines=True) |
374 | + return ipmi_sel_return |
375 | + |
376 | +def sel_entry_test(args): |
377 | + |
378 | + #Default config file to config requirement info for DCMI in-band/out-of-band access |
379 | + DEFAULT_CFG = "/etc/checkbox.d/me.cfg" |
380 | + if not "config" in vars(args): |
381 | + config_file = DEFAULT_CFG |
382 | + else: |
383 | + config_file = args.config |
384 | + |
385 | + config = configparser.RawConfigParser() |
386 | + |
387 | + try: |
388 | + config.readfp(open(config_file)) |
389 | + except IOError: |
390 | + print("No config file found") |
391 | + return 10 |
392 | + |
393 | + # Acquire ME IP/Credential parameters from config file |
394 | + try: |
395 | + targets_options = config.options('Targets') |
396 | + targets_list = [] |
397 | + for target_key in targets_options: |
398 | + targets_list.append(config.get('Targets', target_key)) |
399 | + if not targets_list: |
400 | + print("Invalid or Empty targets") |
401 | + return 20 |
402 | + except configparser.Error: |
403 | + print("Invalid or Empty targets") |
404 | + return 30 |
405 | + |
406 | + try: |
407 | + user_value = config.get('Account', 'USER') |
408 | + passwd_value = config.get('Account', 'PASSWORD') |
409 | + except configparser.Error: |
410 | + print("Invalid or Empty credential info") |
411 | + return 40 |
412 | + |
413 | + for target in targets_list: |
414 | + |
415 | + if not target or not user_value or not passwd_value: |
416 | + print("Require Taget IP, Account(USER/PASSWORD) for DCMI out-of-band access") |
417 | + return 50 |
418 | + else: |
419 | + print("SUT =", target) |
420 | + |
421 | + try: |
422 | + sel_return = get_sel_info(target, user_value, passwd_value) |
423 | + time.sleep(5) |
424 | + except CalledProcessError as command_exception: |
425 | + print("Failed executing ipmi command, Reason: %s." %(command_exception)) |
426 | + return 60 |
427 | + |
428 | + try: |
429 | + print("Used Entry:", int(get_entry_used(sel_return))) |
430 | + print("Free Entry:", int(get_entry_free(sel_return))) |
431 | + except: |
432 | + print("Error to parse SEL info") |
433 | + return 70 |
434 | + |
435 | + try: |
436 | + entry_space = int(get_entry_used(sel_return))+int(get_entry_free(sel_return)) |
437 | + except ArithmeticError: |
438 | + print("Arithmetic Error") |
439 | + return 80 |
440 | + |
441 | + if entry_space < 256: |
442 | + print("Entries Number:", int(entry_space), "Entries Number is less than 256") |
443 | + return 90 |
444 | + else: |
445 | + print("Entries Number of SUT is more than 256.") |
446 | + return 0 |
447 | + |
448 | +def main(): |
449 | + |
450 | + intro_message = "Default config location is /etc/checkbox.d/me.cfg" |
451 | + parser = ArgumentParser(description=intro_message, |
452 | + formatter_class=RawTextHelpFormatter) |
453 | + parser.add_argument('--config', default="/etc/checkbox.d/me.cfg", |
454 | + help="Supply config file for getting default credential") |
455 | + args = parser.parse_args() |
456 | + return sel_entry_test(args) |
457 | + |
458 | +if __name__ == "__main__": |
459 | + sys.exit(main()) |
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 checkbox. install: usr/share/ checkbox/ examples/ checkbox. ini checkbox. install: usr/share/ checkbox/ examples/ network. cfg checkbox. install: usr/share/ checkbox/ examples/ virtualization. cfg checkbox. install: usr/share/ checkbox/ examples/ org.freedesktop .policykit. checkbox. policy usr/share/ polkit- 1/actions/ checkbox- ocp-cli. install: usr/share/ checkbox/ examples/ checkbox- ocp-cli. ini checkbox- ocp-gtk. install: usr/share/ checkbox/ examples/ checkbox- ocp-gtk. ini checkbox- ocp-qt. install: usr/share/ checkbox/ examples/ checkbox- ocp-qt. ini checkbox- ocp-urwid. install: usr/share/ checkbox/ examples/ checkbox- ocp-urwid. ini checkbox. postinst: cp /usr/share/ checkbox/ examples/ network. cfg /etc/checkbox.d/ checkbox. postinst: cp /usr/share/ checkbox/ examples/ virtualization. cfg /etc/checkbox.d/
debian/
debian/
debian/
debian/
debian/
debian/
debian/
debian/
debian/
debian/
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!