Change Event.error/incidence for Event.severity

This commit is contained in:
Xavier Bustamante Talavera 2018-11-08 17:37:14 +01:00
parent b5e3d0c6ec
commit e009bf4bc1
28 changed files with 319 additions and 302 deletions

View File

@ -9,7 +9,7 @@
"elapsed": 2 "elapsed": 2
}, },
{ {
"error": false, "severity": "Info",
"type": "StressTest", "type": "StressTest",
"elapsed": 60 "elapsed": 60
}, },
@ -91,14 +91,14 @@
{ {
"steps": [ "steps": [
{ {
"error": false, "severity": "Info",
"type": "StepRandom", "type": "StepRandom",
"startTime": "2018-07-11T11:20:01.005336", "startTime": "2018-07-11T11:20:01.005336",
"endTime": "2018-07-11T11:42:12.971177" "endTime": "2018-07-11T11:42:12.971177"
} }
], ],
"zeros": false, "zeros": false,
"error": false, "severity": "Info",
"type": "EraseBasic", "type": "EraseBasic",
"endTime": "2018-07-11T11:42:12.975358", "endTime": "2018-07-11T11:42:12.975358",
"startTime": "2018-07-11T11:20:01.004892" "startTime": "2018-07-11T11:20:01.004892"
@ -111,7 +111,7 @@
}, },
{ {
"length": "Short", "length": "Short",
"error": true, "severity": "Error",
"type": "TestDataStorage", "type": "TestDataStorage",
"status": "Unspecified Error. Self-test not started.", "status": "Unspecified Error. Self-test not started.",
"elapsed": 0 "elapsed": 0

View File

@ -74,13 +74,13 @@
"type": "EraseBasic", "type": "EraseBasic",
"zeros": false, "zeros": false,
"endTime": "2018-07-11T11:56:52.390306", "endTime": "2018-07-11T11:56:52.390306",
"error": false, "severity": "Info",
"startTime": "2018-07-11T10:49:31.998217", "startTime": "2018-07-11T10:49:31.998217",
"steps": [ "steps": [
{ {
"type": "StepRandom", "type": "StepRandom",
"endTime": "2018-07-11T11:56:52.386505", "endTime": "2018-07-11T11:56:52.386505",
"error": false, "severity": "Info",
"startTime": "2018-07-11T10:49:31.998609" "startTime": "2018-07-11T10:49:31.998609"
} }
] ]
@ -89,7 +89,7 @@
"length": "Short", "length": "Short",
"type": "TestDataStorage", "type": "TestDataStorage",
"status": "Unspecified Error. Self-test not started.", "status": "Unspecified Error. Self-test not started.",
"error": true, "severity": "Error",
"elapsed": 0 "elapsed": 0
}, },
{ {
@ -130,7 +130,7 @@
}, },
{ {
"type": "StressTest", "type": "StressTest",
"error": false, "severity": "Info",
"elapsed": 60 "elapsed": 60
} }
], ],

View File

@ -69,7 +69,7 @@
{ {
"elapsed": 1, "elapsed": 1,
"type": "TestDataStorage", "type": "TestDataStorage",
"error": true, "severity": "Error",
"status": "Unspecified Error. Self-test not started.", "status": "Unspecified Error. Self-test not started.",
"length": "Short" "length": "Short"
}, },
@ -83,13 +83,13 @@
"startTime": "2018-07-11T10:32:14.445306", "startTime": "2018-07-11T10:32:14.445306",
"zeros": false, "zeros": false,
"type": "EraseBasic", "type": "EraseBasic",
"error": false, "severity": "Info",
"endTime": "2018-07-11T10:53:46.442123", "endTime": "2018-07-11T10:53:46.442123",
"steps": [ "steps": [
{ {
"startTime": "2018-07-11T10:32:14.445496", "startTime": "2018-07-11T10:32:14.445496",
"type": "StepRandom", "type": "StepRandom",
"error": false, "severity": "Info",
"endTime": "2018-07-11T10:53:46.438901" "endTime": "2018-07-11T10:53:46.438901"
} }
] ]
@ -107,7 +107,7 @@
{ {
"elapsed": 0, "elapsed": 0,
"type": "TestDataStorage", "type": "TestDataStorage",
"error": true, "severity": "Error",
"status": "Unspecified Error. Self-test not started.", "status": "Unspecified Error. Self-test not started.",
"length": "Short" "length": "Short"
}, },
@ -115,13 +115,13 @@
"startTime": "2018-07-11T10:53:46.442187", "startTime": "2018-07-11T10:53:46.442187",
"zeros": false, "zeros": false,
"type": "EraseBasic", "type": "EraseBasic",
"error": false, "severity": "Info",
"endTime": "2018-07-11T11:16:28.469899", "endTime": "2018-07-11T11:16:28.469899",
"steps": [ "steps": [
{ {
"startTime": "2018-07-11T10:53:46.442343", "startTime": "2018-07-11T10:53:46.442343",
"type": "StepRandom", "type": "StepRandom",
"error": false, "severity": "Info",
"endTime": "2018-07-11T11:16:28.463789" "endTime": "2018-07-11T11:16:28.463789"
} }
] ]
@ -157,7 +157,7 @@
"chassis": "Tower", "chassis": "Tower",
"events": [ "events": [
{ {
"error": false, "severity": "Info",
"elapsed": 60, "elapsed": 60,
"type": "StressTest" "type": "StressTest"
}, },

View File

@ -10,7 +10,7 @@
{ {
"elapsed": 60, "elapsed": 60,
"type": "StressTest", "type": "StressTest",
"error": false "severity": "Info"
}, },
{ {
"elapsed": 1, "elapsed": 1,
@ -92,7 +92,7 @@
"elapsed": 15 "elapsed": 15
}, },
{ {
"error": true, "severity": "Error",
"type": "TestDataStorage", "type": "TestDataStorage",
"elapsed": 0, "elapsed": 0,
"length": "Short", "length": "Short",
@ -102,13 +102,13 @@
"startTime": "2018-07-11T13:28:07.319948", "startTime": "2018-07-11T13:28:07.319948",
"type": "EraseBasic", "type": "EraseBasic",
"endTime": "2018-07-11T14:04:04.864425", "endTime": "2018-07-11T14:04:04.864425",
"error": false, "severity": "Info",
"steps": [ "steps": [
{ {
"startTime": "2018-07-11T13:28:07.320244", "startTime": "2018-07-11T13:28:07.320244",
"type": "StepRandom", "type": "StepRandom",
"endTime": "2018-07-11T14:04:04.861590", "endTime": "2018-07-11T14:04:04.861590",
"error": false "severity": "Info"
} }
], ],
"zeros": false "zeros": false

View File

@ -6,7 +6,7 @@
"manufacturer": "NEC Computers SAS", "manufacturer": "NEC Computers SAS",
"events": [ "events": [
{ {
"error": false, "severity": "Info",
"elapsed": 60, "elapsed": 60,
"type": "StressTest" "type": "StressTest"
}, },
@ -101,7 +101,7 @@
"size": 305245, "size": 305245,
"events": [ "events": [
{ {
"error": false, "severity": "Info",
"endTime": "2018-07-11T11:33:41.531918", "endTime": "2018-07-11T11:33:41.531918",
"startTime": "2018-07-11T10:30:35.643855", "startTime": "2018-07-11T10:30:35.643855",
"zeros": false, "zeros": false,
@ -111,7 +111,7 @@
"type": "StepRandom", "type": "StepRandom",
"endTime": "2018-07-11T11:33:41.529224", "endTime": "2018-07-11T11:33:41.529224",
"startTime": "2018-07-11T10:30:35.644043", "startTime": "2018-07-11T10:30:35.644043",
"error": false "severity": "Info"
} }
] ]
}, },
@ -125,7 +125,7 @@
"type": "TestDataStorage", "type": "TestDataStorage",
"length": "Short", "length": "Short",
"elapsed": 1, "elapsed": 1,
"error": true, "severity": "Error",
"status": "Unspecified Error. Self-test not started." "status": "Unspecified Error. Self-test not started."
} }
], ],

