1 | # -*- coding: utf-8 -*-
|
---|
2 | # $Id: testbox.py 52776 2014-09-17 14:51:43Z vboxsync $
|
---|
3 |
|
---|
4 | """
|
---|
5 | Test Manager - TestBox.
|
---|
6 | """
|
---|
7 |
|
---|
8 | __copyright__ = \
|
---|
9 | """
|
---|
10 | Copyright (C) 2012-2014 Oracle Corporation
|
---|
11 |
|
---|
12 | This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
13 | available from http://www.virtualbox.org. This file is free software;
|
---|
14 | you can redistribute it and/or modify it under the terms of the GNU
|
---|
15 | General Public License (GPL) as published by the Free Software
|
---|
16 | Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
17 | VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
18 | hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
19 |
|
---|
20 | The contents of this file may alternatively be used under the terms
|
---|
21 | of the Common Development and Distribution License Version 1.0
|
---|
22 | (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
23 | VirtualBox OSE distribution, in which case the provisions of the
|
---|
24 | CDDL are applicable instead of those of the GPL.
|
---|
25 |
|
---|
26 | You may elect to license modified versions of this file under the
|
---|
27 | terms and conditions of either the GPL or the CDDL or both.
|
---|
28 | """
|
---|
29 | __version__ = "$Revision: 52776 $"
|
---|
30 |
|
---|
31 |
|
---|
32 | # Standard python imports.
|
---|
33 | import unittest;
|
---|
34 |
|
---|
35 | # Validation Kit imports.
|
---|
36 | from testmanager.core.base import ModelDataBase, ModelDataBaseTestCase, ModelLogicBase, TMExceptionBase, \
|
---|
37 | ChangeLogEntry, AttributeChangeEntry;
|
---|
38 |
|
---|
39 |
|
---|
40 | # pylint: disable=C0103
|
---|
41 | class TestBoxData(ModelDataBase): # pylint: disable=R0902
|
---|
42 | """
|
---|
43 | TestBox Data.
|
---|
44 | """
|
---|
45 |
|
---|
46 | ## LomKind_T
|
---|
47 | ksLomKind_None = 'none';
|
---|
48 | ksLomKind_ILOM = 'ilom';
|
---|
49 | ksLomKind_ELOM = 'elom';
|
---|
50 | ksLomKind_AppleXserveLom = 'apple-xserver-lom';
|
---|
51 | kasLomKindValues = [ ksLomKind_None, ksLomKind_ILOM, ksLomKind_ELOM, ksLomKind_AppleXserveLom];
|
---|
52 | kaoLomKindDescs = \
|
---|
53 | [
|
---|
54 | ( ksLomKind_None, 'None', ''),
|
---|
55 | ( ksLomKind_ILOM, 'ILOM', ''),
|
---|
56 | ( ksLomKind_ELOM, 'ELOM', ''),
|
---|
57 | ( ksLomKind_AppleXserveLom, 'Apple Xserve LOM', ''),
|
---|
58 | ];
|
---|
59 |
|
---|
60 |
|
---|
61 | ## TestBoxCmd_T
|
---|
62 | ksTestBoxCmd_None = 'none';
|
---|
63 | ksTestBoxCmd_Abort = 'abort';
|
---|
64 | ksTestBoxCmd_Reboot = 'reboot';
|
---|
65 | ksTestBoxCmd_Upgrade = 'upgrade';
|
---|
66 | ksTestBoxCmd_UpgradeAndReboot = 'upgrade-and-reboot';
|
---|
67 | ksTestBoxCmd_Special = 'special';
|
---|
68 | kasTestBoxCmdValues = [ ksTestBoxCmd_None, ksTestBoxCmd_Abort, ksTestBoxCmd_Reboot, ksTestBoxCmd_Upgrade,
|
---|
69 | ksTestBoxCmd_UpgradeAndReboot, ksTestBoxCmd_Special];
|
---|
70 | kaoTestBoxCmdDescs = \
|
---|
71 | [
|
---|
72 | ( ksTestBoxCmd_None, 'None', ''),
|
---|
73 | ( ksTestBoxCmd_Abort, 'Abort current test', ''),
|
---|
74 | ( ksTestBoxCmd_Reboot, 'Reboot TestBox', ''),
|
---|
75 | ( ksTestBoxCmd_Upgrade, 'Upgrade TestBox Script', ''),
|
---|
76 | ( ksTestBoxCmd_UpgradeAndReboot, 'Upgrade TestBox Script and reboot', ''),
|
---|
77 | ( ksTestBoxCmd_Special, 'Special (reserved)', ''),
|
---|
78 | ];
|
---|
79 |
|
---|
80 |
|
---|
81 | ksIdAttr = 'idTestBox';
|
---|
82 | ksIdGenAttr = 'idGenTestBox';
|
---|
83 |
|
---|
84 | ksParam_idTestBox = 'TestBox_idTestBox';
|
---|
85 | ksParam_tsEffective = 'TestBox_tsEffective';
|
---|
86 | ksParam_tsExpire = 'TestBox_tsExpire';
|
---|
87 | ksParam_uidAuthor = 'TestBox_uidAuthor';
|
---|
88 | ksParam_idGenTestBox = 'TestBox_idGenTestBox';
|
---|
89 | ksParam_ip = 'TestBox_ip';
|
---|
90 | ksParam_uuidSystem = 'TestBox_uuidSystem';
|
---|
91 | ksParam_sName = 'TestBox_sName';
|
---|
92 | ksParam_sDescription = 'TestBox_sDescription';
|
---|
93 | ksParam_idSchedGroup = 'TestBox_idSchedGroup';
|
---|
94 | ksParam_fEnabled = 'TestBox_fEnabled';
|
---|
95 | ksParam_enmLomKind = 'TestBox_enmLomKind';
|
---|
96 | ksParam_ipLom = 'TestBox_ipLom';
|
---|
97 | ksParam_pctScaleTimeout = 'TestBox_pctScaleTimeout';
|
---|
98 | ksParam_sOs = 'TestBox_sOs';
|
---|
99 | ksParam_sOsVersion = 'TestBox_sOsVersion';
|
---|
100 | ksParam_sCpuVendor = 'TestBox_sCpuVendor';
|
---|
101 | ksParam_sCpuArch = 'TestBox_sCpuArch';
|
---|
102 | ksParam_sCpuName = 'TestBox_sCpuName';
|
---|
103 | ksParam_lCpuRevision = 'TestBox_lCpuRevision';
|
---|
104 | ksParam_cCpus = 'TestBox_cCpus';
|
---|
105 | ksParam_fCpuHwVirt = 'TestBox_fCpuHwVirt';
|
---|
106 | ksParam_fCpuNestedPaging = 'TestBox_fCpuNestedPaging';
|
---|
107 | ksParam_fCpu64BitGuest = 'TestBox_fCpu64BitGuest';
|
---|
108 | ksParam_fChipsetIoMmu = 'TestBox_fChipsetIoMmu';
|
---|
109 | ksParam_cMbMemory = 'TestBox_cMbMemory';
|
---|
110 | ksParam_cMbScratch = 'TestBox_cMbScratch';
|
---|
111 | ksParam_sReport = 'TestBox_sReport';
|
---|
112 | ksParam_iTestBoxScriptRev = 'TestBox_iTestBoxScriptRev';
|
---|
113 | ksParam_iPythonHexVersion = 'TestBox_iPythonHexVersion';
|
---|
114 | ksParam_enmPendingCmd = 'TestBox_enmPendingCmd';
|
---|
115 |
|
---|
116 | kasAllowNullAttributes = ['idTestBox', 'tsEffective', 'tsExpire', 'uidAuthor', 'idGenTestBox', 'sDescription',
|
---|
117 | 'ipLom', 'sOs', 'sOsVersion', 'sCpuVendor', 'sCpuArch', 'sCpuName', 'lCpuRevision', 'cCpus',
|
---|
118 | 'fCpuHwVirt', 'fCpuNestedPaging', 'fCpu64BitGuest', 'fChipsetIoMmu', 'cMbMemory',
|
---|
119 | 'cMbScratch', 'sReport', 'iTestBoxScriptRev', 'iPythonHexVersion' ];
|
---|
120 | kasValidValues_enmLomKind = kasLomKindValues;
|
---|
121 | kasValidValues_enmPendingCmd = kasTestBoxCmdValues;
|
---|
122 | kiMin_pctScaleTimeout = 11;
|
---|
123 | kiMax_pctScaleTimeout = 19999;
|
---|
124 | kcchMax_sReport = 65535;
|
---|
125 |
|
---|
126 |
|
---|
127 | def __init__(self):
|
---|
128 | ModelDataBase.__init__(self);
|
---|
129 |
|
---|
130 | #
|
---|
131 | # Initialize with defaults.
|
---|
132 | # See the database for explanations of each of these fields.
|
---|
133 | #
|
---|
134 | self.idTestBox = None;
|
---|
135 | self.tsEffective = None;
|
---|
136 | self.tsExpire = None;
|
---|
137 | self.uidAuthor = None;
|
---|
138 | self.idGenTestBox = None;
|
---|
139 | self.ip = None;
|
---|
140 | self.uuidSystem = None;
|
---|
141 | self.sName = None;
|
---|
142 | self.sDescription = None;
|
---|
143 | self.idSchedGroup = 1;
|
---|
144 | self.fEnabled = False;
|
---|
145 | self.enmLomKind = self.ksLomKind_None;
|
---|
146 | self.ipLom = None;
|
---|
147 | self.pctScaleTimeout = 100;
|
---|
148 | self.sOs = None;
|
---|
149 | self.sOsVersion = None;
|
---|
150 | self.sCpuVendor = None;
|
---|
151 | self.sCpuArch = None;
|
---|
152 | self.sCpuName = None;
|
---|
153 | self.lCpuRevision = None;
|
---|
154 | self.cCpus = 1;
|
---|
155 | self.fCpuHwVirt = False;
|
---|
156 | self.fCpuNestedPaging = False;
|
---|
157 | self.fCpu64BitGuest = False;
|
---|
158 | self.fChipsetIoMmu = False;
|
---|
159 | self.cMbMemory = 1;
|
---|
160 | self.cMbScratch = 0;
|
---|
161 | self.sReport = None;
|
---|
162 | self.iTestBoxScriptRev = 0;
|
---|
163 | self.iPythonHexVersion = 0;
|
---|
164 | self.enmPendingCmd = self.ksTestBoxCmd_None;
|
---|
165 |
|
---|
166 | def initFromDbRow(self, aoRow):
|
---|
167 | """
|
---|
168 | Internal worker for initFromDbWithId and initFromDbWithGenId as well as
|
---|
169 | from TestBoxLogic. Expecting a SELECT * FROM TestBoxes result.
|
---|
170 | """
|
---|
171 |
|
---|
172 | if aoRow is None:
|
---|
173 | raise TMExceptionBase('TestBox not found.');
|
---|
174 |
|
---|
175 | self.idTestBox = aoRow[0];
|
---|
176 | self.tsEffective = aoRow[1];
|
---|
177 | self.tsExpire = aoRow[2];
|
---|
178 | self.uidAuthor = aoRow[3];
|
---|
179 | self.idGenTestBox = aoRow[4];
|
---|
180 | self.ip = aoRow[5];
|
---|
181 | self.uuidSystem = aoRow[6];
|
---|
182 | self.sName = aoRow[7];
|
---|
183 | self.sDescription = aoRow[8];
|
---|
184 | self.idSchedGroup = aoRow[9];
|
---|
185 | self.fEnabled = aoRow[10];
|
---|
186 | self.enmLomKind = aoRow[11];
|
---|
187 | self.ipLom = aoRow[12];
|
---|
188 | self.pctScaleTimeout = aoRow[13];
|
---|
189 | self.sOs = aoRow[14];
|
---|
190 | self.sOsVersion = aoRow[15];
|
---|
191 | self.sCpuVendor = aoRow[16];
|
---|
192 | self.sCpuArch = aoRow[17];
|
---|
193 | self.sCpuName = aoRow[18];
|
---|
194 | self.lCpuRevision = aoRow[19];
|
---|
195 | self.cCpus = aoRow[20];
|
---|
196 | self.fCpuHwVirt = aoRow[21];
|
---|
197 | self.fCpuNestedPaging = aoRow[22];
|
---|
198 | self.fCpu64BitGuest = aoRow[23];
|
---|
199 | self.fChipsetIoMmu = aoRow[24];
|
---|
200 | self.cMbMemory = aoRow[25];
|
---|
201 | self.cMbScratch = aoRow[26];
|
---|
202 | self.sReport = aoRow[27];
|
---|
203 | self.iTestBoxScriptRev = aoRow[28];
|
---|
204 | self.iPythonHexVersion = aoRow[29];
|
---|
205 | self.enmPendingCmd = aoRow[30];
|
---|
206 | return self;
|
---|
207 |
|
---|
208 | def initFromDbWithId(self, oDb, idTestBox, tsNow = None, sPeriodBack = None):
|
---|
209 | """
|
---|
210 | Initialize the object from the database.
|
---|
211 | """
|
---|
212 | oDb.execute(self.formatSimpleNowAndPeriodQuery(oDb,
|
---|
213 | 'SELECT *\n'
|
---|
214 | 'FROM TestBoxes\n'
|
---|
215 | 'WHERE idTestBox = %s\n'
|
---|
216 | , ( idTestBox, ), tsNow, sPeriodBack));
|
---|
217 | aoRow = oDb.fetchOne()
|
---|
218 | if aoRow is None:
|
---|
219 | raise TMExceptionBase('idTestBox=%s not found (tsNow=%s sPeriodBack=%s)' % (idTestBox, tsNow, sPeriodBack,));
|
---|
220 | return self.initFromDbRow(aoRow);
|
---|
221 |
|
---|
222 | def initFromDbWithGenId(self, oDb, idGenTestBox):
|
---|
223 | """
|
---|
224 | Initialize the object from the database.
|
---|
225 | """
|
---|
226 | oDb.execute('SELECT *\n'
|
---|
227 | 'FROM TestBoxes\n'
|
---|
228 | 'WHERE idGenTestBox = %s\n'
|
---|
229 | , (idGenTestBox, ) );
|
---|
230 | return self.initFromDbRow(oDb.fetchOne());
|
---|
231 |
|
---|
232 | def _validateAndConvertWorker(self, asAllowNullAttributes, oDb):
|
---|
233 | # Override to do extra ipLom checks.
|
---|
234 | dErrors = ModelDataBase._validateAndConvertWorker(self, asAllowNullAttributes, oDb);
|
---|
235 | if self.ksParam_ipLom not in dErrors \
|
---|
236 | and self.ksParam_enmLomKind not in dErrors \
|
---|
237 | and self.enmLomKind != self.ksLomKind_None \
|
---|
238 | and self.ipLom is None:
|
---|
239 | dErrors[self.ksParam_ipLom] = 'Light-out-management IP is mandatory and a LOM is selected.'
|
---|
240 | return dErrors;
|
---|
241 |
|
---|
242 | def formatPythonVersion(self):
|
---|
243 | """
|
---|
244 | Unbuttons the version number and formats it as a version string.
|
---|
245 | """
|
---|
246 | if self.iPythonHexVersion is None:
|
---|
247 | return 'N/A';
|
---|
248 | return 'v%d.%d.%d.%d' \
|
---|
249 | % ( self.iPythonHexVersion >> 24,
|
---|
250 | (self.iPythonHexVersion >> 16) & 0xff,
|
---|
251 | (self.iPythonHexVersion >> 8) & 0xff,
|
---|
252 | self.iPythonHexVersion & 0xff);
|
---|
253 |
|
---|
254 | def getCpuFamily(self):
|
---|
255 | """ Returns the CPU family for a x86 or amd64 testboxes."""
|
---|
256 | if self.lCpuRevision is None:
|
---|
257 | return 0;
|
---|
258 | return (self.lCpuRevision >> 24 & 0xff);
|
---|
259 |
|
---|
260 | def getCpuModel(self):
|
---|
261 | """ Returns the CPU model for a x86 or amd64 testboxes."""
|
---|
262 | if self.lCpuRevision is None:
|
---|
263 | return 0;
|
---|
264 | return (self.lCpuRevision >> 8 & 0xffff);
|
---|
265 |
|
---|
266 | def getCpuStepping(self):
|
---|
267 | """ Returns the CPU stepping for a x86 or amd64 testboxes."""
|
---|
268 | if self.lCpuRevision is None:
|
---|
269 | return 0;
|
---|
270 | return (self.lCpuRevision & 0xff);
|
---|
271 |
|
---|
272 |
|
---|
273 | class TestBoxLogic(ModelLogicBase):
|
---|
274 | """
|
---|
275 | TestBox logic.
|
---|
276 | """
|
---|
277 |
|
---|
278 |
|
---|
279 | def __init__(self, oDb):
|
---|
280 | ModelLogicBase.__init__(self, oDb);
|
---|
281 |
|
---|
282 | def tryFetchTestBoxByUuid(self, sTestBoxUuid):
|
---|
283 | """
|
---|
284 | Tries to fetch a testbox by its UUID alone.
|
---|
285 | """
|
---|
286 | self._oDb.execute('SELECT *\n'
|
---|
287 | 'FROM TestBoxes\n'
|
---|
288 | 'WHERE uuidSystem = %s\n'
|
---|
289 | ' AND tsExpire = \'infinity\'::timestamp\n'
|
---|
290 | 'ORDER BY tsEffective DESC\n',
|
---|
291 | (sTestBoxUuid,));
|
---|
292 | if self._oDb.getRowCount() == 0:
|
---|
293 | return None;
|
---|
294 | if self._oDb.getRowCount() != 1:
|
---|
295 | raise TMExceptionBase('Database integrity error: %u hits' % (self._oDb.getRowCount(),));
|
---|
296 | oData = TestBoxData();
|
---|
297 | oData.initFromDbRow(self._oDb.fetchOne());
|
---|
298 | return oData;
|
---|
299 |
|
---|
300 | def fetchForListing(self, iStart, cMaxRows, tsNow):
|
---|
301 | """
|
---|
302 | Fetches testboxes for listing.
|
---|
303 |
|
---|
304 | Returns an array (list) of TestBoxData items, empty list if none. The
|
---|
305 | TestBoxData instances have an extra oStatus member that is either None or
|
---|
306 | a TestBoxStatusData instance, and a member tsCurrent holding
|
---|
307 | CURRENT_TIMESTAMP.
|
---|
308 |
|
---|
309 | Raises exception on error.
|
---|
310 | """
|
---|
311 | from testmanager.core.testboxstatus import TestBoxStatusData;
|
---|
312 |
|
---|
313 | if tsNow is None:
|
---|
314 | self._oDb.execute('SELECT TestBoxes.*, TestBoxStatuses.*\n'
|
---|
315 | 'FROM TestBoxes\n'
|
---|
316 | 'LEFT OUTER JOIN TestBoxStatuses ON (\n'
|
---|
317 | ' TestBoxStatuses.idTestBox = TestBoxes.idTestBox )\n'
|
---|
318 | 'WHERE tsExpire = \'infinity\'::TIMESTAMP\n'
|
---|
319 | 'ORDER BY sName\n'
|
---|
320 | 'LIMIT %s OFFSET %s\n'
|
---|
321 | , (cMaxRows, iStart,));
|
---|
322 | else:
|
---|
323 | self._oDb.execute('SELECT TestBoxes.*, TestBoxStatuses.*\n'
|
---|
324 | 'FROM TestBoxes\n'
|
---|
325 | 'LEFT OUTER JOIN TestBoxStatuses ON (\n'
|
---|
326 | ' TestBoxStatuses.idTestBox = TestBoxes.idTestBox )\n'
|
---|
327 | 'WHERE tsExpire > %s\n'
|
---|
328 | ' AND tsEffective <= %s\n'
|
---|
329 | 'ORDER BY sName\n'
|
---|
330 | 'LIMIT %s OFFSET %s\n'
|
---|
331 | , (tsNow, tsNow, cMaxRows, iStart,));
|
---|
332 |
|
---|
333 | aoRows = [];
|
---|
334 | for aoOne in self._oDb.fetchAll():
|
---|
335 | oTestBox = TestBoxData().initFromDbRow(aoOne);
|
---|
336 | oTestBox.tsCurrent = self._oDb.getCurrentTimestamp(); # pylint: disable=W0201
|
---|
337 | oTestBox.oStatus = None; # pylint: disable=W0201
|
---|
338 | if aoOne[31] is not None:
|
---|
339 | oTestBox.oStatus = TestBoxStatusData().initFromDbRow(aoOne[31:]); # pylint: disable=W0201
|
---|
340 | aoRows.append(oTestBox);
|
---|
341 | return aoRows;
|
---|
342 |
|
---|
343 | def fetchForChangeLog(self, idTestBox, iStart, cMaxRows, tsNow): # pylint: disable=R0914
|
---|
344 | """
|
---|
345 | Fetches change log entries for a testbox.
|
---|
346 |
|
---|
347 | Returns an array of ChangeLogEntry instance and an indicator whether
|
---|
348 | there are more entries.
|
---|
349 | Raises exception on error.
|
---|
350 | """
|
---|
351 |
|
---|
352 | if tsNow is None:
|
---|
353 | tsNow = self._oDb.getCurrentTimestamp();
|
---|
354 |
|
---|
355 | self._oDb.execute('SELECT TestBoxes.*, Users.sUsername\n'
|
---|
356 | 'FROM TestBoxes\n'
|
---|
357 | 'LEFT OUTER JOIN Users \n'
|
---|
358 | ' ON ( TestBoxes.uidAuthor = Users.uid\n'
|
---|
359 | ' AND Users.tsEffective <= TestBoxes.tsEffective\n'
|
---|
360 | ' AND Users.tsExpire > TestBoxes.tsEffective)\n'
|
---|
361 | 'WHERE TestBoxes.tsEffective <= %s\n'
|
---|
362 | ' AND TestBoxes.idTestBox = %s\n'
|
---|
363 | 'ORDER BY TestBoxes.tsExpire DESC\n'
|
---|
364 | 'LIMIT %s OFFSET %s\n'
|
---|
365 | , (tsNow, idTestBox, cMaxRows + 1, iStart,));
|
---|
366 |
|
---|
367 | aoRows = [];
|
---|
368 | for _ in range(self._oDb.getRowCount()):
|
---|
369 | oRow = self._oDb.fetchOne();
|
---|
370 | aoRows.append([TestBoxData().initFromDbRow(oRow), oRow[-1],]);
|
---|
371 |
|
---|
372 | # Calculate the changes.
|
---|
373 | aoEntries = [];
|
---|
374 | for i in range(0, len(aoRows) - 1):
|
---|
375 | (oNew, sAuthor) = aoRows[i];
|
---|
376 | (oOld, _ ) = aoRows[i + 1];
|
---|
377 | aoChanges = [];
|
---|
378 | for sAttr in oNew.getDataAttributes():
|
---|
379 | if sAttr not in [ 'tsEffective', 'tsExpire', 'uidAuthor']:
|
---|
380 | oOldAttr = getattr(oOld, sAttr);
|
---|
381 | oNewAttr = getattr(oNew, sAttr);
|
---|
382 | if oOldAttr != oNewAttr:
|
---|
383 | aoChanges.append(AttributeChangeEntry(sAttr, oNewAttr, oOldAttr, str(oNewAttr), str(oOldAttr)));
|
---|
384 | aoEntries.append(ChangeLogEntry(oNew.uidAuthor, sAuthor, oNew.tsEffective, oNew.tsExpire, oNew, oOld, aoChanges));
|
---|
385 |
|
---|
386 | # If we're at the end of the log, add the initial entry.
|
---|
387 | if len(aoRows) <= cMaxRows and len(aoRows) > 0:
|
---|
388 | (oNew, sAuthor) = aoRows[-1];
|
---|
389 | aoEntries.append(ChangeLogEntry(oNew.uidAuthor, aoRows[-1][1], oNew.tsEffective, oNew.tsExpire, oNew, None, []));
|
---|
390 |
|
---|
391 | return (aoEntries, len(aoRows) > cMaxRows);
|
---|
392 |
|
---|
393 | def addEntry(self, oData, uidAuthor, fCommit = False):
|
---|
394 | """
|
---|
395 | Creates a testbox in the database.
|
---|
396 | Returns the testbox ID, testbox generation ID and effective timestamp
|
---|
397 | of the created testbox on success. Throws error on failure.
|
---|
398 | """
|
---|
399 | dDataErrors = oData.validateAndConvert(self._oDb);
|
---|
400 | if len(dDataErrors) > 0:
|
---|
401 | raise TMExceptionBase('Invalid data passed to create(): %s' % (dDataErrors,));
|
---|
402 |
|
---|
403 | self._oDb.execute('INSERT INTO TestBoxes (\n'
|
---|
404 | ' idTestBox,\n'
|
---|
405 | ' tsEffective,\n'
|
---|
406 | ' tsExpire,\n'
|
---|
407 | ' uidAuthor,\n'
|
---|
408 | ' idGenTestBox,\n'
|
---|
409 | ' ip,\n'
|
---|
410 | ' uuidSystem,\n'
|
---|
411 | ' sName,\n'
|
---|
412 | ' sDescription,\n'
|
---|
413 | ' idSchedGroup,\n'
|
---|
414 | ' fEnabled,\n'
|
---|
415 | ' enmLomKind,\n'
|
---|
416 | ' ipLom,\n'
|
---|
417 | ' pctScaleTimeout,\n'
|
---|
418 | ' sOs,\n'
|
---|
419 | ' sOsVersion,\n'
|
---|
420 | ' sCpuVendor,\n'
|
---|
421 | ' sCpuArch,\n'
|
---|
422 | ' sCpuName,\n'
|
---|
423 | ' lCpuRevision,\n'
|
---|
424 | ' cCpus,\n'
|
---|
425 | ' fCpuHwVirt,\n'
|
---|
426 | ' fCpuNestedPaging,\n'
|
---|
427 | ' fCpu64BitGuest,\n'
|
---|
428 | ' fChipsetIoMmu,\n'
|
---|
429 | ' cMbMemory,\n'
|
---|
430 | ' cMbScratch,\n'
|
---|
431 | ' sReport,\n'
|
---|
432 | ' iTestBoxScriptRev,\n'
|
---|
433 | ' iPythonHexVersion,\n'
|
---|
434 | ' enmPendingCmd\n'
|
---|
435 | ' )'
|
---|
436 | 'VALUES (\n'
|
---|
437 | ' DEFAULT,\n'
|
---|
438 | ' CURRENT_TIMESTAMP,\n'
|
---|
439 | ' DEFAULT,\n'
|
---|
440 | ' %s,\n' # uidAuthor
|
---|
441 | ' DEFAULT,\n'
|
---|
442 | ' %s,\n' # ip
|
---|
443 | ' %s,\n' # uuidSystem
|
---|
444 | ' %s,\n' # sName
|
---|
445 | ' %s,\n' # sDescription
|
---|
446 | ' %s,\n' # idSchedGroup
|
---|
447 | ' %s,\n' # fEnabled
|
---|
448 | ' %s,\n' # enmLomKind
|
---|
449 | ' %s,\n' # ipLom
|
---|
450 | ' %s,\n' # pctScaleTimeout
|
---|
451 | ' %s,\n' # sOs
|
---|
452 | ' %s,\n' # sOsVersion
|
---|
453 | ' %s,\n' # sCpuVendor
|
---|
454 | ' %s,\n' # sCpuArch
|
---|
455 | ' %s,\n' # sCpuName
|
---|
456 | ' %s,\n' # lCpuRevision
|
---|
457 | ' %s,\n' # cCpus
|
---|
458 | ' %s,\n' # fCpuHwVirt
|
---|
459 | ' %s,\n' # fCpuNestedPaging
|
---|
460 | ' %s,\n' # fCpu64BitGuest
|
---|
461 | ' %s,\n' # fChipsetIoMmu
|
---|
462 | ' %s,\n' # cMbMemory
|
---|
463 | ' %s,\n' # cMbScratch
|
---|
464 | ' %s,\n' # sReport
|
---|
465 | ' %s,\n' # iTestBoxScriptRev
|
---|
466 | ' %s,\n' # iPythonHexVersion
|
---|
467 | ' %s\n' # enmPendingCmd
|
---|
468 | ' )\n'
|
---|
469 | 'RETURNING idTestBox, idGenTestBox, tsEffective'
|
---|
470 | , (uidAuthor,
|
---|
471 | oData.ip,
|
---|
472 | oData.uuidSystem,
|
---|
473 | oData.sName,
|
---|
474 | oData.sDescription,
|
---|
475 | oData.idSchedGroup,
|
---|
476 | oData.fEnabled,
|
---|
477 | oData.enmLomKind,
|
---|
478 | oData.ipLom,
|
---|
479 | oData.pctScaleTimeout,
|
---|
480 | oData.sOs,
|
---|
481 | oData.sOsVersion,
|
---|
482 | oData.sCpuVendor,
|
---|
483 | oData.sCpuArch,
|
---|
484 | oData.sCpuName,
|
---|
485 | oData.lCpuRevision,
|
---|
486 | oData.cCpus,
|
---|
487 | oData.fCpuHwVirt,
|
---|
488 | oData.fCpuNestedPaging,
|
---|
489 | oData.fCpu64BitGuest,
|
---|
490 | oData.fChipsetIoMmu,
|
---|
491 | oData.cMbMemory,
|
---|
492 | oData.cMbScratch,
|
---|
493 | oData.sReport,
|
---|
494 | oData.iTestBoxScriptRev,
|
---|
495 | oData.iPythonHexVersion,
|
---|
496 | oData.enmPendingCmd
|
---|
497 | )
|
---|
498 | );
|
---|
499 | oRow = self._oDb.fetchOne();
|
---|
500 | self._oDb.maybeCommit(fCommit);
|
---|
501 | return (oRow[0], oRow[1], oRow[2]);
|
---|
502 |
|
---|
503 | def editEntry(self, oData, uidAuthor, fCommit = False):
|
---|
504 | """
|
---|
505 | Data edit update, web UI is the primary user.
|
---|
506 | Returns the new generation ID and effective date.
|
---|
507 | """
|
---|
508 |
|
---|
509 | dDataErrors = oData.validateAndConvert(self._oDb);
|
---|
510 | if len(dDataErrors) > 0:
|
---|
511 | raise TMExceptionBase('Invalid data passed to create(): %s' % (dDataErrors,));
|
---|
512 |
|
---|
513 | ## @todo check if the data changed.
|
---|
514 |
|
---|
515 | self._oDb.execute('UPDATE ONLY TestBoxes\n'
|
---|
516 | 'SET tsExpire = CURRENT_TIMESTAMP\n'
|
---|
517 | 'WHERE idGenTestBox = %s\n'
|
---|
518 | ' AND tsExpire = \'infinity\'::timestamp\n'
|
---|
519 | 'RETURNING tsExpire\n',
|
---|
520 | (oData.idGenTestBox,));
|
---|
521 | try:
|
---|
522 | tsEffective = self._oDb.fetchOne()[0];
|
---|
523 |
|
---|
524 | # Would be easier to do this using an insert or update hook, I think. Much easier.
|
---|
525 | self._oDb.execute('INSERT INTO TestBoxes (\n'
|
---|
526 | ' idGenTestBox,\n'
|
---|
527 | ' idTestBox,\n'
|
---|
528 | ' tsEffective,\n'
|
---|
529 | ' uidAuthor,\n'
|
---|
530 | ' ip,\n'
|
---|
531 | ' uuidSystem,\n'
|
---|
532 | ' sName,\n'
|
---|
533 | ' sDescription,\n'
|
---|
534 | ' idSchedGroup,\n'
|
---|
535 | ' fEnabled,\n'
|
---|
536 | ' enmLomKind,\n'
|
---|
537 | ' ipLom,\n'
|
---|
538 | ' pctScaleTimeout,\n'
|
---|
539 | ' sOs,\n'
|
---|
540 | ' sOsVersion,\n'
|
---|
541 | ' sCpuVendor,\n'
|
---|
542 | ' sCpuArch,\n'
|
---|
543 | ' sCpuName,\n'
|
---|
544 | ' lCpuRevision,\n'
|
---|
545 | ' cCpus,\n'
|
---|
546 | ' fCpuHwVirt,\n'
|
---|
547 | ' fCpuNestedPaging,\n'
|
---|
548 | ' fCpu64BitGuest,\n'
|
---|
549 | ' fChipsetIoMmu,\n'
|
---|
550 | ' cMbMemory,\n'
|
---|
551 | ' cMbScratch,\n'
|
---|
552 | ' iTestBoxScriptRev,\n'
|
---|
553 | ' iPythonHexVersion,\n'
|
---|
554 | ' enmPendingCmd\n'
|
---|
555 | ' )\n'
|
---|
556 | 'SELECT NEXTVAL(\'TestBoxGenIdSeq\'),\n'
|
---|
557 | ' idTestBox,\n'
|
---|
558 | ' %s,\n' # tsEffective
|
---|
559 | ' %s,\n' # uidAuthor
|
---|
560 | ' %s,\n' # ip
|
---|
561 | ' %s,\n' # uuidSystem
|
---|
562 | ' %s,\n' # sName
|
---|
563 | ' %s,\n' # sDescription
|
---|
564 | ' %s,\n' # idSchedGroup
|
---|
565 | ' %s,\n' # fEnabled
|
---|
566 | ' %s,\n' # enmLomKind
|
---|
567 | ' %s,\n' # ipLom
|
---|
568 | ' %s,\n' # pctScaleTimeout
|
---|
569 | ' sOs,\n'
|
---|
570 | ' sOsVersion,\n'
|
---|
571 | ' sCpuVendor,\n'
|
---|
572 | ' sCpuArch,\n'
|
---|
573 | ' sCpuName,\n'
|
---|
574 | ' lCpuRevision,\n'
|
---|
575 | ' cCpus,\n'
|
---|
576 | ' fCpuHwVirt,\n'
|
---|
577 | ' fCpuNestedPaging,\n'
|
---|
578 | ' fCpu64BitGuest,\n'
|
---|
579 | ' fChipsetIoMmu,\n'
|
---|
580 | ' cMbMemory,\n'
|
---|
581 | ' cMbScratch,\n'
|
---|
582 | ' iTestBoxScriptRev,\n'
|
---|
583 | ' iPythonHexVersion,\n'
|
---|
584 | ' %s\n' # enmPendingCmd
|
---|
585 | 'FROM TestBoxes\n'
|
---|
586 | 'WHERE idGenTestBox = %s\n'
|
---|
587 | 'RETURNING idGenTestBox, tsEffective'
|
---|
588 | , (tsEffective,
|
---|
589 | uidAuthor,
|
---|
590 | oData.ip,
|
---|
591 | oData.uuidSystem,
|
---|
592 | oData.sName,
|
---|
593 | oData.sDescription,
|
---|
594 | oData.idSchedGroup,
|
---|
595 | oData.fEnabled,
|
---|
596 | oData.enmLomKind,
|
---|
597 | oData.ipLom,
|
---|
598 | oData.pctScaleTimeout,
|
---|
599 | oData.enmPendingCmd,
|
---|
600 | oData.idGenTestBox,
|
---|
601 | ));
|
---|
602 | aRow = self._oDb.fetchOne();
|
---|
603 | if aRow is None:
|
---|
604 | raise TMExceptionBase('Insert failed? oRow=None');
|
---|
605 | idGenTestBox = aRow[0];
|
---|
606 | tsEffective = aRow[1];
|
---|
607 | self._oDb.maybeCommit(fCommit);
|
---|
608 | except:
|
---|
609 | self._oDb.rollback();
|
---|
610 | raise;
|
---|
611 |
|
---|
612 | return (idGenTestBox, tsEffective);
|
---|
613 |
|
---|
614 | def updateOnSignOn(self, idTestBox, idGenTestBox, sTestBoxAddr, sOs, sOsVersion, # pylint: disable=R0913,R0914
|
---|
615 | sCpuVendor, sCpuArch, sCpuName, lCpuRevision, cCpus, fCpuHwVirt, fCpuNestedPaging, fCpu64BitGuest,
|
---|
616 | fChipsetIoMmu, cMbMemory, cMbScratch, sReport, iTestBoxScriptRev, iPythonHexVersion):
|
---|
617 | """
|
---|
618 | Update the testbox attributes automatically on behalf of the testbox script.
|
---|
619 | Returns the new generation id on success, raises an exception on failure.
|
---|
620 | """
|
---|
621 | try:
|
---|
622 | # Would be easier to do this using an insert or update hook, I think. Much easier.
|
---|
623 | self._oDb.execute('UPDATE ONLY TestBoxes\n'
|
---|
624 | 'SET tsExpire = CURRENT_TIMESTAMP\n'
|
---|
625 | 'WHERE idGenTestBox = %s\n'
|
---|
626 | ' AND tsExpire = \'infinity\'::timestamp\n'
|
---|
627 | 'RETURNING tsExpire\n',
|
---|
628 | (idGenTestBox,));
|
---|
629 | tsEffective = self._oDb.fetchOne()[0];
|
---|
630 |
|
---|
631 | self._oDb.execute('INSERT INTO TestBoxes (\n'
|
---|
632 | ' idGenTestBox,\n'
|
---|
633 | ' idTestBox,\n'
|
---|
634 | ' tsEffective,\n'
|
---|
635 | ' uidAuthor,\n'
|
---|
636 | ' ip,\n'
|
---|
637 | ' uuidSystem,\n'
|
---|
638 | ' sName,\n'
|
---|
639 | ' sDescription,\n'
|
---|
640 | ' idSchedGroup,\n'
|
---|
641 | ' fEnabled,\n'
|
---|
642 | ' enmLomKind,\n'
|
---|
643 | ' ipLom,\n'
|
---|
644 | ' pctScaleTimeout,\n'
|
---|
645 | ' sOs,\n'
|
---|
646 | ' sOsVersion,\n'
|
---|
647 | ' sCpuVendor,\n'
|
---|
648 | ' sCpuArch,\n'
|
---|
649 | ' sCpuName,\n'
|
---|
650 | ' lCpuRevision,\n'
|
---|
651 | ' cCpus,\n'
|
---|
652 | ' fCpuHwVirt,\n'
|
---|
653 | ' fCpuNestedPaging,\n'
|
---|
654 | ' fCpu64BitGuest,\n'
|
---|
655 | ' fChipsetIoMmu,\n'
|
---|
656 | ' cMbMemory,\n'
|
---|
657 | ' cMbScratch,\n'
|
---|
658 | ' sReport,\n'
|
---|
659 | ' iTestBoxScriptRev,\n'
|
---|
660 | ' iPythonHexVersion,\n'
|
---|
661 | ' enmPendingCmd\n'
|
---|
662 | ' )\n'
|
---|
663 | 'SELECT NEXTVAL(\'TestBoxGenIdSeq\'),\n'
|
---|
664 | ' %s,\n'
|
---|
665 | ' %s,\n'
|
---|
666 | ' NULL,\n' # uidAuthor
|
---|
667 | ' %s,\n'
|
---|
668 | ' uuidSystem,\n'
|
---|
669 | ' sName,\n'
|
---|
670 | ' sDescription,\n'
|
---|
671 | ' idSchedGroup,\n'
|
---|
672 | ' fEnabled,\n'
|
---|
673 | ' enmLomKind,\n'
|
---|
674 | ' ipLom,\n'
|
---|
675 | ' pctScaleTimeout,\n'
|
---|
676 | ' %s,\n' # sOs
|
---|
677 | ' %s,\n' # sOsVersion
|
---|
678 | ' %s,\n' # sCpuVendor
|
---|
679 | ' %s,\n' # sCpuArch
|
---|
680 | ' %s,\n' # sCpuName
|
---|
681 | ' %s,\n' # lCpuRevision
|
---|
682 | ' %s,\n' # cCpus
|
---|
683 | ' %s,\n' # fCpuHwVirt
|
---|
684 | ' %s,\n' # fCpuNestedPaging
|
---|
685 | ' %s,\n' # fCpu64BitGuest
|
---|
686 | ' %s,\n' # fChipsetIoMmu
|
---|
687 | ' %s,\n' # cMbMemory
|
---|
688 | ' %s,\n' # cMbScratch
|
---|
689 | ' %s,\n' # sReport
|
---|
690 | ' %s,\n' # iTestBoxScriptRev
|
---|
691 | ' %s,\n' # iPythonHexVersion
|
---|
692 | ' enmPendingCmd\n'
|
---|
693 | 'FROM TestBoxes\n'
|
---|
694 | 'WHERE idGenTestBox = %s\n'
|
---|
695 | 'RETURNING idGenTestBox'
|
---|
696 | , (idTestBox,
|
---|
697 | tsEffective,
|
---|
698 | sTestBoxAddr,
|
---|
699 | sOs,
|
---|
700 | sOsVersion,
|
---|
701 | sCpuVendor,
|
---|
702 | sCpuArch,
|
---|
703 | sCpuName,
|
---|
704 | lCpuRevision,
|
---|
705 | cCpus,
|
---|
706 | fCpuHwVirt,
|
---|
707 | fCpuNestedPaging,
|
---|
708 | fCpu64BitGuest,
|
---|
709 | fChipsetIoMmu,
|
---|
710 | cMbMemory,
|
---|
711 | cMbScratch,
|
---|
712 | sReport,
|
---|
713 | iTestBoxScriptRev,
|
---|
714 | iPythonHexVersion,
|
---|
715 | idGenTestBox,
|
---|
716 | ));
|
---|
717 | idGenTestBox = self._oDb.fetchOne()[0];
|
---|
718 | self._oDb.commit();
|
---|
719 | except:
|
---|
720 | self._oDb.rollback();
|
---|
721 | raise;
|
---|
722 |
|
---|
723 | return idGenTestBox;
|
---|
724 |
|
---|
725 | def setCommand(self, idTestBox, sOldCommand, sNewCommand, uidAuthor = None, fCommit = False):
|
---|
726 | """
|
---|
727 | Sets or resets the pending command on a testbox.
|
---|
728 | Returns (idGenTestBox, tsEffective) of the new row.
|
---|
729 | """
|
---|
730 | try:
|
---|
731 | # Would be easier to do this using an insert or update hook, I think. Much easier.
|
---|
732 | self._oDb.execute('UPDATE ONLY TestBoxes\n'
|
---|
733 | 'SET tsExpire = CURRENT_TIMESTAMP\n'
|
---|
734 | 'WHERE idTestBox = %s\n'
|
---|
735 | ' AND tsExpire = \'infinity\'::timestamp\n'
|
---|
736 | ' AND enmPendingCmd = %s\n'
|
---|
737 | 'RETURNING tsExpire\n',
|
---|
738 | (idTestBox, sOldCommand,));
|
---|
739 | tsEffective = self._oDb.fetchOne()[0];
|
---|
740 |
|
---|
741 | self._oDb.execute('INSERT INTO TestBoxes (\n'
|
---|
742 | ' idGenTestBox,\n'
|
---|
743 | ' idTestBox,\n'
|
---|
744 | ' tsEffective,\n'
|
---|
745 | ' uidAuthor,\n'
|
---|
746 | ' ip,\n'
|
---|
747 | ' uuidSystem,\n'
|
---|
748 | ' sName,\n'
|
---|
749 | ' sDescription,\n'
|
---|
750 | ' idSchedGroup,\n'
|
---|
751 | ' fEnabled,\n'
|
---|
752 | ' enmLomKind,\n'
|
---|
753 | ' ipLom,\n'
|
---|
754 | ' pctScaleTimeout,\n'
|
---|
755 | ' sOs,\n'
|
---|
756 | ' sOsVersion,\n'
|
---|
757 | ' sCpuVendor,\n'
|
---|
758 | ' sCpuArch,\n'
|
---|
759 | ' sCpuName,\n'
|
---|
760 | ' lCpuRevision,\n'
|
---|
761 | ' cCpus,\n'
|
---|
762 | ' fCpuHwVirt,\n'
|
---|
763 | ' fCpuNestedPaging,\n'
|
---|
764 | ' fCpu64BitGuest,\n'
|
---|
765 | ' fChipsetIoMmu,\n'
|
---|
766 | ' cMbMemory,\n'
|
---|
767 | ' cMbScratch,\n'
|
---|
768 | ' sReport,\n'
|
---|
769 | ' iTestBoxScriptRev,\n'
|
---|
770 | ' iPythonHexVersion,\n'
|
---|
771 | ' enmPendingCmd\n'
|
---|
772 | ' )\n'
|
---|
773 | 'SELECT NEXTVAL(\'TestBoxGenIdSeq\'),\n'
|
---|
774 | ' %s,\n' # idTestBox
|
---|
775 | ' %s,\n' # tsEffective
|
---|
776 | ' %s,\n' # uidAuthor
|
---|
777 | ' ip,\n'
|
---|
778 | ' uuidSystem,\n'
|
---|
779 | ' sName,\n'
|
---|
780 | ' sDescription,\n'
|
---|
781 | ' idSchedGroup,\n'
|
---|
782 | ' fEnabled,\n'
|
---|
783 | ' enmLomKind,\n'
|
---|
784 | ' ipLom,\n'
|
---|
785 | ' pctScaleTimeout,\n'
|
---|
786 | ' sOs,\n'
|
---|
787 | ' sOsVersion,\n'
|
---|
788 | ' sCpuVendor,\n'
|
---|
789 | ' sCpuArch,\n'
|
---|
790 | ' sCpuName,\n'
|
---|
791 | ' lCpuRevision,\n'
|
---|
792 | ' cCpus,\n'
|
---|
793 | ' fCpuHwVirt,\n'
|
---|
794 | ' fCpuNestedPaging,\n'
|
---|
795 | ' fCpu64BitGuest,\n'
|
---|
796 | ' fChipsetIoMmu,\n'
|
---|
797 | ' cMbMemory,\n'
|
---|
798 | ' cMbScratch,\n'
|
---|
799 | ' sReport,\n'
|
---|
800 | ' iTestBoxScriptRev,\n'
|
---|
801 | ' iPythonHexVersion,\n'
|
---|
802 | ' %s\n' # enmPendingCmd
|
---|
803 | 'FROM TestBoxes\n'
|
---|
804 | 'WHERE idTestBox = %s\n'
|
---|
805 | ' AND tsExpire = %s\n'
|
---|
806 | ' AND enmPendingCmd = %s\n'
|
---|
807 | 'RETURNING idGenTestBox'
|
---|
808 | , (idTestBox,
|
---|
809 | tsEffective,
|
---|
810 | uidAuthor,
|
---|
811 | sNewCommand,
|
---|
812 | idTestBox,
|
---|
813 | tsEffective,
|
---|
814 | sOldCommand,
|
---|
815 | ));
|
---|
816 | idGenTestBox = self._oDb.fetchOne()[0];
|
---|
817 | if fCommit is True:
|
---|
818 | self._oDb.commit();
|
---|
819 | except:
|
---|
820 | self._oDb.rollback();
|
---|
821 | raise;
|
---|
822 |
|
---|
823 | return (idGenTestBox, tsEffective);
|
---|
824 |
|
---|
825 |
|
---|
826 |
|
---|
827 | def getAll(self):
|
---|
828 | """
|
---|
829 | Retrieve list of all registered Test Box records from DB.
|
---|
830 | """
|
---|
831 | self._oDb.execute('SELECT *\n'
|
---|
832 | 'FROM TestBoxes\n'
|
---|
833 | 'WHERE tsExpire=\'infinity\'::timestamp;')
|
---|
834 |
|
---|
835 | aaoRows = self._oDb.fetchAll()
|
---|
836 | aoRet = []
|
---|
837 | for aoRow in aaoRows:
|
---|
838 | aoRet.append(TestBoxData().initFromDbRow(aoRow))
|
---|
839 | return aoRet
|
---|
840 |
|
---|
841 | def _historize(self, idTestBox, uidAuthor, tsExpire = None):
|
---|
842 | """ Historizes the current entry. """
|
---|
843 | if tsExpire is None:
|
---|
844 | self._oDb.execute('UPDATE TestBoxes\n'
|
---|
845 | 'SET tsExpire = CURRENT_TIMESTAMP,\n'
|
---|
846 | ' uidAuthor = %s\n'
|
---|
847 | 'WHERE idTestBox = %s\n'
|
---|
848 | ' AND tsExpire = \'infinity\'::TIMESTAMP\n'
|
---|
849 | , (uidAuthor, idTestBox,));
|
---|
850 | else:
|
---|
851 | self._oDb.execute('UPDATE TestBoxes\n'
|
---|
852 | 'SET tsExpire = %s,\n'
|
---|
853 | ' uidAuthor = %s\n'
|
---|
854 | 'WHERE idTestBox = %s\n'
|
---|
855 | ' AND tsExpire = \'infinity\'::TIMESTAMP\n'
|
---|
856 | , (uidAuthor, tsExpire, idTestBox,));
|
---|
857 | return True;
|
---|
858 |
|
---|
859 |
|
---|
860 | def removeEntry(self, uidAuthor, idTestBox, fCascade = False, fCommit=False):
|
---|
861 | """
|
---|
862 | Delete user account
|
---|
863 | """
|
---|
864 | _ = fCascade;
|
---|
865 |
|
---|
866 | fRc = self._historize(idTestBox, uidAuthor, None);
|
---|
867 | if fRc:
|
---|
868 | self._oDb.maybeCommit(fCommit);
|
---|
869 |
|
---|
870 | return fRc
|
---|
871 |
|
---|
872 |
|
---|
873 | #
|
---|
874 | # Unit testing.
|
---|
875 | #
|
---|
876 |
|
---|
877 | # pylint: disable=C0111
|
---|
878 | class TestBoxDataTestCase(ModelDataBaseTestCase):
|
---|
879 | def setUp(self):
|
---|
880 | self.aoSamples = [TestBoxData(),];
|
---|
881 |
|
---|
882 | if __name__ == '__main__':
|
---|
883 | unittest.main();
|
---|
884 | # not reached.
|
---|
885 |
|
---|