View File

@ -2,137 +2,137 @@
"uuid": "de4f495e-c58b-40e1-a33e-46ab5e84767e", "uuid": "de4f495e-c58b-40e1-a33e-46ab5e84767e",
"endTime": "2018-10-24T11:03:36.113006+00:00", "endTime": "2018-10-24T11:03:36.113006+00:00",
"components": [ "components": [
{
"speed": 1000,
"manufacturer": "Realtek Semiconductor Co., Ltd.",
"wireless": false,
"model": "RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller",
"serialNumber": "00:26:18:96:dc:af",
"type": "NetworkAdapter",
"events": []
},
{
"speed": 1333.0,
"manufacturer": null,
"interface": "DDR",
"model": null,
"serialNumber": null,
"type": "RamModule",
"format": "DIMM",
"size": 2048,
"events": []
},
{
"speed": 1333.0,
"manufacturer": null,
"interface": "DDR",
"model": null,
"serialNumber": null,
"type": "RamModule",
"format": "DIMM",
"size": 2048,
"events": []
},
{
"speed": 1333.0,
"manufacturer": null,
"interface": "DDR",
"model": null,
"serialNumber": null,
"type": "RamModule",
"format": "DIMM",
"size": 2048,
"events": []
},
{
"speed": 1333.0,
"manufacturer": null,
"interface": "DDR",
"model": null,
"serialNumber": null,
"type": "RamModule",
"format": "DIMM",
"size": 2048,
"events": []
},
{
"manufacturer": "Intel Corporation",
"model": "5 Series/3400 Series Chipset High Definition Audio",
"serialNumber": null,
"type": "SoundCard",
"events": []
},
{
"speed": 2.5330000000000004,
"manufacturer": "Intel Corp.",
"cores": 4,
"address": 64,
"model": "Intel Core i7 CPU 860 @ 2.80GHz",
"serialNumber": null,
"type": "Processor",
"threads": 8,
"events": [
{ {
"speed": 1000, "elapsed": 9,
"manufacturer": "Realtek Semiconductor Co., Ltd.", "type": "BenchmarkProcessorSysbench",
"wireless": false, "rate": 8.7418
"model": "RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller",
"serialNumber": "00:26:18:96:dc:af",
"type": "NetworkAdapter",
"events": []
}, },
{ {
"speed": 1333.0, "elapsed": 0,
"manufacturer": null, "type": "BenchmarkProcessor",
"interface": "DDR", "rate": 44937.520000000004
"model": null,
"serialNumber": null,
"type": "RamModule",
"format": "DIMM",
"size": 2048,
"events": []
},
{
"speed": 1333.0,
"manufacturer": null,
"interface": "DDR",
"model": null,
"serialNumber": null,
"type": "RamModule",
"format": "DIMM",
"size": 2048,
"events": []
},
{
"speed": 1333.0,
"manufacturer": null,
"interface": "DDR",
"model": null,
"serialNumber": null,
"type": "RamModule",
"format": "DIMM",
"size": 2048,
"events": []
},
{
"speed": 1333.0,
"manufacturer": null,
"interface": "DDR",
"model": null,
"serialNumber": null,
"type": "RamModule",
"format": "DIMM",
"size": 2048,
"events": []
},
{
"manufacturer": "Intel Corporation",
"model": "5 Series/3400 Series Chipset High Definition Audio",
"serialNumber": null,
"type": "SoundCard",
"events": []
},
{
"speed": 2.5330000000000004,
"manufacturer": "Intel Corp.",
"cores": 4,
"address": 64,
"model": "Intel Core i7 CPU 860 @ 2.80GHz",
"serialNumber": null,
"type": "Processor",
"threads": 8,
"events": [
{
"elapsed": 9,
"type": "BenchmarkProcessorSysbench",
"rate": 8.7418
},
{
"elapsed": 0,
"type": "BenchmarkProcessor",
"rate": 44937.520000000004
}
]
},
{
"manufacturer": null,
"interface": "ATA",
"model": "SAMSUNG HD103SJ",
"serialNumber": "S246J90Z406422",
"type": "HardDrive",
"size": 953869,
"events": [
{
"elapsed": 120,
"lifetime": 14298,
"currentPendingSectorCount": 0,
"type": "TestDataStorage",
"status": "Completed without error",
"powerCycleCount": 693,
"assessment": true,
"offlineUncorrectable": 0,
"error": false,
"length": "Short",
"reallocatedSectorCount": 0
},
{
"readSpeed": 136.0,
"elapsed": 9,
"type": "BenchmarkDataStorage",
"writeSpeed": 35.0
}
]
},
{
"manufacturer": "NVIDIA Corporation",
"model": "G84 GeForce 8600 GT",
"serialNumber": null,
"type": "GraphicCard",
"memory": 256.0,
"events": []
},
{
"firewire": 1,
"manufacturer": "ASUSTeK Computer INC.",
"usb": 2,
"model": "P7P55D",
"serialNumber": "101005570001137",
"type": "Motherboard",
"pcmcia": 0,
"slots": 4,
"serial": 1,
"events": []
} }
]
},
{
"manufacturer": null,
"interface": "ATA",
"model": "SAMSUNG HD103SJ",
"serialNumber": "S246J90Z406422",
"type": "HardDrive",
"size": 953869,
"events": [
{
"elapsed": 120,
"lifetime": 14298,
"currentPendingSectorCount": 0,
"type": "TestDataStorage",
"status": "Completed without error",
"powerCycleCount": 693,
"assessment": true,
"offlineUncorrectable": 0,
"severity": "Info",
"length": "Short",
"reallocatedSectorCount": 0
},
{
"readSpeed": 136.0,
"elapsed": 9,
"type": "BenchmarkDataStorage",
"writeSpeed": 35.0
}
]
},
{
"manufacturer": "NVIDIA Corporation",
"model": "G84 GeForce 8600 GT",
"serialNumber": null,
"type": "GraphicCard",
"memory": 256.0,
"events": []
},
{
"firewire": 1,
"manufacturer": "ASUSTeK Computer INC.",
"usb": 2,
"model": "P7P55D",
"serialNumber": "101005570001137",
"type": "Motherboard",
"pcmcia": 0,
"slots": 4,
"serial": 1,
"events": []
}
], ],
"elapsed": 203, "elapsed": 203,
"device": { "device": {
@ -142,19 +142,19 @@
"type": "Desktop", "type": "Desktop",
"serialNumber": null, "serialNumber": null,
"events": [ "events": [
{ {
"elapsed": 60, "elapsed": 60,
"type": "StressTest", "type": "StressTest",
"error": false "severity": "Info"
}, },
{ {
"elapsed": 1, "elapsed": 1,
"type": "BenchmarkRamSysbench", "type": "BenchmarkRamSysbench",
"rate": 0.8315 "rate": 0.8315
} }
], ],
"tags": [ "tags": [
{"id": "A0000000000003", "type": "Tag"} {"id": "A0000000000003", "type": "Tag"}
] ]
}, },
"version": "11.0a6", "version": "11.0a6",

View File

@ -62,7 +62,7 @@
"assessment": true, "assessment": true,
"currentPendingSectorCount": 0, "currentPendingSectorCount": 0,
"elapsed": 134, "elapsed": 134,
"error": false, "severity": "Info",
"length": "Short", "length": "Short",
"lifetime": 19549, "lifetime": 19549,
"offlineUncorrectable": 0, "offlineUncorrectable": 0,
@ -106,7 +106,7 @@
"events": [ "events": [
{ {
"elapsed": 60, "elapsed": 60,
"error": false, "severity": "Info",
"type": "StressTest" "type": "StressTest"
}, },
{ {

View File

@ -90,7 +90,7 @@
"type": "TestDataStorage", "type": "TestDataStorage",
"length": "Short", "length": "Short",
"elapsed": 2, "elapsed": 2,
"error": true, "severity": "Error",
"status": "Unspecified Error. Self-test not started." "status": "Unspecified Error. Self-test not started."
}, },
{ {
@ -99,12 +99,12 @@
{ {
"type": "StepRandom", "type": "StepRandom",
"startTime": "2018-07-03T09:15:22.257059", "startTime": "2018-07-03T09:15:22.257059",
"error": false, "severity": "Info",
"endTime": "2018-07-03T10:32:11.843190" "endTime": "2018-07-03T10:32:11.843190"
} }
], ],
"startTime": "2018-07-03T09:15:22.256074", "startTime": "2018-07-03T09:15:22.256074",
"error": false, "severity": "Info",
"zeros": false, "zeros": false,
"endTime": "2018-07-03T10:32:11.848455" "endTime": "2018-07-03T10:32:11.848455"
} }
@ -143,7 +143,7 @@
}, },
{ {
"type": "StressTest", "type": "StressTest",
"error": false, "severity": "Info",
"elapsed": 60 "elapsed": 60
}, },
{ {

View File

@ -83,7 +83,7 @@
"elapsed": 0, "elapsed": 0,
"type": "TestDataStorage", "type": "TestDataStorage",
"status": "Unspecified Error. Self-test not started.", "status": "Unspecified Error. Self-test not started.",
"error": true, "severity": "Error",
"length": "Short" "length": "Short"
} }
] ]

View File

@ -88,7 +88,7 @@
}, },
{ {
"status": "Unspecified Error. Self-test not started.", "status": "Unspecified Error. Self-test not started.",
"error": true, "severity": "Error",
"type": "TestDataStorage", "type": "TestDataStorage",
"elapsed": 1, "elapsed": 1,
"length": Short "length": Short
@ -142,7 +142,7 @@
{ {
"type": "StressTest", "type": "StressTest",
"elapsed": 60, "elapsed": 60,
"error": false "severity": "Info"
}, },
{ {
"rate": 0.9759, "rate": 0.9759,

View File

@ -96,7 +96,7 @@
"status": "Unspecified Error. Self-test not started.", "status": "Unspecified Error. Self-test not started.",
"type": "TestDataStorage", "type": "TestDataStorage",
"length": Short, "length": Short,
"error": true "severity": "Error"
} }
], ],
"type": "HardDrive", "type": "HardDrive",
@ -122,7 +122,7 @@
"events": [ "events": [
{ {
"type": "StressTest", "type": "StressTest",
"error": false, "severity": "Info",
"elapsed": 120 "elapsed": 120
}, },
{ {

View File

@ -15,7 +15,7 @@
{ {
"type": "StressTest", "type": "StressTest",
"elapsed": 300, "elapsed": 300,
"error": false "severity": "Info"
} }
], ],
"serialNumber": "CZC0408YJG", "serialNumber": "CZC0408YJG",
@ -125,7 +125,7 @@
"offlineUncorrectable": 1, "offlineUncorrectable": 1,
"powerCycleCount": 1838, "powerCycleCount": 1838,
"assessment": true, "assessment": true,
"error": false, "severity": "Info",
"type": "TestDataStorage", "type": "TestDataStorage",
"lifetime": 10546, "lifetime": 10546,
"reallocatedSectorCount": 0, "reallocatedSectorCount": 0,

View File

@ -64,7 +64,7 @@ components:
elapsed: 21 elapsed: 21
- type: TestDataStorage - type: TestDataStorage
elapsed: 233 elapsed: 233
error: False severity: Info
status: Completed without error status: Completed without error
length: Short length: Short
lifetime: 99 lifetime: 99

View File

@ -273,9 +273,10 @@ class DataStoragePrivacyCompliance(Enum):
"""Returns the correct enum depending of the passed-in erasure.""" """Returns the correct enum depending of the passed-in erasure."""
from ereuse_devicehub.resources.event.models import EraseSectors from ereuse_devicehub.resources.event.models import EraseSectors
if isinstance(erasure, EraseSectors): if isinstance(erasure, EraseSectors):
return cls.EraseSectors if not erasure.error else cls.EraseSectorsError c = cls.EraseSectors if erasure.severity != Severity.Error else cls.EraseSectorsError
else: else:
return cls.EraseBasic if not erasure.error else cls.EraseBasicError c = cls.EraseBasic if erasure.severity == Severity.Error else cls.EraseBasicError
return c
class PrinterTechnology(Enum): class PrinterTechnology(Enum):
@ -285,3 +286,38 @@ class PrinterTechnology(Enum):
SolidInk = 'Solid ink' SolidInk = 'Solid ink'
Dye = 'Dye-sublimation' Dye = 'Dye-sublimation'
Thermal = 'Thermal' Thermal = 'Thermal'
class Severity(IntEnum):
"""A flag evaluating the event execution. Ex. failed events
have the value `Severity.Error`.
Devicehub uses 4 severity levels:
- Info: default neutral severity. The event succeeded.
- Notice: The event succeeded but it is raising awareness.
Notices are not usually that important but something
(good or bad) worth checking.
- Warning: The event succeeded but there is something important
to check negatively affecting the event.
- Error: the event failed.
Devicehub specially raises user awareness when an event
has a Severity of ``Warning`` or greater.
"""
Info = 0
Notice = 1
Warning = 2
Error = 3
def __str__(self):
if self == self.Info:
m = ''
elif self == self.Notice:
m = ''
elif self == self.Warning:
m = ''
else:
m = ''
return m

View File

@ -6,11 +6,12 @@ from typing import Set, Union
from uuid import uuid4 from uuid import uuid4
import inflection import inflection
import teal.db
from boltons import urlutils from boltons import urlutils
from citext import CIText from citext import CIText
from flask import current_app as app, g from flask import current_app as app, g
from sqlalchemy import BigInteger, Boolean, CheckConstraint, Column, DateTime, Enum as DBEnum, \ from sqlalchemy import BigInteger, Boolean, CheckConstraint, Column, DateTime, Enum as DBEnum, \
Float, ForeignKey, Interval, JSON, Numeric, SmallInteger, Unicode, event, orm, Integer Float, ForeignKey, Integer, Interval, JSON, Numeric, SmallInteger, Unicode, event, orm
from sqlalchemy.dialects.postgresql import UUID from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.ext.declarative import declared_attr from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.ext.orderinglist import ordering_list from sqlalchemy.ext.orderinglist import ordering_list
@ -27,9 +28,9 @@ from ereuse_devicehub.db import db
from ereuse_devicehub.resources.agent.models import Agent from ereuse_devicehub.resources.agent.models import Agent
from ereuse_devicehub.resources.device.models import Component, Computer, DataStorage, Desktop, \ from ereuse_devicehub.resources.device.models import Component, Computer, DataStorage, Desktop, \
Device, Laptop, Server Device, Laptop, Server
from ereuse_devicehub.resources.enums import AppearanceRange, Bios, \ from ereuse_devicehub.resources.enums import AppearanceRange, Bios, FunctionalityRange, \
FunctionalityRange, PriceSoftware, RATE_NEGATIVE, RATE_POSITIVE, RatingRange, RatingSoftware, \ PriceSoftware, RATE_NEGATIVE, RATE_POSITIVE, RatingRange, RatingSoftware, ReceiverRole, \
ReceiverRole, SnapshotExpectedEvents, SnapshotSoftware, TestDataStorageLength Severity, SnapshotExpectedEvents, SnapshotSoftware, TestDataStorageLength
from ereuse_devicehub.resources.models import STR_SM_SIZE, Thing from ereuse_devicehub.resources.models import STR_SM_SIZE, Thing
from ereuse_devicehub.resources.user.models import User from ereuse_devicehub.resources.user.models import User
@ -48,22 +49,14 @@ class Event(Thing):
name.comment = """ name.comment = """
A name or title for the event. Used when searching for events. A name or title for the event. Used when searching for events.
""" """
incidence = Column(Boolean, default=False, nullable=False) severity = Column(teal.db.IntEnum(Severity), default=Severity.Info, nullable=False)
incidence.comment = """ severity.comment = Severity.__doc__
Should this event be reviewed due some anomaly?
"""
closed = Column(Boolean, default=True, nullable=False) closed = Column(Boolean, default=True, nullable=False)
closed.comment = """ closed.comment = """
Whether the author has finished the event. Whether the author has finished the event.
After this is set to True, no modifications are allowed. After this is set to True, no modifications are allowed.
By default events are closed when performed. By default events are closed when performed.
""" """
error = Column(Boolean, default=False, nullable=False)
error.comment = """
Did the event fail?
For example, a failure in ``Erase`` means that the data storage
unit did not erase correctly.
"""
description = Column(Unicode, default='', nullable=False) description = Column(Unicode, default='', nullable=False)
description.comment = """ description.comment = """
A comment about the event. A comment about the event.
@ -181,6 +174,7 @@ class Event(Thing):
args = {POLYMORPHIC_ID: cls.t} args = {POLYMORPHIC_ID: cls.t}
if cls.t == 'Event': if cls.t == 'Event':
args[POLYMORPHIC_ON] = cls.type args[POLYMORPHIC_ON] = cls.type
# noinspection PyUnresolvedReferences
if JoinedTableMixin in cls.mro(): if JoinedTableMixin in cls.mro():
args[INHERIT_COND] = cls.id == Event.id args[INHERIT_COND] = cls.id == Event.id
return args return args
@ -197,16 +191,15 @@ class Event(Thing):
raise ValidationError('The event cannot start after it finished.') raise ValidationError('The event cannot start after it finished.')
return start_time return start_time
@property
def _err_str(self):
return '❌ Error.' if self.error else ''
@property @property
def _date_str(self): def _date_str(self):
return '{:%c}'.format(self.end_time or self.created) return '{:%c}'.format(self.end_time or self.created)
def __str__(self) -> str: def __str__(self) -> str:
return '{}'.format(self._err_str) return '{}'.format(self.severity)
def __repr__(self):
return '<{0.t} {0.id} {0.severity}>'.format(self)
class EventComponent(db.Model): class EventComponent(db.Model):
@ -232,7 +225,7 @@ class EventWithOneDevice(JoinedTableMixin, Event):
primaryjoin=Device.id == device_id) primaryjoin=Device.id == device_id)
def __repr__(self) -> str: def __repr__(self) -> str:
return '<{0.t} {0.id!r} device={0.device!r}>'.format(self) return '<{0.t} {0.id} {0.severity} device={0.device!r}>'.format(self)
@declared_attr @declared_attr
def __mapper_args__(cls): def __mapper_args__(cls):
@ -260,7 +253,7 @@ class EventWithMultipleDevices(Event):
collection_class=OrderedSet) collection_class=OrderedSet)
def __repr__(self) -> str: def __repr__(self) -> str:
return '<{0.t} {0.id!r} devices={0.devices!r}>'.format(self) return '<{0.t} {0.id} {0.severity} devices={0.devices!r}>'.format(self)
class EventDevice(db.Model): class EventDevice(db.Model):
@ -299,7 +292,7 @@ class EraseBasic(JoinedWithOneDeviceMixin, EventWithOneDevice):
# todo return erasure properties like num steps, if it is british... # todo return erasure properties like num steps, if it is british...
def __str__(self) -> str: def __str__(self) -> str:
return '{} on {}.'.format(self._err_str, self.end_time) return '{} on {}.'.format(self.severity, self.end_time)
class EraseSectors(EraseBasic): class EraseSectors(EraseBasic):
@ -310,7 +303,7 @@ class Step(db.Model):
erasure_id = Column(UUID(as_uuid=True), ForeignKey(EraseBasic.id), primary_key=True) erasure_id = Column(UUID(as_uuid=True), ForeignKey(EraseBasic.id), primary_key=True)
type = Column(Unicode(STR_SM_SIZE), nullable=False) type = Column(Unicode(STR_SM_SIZE), nullable=False)
num = Column(SmallInteger, primary_key=True) num = Column(SmallInteger, primary_key=True)
error = Column(Boolean, default=False, nullable=False) severity = Column(teal.db.IntEnum(Severity), default=Severity.Info, nullable=False)
start_time = Column(DateTime, nullable=False) start_time = Column(DateTime, nullable=False)
start_time.comment = Event.start_time.comment start_time.comment = Event.start_time.comment
end_time = Column(DateTime, CheckConstraint('end_time > start_time'), nullable=False) end_time = Column(DateTime, CheckConstraint('end_time > start_time'), nullable=False)
@ -358,7 +351,7 @@ class Snapshot(JoinedWithOneDeviceMixin, EventWithOneDevice):
expected_events = Column(ArrayOfEnum(DBEnum(SnapshotExpectedEvents))) expected_events = Column(ArrayOfEnum(DBEnum(SnapshotExpectedEvents)))
def __str__(self) -> str: def __str__(self) -> str:
return '{}. {} version {}.'.format(self._err_str, self.software, self.version) return '{}. {} version {}.'.format(self.severity, self.software, self.version)
class Install(JoinedWithOneDeviceMixin, EventWithOneDevice): class Install(JoinedWithOneDeviceMixin, EventWithOneDevice):
@ -747,20 +740,18 @@ class TestDataStorage(Test):
def __init__(self, **kwargs) -> None: def __init__(self, **kwargs) -> None:
super().__init__(**kwargs) super().__init__(**kwargs)
# Define severity
# As of https://www.backblaze.com/blog/hard-drive-smart-stats/ and # As of https://www.backblaze.com/blog/hard-drive-smart-stats/ and
# https://www.backblaze.com/blog-smart-stats-2014-8.html # https://www.backblaze.com/blog-smart-stats-2014-8.html
# We can guess some future disk failures by analyzing some # We can guess some future disk failures by analyzing some SMART data.
# SMART data if self.severity is None:
if (self.reallocated_sector_count or 0) > 10: # Test finished successfully
self.incidence = True if not self.assessment:
self.description = 'Warning: Chance of disk failure within a year.' self.severity = Severity.Error
if (self.current_pending_sector_count or 0) > 40 \ elif self.current_pending_sector_count and self.current_pending_sector_count > 40 \
and (self.reported_uncorrectable_errors or 0) > 10: or self.reallocated_sector_count and self.reallocated_sector_count > 10:
self.incidence = True self.severity = Severity.Warning
self.description = 'Warning: Chance of disk failure within a year.'
if not self.assessment:
self.incidence = True
self.description = 'Warning: Drive failure expected soon.'
def __str__(self) -> str: def __str__(self) -> str:
t = inflection.humanize(self.status) t = inflection.humanize(self.status)
@ -780,7 +771,7 @@ class StressTest(Test):
return value return value
def __str__(self) -> str: def __str__(self) -> str:
return '{}. Computing for {}'.format(self._err_str, self.elapsed) return '{}. Computing for {}'.format(self.severity, self.elapsed)
class Benchmark(JoinedWithOneDeviceMixin, EventWithOneDevice): class Benchmark(JoinedWithOneDeviceMixin, EventWithOneDevice):

View File

@ -17,8 +17,8 @@ from teal.enums import Country
from ereuse_devicehub.resources.agent.models import Agent from ereuse_devicehub.resources.agent.models import Agent
from ereuse_devicehub.resources.device.models import Component, Computer, Device from ereuse_devicehub.resources.device.models import Component, Computer, Device
from ereuse_devicehub.resources.enums import AppearanceRange, Bios, FunctionalityRange, \ from ereuse_devicehub.resources.enums import AppearanceRange, Bios, FunctionalityRange, \
PriceSoftware, RatingSoftware, ReceiverRole, SnapshotExpectedEvents, SnapshotSoftware, \ PriceSoftware, RatingSoftware, ReceiverRole, Severity, SnapshotExpectedEvents, \
TestDataStorageLength SnapshotSoftware, TestDataStorageLength
from ereuse_devicehub.resources.models import Thing from ereuse_devicehub.resources.models import Thing
from ereuse_devicehub.resources.user.models import User from ereuse_devicehub.resources.user.models import User
@ -27,8 +27,6 @@ class Event(Thing):
id = ... # type: Column id = ... # type: Column
name = ... # type: Column name = ... # type: Column
type = ... # type: Column type = ... # type: Column
error = ... # type: Column
incidence = ... # type: Column
description = ... # type: Column description = ... # type: Column
snapshot_id = ... # type: Column snapshot_id = ... # type: Column
snapshot = ... # type: relationship snapshot = ... # type: relationship
@ -41,17 +39,14 @@ class Event(Thing):
start_time = ... # type: Column start_time = ... # type: Column
end_time = ... # type: Column end_time = ... # type: Column
agent_id = ... # type: Column agent_id = ... # type: Column
severity = ... # type: Column
def __init__(self, id=None, name=None, incidence=None, closed=None, error=None, def __init__(self, **kwargs) -> None:
description=None, start_time=None, end_time=None, snapshot=None, agent=None,
parent=None, created=None, updated=None, author=None) -> None:
super().__init__(created, updated) super().__init__(created, updated)
self.id = ... # type: UUID self.id = ... # type: UUID
self.name = ... # type: str self.name = ... # type: str
self.type = ... # type: str self.type = ... # type: str
self.incidence = ... # type: bool
self.closed = ... # type: bool self.closed = ... # type: bool
self.error = ... # type: bool
self.description = ... # type: str self.description = ... # type: str
self.start_time = ... # type: datetime self.start_time = ... # type: datetime
self.end_time = ... # type: datetime self.end_time = ... # type: datetime
@ -60,34 +55,25 @@ class Event(Thing):
self.parent = ... # type: Computer self.parent = ... # type: Computer
self.agent = ... # type: Agent self.agent = ... # type: Agent
self.author = ... # type: User self.author = ... # type: User
self.severity = ... # type: Severity
@property @property
def url(self) -> urlutils.URL: def url(self) -> urlutils.URL:
pass pass
@property
def _err_str(self):
pass
class EventWithOneDevice(Event): class EventWithOneDevice(Event):
def __init__(self, id=None, name=None, incidence=None, closed=None, error=None, def __init__(self, **kwargs) -> None:
description=None, start_time=None, end_time=None, snapshot=None, agent=None, super().__init__(**kwargs)
parent=None, created=None, updated=None, author=None, device=None) -> None:
super().__init__(id, name, incidence, closed, error, description, start_time, end_time,
snapshot, agent, parent, created, updated, author)
self.device = ... # type: Device self.device = ... # type: Device
class EventWithMultipleDevices(Event): class EventWithMultipleDevices(Event):
devices = ... # type: relationship devices = ... # type: relationship
def __init__(self, id=None, name=None, incidence=None, closed=None, error=None, def __init__(self, **kwargs) -> None:
description=None, start_time=None, end_time=None, snapshot=None, agent=None, super().__init__(**kwargs)
parent=None, created=None, updated=None, author=None, devices=None) -> None:
super().__init__(id, name, incidence, closed, error, description, start_time, end_time,
snapshot, agent, parent, created, updated, author)
self.devices = ... # type: Set[Device] self.devices = ... # type: Set[Device]
@ -100,15 +86,21 @@ class Remove(EventWithOneDevice):
class Step(Model): class Step(Model):
type = ... # type: Column
num = ... # type: Column
start_time = ... # type: Column
end_time = ... # type: Column
erasure = ... # type: relationship
severity = ... # type: Column
def __init__(self, num=None, success=None, start_time=None, end_time=None, def __init__(self, num=None, success=None, start_time=None, end_time=None,
erasure=None, error=None) -> None: erasure=None, severity=None) -> None:
self.type = ... # type: str self.type = ... # type: str
self.num = ... # type: int self.num = ... # type: int
self.success = ... # type: bool
self.start_time = ... # type: datetime self.start_time = ... # type: datetime
self.end_time = ... # type: datetime self.end_time = ... # type: datetime
self.erasure = ... # type: EraseBasic self.erasure = ... # type: EraseBasic
self.error = ... # type: bool self.severity = ... # type: Severity
class StepZero(Step): class StepZero(Step):

View File

@ -12,7 +12,7 @@ from ereuse_devicehub.marshmallow import NestedOn
from ereuse_devicehub.resources.agent.schemas import Agent from ereuse_devicehub.resources.agent.schemas import Agent
from ereuse_devicehub.resources.device.schemas import Component, Computer, Device from ereuse_devicehub.resources.device.schemas import Component, Computer, Device
from ereuse_devicehub.resources.enums import AppearanceRange, Bios, FunctionalityRange, \ from ereuse_devicehub.resources.enums import AppearanceRange, Bios, FunctionalityRange, \
PriceSoftware, RATE_POSITIVE, RatingRange, RatingSoftware, ReceiverRole, \ PriceSoftware, RATE_POSITIVE, RatingRange, RatingSoftware, ReceiverRole, Severity, \
SnapshotExpectedEvents, SnapshotSoftware, TestDataStorageLength SnapshotExpectedEvents, SnapshotSoftware, TestDataStorageLength
from ereuse_devicehub.resources.event import models as m from ereuse_devicehub.resources.event import models as m
from ereuse_devicehub.resources.models import STR_BIG_SIZE, STR_SIZE from ereuse_devicehub.resources.models import STR_BIG_SIZE, STR_SIZE
@ -25,9 +25,8 @@ class Event(Thing):
name = SanitizedStr(default='', name = SanitizedStr(default='',
validate=Length(max=STR_BIG_SIZE), validate=Length(max=STR_BIG_SIZE),
description=m.Event.name.comment) description=m.Event.name.comment)
incidence = Boolean(default=False, description=m.Event.incidence.comment)
closed = Boolean(missing=True, description=m.Event.closed.comment) closed = Boolean(missing=True, description=m.Event.closed.comment)
error = Boolean(default=False, description=m.Event.error.comment) severity = EnumField(Severity, description=m.Event.severity.comment)
description = SanitizedStr(default='', description=m.Event.description.comment) description = SanitizedStr(default='', description=m.Event.description.comment)
start_time = DateTime(data_key='startTime', description=m.Event.start_time.comment) start_time = DateTime(data_key='startTime', description=m.Event.start_time.comment)
end_time = DateTime(data_key='endTime', description=m.Event.end_time.comment) end_time = DateTime(data_key='endTime', description=m.Event.end_time.comment)
@ -85,7 +84,7 @@ class Step(Schema):
type = String(description='Only required when it is nested.') type = String(description='Only required when it is nested.')
start_time = DateTime(required=True, data_key='startTime') start_time = DateTime(required=True, data_key='startTime')
end_time = DateTime(required=True, data_key='endTime') end_time = DateTime(required=True, data_key='endTime')
error = Boolean(default=False, description='Did the event fail?') severity = EnumField(Severity, description=m.Event.severity.comment)
class StepZero(Step): class StepZero(Step):

View File

@ -69,12 +69,12 @@
{ {
"endTime": "2018-07-13T11:54:55.096491", "endTime": "2018-07-13T11:54:55.096491",
"type": "StepRandom", "type": "StepRandom",
"error": false, "severity": "Info",
"startTime": "2018-07-13T10:52:45.092981" "startTime": "2018-07-13T10:52:45.092981"
} }
], ],
"type": "EraseBasic", "type": "EraseBasic",
"error": false, "severity": "Info",
"zeros": false, "zeros": false,
"startTime": "2018-07-13T10:52:45.092612" "startTime": "2018-07-13T10:52:45.092612"
}, },
@ -84,7 +84,7 @@
"elapsed": 131, "elapsed": 131,
"length": "Short", "length": "Short",
"offlineUncorrectable": 1, "offlineUncorrectable": 1,
"error": true, "severity": "Error",
"currentPendingSectorCount": 1, "currentPendingSectorCount": 1,
"powerCycleCount": 1253, "powerCycleCount": 1253,
"reallocatedSectorCount": 15, "reallocatedSectorCount": 15,
@ -107,12 +107,12 @@
{ {
"endTime": "2018-07-13T12:55:47.326835", "endTime": "2018-07-13T12:55:47.326835",
"type": "StepRandom", "type": "StepRandom",
"error": false, "severity": "Info",
"startTime": "2018-07-13T11:54:55.100925" "startTime": "2018-07-13T11:54:55.100925"
} }
], ],
"type": "EraseBasic", "type": "EraseBasic",
"error": false, "severity": "Info",
"zeros": false, "zeros": false,
"startTime": "2018-07-13T11:54:55.100667" "startTime": "2018-07-13T11:54:55.100667"
}, },
@ -122,7 +122,7 @@
"elapsed": 115, "elapsed": 115,
"length": "Short", "length": "Short",
"offlineUncorrectable": 0, "offlineUncorrectable": 0,
"error": false, "severity": "Info",
"currentPendingSectorCount": 0, "currentPendingSectorCount": 0,
"powerCycleCount": 1956, "powerCycleCount": 1956,
"reallocatedSectorCount": 0, "reallocatedSectorCount": 0,

View File

@ -21,11 +21,11 @@ components:
endTime: 2018-06-01T09:12:06 endTime: 2018-06-01T09:12:06
steps: steps:
- type: StepZero - type: StepZero
error: False severity: Info
startTime: 2018-06-01T08:15:00 startTime: 2018-06-01T08:15:00
endTime: 2018-06-01T09:16:00 endTime: 2018-06-01T09:16:00
- type: StepZero - type: StepZero
error: False severity: Info
startTime: 2018-06-01T08:16:00 startTime: 2018-06-01T08:16:00
endTime: 2018-06-01T09:17:00 endTime: 2018-06-01T09:17:00
- type: Processor - type: Processor

View File

@ -77,7 +77,7 @@
"status": "Self-test routine in progress", "status": "Self-test routine in progress",
"powerCycleCount": 648, "powerCycleCount": 648,
"length": "Short", "length": "Short",
"error": false, "severity": "Error",
"lifetime": 202 "lifetime": 202
} }
], ],
@ -110,7 +110,7 @@
"type": "BenchmarkRamSysbench" "type": "BenchmarkRamSysbench"
}, },
{ {
"error": false, "severity": "Info",
"elapsed": 60, "elapsed": 60,
"type": "StressTest" "type": "StressTest"
} }

View File

@ -28,12 +28,12 @@ components:
serialNumber: 6VMB1A52 serialNumber: 6VMB1A52
size: 238475 size: 238475
test: {'@type': TestHardDrive, CommandTimeout: 1786733725708, CurrentPendingSectorCount: 0, test: {'@type': TestHardDrive, CommandTimeout: 1786733725708, CurrentPendingSectorCount: 0,
OfflineUncorrectable: 0, assessment: true, error: false, firstError: null, lifetime: 16947, OfflineUncorrectable: 0, assessment: true, severity: Info, firstError: null, lifetime: 16947,
passedLifetime: 16947, powerCycleCount: 1694, reallocatedSectorCount: 0, reportedUncorrectableErrors: 0, passedLifetime: 16947, powerCycleCount: 1694, reallocatedSectorCount: 0, reportedUncorrectableErrors: 0,
status: Completed without error, type: Short offline} status: Completed without error, type: Short offline}
type: HDD type: HDD
- { '@type': GraphicCard, manufacturer: Intel Corporation, memory: 256.0, model: 4 - { '@type': GraphicCard, manufacturer: Intel Corporation, memory: 256.0, model: 4
Series Chipset Integrated Graphics Controller, serialNumber: null} Series Chipset Integrated Graphics Controller, serialNumber: null}
- '@type': Motherboard - '@type': Motherboard
connectors: {firewire: 0, pcmcia: 0, serial: 1, usb: 8} connectors: {firewire: 0, pcmcia: 0, serial: 1, usb: 8}
manufacturer: LENOVO manufacturer: LENOVO
@ -41,22 +41,22 @@ components:
serialNumber: null serialNumber: null
totalSlots: 0 totalSlots: 0
usedSlots: 2 usedSlots: 2
- { '@type': NetworkAdapter, manufacturer: Intel Corporation, model: 82567LM-3 Gigabit - { '@type': NetworkAdapter, manufacturer: Intel Corporation, model: 82567LM-3 Gigabit
Network Connection, serialNumber: '00:21:86:2c:5e:d6', speed: 1000} Network Connection, serialNumber: '00:21:86:2c:5e:d6', speed: 1000}
- { '@type': SoundCard, manufacturer: Intel Corporation, model: 82801JD/DO HD Audio - { '@type': SoundCard, manufacturer: Intel Corporation, model: 82801JD/DO HD Audio
Controller, serialNumber: null} Controller, serialNumber: null}
condition: condition:
appearance: {general: B} appearance: {general: B}
functionality: {general: A} functionality: {general: A}
date: '2018-05-09T10:32:15' date: '2018-05-09T10:32:15'
debug: debug:
capabilities: { dmi-2.5: DMI version 2.5, smbios-2.5: SMBIOS version 2.5, smp: Symmetric capabilities: { dmi-2.5: DMI version 2.5, smbios-2.5: SMBIOS version 2.5, smp: Symmetric
Multi-Processing, smp-1.4: SMP specification v1.4} Multi-Processing, smp-1.4: SMP specification v1.4}
children: children:
- children: - children:
- capabilities: { acpi: ACPI, biosbootspecification: BIOS boot specification, cdboot: Booting - capabilities: { acpi: ACPI, biosbootspecification: BIOS boot specification, cdboot: Booting
from CD-ROM/DVD, edd: Enhanced Disk Drive extensions, escd: ESCD, ls120boot: Booting from CD-ROM/DVD, edd: Enhanced Disk Drive extensions, escd: ESCD, ls120boot: Booting
from LS-120, pci: PCI bus, pnp: Plug-and-Play, shadowing: BIOS shadowing, from LS-120, pci: PCI bus, pnp: Plug-and-Play, shadowing: BIOS shadowing,
smartbattery: Smart battery, upgrade: BIOS EEPROM can be upgraded, usb: USB smartbattery: Smart battery, upgrade: BIOS EEPROM can be upgraded, usb: USB
legacy emulation} legacy emulation}
capacity: 4128768 capacity: 4128768
@ -71,9 +71,9 @@ debug:
vendor: LENOVO vendor: LENOVO
version: 5CKT48AUS version: 5CKT48AUS
- businfo: cpu@0 - businfo: cpu@0
capabilities: { acpi: thermal control (ACPI), aperfmperf: true, apic: on-chip capabilities: { acpi: thermal control (ACPI), aperfmperf: true, apic: on-chip
advanced programmable interrupt controller (APIC), arch_perfmon: true, boot: boot advanced programmable interrupt controller (APIC), arch_perfmon: true, boot: boot
processor, bts: true, clflush: true, cmov: conditional move instruction, processor, bts: true, clflush: true, cmov: conditional move instruction,
constant_tsc: true, cpufreq: CPU Frequency scaling, cx16: true, cx8: compare constant_tsc: true, cpufreq: CPU Frequency scaling, cx16: true, cx8: compare
and exchange 8-byte, de: debugging extensions, ds_cpl: true, dtes64: true, and exchange 8-byte, de: debugging extensions, ds_cpl: true, dtes64: true,
dtherm: true, dts: debug trace and EMON store MSRs, eagerfpu: true, est: true, dtherm: true, dts: debug trace and EMON store MSRs, eagerfpu: true, est: true,
@ -149,16 +149,16 @@ debug:
version: 6.7.10 version: 6.7.10
width: 64 width: 64
- children: - children:
- { claimed: true, class: memory, clock: 1067000000, description: DIMM DDR2 Synchronous - { claimed: true, class: memory, clock: 1067000000, description: DIMM DDR2 Synchronous
1067 MHz (0.9 ns), handle: 'DMI:001F', id: 'bank:0', physid: '0', product: '000000000000000000000000000000000000', 1067 MHz (0.9 ns), handle: 'DMI:001F', id: 'bank:0', physid: '0', product: '000000000000000000000000000000000000',
serial: '00000000', size: 2147483648, slot: J6G1, units: bytes, vendor: Unknown, serial: '00000000', size: 2147483648, slot: J6G1, units: bytes, vendor: Unknown,
width: 40960} width: 40960}
- {claimed: true, class: memory, clock: 1067000000, description: 'DIMM DDR2 - {claimed: true, class: memory, clock: 1067000000, description: 'DIMM DDR2
Synchronous 1067 MHz (0.9 ns) [empty]', handle: 'DMI:0020', id: 'bank:1', Synchronous 1067 MHz (0.9 ns) [empty]', handle: 'DMI:0020', id: 'bank:1',
physid: '1', product: 012345678901234567890123456789012345, serial: '01234567', physid: '1', product: 012345678901234567890123456789012345, serial: '01234567',
slot: J6G2, vendor: 48spaces} slot: J6G2, vendor: 48spaces}
- { claimed: true, class: memory, clock: 1067000000, description: DIMM DDR2 Synchronous - { claimed: true, class: memory, clock: 1067000000, description: DIMM DDR2 Synchronous
1067 MHz (0.9 ns), handle: 'DMI:0021', id: 'bank:2', physid: '2', product: '000000000000000000000000000000000000', 1067 MHz (0.9 ns), handle: 'DMI:0021', id: 'bank:2', physid: '2', product: '000000000000000000000000000000000000',
serial: '00000000', size: 2147483648, slot: J6H1, units: bytes, vendor: Unknown, serial: '00000000', size: 2147483648, slot: J6H1, units: bytes, vendor: Unknown,
width: 41984} width: 41984}
- {claimed: true, class: memory, clock: 1067000000, description: 'DIMM DDR2 - {claimed: true, class: memory, clock: 1067000000, description: 'DIMM DDR2
@ -205,7 +205,7 @@ debug:
- businfo: pci@0000:00:00.0 - businfo: pci@0000:00:00.0
children: children:
- businfo: pci@0000:00:02.0 - businfo: pci@0000:00:02.0
capabilities: { bus_master: bus mastering, cap_list: PCI capabilities listing, capabilities: { bus_master: bus mastering, cap_list: PCI capabilities listing,
msi: Message Signalled Interrupts, pm: Power Management, rom: extension msi: Message Signalled Interrupts, pm: Power Management, rom: extension
ROM, vga_controller: true} ROM, vga_controller: true}
claimed: true claimed: true
@ -265,8 +265,8 @@ debug:
version: '03' version: '03'
width: 32 width: 32
- businfo: pci@0000:00:03.3 - businfo: pci@0000:00:03.3
capabilities: { '16550': true, bus_master: bus mastering, cap_list: PCI capabilities capabilities: { '16550': true, bus_master: bus mastering, cap_list: PCI capabilities
listing, msi: Message Signalled Interrupts, pm: Power Management} listing, msi: Message Signalled Interrupts, pm: Power Management}
claimed: true claimed: true
class: communication class: communication
clock: 66000000 clock: 66000000
@ -280,8 +280,8 @@ debug:
version: '03' version: '03'
width: 32 width: 32
- businfo: pci@0000:00:19.0 - businfo: pci@0000:00:19.0
capabilities: { 1000bt-fd: 1Gbit/s (full duplex), 100bt: 100Mbit/s, 100bt-fd: 100Mbit/s capabilities: { 1000bt-fd: 1Gbit/s (full duplex), 100bt: 100Mbit/s, 100bt-fd: 100Mbit/s
(full duplex), 10bt: 10Mbit/s, 10bt-fd: 10Mbit/s (full duplex), autonegotiation: Auto-negotiation, (full duplex), 10bt: 10Mbit/s, 10bt-fd: 10Mbit/s (full duplex), autonegotiation: Auto-negotiation,
bus_master: bus mastering, cap_list: PCI capabilities listing, ethernet: true, bus_master: bus mastering, cap_list: PCI capabilities listing, ethernet: true,
msi: Message Signalled Interrupts, physical: Physical interface, pm: Power msi: Message Signalled Interrupts, physical: Physical interface, pm: Power
Management, tp: twisted pair} Management, tp: twisted pair}
@ -575,8 +575,8 @@ debug:
version: '02' version: '02'
width: 32 width: 32
- businfo: pci@0000:00:1f.2 - businfo: pci@0000:00:1f.2
capabilities: { ahci_1.0: true, bus_master: bus mastering, cap_list: PCI capabilities capabilities: { ahci_1.0: true, bus_master: bus mastering, cap_list: PCI capabilities
listing, msi: Message Signalled Interrupts, pm: Power Management, storage: true} listing, msi: Message Signalled Interrupts, pm: Power Management, storage: true}
claimed: true claimed: true
class: storage class: storage
clock: 66000000 clock: 66000000
@ -620,7 +620,7 @@ debug:
table} table}
children: children:
- businfo: scsi@0:0.0.0,1 - businfo: scsi@0:0.0.0,1
capabilities: { dir_nlink: directories with 65000+ subdirs, ext2: EXT2/EXT3, capabilities: { dir_nlink: directories with 65000+ subdirs, ext2: EXT2/EXT3,
ext4: true, extended_attributes: Extended Attributes, extents: extent-based ext4: true, extended_attributes: Extended Attributes, extents: extent-based
allocation, huge_files: 16TB+ files, initialized: initialized volume, allocation, huge_files: 16TB+ files, initialized: initialized volume,
journaled: true, large_files: 4GB+ files, primary: Primary partition} journaled: true, large_files: 4GB+ files, primary: Primary partition}
@ -672,8 +672,8 @@ debug:
- capabilities: {emulated: Emulated device} - capabilities: {emulated: Emulated device}
children: children:
- businfo: scsi@1:0.0.0 - businfo: scsi@1:0.0.0
capabilities: { audio: Audio CD playback, cd-r: CD-R burning, cd-rw: CD-RW capabilities: { audio: Audio CD playback, cd-r: CD-R burning, cd-rw: CD-RW
burning, dvd: DVD playback, dvd-r: DVD-R burning, dvd-ram: DVD-RAM burning, burning, dvd: DVD playback, dvd-r: DVD-R burning, dvd-ram: DVD-RAM burning,
removable: support is removable} removable: support is removable}
claimed: true claimed: true
class: disk class: disk

View File

@ -8,5 +8,5 @@
type: 'StressTest' type: 'StressTest'
elapsed: 300 elapsed: 300
error: False severity: Info
# snapshot: None fulfill! # snapshot: None fulfill!

View File

@ -7,7 +7,7 @@
# All numbers are invented # All numbers are invented
type: 'EraseSectors' type: 'EraseSectors'
error: False severity: Info
# snapshot: None fulfill! # snapshot: None fulfill!
# device: None fulfill! # device: None fulfill!
zeros: False zeros: False
@ -17,4 +17,4 @@ steps:
- type: 'StepRandom' - type: 'StepRandom'
startTime: '2018-01-01T10:10:10' startTime: '2018-01-01T10:10:10'
endTime: '2018-01-01T12:10:10' endTime: '2018-01-01T12:10:10'
error: False severity: Info

View File

@ -8,7 +8,7 @@
type: 'Install' type: 'Install'
elapsed: 420 elapsed: 420
error: False severity: Info
# snapshot: None fulfill! # snapshot: None fulfill!
# device: None fulfill! # device: None fulfill!
name: 'LinuxMint 18.01 32b' name: 'LinuxMint 18.01 32b'

View File

@ -20,7 +20,7 @@ from ereuse_devicehub.resources.device.exceptions import NeedsId
from ereuse_devicehub.resources.device.schemas import Device as DeviceS from ereuse_devicehub.resources.device.schemas import Device as DeviceS
from ereuse_devicehub.resources.device.sync import MismatchBetweenTags, MismatchBetweenTagsAndHid, \ from ereuse_devicehub.resources.device.sync import MismatchBetweenTags, MismatchBetweenTagsAndHid, \
Sync Sync
from ereuse_devicehub.resources.enums import ComputerChassis, DisplayTech from ereuse_devicehub.resources.enums import ComputerChassis, DisplayTech, Severity
from ereuse_devicehub.resources.event import models as m from ereuse_devicehub.resources.event import models as m
from ereuse_devicehub.resources.event.models import Remove, Test from ereuse_devicehub.resources.event.models import Remove, Test
from ereuse_devicehub.resources.tag.model import Tag from ereuse_devicehub.resources.tag.model import Tag
@ -393,7 +393,7 @@ def test_get_device(app: Devicehub, user: UserClient):
db.session.add(pc) db.session.add(pc)
db.session.add(Test(device=pc, db.session.add(Test(device=pc,
elapsed=timedelta(seconds=4), elapsed=timedelta(seconds=4),
error=False, severity=Severity.Info,
agent=Person(name='Timmy'), agent=Person(name='Timmy'),
author=User(email='bar@bar.com'))) author=User(email='bar@bar.com')))
db.session.commit() db.session.commit()
@ -402,7 +402,7 @@ def test_get_device(app: Devicehub, user: UserClient):
assert pc['events'][0]['type'] == 'Test' assert pc['events'][0]['type'] == 'Test'
assert pc['events'][0]['device'] == 1 assert pc['events'][0]['device'] == 1
assert pc['events'][0]['elapsed'] == 4 assert pc['events'][0]['elapsed'] == 4
assert not pc['events'][0]['error'] assert pc['events'][0]['severity'] == 'Info'
assert UUID(pc['events'][0]['author']) assert UUID(pc['events'][0]['author'])
assert 'events_components' not in pc, 'events_components are internal use only' assert 'events_components' not in pc, 'events_components are internal use only'
assert 'events_one' not in pc, 'they are internal use only' assert 'events_one' not in pc, 'they are internal use only'

View File

@ -13,7 +13,7 @@ from ereuse_devicehub.db import db
from ereuse_devicehub.resources.device import states from ereuse_devicehub.resources.device import states
from ereuse_devicehub.resources.device.models import Desktop, Device, GraphicCard, HardDrive, \ from ereuse_devicehub.resources.device.models import Desktop, Device, GraphicCard, HardDrive, \
RamModule, SolidStateDrive RamModule, SolidStateDrive
from ereuse_devicehub.resources.enums import ComputerChassis, TestDataStorageLength from ereuse_devicehub.resources.enums import ComputerChassis, Severity, TestDataStorageLength
from ereuse_devicehub.resources.event import models from ereuse_devicehub.resources.event import models
from tests import conftest from tests import conftest
from tests.conftest import create_user, file from tests.conftest import create_user, file
@ -89,7 +89,7 @@ def test_erase_sectors_steps():
def test_test_data_storage(): def test_test_data_storage():
test = models.TestDataStorage( test = models.TestDataStorage(
device=HardDrive(serial_number='foo', manufacturer='bar', model='foo-bar'), device=HardDrive(serial_number='foo', manufacturer='bar', model='foo-bar'),
error=False, severity=Severity.Info,
elapsed=timedelta(minutes=25), elapsed=timedelta(minutes=25),
length=TestDataStorageLength.Short, length=TestDataStorageLength.Short,
status='ok!', status='ok!',

View File

@ -310,13 +310,13 @@ def test_erase(user: UserClient):
assert erasure['device']['id'] == storage['id'] assert erasure['device']['id'] == storage['id']
for step in erasure['steps']: for step in erasure['steps']:
assert step['type'] == 'StepZero' assert step['type'] == 'StepZero'
assert step['error'] is False assert step['severity'] == 'Info'
assert 'num' not in step assert 'num' not in step
assert storage['privacy'] == erasure['device']['privacy'] == 'EraseSectors' assert storage['privacy'] == erasure['device']['privacy'] == 'EraseSectors'
# Let's try a second erasure with an error # Let's try a second erasure with an error
s['uuid'] = uuid4() s['uuid'] = uuid4()
s['components'][0]['events'][0]['error'] = True s['components'][0]['events'][0]['severity'] = 'Error'
snapshot, _ = user.post(s, res=Snapshot) snapshot, _ = user.post(s, res=Snapshot)
assert snapshot['components'][0]['hid'] == 'c1mr-c1s-c1ml' assert snapshot['components'][0]['hid'] == 'c1mr-c1s-c1ml'
assert snapshot['components'][0]['privacy'] == 'EraseSectorsError' assert snapshot['components'][0]['privacy'] == 'EraseSectorsError'
@ -330,8 +330,7 @@ def test_test_data_storage(user: UserClient):
ev for ev in snapshot['events'] ev for ev in snapshot['events']
if ev.get('reallocatedSectorCount', None) == 15 if ev.get('reallocatedSectorCount', None) == 15
) )
assert incidence_test['incidence'] incidence_test['severity'] == 'Error'
assert incidence_test['description'] == 'Warning: Drive failure expected soon.'
def test_snapshot_computer_monitor(user: UserClient): def test_snapshot_computer_monitor(user: UserClient):

View File

@ -49,7 +49,7 @@ def test_workbench_server_condensed(user: UserClient):
('TestDataStorage', 6) ('TestDataStorage', 6)
} }
assert snapshot['closed'] assert snapshot['closed']
assert not snapshot['error'] assert snapshot['severity'] == 'Info'
device, _ = user.get(res=Device, item=snapshot['device']['id']) device, _ = user.get(res=Device, item=snapshot['device']['id'])
assert device['dataStorageSize'] == 1100 assert device['dataStorageSize'] == 1100
assert device['chassis'] == 'Tower' assert device['chassis'] == 'Tower'
@ -59,7 +59,7 @@ def test_workbench_server_condensed(user: UserClient):
assert device['processorModel'] == device['components'][3]['model'] == 'p1-1ml' assert device['processorModel'] == device['components'][3]['model'] == 'p1-1ml'
assert device['ramSize'] == 2048, 'There are 3 RAM: 2 x 1024 and 1 None sizes' assert device['ramSize'] == 2048, 'There are 3 RAM: 2 x 1024 and 1 None sizes'
assert device['rate']['closed'] assert device['rate']['closed']
assert not device['rate']['error'] assert device['rate']['severity'] == 'Info'
assert device['rate']['rating'] == 0 assert device['rate']['rating'] == 0
assert device['rate']['workbench'] assert device['rate']['workbench']
assert device['rate']['appearanceRange'] == 'A' assert device['rate']['appearanceRange'] == 'A'
@ -129,7 +129,7 @@ def test_workbench_server_phases(user: UserClient):
assert events[8]['type'] == 'Install' assert events[8]['type'] == 'Install'
assert events[8]['device'] == 6 assert events[8]['device'] == 6
assert snapshot['closed'] assert snapshot['closed']
assert not snapshot['error'] assert snapshot['severity'] == 'Info'
pc, _ = user.get(res=Device, item=snapshot['id']) pc, _ = user.get(res=Device, item=snapshot['id'])
assert len(pc['events']) == 10 # todo shall I add child events? assert len(pc['events']) == 10 # todo shall I add child events?
@ -264,7 +264,7 @@ def test_snapshot_real_eee_1001pxd(user: UserClient):
assert erase['endTime'] assert erase['endTime']
assert erase['startTime'] assert erase['startTime']
assert erase['zeros'] is False assert erase['zeros'] is False
assert erase['error'] is False assert erase['severity'] == 'Info'
assert hdd['privacy'] == 'EraseBasic' assert hdd['privacy'] == 'EraseBasic'
mother = components[8] mother = components[8]
assert mother['hid'] == 'asustek_computer_inc-eee0123456789-1001pxd' assert mother['hid'] == 'asustek_computer_inc-eee0123456789-1001pxd'