From e3a0ea7e5b85bd4a35754e81aafe980045c7b3a4 Mon Sep 17 00:00:00 2001 From: nad Date: Tue, 29 Jun 2021 17:15:45 +0200 Subject: [PATCH 01/15] first iteration #155 decode snapshot json --- .../resources/action/views/views.py | 21 ++++++++++++------- tests/test_workbench.py | 5 +++++ tests/workbench_files/encoded.snapshot.json | 1 + 3 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 tests/workbench_files/encoded.snapshot.json diff --git a/ereuse_devicehub/resources/action/views/views.py b/ereuse_devicehub/resources/action/views/views.py index 8cb324ff..b53c9bb7 100644 --- a/ereuse_devicehub/resources/action/views/views.py +++ b/ereuse_devicehub/resources/action/views/views.py @@ -4,23 +4,25 @@ from datetime import timedelta from distutils.version import StrictVersion from uuid import UUID +import jwt from flask import current_app as app, request, g +from teal.db import ResourceNotFound from teal.marshmallow import ValidationError from teal.resource import View -from teal.db import ResourceNotFound from ereuse_devicehub.db import db from ereuse_devicehub.query import things_response from ereuse_devicehub.resources.action.models import (Action, Snapshot, VisualTest, InitTransfer, Live, Allocate, Deallocate, Trade, Confirm, ConfirmRevoke, Revoke) -from ereuse_devicehub.resources.device.models import Device, Computer, DataStorage -from ereuse_devicehub.resources.enums import Severity from ereuse_devicehub.resources.action.views import trade as trade_view from ereuse_devicehub.resources.action.views.snapshot import SnapshotView, save_json, move_json +from ereuse_devicehub.resources.device.models import Device, Computer, DataStorage +from ereuse_devicehub.resources.enums import Severity SUPPORTED_WORKBENCH = StrictVersion('11.0') + class AllocateMix(): model = None @@ -121,11 +123,11 @@ class LiveView(View): """If the device.allocated == True, then this snapshot create an action live.""" hid = self.get_hid(snapshot) if not hid or not Device.query.filter( - Device.hid==hid).count(): + Device.hid == hid).count(): raise ValidationError('Device not exist.') device = Device.query.filter( - Device.hid==hid, Device.allocated==True).one() + Device.hid == hid, Device.allocated == True).one() # Is not necessary if not device: raise ValidationError('Device not exist.') @@ -170,8 +172,12 @@ class ActionView(View): def post(self): """Posts an action.""" json = request.get_json(validate=False) - if not json or 'type' not in json: - raise ValidationError('Resource needs a type.') + if not json: + raise ValidationError('Post request needs a json.') + elif 'type' not in json: + # JN TODO Use the user's key instead an empty string + key = '' + json = jwt.decode(json, key, algorithms="HS256") # todo there should be a way to better get subclassess resource # defs resource_def = app.resources[json['type']] @@ -220,4 +226,3 @@ class ActionView(View): def transfer_ownership(self): """Perform a InitTransfer action to change author_id of device""" pass - diff --git a/tests/test_workbench.py b/tests/test_workbench.py index b2952f13..9e2b8da3 100644 --- a/tests/test_workbench.py +++ b/tests/test_workbench.py @@ -337,3 +337,8 @@ def test_david(user: UserClient): def test_eresueprice_computer_type(user: UserClient): s = file_workbench('computer-type.snapshot') snapshot, _ = user.post(res=em.Snapshot, data=s) + + +def test_workbench_encoded_snapshot(user: UserClient): + s = file_workbench('encoded.snapshot') + snapshot, _ = user.post(res=em.Snapshot, data=s) diff --git a/tests/workbench_files/encoded.snapshot.json b/tests/workbench_files/encoded.snapshot.json new file mode 100644 index 00000000..ba4ed574 --- /dev/null +++ b/tests/workbench_files/encoded.snapshot.json @@ -0,0 +1 @@ +eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0eXBlIjoiU25hcHNob3QiLCJ1dWlkIjoiMDA0MWQ4ZTgtNTY5Yy00NDUyLWIyOTktMDc0YjVmY2M2NDIyIiwic29mdHdhcmUiOiJXb3JrYmVuY2giLCJ2ZXJzaW9uIjoiMTIuMGIwIiwiY2xvc2VkIjp0cnVlLCJlbmRUaW1lIjoiMjAyMS0wNi0yOVQxMzo0NzoxNi42MTI5NjkrMDA6MDAiLCJlbGFwc2VkIjozMSwiZGV2aWNlIjp7ImFjdGlvbnMiOlt7ImVsYXBzZWQiOjEwLCJ0eXBlIjoiQmVuY2htYXJrUmFtU3lzYmVuY2giLCJyYXRlIjoxMC4wMDAxfV0sInR5cGUiOiJDb21wdXRlciIsIm1hbnVmYWN0dXJlciI6IkludGVsIENsaWVudCBTeXN0ZW1zIiwibW9kZWwiOiJOVUM2Q0FZSCIsInNlcmlhbE51bWJlciI6Ikc2QVk5MjIwMEw3OCIsImNoYXNzaXMiOiJWaXJ0dWFsIiwic2t1IjpudWxsLCJ2ZXJzaW9uIjoiSjI2ODQzLTQwOSJ9LCJjb21wb25lbnRzIjpbeyJhY3Rpb25zIjpbeyJlbGFwc2VkIjoxMCwidHlwZSI6IkJlbmNobWFya1Byb2Nlc3NvclN5c2JlbmNoIiwicmF0ZSI6MTAuMDA2NH0seyJlbGFwc2VkIjowLCJ0eXBlIjoiQmVuY2htYXJrUHJvY2Vzc29yIiwicmF0ZSI6MTE5ODAuOH1dLCJ0eXBlIjoiUHJvY2Vzc29yIiwibWFudWZhY3R1cmVyIjoiSW50ZWwgQ29ycC4iLCJtb2RlbCI6IkludGVsIENlbGVyb24gQ1BVIEozNDU1IEAgMS41MEdIeiIsInNlcmlhbE51bWJlciI6bnVsbCwic3BlZWQiOjEuODIxNjk0MDAwMDAwMDAwMSwiYWRkcmVzcyI6NjQsImNvcmVzIjo0LCJ0aHJlYWRzIjo0LCJicmFuZCI6IkNlbGVyb24iLCJnZW5lcmF0aW9uIjpudWxsfSx7ImFjdGlvbnMiOltdLCJ0eXBlIjoiUmFtTW9kdWxlIiwibWFudWZhY3R1cmVyIjoiVW5kZSIsIm1vZGVsIjoiQ1Q0RzNTMTg2REpNLk04RlAiLCJzZXJpYWxOdW1iZXIiOiJFMDgyMjRGRSIsImZvcm1hdCI6IlNPRElNTSIsInNpemUiOjQwOTYuMCwiaW50ZXJmYWNlIjoiRERSMyIsInNwZWVkIjoxODY2LjB9LHsiYWN0aW9ucyI6W3siZWxhcHNlZCI6MiwidHlwZSI6IkJlbmNobWFya0RhdGFTdG9yYWdlIiwicmVhZFNwZWVkIjozNjUuMCwid3JpdGVTcGVlZCI6MTYxLjB9XSwidHlwZSI6IkhhcmREcml2ZSIsIm1hbnVmYWN0dXJlciI6bnVsbCwibW9kZWwiOiJLSU5HU1RPTiBTQTQwMFMzIiwic2VyaWFsTnVtYmVyIjoiNTAwMjZCNzM4MEM5MTA5QSIsInNpemUiOjEyMDAzNC4xMjM3NzYsImludGVyZmFjZSI6IkFUQSIsInZhcmlhbnQiOiJCMUg1In0seyJhY3Rpb25zIjpbXSwidHlwZSI6IkdyYXBoaWNDYXJkIiwibWFudWZhY3R1cmVyIjoiSW50ZWwgQ29ycG9yYXRpb24iLCJtb2RlbCI6IkludGVsIENvcnBvcmF0aW9uIiwic2VyaWFsTnVtYmVyIjpudWxsLCJtZW1vcnkiOm51bGx9LHsiYWN0aW9ucyI6W10sInR5cGUiOiJOZXR3b3JrQWRhcHRlciIsIm1hbnVmYWN0dXJlciI6IkludGVsIENvcnBvcmF0aW9uIiwibW9kZWwiOiJJbnRlbCBDb3Jwb3JhdGlvbiIsInNlcmlhbE51bWJlciI6bnVsbCwic3BlZWQiOm51bGwsInZhcmlhbnQiOiIxMCIsIndpcmVsZXNzIjpmYWxzZX0seyJhY3Rpb25zIjpbXSwidHlwZSI6Ik5ldHdvcmtBZGFwdGVyIiwibWFudWZhY3R1cmVyIjoiUmVhbHRlayBTZW1pY29uZHVjdG9yIENvLiwgTHRkLiIsIm1vZGVsIjoiUlRMODExMS84MTY4Lzg0MTEgUENJIEV4cHJlc3MgR2lnYWJpdCBFdGhlcm5ldCBDb250cm9sbGVyIiwic2VyaWFsTnVtYmVyIjoiMWM6Njk6N2E6MDM6ODU6ZWQiLCJzcGVlZCI6MTAwMC4wLCJ2YXJpYW50IjoiMTUiLCJ3aXJlbGVzcyI6ZmFsc2V9LHsiYWN0aW9ucyI6W10sInR5cGUiOiJTb3VuZENhcmQiLCJtYW51ZmFjdHVyZXIiOiJJbnRlbCBDb3Jwb3JhdGlvbiIsIm1vZGVsIjoiQXRvbS9DZWxlcm9uL1BlbnRpdW0gUHJvY2Vzc29yIE40MjAwL04zMzUwL0UzOTAwIFNlcmllcyBBdWRpbyBDbHVzdGVyIiwic2VyaWFsTnVtYmVyIjpudWxsfSx7ImFjdGlvbnMiOltdLCJ0eXBlIjoiTW90aGVyYm9hcmQiLCJtYW51ZmFjdHVyZXIiOiJJbnRlbCBDb3Jwb3JhdGlvbiIsIm1vZGVsIjoiTlVDNkNBWUIiLCJzZXJpYWxOdW1iZXIiOiJHRUFZOTIxMDBVUjUiLCJ1c2IiOjEsImZpcmV3aXJlIjowLCJzZXJpYWwiOjIsInBjbWNpYSI6MCwic2xvdHMiOjAsImJpb3NEYXRlIjoiMjAxOS0wMi0xOVQwMDowMDowMCIsInZlcnNpb24iOiJBWUFQTENFTC44NkEuMDA2MC4yMDE5LjAyMTkuMTUyNyIsInJhbVNsb3RzIjo0LCJyYW1NYXhTaXplIjozMn1dfQ.7HgnMZhOIqczfYOHyqKp0YcdWBZxj2P7vbe8RbDcGpU \ No newline at end of file From 06170554eb3c48f7693d3a853abcbac5d530abdb Mon Sep 17 00:00:00 2001 From: nad Date: Wed, 30 Jun 2021 10:53:24 +0200 Subject: [PATCH 02/15] add pyjwt requirements.txt --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 299a9050..f0359648 100644 --- a/requirements.txt +++ b/requirements.txt @@ -36,3 +36,4 @@ sortedcontainers==2.1.0 tqdm==4.32.2 python-decouple==3.3 python-dotenv==0.14.0 +pyjwt==2.1.0 \ No newline at end of file From 6d4212f3148a085b440ee1b2ef85d3f719aa68ed Mon Sep 17 00:00:00 2001 From: nad Date: Wed, 30 Jun 2021 12:47:26 +0200 Subject: [PATCH 03/15] add example snapshot with hash --- requirements.txt | 3 +-- tests/workbench_files/acer.hash.snapshot.json | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 tests/workbench_files/acer.hash.snapshot.json diff --git a/requirements.txt b/requirements.txt index f0359648..15ccaa98 100644 --- a/requirements.txt +++ b/requirements.txt @@ -35,5 +35,4 @@ psycopg2-binary==2.8.3 sortedcontainers==2.1.0 tqdm==4.32.2 python-decouple==3.3 -python-dotenv==0.14.0 -pyjwt==2.1.0 \ No newline at end of file +python-dotenv==0.14.0 \ No newline at end of file diff --git a/tests/workbench_files/acer.hash.snapshot.json b/tests/workbench_files/acer.hash.snapshot.json new file mode 100644 index 00000000..3eb27462 --- /dev/null +++ b/tests/workbench_files/acer.hash.snapshot.json @@ -0,0 +1 @@ +{"closed": true, "components": [{"actions": [], "manufacturer": "Marvell Technology Group Ltd.", "model": "88E8071 PCI-E Gigabit Ethernet Controller", "serialNumber": "40:61:86:59:43:3f", "speed": 1000.0, "type": "NetworkAdapter", "variant": "16", "wireless": false}, {"actions": [{"elapsed": 0, "rate": 10374.16, "type": "BenchmarkProcessor"}, {"elapsed": 22, "rate": 21.6519, "type": "BenchmarkProcessorSysbench"}], "address": 64, "brand": "Pentium", "cores": 2, "generation": null, "manufacturer": "Intel Corp.", "model": "Pentium Dual-Core CPU E5300 @ 2.60GHz", "serialNumber": null, "speed": 2.6, "threads": 2, "type": "Processor"}, {"actions": [], "format": "DIMM", "interface": "DDR3", "manufacturer": "Apacer", "model": null, "serialNumber": "13930002", "size": 2048.0, "speed": 1333.0, "type": "RamModule"}, {"actions": [], "format": "DIMM", "interface": "DDR3", "manufacturer": "Apacer", "model": null, "serialNumber": "13930002", "size": 2048.0, "speed": 1333.0, "type": "RamModule"}, {"actions": [{"elapsed": 11, "readSpeed": 127.0, "type": "BenchmarkDataStorage", "writeSpeed": 32.0}, {"assessment": true, "currentPendingSectorCount": 0, "elapsed": 120, "length": "Short", "lifetime": 8636, "offlineUncorrectable": 0, "powerCycleCount": 1876, "reallocatedSectorCount": 0, "severity": "Info", "status": "Completed without error", "type": "TestDataStorage"}], "interface": "ATA", "manufacturer": "Western Digital", "model": "WDC WD5000AAKX-0", "serialNumber": "WD-WCAYUJP74971", "size": 500107.86201599997, "type": "HardDrive", "variant": "1H15"}, {"actions": [], "manufacturer": "Intel Corporation", "model": "82801JI HD Audio Controller", "serialNumber": null, "type": "SoundCard"}, {"actions": [], "manufacturer": "Intel Corporation", "memory": null, "model": "4 Series Chipset Integrated Graphics Controller", "serialNumber": null, "type": "GraphicCard"}, {"actions": [], "biosDate": "2009-08-07T00:00:00", "firewire": 0, "manufacturer": "Acer", "model": "Veriton M480", "pcmcia": 0, "ramMaxSize": 8, "ramSlots": 4, "serial": 1, "serialNumber": null, "slots": 4, "type": "Motherboard", "usb": 8, "version": "P01-A3"}], "debug": {"battery": null, "hwinfo": "01: None 00.0: 10105 BIOS\n [Created at bios.186]\n Unique ID: rdCR.lZF+r4EgHp4\n Hardware Class: bios\n BIOS Keyboard LED Status:\n Scroll Lock: off\n Num Lock: on\n Caps Lock: off\n Serial Port 0: 0x3f8\n Serial Port 1: 0x2f8\n Parallel Port 0: 0x378\n Base Memory: 623 kB\n PnP BIOS: @@@0000\n BIOS: extended read supported\n MP spec rev 1.4 info:\n OEM id: \"Intel\"\n Product id: \"Eaglelake\"\n 2 CPUs (0 disabled)\n BIOS32 Service Directory Entry: 0xf0010\n SMBIOS Version: 2.6\n BIOS Info: #0\n Vendor: \"Acer\"\n Version: \"P01-A3\"\n Date: \"08/07/2009\"\n Start Address: 0xf0000\n ROM Size: 1024 kB\n Features: 0x0533000000017f8bde90\n ISA supported\n PCI supported\n PnP supported\n APM supported\n BIOS flashable\n BIOS shadowing allowed\n ESCD supported\n CD boot supported\n Selectable boot supported\n BIOS ROM socketed\n EDD spec supported\n 1.2MB Floppy supported\n 720kB Floppy supported\n 2.88MB Floppy supported\n Print Screen supported\n 8042 Keyboard Services supported\n Serial Services supported\n Printer Services supported\n CGA/Mono Video supported\n ACPI supported\n USB Legacy supported\n LS-120 boot supported\n ATAPI ZIP boot supported\n BIOS Boot Spec supported\n System Info: #1\n Manufacturer: \"Acer\"\n Product: \"Veriton M480G\"\n Serial: \"P1FUR7ZG7S948048A12700\"\n UUID: undefined, but settable\n Wake-up: 0x06 (Power Switch)\n Board Info: #2\n Manufacturer: \"Acer\"\n Product: \"Veriton M480\"\n Asset Tag: \"To Be Filled By O.E.M.\"\n Type: 0x0a (Motherboard)\n Features: 0x09\n Hosting Board\n Replaceable\n Location: \"To Be Filled By O.E.M.\"\n Chassis: #3\n Chassis Info: #3\n Manufacturer: \"Acer\"\n Type: 0x03 (Desktop)\n Bootup State: 0x03 (Safe)\n Power Supply State: 0x03 (Safe)\n Thermal State: 0x03 (Safe)\n Security Status: 0x03 (None)\n Processor Info: #4\n Socket: \"CPU 1\"\n Socket Type: 0x15 (Other)\n Socket Status: Populated\n Type: 0x03 (CPU)\n Family: 0xa3 (Other)\n Manufacturer: \"Intel\"\n Version: \"Pentium(R) Dual-Core CPU E5300 @ 2.60GHz\"\n Serial: \"To Be Filled By O.E.M.\"\n Asset Tag: \"To Be Filled By O.E.M.\"\n Part Number: \"To Be Filled By O.E.M.\"\n Processor ID: 0xbfebfbff0001067a\n Status: 0x01 (Enabled)\n Voltage: 1.3 V\n External Clock: 200 MHz\n Max. Speed: 2600 MHz\n Current Speed: 2600 MHz\n L1 Cache: #5\n L2 Cache: #6\n L3 Cache: #7\n Cache Info: #5\n Designation: \"L1-Cache\"\n Level: L1\n State: Enabled\n Mode: 0x01 (Write Back)\n Location: 0x00 (Internal, Not Socketed)\n ECC: 0x04 (Parity)\n Type: 0x04 (Data)\n Associativity: 0x07 (8-way Set-Associative)\n Max. Size: 64 kB\n Current Size: 64 kB\n Supported SRAM Types: 0x0001 (Other)\n Current SRAM Type: 0x0001 (Other)\n Cache Info: #6\n Designation: \"L2-Cache\"\n Level: L2\n State: Enabled\n Mode: 0x01 (Write Back)\n Location: 0x00 (Internal, Not Socketed)\n ECC: 0x05 (Single-bit)\n Type: 0x05 (Unified)\n Associativity: 0x07 (8-way Set-Associative)\n Max. Size: 2048 kB\n Current Size: 2048 kB\n Supported SRAM Types: 0x0001 (Other)\n Current SRAM Type: 0x0001 (Other)\n Cache Info: #7\n Designation: \"L3-Cache\"\n Level: L3\n State: Disabled\n Mode: 0x03 (Unknown)\n Location: 0x00 (Internal, Not Socketed)\n ECC: 0x02 (Unknown)\n Type: 0x02 (Unknown)\n Associativity: 0x02 (Unknown)\n Supported SRAM Types: 0x0002 (Unknown)\n Current SRAM Type: 0x0002 (Unknown)\n Type 5 Record: #8\n Data 00: 05 18 08 00 06 04 03 03 0d 01 00 00 05 02 04 09\n Data 10: 00 0a 00 0b 00 0c 00 04\n Type 6 Record: #9\n Data 00: 06 0c 09 00 01 01 0c 00 05 8b 8b 00\n String 1: \"DIMM0\"\n Type 6 Record: #10\n Data 00: 06 0c 0a 00 01 23 00 00 05 7f 7f 00\n String 1: \"DIMM1\"\n Type 6 Record: #11\n Data 00: 06 0c 0b 00 01 45 0c 00 05 8b 8b 00\n String 1: \"DIMM2\"\n Type 6 Record: #12\n Data 00: 06 0c 0c 00 01 67 00 00 05 7f 7f 00\n String 1: \"DIMM3\"\n Port Connector: #13\n Type: 0x0e (Mouse Port)\n Internal Designator: \"J1A1\"\n External Designator: \"PS2Mouse\"\n External Connector: 0x0f (PS/2)\n Port Connector: #14\n Type: 0x0d (Keyboard Port)\n Internal Designator: \"J1A1\"\n External Designator: \"Keyboard\"\n External Connector: 0x0f (PS/2)\n Port Connector: #15\n Type: 0x10 (USB)\n Internal Designator: \"J2A2\"\n External Designator: \"USB1\"\n External Connector: 0x12 (Access Bus [USB])\n Port Connector: #16\n Type: 0x10 (USB)\n Internal Designator: \"J2A2\"\n External Designator: \"USB2\"\n External Connector: 0x12 (Access Bus [USB])\n Port Connector: #17\n Type: 0x05 (Parallel Port ECP/EPP)\n Internal Designator: \"J4A1\"\n External Designator: \"LPT 1\"\n External Connector: 0x04 (DB-25 pin male)\n Port Connector: #18\n Type: 0x09 (Serial Port 16550A Compatible)\n Internal Designator: \"J2A1\"\n External Designator: \"COM A\"\n External Connector: 0x08 (DB-9 pin male)\n Port Connector: #19\n Type: 0x1d (Audio Port)\n Internal Designator: \"J6A1\"\n External Designator: \"Audio Mic In\"\n External Connector: 0x1f (Mini-jack [headphones])\n Port Connector: #20\n Type: 0x1d (Audio Port)\n Internal Designator: \"J6A1\"\n External Designator: \"Audio Line In\"\n External Connector: 0x1f (Mini-jack [headphones])\n System Slot: #21\n Designation: \"PCI1\"\n Type: 0x06 (PCI)\n Bus Width: 0x05 (32 bit)\n Status: 0x03 (Available)\n Length: 0x04 (Long)\n Slot ID: 1\n Characteristics: 0x010c (3.3 V, Shared, PME#)\n System Slot: #22\n Designation: \"PCI2\"\n Type: 0x06 (PCI)\n Bus Width: 0x05 (32 bit)\n Status: 0x03 (Available)\n Length: 0x04 (Long)\n Slot ID: 2\n Characteristics: 0x010c (3.3 V, Shared, PME#)\n System Slot: #23\n Designation: \"PCI_E1\"\n Type: 0xa5 (Other)\n Bus Width: 0x0d (Other)\n Status: 0x03 (Available)\n Length: 0x04 (Long)\n Slot ID: 16\n Characteristics: 0x010c (3.3 V, Shared, PME#)\n System Slot: #24\n Designation: \"PCI_E2\"\n Type: 0xa5 (Other)\n Bus Width: 0x08 (Other)\n Status: 0x03 (Available)\n Length: 0x03 (Short)\n Slot ID: 32\n Characteristics: 0x010c (3.3 V, Shared, PME#)\n On Board Devices: #25\n Video: \"Onboard Intel Graphics\"\n On Board Devices: #26\n Ethernet: \"Onboard Marvell Ethernet\"\n On Board Devices: #27\n Sound: \"Onboard Realtek ALC662\"\n OEM Strings: #28\n Intel G43 + ICH10R\n Physical Memory Array: #29\n Use: 0x03 (System memory)\n Location: 0x03 (Motherboard)\n Slots: 4\n Max. Size: 8 GB\n ECC: 0x03 (None)\n Memory Array Mapping: #30\n Memory Array: #29\n Partition Width: 4\n Start Address: 0x0000000000000000\n End Address: 0x0000000100000000\n Memory Device: #31\n Location: \"DIMM0\"\n Bank: \"BANK0\"\n Manufacturer: \"Apacer\"\n Serial: \"13930002\"\n Memory Array: #29\n Form Factor: 0x09 (DIMM)\n Type: 0x18 (Other)\n Type Detail: 0x0080 (Synchronous)\n Data Width: 64 bits\n Size: 2 GB\n Speed: 1333 MHz\n Memory Device Mapping: #32\n Memory Device: #31\n Array Mapping: #30\n Row: 1\n Interleave Pos: 0\n Interleaved Depth: 1\n Start Address: 0x00000000\n End Address: 0x80000000\n Memory Device: #33\n Location: \"DIMM1\"\n Bank: \"BANK1\"\n Manufacturer: \"Manufacturer01\"\n Serial: \"SerNum01\"\n Memory Array: #29\n Form Factor: 0x09 (DIMM)\n Type: 0x02 (Unknown)\n Type Detail: 0x0004 (Unknown)\n Data Width: 0 bits\n Size: No Memory Installed\n Memory Device Mapping: #34\n Memory Device: #33\n Array Mapping: #30\n Row: 1\n Interleave Pos: 0\n Interleaved Depth: 1\n Start Address: 0x00000000\n End Address: 0x00000400\n Memory Device: #35\n Location: \"DIMM2\"\n Bank: \"BANK2\"\n Manufacturer: \"Apacer\"\n Serial: \"13930002\"\n Memory Array: #29\n Form Factor: 0x09 (DIMM)\n Type: 0x18 (Other)\n Type Detail: 0x0080 (Synchronous)\n Data Width: 64 bits\n Size: 2 GB\n Speed: 1333 MHz\n Memory Device Mapping: #36\n Memory Device: #35\n Array Mapping: #30\n Row: 1\n Interleave Pos: 0\n Interleaved Depth: 1\n Start Address: 0x0000000080000000\n End Address: 0x0000000100000000\n Memory Device: #37\n Location: \"DIMM3\"\n Bank: \"BANK3\"\n Manufacturer: \"Manufacturer03\"\n Serial: \"SerNum03\"\n Memory Array: #29\n Form Factor: 0x09 (DIMM)\n Type: 0x02 (Unknown)\n Type Detail: 0x0004 (Unknown)\n Data Width: 0 bits\n Size: No Memory Installed\n Memory Device Mapping: #38\n Memory Device: #37\n Array Mapping: #30\n Row: 1\n Interleave Pos: 0\n Interleaved Depth: 1\n Start Address: 0x00000000\n End Address: 0x00000400\n Hardware Security: #39\n Power-on Password: 0x00 (Disabled)\n Keyboard Password: 0x02 (Not Implemented)\n Admin Password: 0x00 (Disabled)\n Front Panel Reset: 0x02 (Not Implemented)\n Type 32 Record: #40\n Data 00: 20 14 28 00 00 00 00 00 00 00 00 00 00 00 00 00\n Data 10: 00 00 00 00\n Type 41 Record: #41\n Data 00: 29 0b 29 00 01 83 00 00 00 00 10\n String 1: \"Onboard Intel Graphics\"\n Type 41 Record: #42\n Data 00: 29 0b 2a 00 01 85 00 00 00 ff 00\n String 1: \"Onboard Marvell Ethernet\"\n Type 41 Record: #43\n Data 00: 29 0b 2b 00 01 87 00 ff ff 00 d8\n String 1: \"Onboard Realtek ALC662\"\n Type 129 Record: #44\n Data 00: 81 08 2c 00 01 01 02 01\n String 1: \"Intel_ASF\"\n String 2: \"Intel_ASF_001\"\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n02: None 00.0: 10107 System\n [Created at sys.63]\n Unique ID: rdCR.n_7QNeEnh23\n Hardware Class: system\n Model: \"System\"\n Formfactor: \"desktop\"\n Driver Info #0:\n Driver Status: thermal,fan are not active\n Driver Activation Cmd: \"modprobe thermal; modprobe fan\"\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n03: None 00.0: 10104 FPU\n [Created at misc.191]\n Unique ID: rdCR.EMpH5pjcahD\n Hardware Class: unknown\n Model: \"FPU\"\n I/O Ports: 0xf0-0xff (rw)\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n04: None 00.0: 0801 DMA controller (8237)\n [Created at misc.205]\n Unique ID: rdCR.f5u1ucRm+H9\n Hardware Class: unknown\n Model: \"DMA controller\"\n I/O Ports: 0x00-0xcf7 (rw)\n I/O Ports: 0xc0-0xdf (rw)\n I/O Ports: 0x80-0x8f (rw)\n DMA: 4\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n05: None 00.0: 0800 PIC (8259)\n [Created at misc.218]\n Unique ID: rdCR.8uRK7LxiIA2\n Hardware Class: unknown\n Model: \"PIC\"\n I/O Ports: 0x20-0x21 (rw)\n I/O Ports: 0xa0-0xa1 (rw)\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n06: None 00.0: 0900 Keyboard controller\n [Created at misc.250]\n Unique ID: rdCR.9N+EecqykME\n Hardware Class: unknown\n Model: \"Keyboard controller\"\n I/O Port: 0x60 (rw)\n I/O Port: 0x64 (rw)\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n07: None 00.0: 0701 Parallel controller (SPP)\n [Created at misc.261]\n Unique ID: YMnp.ecK7NLYWZ5D\n Hardware Class: unknown\n Model: \"Parallel controller\"\n Device File: /dev/lp0\n I/O Ports: 0x378-0x37a (rw)\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n08: None 00.0: 10400 PS/2 Controller\n [Created at misc.303]\n Unique ID: rdCR.DziBbWO85o5\n Hardware Class: unknown\n Model: \"PS/2 Controller\"\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n11: None 00.0: 10102 Main Memory\n [Created at memory.74]\n Unique ID: rdCR.CxwsZFjVASF\n Hardware Class: memory\n Model: \"Main Memory\"\n Memory Range: 0x00000000-0xfa5b5fff (rw)\n Memory Size: 4 GB\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n12: PCI 1f.5: 0101 IDE interface\n [Created at pci.378]\n Unique ID: W60f.a_3MiEMsU_0\n SysFS ID: /devices/pci0000:00/0000:00:1f.5\n SysFS BusID: 0000:00:1f.5\n Hardware Class: storage\n Model: \"Intel 82801JI (ICH10 Family) 2 port SATA IDE Controller #2\"\n Vendor: pci 0x8086 \"Intel Corporation\"\n Device: pci 0x3a26 \"82801JI (ICH10 Family) 2 port SATA IDE Controller #2\"\n SubVendor: pci 0x1025 \"Acer Incorporated [ALI]\"\n SubDevice: pci 0x023c \n Driver: \"ata_piix\"\n Driver Modules: \"ata_piix\"\n I/O Ports: 0xbc00-0xbc07 (rw)\n I/O Ports: 0xb880-0xb883 (rw)\n I/O Ports: 0xb800-0xb807 (rw)\n I/O Ports: 0xb480-0xb483 (rw)\n I/O Ports: 0xb400-0xb40f (rw)\n I/O Ports: 0xb080-0xb08f (rw)\n IRQ: 19 (1251 events)\n Module Alias: \"pci:v00008086d00003A26sv00001025sd0000023Cbc01sc01i85\"\n Driver Info #0:\n Driver Status: ata_piix is active\n Driver Activation Cmd: \"modprobe ata_piix\"\n Driver Info #1:\n Driver Status: ata_generic is active\n Driver Activation Cmd: \"modprobe ata_generic\"\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n13: PCI 1e.0: 0604 PCI bridge (Subtractive decode)\n [Created at pci.378]\n Unique ID: 6NW+.wWtQCRGqvsB\n SysFS ID: /devices/pci0000:00/0000:00:1e.0\n SysFS BusID: 0000:00:1e.0\n Hardware Class: bridge\n Model: \"Intel 82801 PCI Bridge\"\n Vendor: pci 0x8086 \"Intel Corporation\"\n Device: pci 0x244e \"82801 PCI Bridge\"\n SubVendor: pci 0x1025 \"Acer Incorporated [ALI]\"\n SubDevice: pci 0x023c \n Revision: 0x90\n Module Alias: \"pci:v00008086d0000244Esv00001025sd0000023Cbc06sc04i01\"\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n14: PCI 1f.3: 0c05 SMBus\n [Created at pci.378]\n Unique ID: nS1_.uKBBnQOqbV0\n SysFS ID: /devices/pci0000:00/0000:00:1f.3\n SysFS BusID: 0000:00:1f.3\n Hardware Class: unknown\n Model: \"Intel 82801JI (ICH10 Family) SMBus Controller\"\n Vendor: pci 0x8086 \"Intel Corporation\"\n Device: pci 0x3a30 \"82801JI (ICH10 Family) SMBus Controller\"\n SubVendor: pci 0x1025 \"Acer Incorporated [ALI]\"\n SubDevice: pci 0x023c \n Driver: \"i801_smbus\"\n Driver Modules: \"i2c_i801\"\n Memory Range: 0xfeaf3c00-0xfeaf3cff (rw,non-prefetchable)\n I/O Ports: 0x400-0x41f (rw)\n IRQ: 18 (no events)\n Module Alias: \"pci:v00008086d00003A30sv00001025sd0000023Cbc0Csc05i00\"\n Driver Info #0:\n Driver Status: i2c_i801 is active\n Driver Activation Cmd: \"modprobe i2c_i801\"\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n15: PCI 00.0: 0600 Host bridge\n [Created at pci.378]\n Unique ID: qLht.qaDJIW1j0S8\n SysFS ID: /devices/pci0000:00/0000:00:00.0\n SysFS BusID: 0000:00:00.0\n Hardware Class: bridge\n Model: \"Intel 4 Series Chipset DRAM Controller\"\n Vendor: pci 0x8086 \"Intel Corporation\"\n Device: pci 0x2e20 \"4 Series Chipset DRAM Controller\"\n SubVendor: pci 0x1025 \"Acer Incorporated [ALI]\"\n SubDevice: pci 0x023c \n Revision: 0x03\n Module Alias: \"pci:v00008086d00002E20sv00001025sd0000023Cbc06sc00i00\"\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n16: PCI 1c.1: 0604 PCI bridge (Normal decode)\n [Created at pci.378]\n Unique ID: qTvu.ZgPTai_Bkh5\n SysFS ID: /devices/pci0000:00/0000:00:1c.1\n SysFS BusID: 0000:00:1c.1\n Hardware Class: bridge\n Model: \"Intel 82801JI (ICH10 Family) PCI Express Port 2\"\n Vendor: pci 0x8086 \"Intel Corporation\"\n Device: pci 0x3a42 \"82801JI (ICH10 Family) PCI Express Port 2\"\n SubVendor: pci 0x1025 \"Acer Incorporated [ALI]\"\n SubDevice: pci 0x023c \n Driver: \"pcieport\"\n IRQ: 25 (no events)\n Module Alias: \"pci:v00008086d00003A42sv00001025sd0000023Cbc06sc04i00\"\n Driver Info #0:\n Driver Status: shpchp is active\n Driver Activation Cmd: \"modprobe shpchp\"\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n17: PCI 1a.2: 0c03 USB Controller (UHCI)\n [Created at pci.378]\n Unique ID: XaIo.VeoVaxnHxH4\n SysFS ID: /devices/pci0000:00/0000:00:1a.2\n SysFS BusID: 0000:00:1a.2\n Hardware Class: usb controller\n Model: \"Intel 82801JI (ICH10 Family) USB UHCI Controller #6\"\n Vendor: pci 0x8086 \"Intel Corporation\"\n Device: pci 0x3a39 \"82801JI (ICH10 Family) USB UHCI Controller #6\"\n SubVendor: pci 0x1025 \"Acer Incorporated [ALI]\"\n SubDevice: pci 0x023c \n Driver: \"uhci_hcd\"\n Driver Modules: \"uhci_hcd\"\n I/O Ports: 0xd480-0xd49f (rw)\n IRQ: 19 (1251 events)\n Module Alias: \"pci:v00008086d00003A39sv00001025sd0000023Cbc0Csc03i00\"\n Driver Info #0:\n Driver Status: uhci-hcd is active\n Driver Activation Cmd: \"modprobe uhci-hcd\"\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n18: PCI 1d.2: 0c03 USB Controller (UHCI)\n [Created at pci.378]\n Unique ID: mvRC.yOzF8I5yLZ4\n SysFS ID: /devices/pci0000:00/0000:00:1d.2\n SysFS BusID: 0000:00:1d.2\n Hardware Class: usb controller\n Model: \"Intel 82801JI (ICH10 Family) USB UHCI Controller #3\"\n Vendor: pci 0x8086 \"Intel Corporation\"\n Device: pci 0x3a36 \"82801JI (ICH10 Family) USB UHCI Controller #3\"\n SubVendor: pci 0x1025 \"Acer Incorporated [ALI]\"\n SubDevice: pci 0x023c \n Driver: \"uhci_hcd\"\n Driver Modules: \"uhci_hcd\"\n I/O Ports: 0xd000-0xd01f (rw)\n IRQ: 18 (no events)\n Module Alias: \"pci:v00008086d00003A36sv00001025sd0000023Cbc0Csc03i00\"\n Driver Info #0:\n Driver Status: uhci-hcd is active\n Driver Activation Cmd: \"modprobe uhci-hcd\"\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n19: PCI 1a.0: 0c03 USB Controller (UHCI)\n [Created at pci.378]\n Unique ID: pwJ7.Tpv+coYttW3\n SysFS ID: /devices/pci0000:00/0000:00:1a.0\n SysFS BusID: 0000:00:1a.0\n Hardware Class: usb controller\n Model: \"Intel 82801JI (ICH10 Family) USB UHCI Controller #4\"\n Vendor: pci 0x8086 \"Intel Corporation\"\n Device: pci 0x3a37 \"82801JI (ICH10 Family) USB UHCI Controller #4\"\n SubVendor: pci 0x1025 \"Acer Incorporated [ALI]\"\n SubDevice: pci 0x023c \n Driver: \"uhci_hcd\"\n Driver Modules: \"uhci_hcd\"\n I/O Ports: 0xd880-0xd89f (rw)\n IRQ: 16 (no events)\n Module Alias: \"pci:v00008086d00003A37sv00001025sd0000023Cbc0Csc03i00\"\n Driver Info #0:\n Driver Status: uhci-hcd is active\n Driver Activation Cmd: \"modprobe uhci-hcd\"\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n20: PCI 1d.0: 0c03 USB Controller (UHCI)\n [Created at pci.378]\n Unique ID: 1GTX.wZ4mA9sXIo3\n SysFS ID: /devices/pci0000:00/0000:00:1d.0\n SysFS BusID: 0000:00:1d.0\n Hardware Class: usb controller\n Model: \"Intel 82801JI (ICH10 Family) USB UHCI Controller #1\"\n Vendor: pci 0x8086 \"Intel Corporation\"\n Device: pci 0x3a34 \"82801JI (ICH10 Family) USB UHCI Controller #1\"\n SubVendor: pci 0x1025 \"Acer Incorporated [ALI]\"\n SubDevice: pci 0x023c \n Driver: \"uhci_hcd\"\n Driver Modules: \"uhci_hcd\"\n I/O Ports: 0xd400-0xd41f (rw)\n IRQ: 23 (6619 events)\n Module Alias: \"pci:v00008086d00003A34sv00001025sd0000023Cbc0Csc03i00\"\n Driver Info #0:\n Driver Status: uhci-hcd is active\n Driver Activation Cmd: \"modprobe uhci-hcd\"\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n21: PCI 1a.7: 0c03 USB Controller (EHCI)\n [Created at pci.378]\n Unique ID: sClz.YuDxIjd92HA\n SysFS ID: /devices/pci0000:00/0000:00:1a.7\n SysFS BusID: 0000:00:1a.7\n Hardware Class: usb controller\n Model: \"Intel 82801JI (ICH10 Family) USB2 EHCI Controller #2\"\n Vendor: pci 0x8086 \"Intel Corporation\"\n Device: pci 0x3a3c \"82801JI (ICH10 Family) USB2 EHCI Controller #2\"\n SubVendor: pci 0x1025 \"Acer Incorporated [ALI]\"\n SubDevice: pci 0x023c \n Driver: \"ehci-pci\"\n Driver Modules: \"ehci_pci\"\n Memory Range: 0xfeafa000-0xfeafa3ff (rw,non-prefetchable)\n IRQ: 18 (no events)\n Module Alias: \"pci:v00008086d00003A3Csv00001025sd0000023Cbc0Csc03i20\"\n Driver Info #0:\n Driver Status: ehci-hcd is active\n Driver Activation Cmd: \"modprobe ehci-hcd\"\n Driver Info #1:\n Driver Status: ehci_pci is active\n Driver Activation Cmd: \"modprobe ehci_pci\"\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n22: PCI 02.0: 0300 VGA compatible controller (VGA)\n [Created at pci.378]\n Unique ID: _Znp.pyR3jqaNld4\n SysFS ID: /devices/pci0000:00/0000:00:02.0\n SysFS BusID: 0000:00:02.0\n Hardware Class: graphics card\n Device Name: \"Onboard Intel Graphics\"\n Model: \"Intel 4 Series Chipset Integrated Graphics Controller\"\n Vendor: pci 0x8086 \"Intel Corporation\"\n Device: pci 0x2e22 \"4 Series Chipset Integrated Graphics Controller\"\n SubVendor: pci 0x1025 \"Acer Incorporated [ALI]\"\n SubDevice: pci 0x023c \n Revision: 0x03\n Driver: \"i915\"\n Driver Modules: \"i915\"\n Memory Range: 0xfe400000-0xfe7fffff (rw,non-prefetchable)\n Memory Range: 0xd0000000-0xdfffffff (ro,non-prefetchable)\n I/O Ports: 0xdc00-0xdc07 (rw)\n Memory Range: 0x000c0000-0x000dffff (rw,non-prefetchable,disabled)\n IRQ: 27 (5 events)\n I/O Ports: 0x3c0-0x3df (rw)\n Module Alias: \"pci:v00008086d00002E22sv00001025sd0000023Cbc03sc00i00\"\n Driver Info #0:\n Driver Status: i915 is active\n Driver Activation Cmd: \"modprobe i915\"\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n23: PCI 1d.7: 0c03 USB Controller (EHCI)\n [Created at pci.378]\n Unique ID: 5YuN.W3LRLaOl_V9\n SysFS ID: /devices/pci0000:00/0000:00:1d.7\n SysFS BusID: 0000:00:1d.7\n Hardware Class: usb controller\n Model: \"Intel 82801JI (ICH10 Family) USB2 EHCI Controller #1\"\n Vendor: pci 0x8086 \"Intel Corporation\"\n Device: pci 0x3a3a \"82801JI (ICH10 Family) USB2 EHCI Controller #1\"\n SubVendor: pci 0x1025 \"Acer Incorporated [ALI]\"\n SubDevice: pci 0x023c \n Driver: \"ehci-pci\"\n Driver Modules: \"ehci_pci\"\n Memory Range: 0xfeaf8000-0xfeaf83ff (rw,non-prefetchable)\n IRQ: 23 (6619 events)\n Module Alias: \"pci:v00008086d00003A3Asv00001025sd0000023Cbc0Csc03i20\"\n Driver Info #0:\n Driver Status: ehci-hcd is active\n Driver Activation Cmd: \"modprobe ehci-hcd\"\n Driver Info #1:\n Driver Status: ehci_pci is active\n Driver Activation Cmd: \"modprobe ehci_pci\"\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n24: PCI 1f.2: 0101 IDE interface\n [Created at pci.378]\n Unique ID: w7Y8.eN1YPYndms5\n SysFS ID: /devices/pci0000:00/0000:00:1f.2\n SysFS BusID: 0000:00:1f.2\n Hardware Class: storage\n Model: \"Intel 82801JI (ICH10 Family) 4 port SATA IDE Controller #1\"\n Vendor: pci 0x8086 \"Intel Corporation\"\n Device: pci 0x3a20 \"82801JI (ICH10 Family) 4 port SATA IDE Controller #1\"\n SubVendor: pci 0x1025 \"Acer Incorporated [ALI]\"\n SubDevice: pci 0x023c \n Driver: \"ata_piix\"\n Driver Modules: \"ata_piix\"\n I/O Ports: 0xcc00-0xcc07 (rw)\n I/O Ports: 0xc880-0xc883 (rw)\n I/O Ports: 0xc800-0xc807 (rw)\n I/O Ports: 0xc480-0xc483 (rw)\n I/O Ports: 0xc400-0xc40f (rw)\n I/O Ports: 0xc080-0xc08f (rw)\n IRQ: 19 (1251 events)\n Module Alias: \"pci:v00008086d00003A20sv00001025sd0000023Cbc01sc01i8F\"\n Driver Info #0:\n Driver Status: ata_piix is active\n Driver Activation Cmd: \"modprobe ata_piix\"\n Driver Info #1:\n Driver Status: ata_generic is active\n Driver Activation Cmd: \"modprobe ata_generic\"\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n25: PCI 1c.0: 0604 PCI bridge (Normal decode)\n [Created at pci.378]\n Unique ID: z8Q3.XrWzcZlngw4\n SysFS ID: /devices/pci0000:00/0000:00:1c.0\n SysFS BusID: 0000:00:1c.0\n Hardware Class: bridge\n Model: \"Intel 82801JI (ICH10 Family) PCI Express Root Port 1\"\n Vendor: pci 0x8086 \"Intel Corporation\"\n Device: pci 0x3a40 \"82801JI (ICH10 Family) PCI Express Root Port 1\"\n SubVendor: pci 0x1025 \"Acer Incorporated [ALI]\"\n SubDevice: pci 0x023c \n Driver: \"pcieport\"\n IRQ: 24 (no events)\n Module Alias: \"pci:v00008086d00003A40sv00001025sd0000023Cbc06sc04i00\"\n Driver Info #0:\n Driver Status: shpchp is active\n Driver Activation Cmd: \"modprobe shpchp\"\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n26: PCI 1a.1: 0c03 USB Controller (UHCI)\n [Created at pci.378]\n Unique ID: gFpy._Dsl5NgaPv3\n SysFS ID: /devices/pci0000:00/0000:00:1a.1\n SysFS BusID: 0000:00:1a.1\n Hardware Class: usb controller\n Model: \"Intel 82801JI (ICH10 Family) USB UHCI Controller #5\"\n Vendor: pci 0x8086 \"Intel Corporation\"\n Device: pci 0x3a38 \"82801JI (ICH10 Family) USB UHCI Controller #5\"\n SubVendor: pci 0x1025 \"Acer Incorporated [ALI]\"\n SubDevice: pci 0x023c \n Driver: \"uhci_hcd\"\n Driver Modules: \"uhci_hcd\"\n I/O Ports: 0xd800-0xd81f (rw)\n IRQ: 21 (no events)\n Module Alias: \"pci:v00008086d00003A38sv00001025sd0000023Cbc0Csc03i00\"\n Driver Info #0:\n Driver Status: uhci-hcd is active\n Driver Activation Cmd: \"modprobe uhci-hcd\"\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n27: PCI 1f.0: 0601 ISA bridge\n [Created at pci.378]\n Unique ID: BUZT.KpYN9waZRJ2\n SysFS ID: /devices/pci0000:00/0000:00:1f.0\n SysFS BusID: 0000:00:1f.0\n Hardware Class: bridge\n Model: \"Intel 82801JIR (ICH10R) LPC Interface Controller\"\n Vendor: pci 0x8086 \"Intel Corporation\"\n Device: pci 0x3a16 \"82801JIR (ICH10R) LPC Interface Controller\"\n SubVendor: pci 0x1025 \"Acer Incorporated [ALI]\"\n SubDevice: pci 0x023c \n Driver: \"lpc_ich\"\n Driver Modules: \"lpc_ich\"\n Module Alias: \"pci:v00008086d00003A16sv00001025sd0000023Cbc06sc01i00\"\n Driver Info #0:\n Driver Status: lpc_ich is active\n Driver Activation Cmd: \"modprobe lpc_ich\"\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n28: PCI 200.0: 0200 Ethernet controller\n [Created at pci.378]\n Unique ID: c3qJ.eXFF3sAVI_6\n Parent ID: qTvu.ZgPTai_Bkh5\n SysFS ID: /devices/pci0000:00/0000:00:1c.1/0000:02:00.0\n SysFS BusID: 0000:02:00.0\n Hardware Class: network\n Model: \"Marvell 88E8071 PCI-E Gigabit Ethernet Controller\"\n Vendor: pci 0x11ab \"Marvell Technology Group Ltd.\"\n Device: pci 0x436b \"88E8071 PCI-E Gigabit Ethernet Controller\"\n SubVendor: pci 0x1025 \"Acer Incorporated [ALI]\"\n SubDevice: pci 0x7607 \n Revision: 0x16\n Driver: \"sky2\"\n Driver Modules: \"sky2\"\n Device File: enp2s0\n Memory Range: 0xfebfc000-0xfebfffff (rw,non-prefetchable)\n I/O Ports: 0xe800-0xe8ff (rw)\n Memory Range: 0xfebc0000-0xfebdffff (ro,non-prefetchable,disabled)\n IRQ: 26 (20 events)\n HW Address: 40:61:86:59:43:3f\n Permanent HW Address: 40:61:86:59:43:3f\n Link detected: yes\n Module Alias: \"pci:v000011ABd0000436Bsv00001025sd00007607bc02sc00i00\"\n Driver Info #0:\n Driver Status: sky2 is active\n Driver Activation Cmd: \"modprobe sky2\"\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n Attached to: #16 (PCI bridge)\n\n29: PCI 1d.1: 0c03 USB Controller (UHCI)\n [Created at pci.378]\n Unique ID: vayM.R_0WfjzEqA4\n SysFS ID: /devices/pci0000:00/0000:00:1d.1\n SysFS BusID: 0000:00:1d.1\n Hardware Class: usb controller\n Model: \"Intel 82801JI (ICH10 Family) USB UHCI Controller #2\"\n Vendor: pci 0x8086 \"Intel Corporation\"\n Device: pci 0x3a35 \"82801JI (ICH10 Family) USB UHCI Controller #2\"\n SubVendor: pci 0x1025 \"Acer Incorporated [ALI]\"\n SubDevice: pci 0x023c \n Driver: \"uhci_hcd\"\n Driver Modules: \"uhci_hcd\"\n I/O Ports: 0xd080-0xd09f (rw)\n IRQ: 19 (1251 events)\n Module Alias: \"pci:v00008086d00003A35sv00001025sd0000023Cbc0Csc03i00\"\n Driver Info #0:\n Driver Status: uhci-hcd is active\n Driver Activation Cmd: \"modprobe uhci-hcd\"\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n30: PCI 02.1: 0380 Display controller\n [Created at pci.378]\n Unique ID: ruGf.KPphcgt11FA\n SysFS ID: /devices/pci0000:00/0000:00:02.1\n SysFS BusID: 0000:00:02.1\n Hardware Class: graphics card\n Model: \"Intel 4 Series Chipset Integrated Graphics Controller\"\n Vendor: pci 0x8086 \"Intel Corporation\"\n Device: pci 0x2e23 \"4 Series Chipset Integrated Graphics Controller\"\n SubVendor: pci 0x1025 \"Acer Incorporated [ALI]\"\n SubDevice: pci 0x023c \n Revision: 0x03\n Memory Range: 0xfe900000-0xfe9fffff (rw,non-prefetchable)\n Module Alias: \"pci:v00008086d00002E23sv00001025sd0000023Cbc03sc80i00\"\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n31: PCI 1b.0: 0403 Audio device\n [Created at pci.378]\n Unique ID: u1Nb.yq4xsbDq1f4\n SysFS ID: /devices/pci0000:00/0000:00:1b.0\n SysFS BusID: 0000:00:1b.0\n Hardware Class: sound\n Device Name: \"Onboard Realtek ALC662\"\n Model: \"Intel 82801JI (ICH10 Family) HD Audio Controller\"\n Vendor: pci 0x8086 \"Intel Corporation\"\n Device: pci 0x3a3e \"82801JI (ICH10 Family) HD Audio Controller\"\n SubVendor: pci 0x1025 \"Acer Incorporated [ALI]\"\n SubDevice: pci 0x023c \n Driver: \"snd_hda_intel\"\n Driver Modules: \"snd_hda_intel\"\n Memory Range: 0xfeaf4000-0xfeaf7fff (rw,non-prefetchable)\n IRQ: 28 (477 events)\n Module Alias: \"pci:v00008086d00003A3Esv00001025sd0000023Cbc04sc03i00\"\n Driver Info #0:\n Driver Status: snd_hda_intel is active\n Driver Activation Cmd: \"modprobe snd_hda_intel\"\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n32: None 00.0: 10000 Monitor\n [Created at monitor.125]\n Unique ID: rdCR.4F88182J2MC\n Parent ID: _Znp.pyR3jqaNld4\n Hardware Class: monitor\n Model: \"DELL P1913S\"\n Vendor: DEL \"DELL\"\n Device: eisa 0xa084 \"DELL P1913S\"\n Serial ID: \"06YHW2BD5G8M\"\n Resolution: 720x400@70Hz\n Resolution: 640x480@60Hz\n Resolution: 640x480@75Hz\n Resolution: 800x600@60Hz\n Resolution: 800x600@75Hz\n Resolution: 1024x768@60Hz\n Resolution: 1024x768@75Hz\n Resolution: 1280x1024@75Hz\n Resolution: 1152x864@75Hz\n Resolution: 1280x1024@60Hz\n Size: 376x301 mm\n Year of Manufacture: 2012\n Week of Manufacture: 46\n Detailed Timings #0:\n Resolution: 1280x1024\n Horizontal: 1280 1328 1440 1688 (+48 +160 +408) +hsync\n Vertical: 1024 1025 1028 1066 (+1 +4 +42) +vsync\n Frequencies: 108.00 MHz, 63.98 kHz, 60.02 Hz\n Driver Info #0:\n Max. Resolution: 1280x1024\n Vert. Sync Range: 56-76 Hz\n Hor. Sync Range: 30-81 kHz\n Bandwidth: 108 MHz\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n Attached to: #22 (VGA compatible controller)\n\n33: ISA(PnP) 00.0: 0000 Unclassified device\n [Created at isapnp.142]\n Unique ID: z9pp.gNN83gfynbD\n SysFS ID: /devices/pnp0/00:00\n SysFS BusID: 00:00\n Hardware Class: unknown\n Model: \"Unclassified device\"\n SubVendor: PNP \"PnP\"\n SubDevice: eisa 0x0c01 \n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n34: ISA(PnP) 00.0: 0000 Unclassified device\n [Created at isapnp.142]\n Unique ID: H20r.B+yZ9Ve8gC1\n SysFS ID: /devices/pnp0/00:09\n SysFS BusID: 00:09\n Hardware Class: unknown\n Model: \"Unclassified device\"\n SubVendor: PNP \"PnP\"\n SubDevice: eisa 0x0c02 \n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n35: ISA(PnP) 00.0: 0000 Unclassified device\n [Created at isapnp.142]\n Unique ID: NhVi.B+yZ9Ve8gC1\n SysFS ID: /devices/pnp0/00:07\n SysFS BusID: 00:07\n Hardware Class: unknown\n Model: \"Unclassified device\"\n SubVendor: PNP \"PnP\"\n SubDevice: eisa 0x0c02 \n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n36: ISA(PnP) 00.0: 0000 Unclassified device\n [Created at isapnp.142]\n Unique ID: E349.xhndlW9HXJ7\n SysFS ID: /devices/pnp0/00:05\n SysFS BusID: 00:05\n Hardware Class: unknown\n Model: \"Unclassified device\"\n SubVendor: PNP \"PnP\"\n SubDevice: eisa 0x0303 \n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n37: ISA(PnP) 00.0: 0000 Unclassified device\n [Created at isapnp.142]\n Unique ID: cqY2.gNN83gfynbD\n SysFS ID: /devices/pnp0/00:0c\n SysFS BusID: 00:0c\n Hardware Class: unknown\n Model: \"Unclassified device\"\n SubVendor: PNP \"PnP\"\n SubDevice: eisa 0x0c01 \n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n38: ISA(PnP) 00.0: 0000 Unclassified device\n [Created at isapnp.142]\n Unique ID: KiZ0.BuKI+1soRmD\n SysFS ID: /devices/pnp0/00:03\n SysFS BusID: 00:03\n Hardware Class: unknown\n Model: \"Unclassified device\"\n SubVendor: PNP \"PnP\"\n SubDevice: eisa 0x0501 \n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n39: ISA(PnP) 00.0: 0000 Unclassified device\n [Created at isapnp.142]\n Unique ID: iT2w.B+yZ9Ve8gC1\n SysFS ID: /devices/pnp0/00:0a\n SysFS BusID: 00:0a\n Hardware Class: unknown\n Model: \"Unclassified device\"\n SubVendor: PNP \"PnP\"\n SubDevice: eisa 0x0c02 \n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n40: ISA(PnP) 00.0: 0000 Unclassified device\n [Created at isapnp.142]\n Unique ID: QL3u.WYwRElrJa93\n SysFS ID: /devices/pnp0/00:01\n SysFS BusID: 00:01\n Hardware Class: unknown\n Model: \"Unclassified device\"\n SubVendor: PNP \"PnP\"\n SubDevice: eisa 0x0b00 \n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n41: ISA(PnP) 00.0: 0000 Unclassified device\n [Created at isapnp.142]\n Unique ID: qslm.B+yZ9Ve8gC1\n SysFS ID: /devices/pnp0/00:08\n SysFS BusID: 00:08\n Hardware Class: unknown\n Model: \"Unclassified device\"\n SubVendor: PNP \"PnP\"\n SubDevice: eisa 0x0c02 \n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n42: ISA(PnP) 00.0: 0000 Unclassified device\n [Created at isapnp.142]\n Unique ID: hEKD.dF8oQb6hYJ9\n SysFS ID: /devices/pnp0/00:06\n SysFS BusID: 00:06\n Hardware Class: unknown\n Model: \"Unclassified device\"\n SubVendor: PNP \"PnP\"\n SubDevice: eisa 0x0f03 \n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n43: ISA(PnP) 00.0: 0000 Unclassified device\n [Created at isapnp.142]\n Unique ID: ntp4.13ubA72AEK3\n SysFS ID: /devices/pnp0/00:04\n SysFS BusID: 00:04\n Hardware Class: unknown\n Model: \"Unclassified device\"\n SubVendor: PNP \"PnP\"\n SubDevice: eisa 0x0400 \n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n44: ISA(PnP) 00.0: 0000 Unclassified device\n [Created at isapnp.142]\n Unique ID: 9fI_.B+yZ9Ve8gC1\n SysFS ID: /devices/pnp0/00:0b\n SysFS BusID: 00:0b\n Hardware Class: unknown\n Model: \"Unclassified device\"\n SubVendor: PNP \"PnP\"\n SubDevice: eisa 0x0c02 \n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n45: ISA(PnP) 00.0: 0000 Unclassified device\n [Created at isapnp.142]\n Unique ID: tWJy.BuKI+1soRmD\n SysFS ID: /devices/pnp0/00:02\n SysFS BusID: 00:02\n Hardware Class: unknown\n Model: \"Unclassified device\"\n SubVendor: PNP \"PnP\"\n SubDevice: eisa 0x0501 \n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n46: None 00.0: 0700 Serial controller (16550)\n [Created at serial.74]\n Unique ID: S_Uw.3fyvFV+mbWD\n Hardware Class: unknown\n Model: \"16550A\"\n Device: \"16550A\"\n Device File: /dev/ttyS0\n I/O Ports: 0x3f8-0x3ff (rw)\n IRQ: 4 (1 event)\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n47: None 00.1: 0700 Serial controller (16550)\n [Created at serial.74]\n Unique ID: v9l_.3fyvFV+mbWD\n Hardware Class: unknown\n Model: \"16550A\"\n Device: \"16550A\"\n Device File: /dev/ttyS1\n I/O Ports: 0x2f8-0x2ff (rw)\n IRQ: 3 (1 event)\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n48: SCSI 400.0: 10600 Disk\n [Created at block.245]\n Unique ID: mZxt.nce0NBFdBI9\n Parent ID: 5YuN.W3LRLaOl_V9\n SysFS ID: /class/block/sdb\n SysFS BusID: 4:0:0:0\n SysFS Device Link: /devices/pci0000:00/0000:00:1d.7/usb3/3-2/3-2:1.0/host4/target4:0:0/4:0:0:0\n Hardware Class: disk\n Model: \"VendorCo ProductCode\"\n Vendor: usb 0xffff \"VendorCo\"\n Device: usb 0x5678 \"ProductCode\"\n Revision: \"2.00\"\n Serial ID: \"5887831180150528145\"\n Driver: \"usb-storage\", \"sd\"\n Driver Modules: \"usb_storage\", \"sd_mod\"\n Device File: /dev/sdb (/dev/sg2)\n Device Files: /dev/sdb, /dev/disk/by-id/usb-VendorCo_ProductCode_5887831180150528145-0:0, /dev/disk/by-label/Debian\\x20stretch\\x2020201028-12:26, /dev/disk/by-path/pci-0000:00:1d.7-usb-0:2:1.0-scsi-0:0:0:0, /dev/disk/by-uuid/2020-10-28-11-10-39-00\n Device Number: block 8:16-8:31 (char 21:2)\n BIOS id: 0x80\n Geometry (Logical): CHS 1022/248/62\n Size: 15728640 sectors a 512 bytes\n Capacity: 7 GB (8053063680 bytes)\n Speed: 480 Mbps\n Geometry (BIOS EDD): CHS 979/255/63\n Size (BIOS EDD): 15728640 sectors\n Geometry (BIOS Legacy): CHS 979/255/63\n Module Alias: \"usb:vFFFFp5678d0200dc00dsc00dp00ic08isc06ip50in00\"\n Driver Info #0:\n Driver Status: uas is active\n Driver Activation Cmd: \"modprobe uas\"\n Driver Info #1:\n Driver Status: usb_storage is active\n Driver Activation Cmd: \"modprobe usb_storage\"\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n Attached to: #23 (USB Controller)\n\n49: None 00.0: 11300 Partition\n [Created at block.434]\n Unique ID: h4pj.SE1wIdpsiiC\n Parent ID: mZxt.nce0NBFdBI9\n SysFS ID: /class/block/sdb/sdb1\n Hardware Class: partition\n Model: \"Partition\"\n Device File: /dev/sdb1\n Device Files: /dev/sdb1, /dev/disk/by-id/usb-VendorCo_ProductCode_5887831180150528145-0:0-part1, /dev/disk/by-label/Debian\\x20stretch\\x2020201028-12:26, /dev/disk/by-partuuid/5ca3f80e-01, /dev/disk/by-path/pci-0000:00:1d.7-usb-0:2:1.0-scsi-0:0:0:0-part1, /dev/disk/by-uuid/2020-10-28-11-10-39-00\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n Attached to: #48 (Disk)\n\n50: None 00.0: 11300 Partition\n [Created at block.434]\n Unique ID: 8G3o.SE1wIdpsiiC\n Parent ID: mZxt.nce0NBFdBI9\n SysFS ID: /class/block/sdb/sdb2\n Hardware Class: partition\n Model: \"Partition\"\n Device File: /dev/sdb2\n Device Files: /dev/sdb2, /dev/disk/by-id/usb-VendorCo_ProductCode_5887831180150528145-0:0-part2, /dev/disk/by-label/Debian\\x20stretch\\x2020201028-12:26, /dev/disk/by-partuuid/5ca3f80e-02, /dev/disk/by-path/pci-0000:00:1d.7-usb-0:2:1.0-scsi-0:0:0:0-part2, /dev/disk/by-uuid/56B9-CD28\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n Attached to: #48 (Disk)\n\n51: SCSI 100.0: 10602 CD-ROM (DVD)\n [Created at block.249]\n Unique ID: KD9E.iczGh1g0Hj1\n Parent ID: w7Y8.eN1YPYndms5\n SysFS ID: /class/block/sr0\n SysFS BusID: 1:0:0:0\n SysFS Device Link: /devices/pci0000:00/0000:00:1f.2/ata2/host1/target1:0:0/1:0:0:0\n Hardware Class: cdrom\n Model: \"ATAPI DVD A DH16AASH\"\n Vendor: \"ATAPI\"\n Device: \"DVD A DH16AASH\"\n Revision: \"SA15\"\n Driver: \"ata_piix\", \"sr\"\n Driver Modules: \"ata_piix\", \"sr_mod\"\n Device File: /dev/sr0 (/dev/sg1)\n Device Files: /dev/sr0, /dev/cdrom, /dev/cdrw, /dev/disk/by-id/ata-ATAPI_DVD_A_DH16AASH, /dev/disk/by-path/pci-0000:00:1f.2-ata-2, /dev/dvd, /dev/dvdrw\n Device Number: block 11:0 (char 21:1)\n Features: CD-R, CD-RW, DVD, DVD-R, DVD-RW, DVD-R DL, DVD+R, DVD+RW, DVD+R DL, DVD-RAM, MRW, MRW-W\n Drive status: no medium\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n Attached to: #24 (IDE interface)\n Drive Speed: 48\n\n52: IDE 00.0: 10600 Disk\n [Created at block.245]\n Unique ID: 3OOL.MHrtizgn1aF\n Parent ID: w7Y8.eN1YPYndms5\n SysFS ID: /class/block/sda\n SysFS BusID: 0:0:0:0\n SysFS Device Link: /devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0\n Hardware Class: disk\n Model: \"WDC WD5000AAKX-0\"\n Vendor: \"WDC\"\n Device: \"WD5000AAKX-0\"\n Revision: \"1H15\"\n Serial ID: \"WD-WCAYUJP74971\"\n Driver: \"ata_piix\", \"sd\"\n Driver Modules: \"ata_piix\", \"sd_mod\"\n Device File: /dev/sda\n Device Files: /dev/sda, /dev/disk/by-id/ata-WDC_WD5000AAKX-003CA0_WD-WCAYUJP74971, /dev/disk/by-id/wwn-0x50014ee1af580111, /dev/disk/by-path/pci-0000:00:1f.2-ata-1\n Device Number: block 8:0-8:15\n BIOS id: 0x81\n Geometry (Logical): CHS 60801/255/63\n Size: 976773168 sectors a 512 bytes\n Capacity: 465 GB (500107862016 bytes)\n Geometry (BIOS EDD): CHS 969021/16/63\n Size (BIOS EDD): 976773168 sectors\n Geometry (BIOS Legacy): CHS 1024/255/63\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n Attached to: #24 (IDE interface)\n\n53: None 00.0: 11300 Partition\n [Created at block.434]\n Unique ID: bdUI.SE1wIdpsiiC\n Parent ID: 3OOL.MHrtizgn1aF\n SysFS ID: /class/block/sda/sda1\n Hardware Class: partition\n Model: \"Partition\"\n Device File: /dev/sda1\n Device Files: /dev/sda1, /dev/disk/by-id/ata-WDC_WD5000AAKX-003CA0_WD-WCAYUJP74971-part1, /dev/disk/by-id/wwn-0x50014ee1af580111-part1, /dev/disk/by-label/BDEDrive, /dev/disk/by-partuuid/c4455b96-01, /dev/disk/by-path/pci-0000:00:1f.2-ata-1-part1, /dev/disk/by-uuid/E61EA95B1EA92611\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n Attached to: #52 (Disk)\n\n54: None 00.0: 11300 Partition\n [Created at block.434]\n Unique ID: 2pkM.SE1wIdpsiiC\n Parent ID: 3OOL.MHrtizgn1aF\n SysFS ID: /class/block/sda/sda2\n Hardware Class: partition\n Model: \"Partition\"\n Device File: /dev/sda2\n Device Files: /dev/sda2, /dev/disk/by-id/ata-WDC_WD5000AAKX-003CA0_WD-WCAYUJP74971-part2, /dev/disk/by-id/wwn-0x50014ee1af580111-part2, /dev/disk/by-label/OSDisk, /dev/disk/by-partuuid/c4455b96-02, /dev/disk/by-path/pci-0000:00:1f.2-ata-1-part2, /dev/disk/by-uuid/C84CAB2E4CAB15EA\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n Attached to: #52 (Disk)\n\n55: None 00.0: 11300 Partition\n [Created at block.434]\n Unique ID: W__Q.SE1wIdpsiiC\n Parent ID: 3OOL.MHrtizgn1aF\n SysFS ID: /class/block/sda/sda3\n Hardware Class: partition\n Model: \"Partition\"\n Device File: /dev/sda3\n Device Files: /dev/sda3, /dev/disk/by-id/ata-WDC_WD5000AAKX-003CA0_WD-WCAYUJP74971-part3, /dev/disk/by-id/wwn-0x50014ee1af580111-part3, /dev/disk/by-label/DadesDisk, /dev/disk/by-partuuid/c4455b96-03, /dev/disk/by-path/pci-0000:00:1f.2-ata-1-part3, /dev/disk/by-uuid/667CAD207CACEBCD\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n Attached to: #52 (Disk)\n\n56: USB 00.0: 10a00 Hub\n [Created at usb.122]\n Unique ID: FZIx.RTX9xWW_uz4\n Parent ID: mvRC.yOzF8I5yLZ4\n SysFS ID: /devices/pci0000:00/0000:00:1d.2/usb8/8-0:1.0\n SysFS BusID: 8-0:1.0\n Hardware Class: hub\n Model: \"Linux Foundation 1.1 root hub\"\n Hotplug: USB\n Vendor: usb 0x1d6b \"Linux Foundation\"\n Device: usb 0x0001 \"1.1 root hub\"\n Revision: \"4.09\"\n Serial ID: \"0000:00:1d.2\"\n Driver: \"hub\"\n Driver Modules: \"usbcore\"\n Speed: 12 Mbps\n Module Alias: \"usb:v1D6Bp0001d0409dc09dsc00dp00ic09isc00ip00in00\"\n Driver Info #0:\n Driver Status: usbcore is active\n Driver Activation Cmd: \"modprobe usbcore\"\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n Attached to: #18 (USB Controller)\n\n57: USB 00.0: 10a00 Hub\n [Created at usb.122]\n Unique ID: uIhY.9T1GDCLyFd9\n Parent ID: 5YuN.W3LRLaOl_V9\n SysFS ID: /devices/pci0000:00/0000:00:1d.7/usb3/3-0:1.0\n SysFS BusID: 3-0:1.0\n Hardware Class: hub\n Model: \"Linux Foundation 2.0 root hub\"\n Hotplug: USB\n Vendor: usb 0x1d6b \"Linux Foundation\"\n Device: usb 0x0002 \"2.0 root hub\"\n Revision: \"4.09\"\n Serial ID: \"0000:00:1d.7\"\n Driver: \"hub\"\n Driver Modules: \"usbcore\"\n Speed: 480 Mbps\n Module Alias: \"usb:v1D6Bp0002d0409dc09dsc00dp00ic09isc00ip00in00\"\n Driver Info #0:\n Driver Status: usbcore is active\n Driver Activation Cmd: \"modprobe usbcore\"\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n Attached to: #23 (USB Controller)\n\n58: USB 00.0: 10a00 Hub\n [Created at usb.122]\n Unique ID: 7eqy.v+N+B0xY+P6\n Parent ID: 1GTX.wZ4mA9sXIo3\n SysFS ID: /devices/pci0000:00/0000:00:1d.0/usb6/6-0:1.0\n SysFS BusID: 6-0:1.0\n Hardware Class: hub\n Model: \"Linux Foundation 1.1 root hub\"\n Hotplug: USB\n Vendor: usb 0x1d6b \"Linux Foundation\"\n Device: usb 0x0001 \"1.1 root hub\"\n Revision: \"4.09\"\n Serial ID: \"0000:00:1d.0\"\n Driver: \"hub\"\n Driver Modules: \"usbcore\"\n Speed: 12 Mbps\n Module Alias: \"usb:v1D6Bp0001d0409dc09dsc00dp00ic09isc00ip00in00\"\n Driver Info #0:\n Driver Status: usbcore is active\n Driver Activation Cmd: \"modprobe usbcore\"\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n Attached to: #20 (USB Controller)\n\n59: USB 00.0: 10a00 Hub\n [Created at usb.122]\n Unique ID: k4bc.MxUuepIFPaE\n Parent ID: pwJ7.Tpv+coYttW3\n SysFS ID: /devices/pci0000:00/0000:00:1a.0/usb1/1-0:1.0\n SysFS BusID: 1-0:1.0\n Hardware Class: hub\n Model: \"Linux Foundation 1.1 root hub\"\n Hotplug: USB\n Vendor: usb 0x1d6b \"Linux Foundation\"\n Device: usb 0x0001 \"1.1 root hub\"\n Revision: \"4.09\"\n Serial ID: \"0000:00:1a.0\"\n Driver: \"hub\"\n Driver Modules: \"usbcore\"\n Speed: 12 Mbps\n Module Alias: \"usb:v1D6Bp0001d0409dc09dsc00dp00ic09isc00ip00in00\"\n Driver Info #0:\n Driver Status: usbcore is active\n Driver Activation Cmd: \"modprobe usbcore\"\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n Attached to: #19 (USB Controller)\n\n60: USB 00.0: 10a00 Hub\n [Created at usb.122]\n Unique ID: zPk0.7gZT0a5zLs5\n Parent ID: gFpy._Dsl5NgaPv3\n SysFS ID: /devices/pci0000:00/0000:00:1a.1/usb4/4-0:1.0\n SysFS BusID: 4-0:1.0\n Hardware Class: hub\n Model: \"Linux Foundation 1.1 root hub\"\n Hotplug: USB\n Vendor: usb 0x1d6b \"Linux Foundation\"\n Device: usb 0x0001 \"1.1 root hub\"\n Revision: \"4.09\"\n Serial ID: \"0000:00:1a.1\"\n Driver: \"hub\"\n Driver Modules: \"usbcore\"\n Speed: 12 Mbps\n Module Alias: \"usb:v1D6Bp0001d0409dc09dsc00dp00ic09isc00ip00in00\"\n Driver Info #0:\n Driver Status: usbcore is active\n Driver Activation Cmd: \"modprobe usbcore\"\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n Attached to: #26 (USB Controller)\n\n61: USB 00.0: 10a00 Hub\n [Created at usb.122]\n Unique ID: BSFT.gkSaZmjGyhD\n Parent ID: vayM.R_0WfjzEqA4\n SysFS ID: /devices/pci0000:00/0000:00:1d.1/usb7/7-0:1.0\n SysFS BusID: 7-0:1.0\n Hardware Class: hub\n Model: \"Linux Foundation 1.1 root hub\"\n Hotplug: USB\n Vendor: usb 0x1d6b \"Linux Foundation\"\n Device: usb 0x0001 \"1.1 root hub\"\n Revision: \"4.09\"\n Serial ID: \"0000:00:1d.1\"\n Driver: \"hub\"\n Driver Modules: \"usbcore\"\n Speed: 12 Mbps\n Module Alias: \"usb:v1D6Bp0001d0409dc09dsc00dp00ic09isc00ip00in00\"\n Driver Info #0:\n Driver Status: usbcore is active\n Driver Activation Cmd: \"modprobe usbcore\"\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n Attached to: #29 (USB Controller)\n\n63: USB 00.0: 10a00 Hub\n [Created at usb.122]\n Unique ID: pBe4.cO89g+iefn1\n Parent ID: sClz.YuDxIjd92HA\n SysFS ID: /devices/pci0000:00/0000:00:1a.7/usb2/2-0:1.0\n SysFS BusID: 2-0:1.0\n Hardware Class: hub\n Model: \"Linux Foundation 2.0 root hub\"\n Hotplug: USB\n Vendor: usb 0x1d6b \"Linux Foundation\"\n Device: usb 0x0002 \"2.0 root hub\"\n Revision: \"4.09\"\n Serial ID: \"0000:00:1a.7\"\n Driver: \"hub\"\n Driver Modules: \"usbcore\"\n Speed: 480 Mbps\n Module Alias: \"usb:v1D6Bp0002d0409dc09dsc00dp00ic09isc00ip00in00\"\n Driver Info #0:\n Driver Status: usbcore is active\n Driver Activation Cmd: \"modprobe usbcore\"\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n Attached to: #21 (USB Controller)\n\n64: USB 00.0: 10a00 Hub\n [Created at usb.122]\n Unique ID: 2XnU.uOe2OKugI8D\n Parent ID: XaIo.VeoVaxnHxH4\n SysFS ID: /devices/pci0000:00/0000:00:1a.2/usb5/5-0:1.0\n SysFS BusID: 5-0:1.0\n Hardware Class: hub\n Model: \"Linux Foundation 1.1 root hub\"\n Hotplug: USB\n Vendor: usb 0x1d6b \"Linux Foundation\"\n Device: usb 0x0001 \"1.1 root hub\"\n Revision: \"4.09\"\n Serial ID: \"0000:00:1a.2\"\n Driver: \"hub\"\n Driver Modules: \"usbcore\"\n Speed: 12 Mbps\n Module Alias: \"usb:v1D6Bp0001d0409dc09dsc00dp00ic09isc00ip00in00\"\n Driver Info #0:\n Driver Status: usbcore is active\n Driver Activation Cmd: \"modprobe usbcore\"\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n Attached to: #17 (USB Controller)\n\n65: PS/2 00.0: 10800 Keyboard\n [Created at input.226]\n Unique ID: nLyy.+49ps10DtUF\n Hardware Class: keyboard\n Model: \"AT Translated Set 2 keyboard\"\n Vendor: 0x0001 \n Device: 0x0001 \"AT Translated Set 2 keyboard\"\n Compatible to: int 0x0211 0x0001\n Device File: /dev/input/event0\n Device Number: char 13:64\n Driver Info #0:\n XkbRules: xfree86\n XkbModel: pc104\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n66: PS/2 00.0: 10500 PS/2 Mouse\n [Created at input.249]\n Unique ID: AH6Q.oV6xZUCQFf1\n Hardware Class: mouse\n Model: \"ImPS/2 Logitech Wheel Mouse\"\n Vendor: 0x0002 \n Device: 0x0005 \"ImPS/2 Logitech Wheel Mouse\"\n Compatible to: int 0x0210 0x0013\n Device File: /dev/input/mice (/dev/input/mouse0)\n Device Files: /dev/input/mice, /dev/input/mouse0, /dev/input/event3\n Device Number: char 13:63 (char 13:32)\n Driver Info #0:\n Buttons: 3\n Wheels: 1\n XFree86 Protocol: explorerps/2\n GPM Protocol: exps2\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n67: None 00.0: 10103 CPU\n [Created at cpu.460]\n Unique ID: rdCR.j8NaKXDZtZ6\n Hardware Class: cpu\n Arch: Intel\n Vendor: \"GenuineIntel\"\n Model: 6.23.10 \"Pentium(R) Dual-Core CPU E5300 @ 2.60GHz\"\n Features: fpu,vme,de,pse,tsc,msr,pae,mce,cx8,apic,sep,mtrr,pge,mca,cmov,pat,pse36,clflush,dts,acpi,mmx,fxsr,sse,sse2,ss,ht,tm,pbe,nx,lm,constant_tsc,arch_perfmon,pebs,bts,aperfmperf,pni,dtes64,monitor,ds_cpl,vmx,est,tm2,ssse3,cx16,xtpr,pdcm,xsave,lahf_lm,tpr_shadow,vnmi,flexpriority,dtherm\n Clock: 2593 MHz\n BogoMips: 5187.08\n Cache: 2048 kb\n Units/Processor: 2\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n68: None 01.0: 10103 CPU\n [Created at cpu.460]\n Unique ID: wkFv.j8NaKXDZtZ6\n Hardware Class: cpu\n Arch: Intel\n Vendor: \"GenuineIntel\"\n Model: 6.23.10 \"Pentium(R) Dual-Core CPU E5300 @ 2.60GHz\"\n Features: fpu,vme,de,pse,tsc,msr,pae,mce,cx8,apic,sep,mtrr,pge,mca,cmov,pat,pse36,clflush,dts,acpi,mmx,fxsr,sse,sse2,ss,ht,tm,pbe,nx,lm,constant_tsc,arch_perfmon,pebs,bts,aperfmperf,pni,dtes64,monitor,ds_cpl,vmx,est,tm2,ssse3,cx16,xtpr,pdcm,xsave,lahf_lm,tpr_shadow,vnmi,flexpriority,dtherm\n Clock: 2593 MHz\n BogoMips: 5187.08\n Cache: 2048 kb\n Units/Processor: 2\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n\n69: None 00.0: 10701 Ethernet\n [Created at net.126]\n Unique ID: Ij4C.ndpeucax6V1\n Parent ID: c3qJ.eXFF3sAVI_6\n SysFS ID: /class/net/enp2s0\n SysFS Device Link: /devices/pci0000:00/0000:00:1c.1/0000:02:00.0\n Hardware Class: network interface\n Model: \"Ethernet network interface\"\n Driver: \"sky2\"\n Driver Modules: \"sky2\"\n Device File: enp2s0\n HW Address: 40:61:86:59:43:3f\n Permanent HW Address: 40:61:86:59:43:3f\n Link detected: yes\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n Attached to: #28 (Ethernet controller)\n\n70: None 00.0: 10700 Loopback\n [Created at net.126]\n Unique ID: ZsBS.GQNx7L4uPNA\n SysFS ID: /class/net/lo\n Hardware Class: network interface\n Model: \"Loopback network interface\"\n Device File: lo\n Link detected: yes\n Config Status: cfg=new, avail=yes, need=no, active=unknown\n 9b1395b9cd67af0283b02b7b346c4cc6a5f05f39cfe25a357d5f627f4a4e4faf", "lshw": {"capabilities": {"dmi-2.6": "DMI version 2.6", "smbios-2.6": "SMBIOS version 2.6", "smp": "Symmetric Multi-Processing", "smp-1.4": "SMP specification v1.4"}, "children": [{"children": [{"capabilities": {"acpi": "ACPI", "apm": "Advanced Power Management", "biosbootspecification": "BIOS boot specification", "bootselect": "Selectable boot path", "cdboot": "Booting from CD-ROM/DVD", "edd": "Enhanced Disk Drive extensions", "escd": "ESCD", "int10video": "INT10 CGA/Mono video", "int13floppy1200": "5.25\" 1.2MB floppy", "int13floppy2880": "3.5\" 2.88MB floppy", "int13floppy720": "3.5\" 720KB floppy", "int14serial": "INT14 serial line control", "int17printer": "INT17 printer control", "int5printscreen": "Print Screen key", "int9keyboard": "i8042 keyboard controller", "isa": "ISA bus", "ls120boot": "Booting from LS-120", "pci": "PCI bus", "pnp": "Plug-and-Play", "shadowing": "BIOS shadowing", "socketedrom": "BIOS ROM is socketed", "upgrade": "BIOS EEPROM can be upgraded", "usb": "USB legacy emulation", "zipboot": "Booting from ATAPI ZIP"}, "capacity": 983040, "claimed": true, "class": "memory", "date": "08/07/2009", "description": "BIOS", "id": "firmware", "physid": "0", "size": 65536, "units": "bytes", "vendor": "Acer", "version": "P01-A3"}, {"businfo": "cpu@0", "capabilities": {"acpi": "thermal control (ACPI)", "aperfmperf": true, "apic": "on-chip advanced programmable interrupt controller (APIC)", "arch_perfmon": true, "boot": "boot processor", "bts": true, "clflush": true, "cmov": "conditional move instruction", "constant_tsc": true, "cx16": true, "cx8": "compare and exchange 8-byte", "de": "debugging extensions", "ds_cpl": true, "dtes64": true, "dtherm": true, "dts": "debug trace and EMON store MSRs", "est": true, "flexpriority": true, "fpu": "mathematical co-processor", "fpu_exception": "FPU exceptions reporting", "fxsr": "fast floating point save/restore", "ht": "HyperThreading", "lahf_lm": true, "mca": "machine check architecture", "mce": "machine check exceptions", "mmx": "multimedia extensions (MMX)", "monitor": true, "msr": "model-specific registers", "mtrr": "memory type range registers", "nx": "no-execute bit (NX)", "pae": "4GB+ memory addressing (Physical Address Extension)", "pat": "page attribute table", "pbe": "pending break event", "pdcm": true, "pebs": true, "pge": "page global enable", "pni": true, "pse": "page size extensions", "pse36": "36-bit page size extensions", "sep": "fast system calls", "ss": "self-snoop", "sse": "streaming SIMD extensions (SSE)", "sse2": "streaming SIMD extensions (SSE2)", "ssse3": true, "tm": "thermal interrupt and status", "tm2": true, "tpr_shadow": true, "tsc": "time stamp counter", "vme": "virtual mode extensions", "vmx": "CPU virtualization (Vanderpool)", "vnmi": true, "wp": true, "x86-64": "64bits extensions (x86-64)", "xsave": true, "xtpr": true}, "capacity": 2600000000, "children": [{"capabilities": {"data": "Data cache", "internal": "Internal", "write-back": "Write-back"}, "capacity": 65536, "claimed": true, "class": "memory", "configuration": {"level": "1"}, "description": "L1 cache", "handle": "DMI:0005", "id": "cache:0", "physid": "5", "size": 65536, "slot": "L1-Cache", "units": "bytes"}, {"capabilities": {"internal": "Internal", "unified": "Unified cache", "write-back": "Write-back"}, "capacity": 2097152, "claimed": true, "class": "memory", "configuration": {"level": "2"}, "description": "L2 cache", "handle": "DMI:0006", "id": "cache:1", "physid": "6", "size": 2097152, "slot": "L2-Cache", "units": "bytes"}, {"capabilities": {"logical": "Logical CPU"}, "claimed": true, "class": "processor", "description": "Logical CPU", "handle": "CPU:0.0", "id": "logicalcpu:0", "physid": "0.1", "width": 64}, {"capabilities": {"logical": "Logical CPU"}, "claimed": true, "class": "processor", "description": "Logical CPU", "handle": "CPU:0.1", "id": "logicalcpu:1", "physid": "0.2", "width": 64}], "claimed": true, "class": "processor", "clock": 200000000, "configuration": {"cores": "2", "enabledcores": "2", "id": "0", "threads": "2"}, "description": "CPU", "handle": "DMI:0004", "id": "cpu:0", "physid": "4", "product": "Pentium(R) Dual-Core CPU E5300 @ 2.60GHz", "serial": "0001-067A-0000-0000-0000-0000", "size": 2600000000, "slot": "CPU 1", "units": "Hz", "vendor": "Intel Corp.", "version": "6.7.10", "width": 64}, {"children": [{"claimed": true, "class": "memory", "clock": 1333000000, "description": "DIMM DDR3 Synchronous 1333 MHz (0.8 ns)", "handle": "DMI:001F", "id": "bank:0", "physid": "0", "serial": "13930002", "size": 2147483648, "slot": "DIMM0", "units": "bytes", "vendor": "Apacer", "width": 64}, {"claimed": true, "class": "memory", "description": "DIMM [empty]", "handle": "DMI:0021", "id": "bank:1", "physid": "1", "serial": "SerNum01", "slot": "DIMM1", "vendor": "Manufacturer01"}, {"claimed": true, "class": "memory", "clock": 1333000000, "description": "DIMM DDR3 Synchronous 1333 MHz (0.8 ns)", "handle": "DMI:0023", "id": "bank:2", "physid": "2", "serial": "13930002", "size": 2147483648, "slot": "DIMM2", "units": "bytes", "vendor": "Apacer", "width": 64}, {"claimed": true, "class": "memory", "description": "DIMM [empty]", "handle": "DMI:0025", "id": "bank:3", "physid": "3", "serial": "SerNum03", "slot": "DIMM3", "vendor": "Manufacturer03"}], "claimed": true, "class": "memory", "description": "System Memory", "handle": "DMI:001D", "id": "memory", "physid": "1d", "size": 4294967296, "slot": "System board or motherboard", "units": "bytes"}, {"businfo": "cpu@1", "capabilities": {"ht": "HyperThreading", "vmx": "CPU virtualization (Vanderpool)"}, "children": [{"capabilities": {"logical": "Logical CPU"}, "claimed": true, "class": "processor", "description": "Logical CPU", "handle": "CPU:0.0", "id": "logicalcpu:0", "physid": "0.1"}, {"capabilities": {"logical": "Logical CPU"}, "claimed": true, "class": "processor", "description": "Logical CPU", "handle": "CPU:0.1", "id": "logicalcpu:1", "physid": "0.2"}], "claimed": true, "class": "processor", "configuration": {"id": "0"}, "id": "cpu:1", "physid": "1", "serial": "0001-067A-0000-0000-0000-0000", "size": 2600000000, "units": "Hz", "version": "6.7.10"}, {"businfo": "pci@0000:00:00.0", "children": [{"businfo": "pci@0000:00:02.0", "capabilities": {"bus_master": "bus mastering", "cap_list": "PCI capabilities listing", "msi": "Message Signalled Interrupts", "pm": "Power Management", "rom": "extension ROM", "vga_controller": true}, "claimed": true, "class": "display", "clock": 33000000, "configuration": {"driver": "i915", "latency": "0"}, "description": "VGA compatible controller", "handle": "PCI:0000:00:02.0", "id": "display:0", "physid": "2", "product": "4 Series Chipset Integrated Graphics Controller", "vendor": "Intel Corporation", "version": "03", "width": 64}, {"businfo": "pci@0000:00:02.1", "capabilities": {"bus_master": "bus mastering", "cap_list": "PCI capabilities listing", "pm": "Power Management"}, "class": "display", "clock": 33000000, "configuration": {"latency": "0"}, "description": "Display controller", "handle": "PCI:0000:00:02.1", "id": "display:1", "physid": "2.1", "product": "4 Series Chipset Integrated Graphics Controller", "vendor": "Intel Corporation", "version": "03", "width": 64}, {"businfo": "pci@0000:00:1a.0", "capabilities": {"bus_master": "bus mastering", "cap_list": "PCI capabilities listing", "uhci": "Universal Host Controller Interface (USB1)"}, "children": [{"businfo": "usb@1", "capabilities": {"usb-1.10": "USB 1.1"}, "claimed": true, "class": "bus", "configuration": {"driver": "hub", "slots": "2", "speed": "12Mbit/s"}, "handle": "USB:1:1", "id": "usbhost", "logicalname": "usb1", "physid": "1", "product": "UHCI Host Controller", "vendor": "Linux 4.9.0-13-686-pae uhci_hcd", "version": "4.09"}], "claimed": true, "class": "bus", "clock": 33000000, "configuration": {"driver": "uhci_hcd", "latency": "0"}, "description": "USB controller", "handle": "PCI:0000:00:1a.0", "id": "usb:0", "physid": "1a", "product": "82801JI (ICH10 Family) USB UHCI Controller #4", "vendor": "Intel Corporation", "version": "00", "width": 32}, {"businfo": "pci@0000:00:1a.1", "capabilities": {"bus_master": "bus mastering", "cap_list": "PCI capabilities listing", "uhci": "Universal Host Controller Interface (USB1)"}, "children": [{"businfo": "usb@4", "capabilities": {"usb-1.10": "USB 1.1"}, "claimed": true, "class": "bus", "configuration": {"driver": "hub", "slots": "2", "speed": "12Mbit/s"}, "handle": "USB:4:1", "id": "usbhost", "logicalname": "usb4", "physid": "1", "product": "UHCI Host Controller", "vendor": "Linux 4.9.0-13-686-pae uhci_hcd", "version": "4.09"}], "claimed": true, "class": "bus", "clock": 33000000, "configuration": {"driver": "uhci_hcd", "latency": "0"}, "description": "USB controller", "handle": "PCI:0000:00:1a.1", "id": "usb:1", "physid": "1a.1", "product": "82801JI (ICH10 Family) USB UHCI Controller #5", "vendor": "Intel Corporation", "version": "00", "width": 32}, {"businfo": "pci@0000:00:1a.2", "capabilities": {"bus_master": "bus mastering", "cap_list": "PCI capabilities listing", "uhci": "Universal Host Controller Interface (USB1)"}, "children": [{"businfo": "usb@5", "capabilities": {"usb-1.10": "USB 1.1"}, "claimed": true, "class": "bus", "configuration": {"driver": "hub", "slots": "2", "speed": "12Mbit/s"}, "handle": "USB:5:1", "id": "usbhost", "logicalname": "usb5", "physid": "1", "product": "UHCI Host Controller", "vendor": "Linux 4.9.0-13-686-pae uhci_hcd", "version": "4.09"}], "claimed": true, "class": "bus", "clock": 33000000, "configuration": {"driver": "uhci_hcd", "latency": "0"}, "description": "USB controller", "handle": "PCI:0000:00:1a.2", "id": "usb:2", "physid": "1a.2", "product": "82801JI (ICH10 Family) USB UHCI Controller #6", "vendor": "Intel Corporation", "version": "00", "width": 32}, {"businfo": "pci@0000:00:1a.7", "capabilities": {"bus_master": "bus mastering", "cap_list": "PCI capabilities listing", "debug": "Debug port", "ehci": "Enhanced Host Controller Interface (USB2)", "pm": "Power Management"}, "children": [{"businfo": "usb@2", "capabilities": {"usb-2.00": "USB 2.0"}, "claimed": true, "class": "bus", "configuration": {"driver": "hub", "slots": "6", "speed": "480Mbit/s"}, "handle": "USB:2:1", "id": "usbhost", "logicalname": "usb2", "physid": "1", "product": "EHCI Host Controller", "vendor": "Linux 4.9.0-13-686-pae ehci_hcd", "version": "4.09"}], "claimed": true, "class": "bus", "clock": 33000000, "configuration": {"driver": "ehci-pci", "latency": "0"}, "description": "USB controller", "handle": "PCI:0000:00:1a.7", "id": "usb:3", "physid": "1a.7", "product": "82801JI (ICH10 Family) USB2 EHCI Controller #2", "vendor": "Intel Corporation", "version": "00", "width": 32}, {"businfo": "pci@0000:00:1b.0", "capabilities": {"bus_master": "bus mastering", "cap_list": "PCI capabilities listing", "msi": "Message Signalled Interrupts", "pciexpress": "PCI Express", "pm": "Power Management"}, "claimed": true, "class": "multimedia", "clock": 33000000, "configuration": {"driver": "snd_hda_intel", "latency": "0"}, "description": "Audio device", "handle": "PCI:0000:00:1b.0", "id": "multimedia", "physid": "1b", "product": "82801JI (ICH10 Family) HD Audio Controller", "vendor": "Intel Corporation", "version": "00", "width": 64}, {"businfo": "pci@0000:00:1c.0", "capabilities": {"bus_master": "bus mastering", "cap_list": "PCI capabilities listing", "msi": "Message Signalled Interrupts", "normal_decode": true, "pci": true, "pciexpress": "PCI Express", "pm": "Power Management"}, "claimed": true, "class": "bridge", "clock": 33000000, "configuration": {"driver": "pcieport"}, "description": "PCI bridge", "handle": "PCIBUS:0000:01", "id": "pci:0", "physid": "1c", "product": "82801JI (ICH10 Family) PCI Express Root Port 1", "vendor": "Intel Corporation", "version": "00", "width": 32}, {"businfo": "pci@0000:00:1c.1", "capabilities": {"bus_master": "bus mastering", "cap_list": "PCI capabilities listing", "msi": "Message Signalled Interrupts", "normal_decode": true, "pci": true, "pciexpress": "PCI Express", "pm": "Power Management"}, "children": [{"businfo": "pci@0000:02:00.0", "capabilities": {"1000bt": "1Gbit/s", "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", "bus_master": "bus mastering", "cap_list": "PCI capabilities listing", "ethernet": true, "msi": "Message Signalled Interrupts", "pciexpress": "PCI Express", "physical": "Physical interface", "pm": "Power Management", "rom": "extension ROM", "tp": "twisted pair", "vpd": "Vital Product Data"}, "capacity": 1000000000, "claimed": true, "class": "network", "clock": 33000000, "configuration": {"autonegotiation": "on", "broadcast": "yes", "driver": "sky2", "driverversion": "1.30", "duplex": "full", "ip": "192.168.1.229", "latency": "0", "link": "yes", "multicast": "yes", "port": "twisted pair", "speed": "100Mbit/s"}, "description": "Ethernet interface", "handle": "PCI:0000:02:00.0", "id": "network", "logicalname": "enp2s0", "physid": "0", "product": "88E8071 PCI-E Gigabit Ethernet Controller", "serial": "40:61:86:59:43:3f", "size": 100000000, "units": "bit/s", "vendor": "Marvell Technology Group Ltd.", "version": "16", "width": 64}], "claimed": true, "class": "bridge", "clock": 33000000, "configuration": {"driver": "pcieport"}, "description": "PCI bridge", "handle": "PCIBUS:0000:02", "id": "pci:1", "physid": "1c.1", "product": "82801JI (ICH10 Family) PCI Express Port 2", "vendor": "Intel Corporation", "version": "00", "width": 32}, {"businfo": "pci@0000:00:1d.0", "capabilities": {"bus_master": "bus mastering", "cap_list": "PCI capabilities listing", "uhci": "Universal Host Controller Interface (USB1)"}, "children": [{"businfo": "usb@6", "capabilities": {"usb-1.10": "USB 1.1"}, "claimed": true, "class": "bus", "configuration": {"driver": "hub", "slots": "2", "speed": "12Mbit/s"}, "handle": "USB:6:1", "id": "usbhost", "logicalname": "usb6", "physid": "1", "product": "UHCI Host Controller", "vendor": "Linux 4.9.0-13-686-pae uhci_hcd", "version": "4.09"}], "claimed": true, "class": "bus", "clock": 33000000, "configuration": {"driver": "uhci_hcd", "latency": "0"}, "description": "USB controller", "handle": "PCI:0000:00:1d.0", "id": "usb:4", "physid": "1d", "product": "82801JI (ICH10 Family) USB UHCI Controller #1", "vendor": "Intel Corporation", "version": "00", "width": 32}, {"businfo": "pci@0000:00:1d.1", "capabilities": {"bus_master": "bus mastering", "cap_list": "PCI capabilities listing", "uhci": "Universal Host Controller Interface (USB1)"}, "children": [{"businfo": "usb@7", "capabilities": {"usb-1.10": "USB 1.1"}, "claimed": true, "class": "bus", "configuration": {"driver": "hub", "slots": "2", "speed": "12Mbit/s"}, "handle": "USB:7:1", "id": "usbhost", "logicalname": "usb7", "physid": "1", "product": "UHCI Host Controller", "vendor": "Linux 4.9.0-13-686-pae uhci_hcd", "version": "4.09"}], "claimed": true, "class": "bus", "clock": 33000000, "configuration": {"driver": "uhci_hcd", "latency": "0"}, "description": "USB controller", "handle": "PCI:0000:00:1d.1", "id": "usb:5", "physid": "1d.1", "product": "82801JI (ICH10 Family) USB UHCI Controller #2", "vendor": "Intel Corporation", "version": "00", "width": 32}, {"businfo": "pci@0000:00:1d.2", "capabilities": {"bus_master": "bus mastering", "cap_list": "PCI capabilities listing", "uhci": "Universal Host Controller Interface (USB1)"}, "children": [{"businfo": "usb@8", "capabilities": {"usb-1.10": "USB 1.1"}, "claimed": true, "class": "bus", "configuration": {"driver": "hub", "slots": "2", "speed": "12Mbit/s"}, "handle": "USB:8:1", "id": "usbhost", "logicalname": "usb8", "physid": "1", "product": "UHCI Host Controller", "vendor": "Linux 4.9.0-13-686-pae uhci_hcd", "version": "4.09"}], "claimed": true, "class": "bus", "clock": 33000000, "configuration": {"driver": "uhci_hcd", "latency": "0"}, "description": "USB controller", "handle": "PCI:0000:00:1d.2", "id": "usb:6", "physid": "1d.2", "product": "82801JI (ICH10 Family) USB UHCI Controller #3", "vendor": "Intel Corporation", "version": "00", "width": 32}, {"businfo": "pci@0000:00:1d.7", "capabilities": {"bus_master": "bus mastering", "cap_list": "PCI capabilities listing", "debug": "Debug port", "ehci": "Enhanced Host Controller Interface (USB2)", "pm": "Power Management"}, "children": [{"businfo": "usb@3", "capabilities": {"usb-2.00": "USB 2.0"}, "children": [{"businfo": "usb@3:2", "capabilities": {"emulated": "Emulated device", "scsi": "SCSI", "usb-2.00": "USB 2.0"}, "children": [{"businfo": "scsi@4:0.0.0", "capabilities": {"removable": "support is removable"}, "children": [{"capabilities": {"partitioned": "Partitioned disk", "partitioned:dos": "MS-DOS partition table"}, "children": [{"capabilities": {"bootable": "Bootable partition (active)", "nofs": "No filesystem", "primary": "Primary partition"}, "capacity": 479166464, "claimed": true, "class": "volume", "configuration": {"mount.fstype": "iso9660", "mount.options": "ro,noatime", "state": "mounted"}, "description": "Empty partition", "dev": "8:17", "id": "volume:0", "logicalname": ["/dev/sdb1", "/lib/live/mount/medium"], "physid": "1"}, {"capabilities": {"boot": "Contains boot code", "fat": "Windows FAT", "initialized": "initialized volume", "primary": "Primary partition"}, "claimed": true, "class": "volume", "configuration": {"FATs": "2", "filesystem": "fat"}, "description": "Windows FAT volume", "dev": "8:18", "id": "volume:1", "logicalname": "/dev/sdb2", "physid": "2", "serial": "56b9-cd28", "size": 18446744073709551104, "vendor": "mkfs.fat", "version": "FAT12"}], "claimed": true, "class": "disk", "configuration": {"signature": "5ca3f80e"}, "dev": "8:16", "id": "medium", "logicalname": "/dev/sdb", "physid": "0", "size": 8053063680, "units": "bytes"}], "claimed": true, "class": "disk", "configuration": {"ansiversion": "4", "logicalsectorsize": "512", "sectorsize": "512"}, "description": "SCSI Disk", "dev": "8:16", "handle": "SCSI:04:00:00:00", "id": "disk", "logicalname": "/dev/sdb", "physid": "0.0.0", "product": "ProductCode", "size": 8053063680, "units": "bytes", "vendor": "VendorCo", "version": "2.00"}], "claimed": true, "class": "storage", "configuration": {"driver": "usb-storage", "maxpower": "100mA", "speed": "480Mbit/s"}, "description": "Mass storage device", "handle": "USB:3:2", "id": "usb", "logicalname": "scsi4", "physid": "2", "product": "Disk 2.0", "serial": "5887831180150528145", "vendor": "USB", "version": "2.00"}], "claimed": true, "class": "bus", "configuration": {"driver": "hub", "slots": "6", "speed": "480Mbit/s"}, "handle": "USB:3:1", "id": "usbhost", "logicalname": "usb3", "physid": "1", "product": "EHCI Host Controller", "vendor": "Linux 4.9.0-13-686-pae ehci_hcd", "version": "4.09"}], "claimed": true, "class": "bus", "clock": 33000000, "configuration": {"driver": "ehci-pci", "latency": "0"}, "description": "USB controller", "handle": "PCI:0000:00:1d.7", "id": "usb:7", "physid": "1d.7", "product": "82801JI (ICH10 Family) USB2 EHCI Controller #1", "vendor": "Intel Corporation", "version": "00", "width": 32}, {"businfo": "pci@0000:00:1e.0", "capabilities": {"bus_master": "bus mastering", "cap_list": "PCI capabilities listing", "pci": true, "subtractive_decode": true}, "claimed": true, "class": "bridge", "clock": 33000000, "description": "PCI bridge", "handle": "PCIBUS:0000:03", "id": "pci:2", "physid": "1e", "product": "82801 PCI Bridge", "vendor": "Intel Corporation", "version": "90", "width": 32}, {"businfo": "pci@0000:00:1f.0", "capabilities": {"bus_master": "bus mastering", "cap_list": "PCI capabilities listing", "isa": true}, "claimed": true, "class": "bridge", "clock": 33000000, "configuration": {"driver": "lpc_ich", "latency": "0"}, "description": "ISA bridge", "handle": "PCI:0000:00:1f.0", "id": "isa", "physid": "1f", "product": "82801JIR (ICH10R) LPC Interface Controller", "vendor": "Intel Corporation", "version": "00", "width": 32}, {"businfo": "pci@0000:00:1f.2", "capabilities": {"bus_master": "bus mastering", "cap_list": "PCI capabilities listing", "ide": true, "pci_native_mode_controller__supports_both_channels_switched_to_isa_compatibility_mode__supports_bus_mastering": true, "pm": "Power Management"}, "claimed": true, "class": "storage", "clock": 66000000, "configuration": {"driver": "ata_piix", "latency": "0"}, "description": "IDE interface", "handle": "PCI:0000:00:1f.2", "id": "ide:0", "physid": "1f.2", "product": "82801JI (ICH10 Family) 4 port SATA IDE Controller #1", "vendor": "Intel Corporation", "version": "00", "width": 32}, {"businfo": "pci@0000:00:1f.3", "claimed": true, "class": "bus", "clock": 33000000, "configuration": {"driver": "i801_smbus", "latency": "0"}, "description": "SMBus", "handle": "PCI:0000:00:1f.3", "id": "serial", "physid": "1f.3", "product": "82801JI (ICH10 Family) SMBus Controller", "vendor": "Intel Corporation", "version": "00", "width": 64}, {"businfo": "pci@0000:00:1f.5", "capabilities": {"bus_master": "bus mastering", "cap_list": "PCI capabilities listing", "ide": true, "pci_native_mode-only_controller__supports_bus_mastering": true, "pm": "Power Management"}, "claimed": true, "class": "storage", "clock": 66000000, "configuration": {"driver": "ata_piix", "latency": "0"}, "description": "IDE interface", "handle": "PCI:0000:00:1f.5", "id": "ide:1", "physid": "1f.5", "product": "82801JI (ICH10 Family) 2 port SATA IDE Controller #2", "vendor": "Intel Corporation", "version": "00", "width": 32}], "claimed": true, "class": "bridge", "clock": 33000000, "description": "Host bridge", "handle": "PCIBUS:0000:00", "id": "pci", "physid": "100", "product": "4 Series Chipset DRAM Controller", "vendor": "Intel Corporation", "version": "03", "width": 32}, {"capabilities": {"emulated": "Emulated device"}, "children": [{"businfo": "scsi@0:0.0.0", "capabilities": {"partitioned": "Partitioned disk", "partitioned:dos": "MS-DOS partition table"}, "children": [{"businfo": "scsi@0:0.0.0,1", "capabilities": {"bootable": "Bootable partition (active)", "initialized": "initialized volume", "ntfs": "Windows NTFS", "primary": "Primary partition"}, "capacity": 104857600, "claimed": true, "class": "volume", "configuration": {"clustersize": "4096", "created": "2017-09-27 19:27:30", "filesystem": "ntfs", "label": "BDEDrive", "modified_by_chkdsk": "true", "mounted_on_nt4": "true", "resize_log_file": "true", "state": "dirty", "upgrade_on_mount": "true"}, "description": "Windows NTFS volume", "dev": "8:1", "id": "volume:0", "logicalname": "/dev/sda1", "physid": "1", "serial": "1ea9-2611", "size": 103808512, "version": "3.1"}, {"businfo": "scsi@0:0.0.0,2", "capabilities": {"initialized": "initialized volume", "ntfs": "Windows NTFS", "primary": "Primary partition"}, "capacity": 400000286720, "claimed": true, "class": "volume", "configuration": {"clustersize": "4096", "created": "2017-09-27 19:27:32", "filesystem": "ntfs", "label": "OSDisk", "state": "clean"}, "description": "Windows NTFS volume", "dev": "8:2", "id": "volume:1", "logicalname": "/dev/sda2", "physid": "2", "serial": "12a878ea-d97f-3f4e-96d1-25c395551dfa", "size": 399995043328, "version": "3.1"}, {"businfo": "scsi@0:0.0.0,3", "capabilities": {"initialized": "initialized volume", "ntfs": "Windows NTFS", "primary": "Primary partition"}, "capacity": 100000595968, "claimed": true, "class": "volume", "configuration": {"clustersize": "4096", "created": "2017-09-27 19:27:35", "filesystem": "ntfs", "label": "DadesDisk", "modified_by_chkdsk": "true", "mounted_on_nt4": "true", "resize_log_file": "true", "state": "dirty", "upgrade_on_mount": "true"}, "description": "Windows NTFS volume", "dev": "8:3", "id": "volume:2", "logicalname": "/dev/sda3", "physid": "3", "serial": "665c63c3-987e-6943-b81f-9cd86d9d909f", "size": 99997449728, "version": "3.1"}], "claimed": true, "class": "disk", "configuration": {"ansiversion": "5", "logicalsectorsize": "512", "sectorsize": "512", "signature": "c4455b96"}, "description": "ATA Disk", "dev": "8:0", "handle": "SCSI:00:00:00:00", "id": "disk", "logicalname": "/dev/sda", "physid": "0.0.0", "product": "WDC WD5000AAKX-0", "serial": "WD-WCAYUJP74971", "size": 500107862016, "units": "bytes", "vendor": "Western Digital", "version": "1H15"}], "claimed": true, "class": "storage", "id": "scsi:0", "logicalname": "scsi0", "physid": "2"}, {"capabilities": {"emulated": "Emulated device"}, "children": [{"businfo": "scsi@1:0.0.0", "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", "removable": "support is removable"}, "claimed": true, "class": "disk", "configuration": {"ansiversion": "5", "status": "nodisc"}, "description": "DVD-RAM writer", "dev": "11:0", "handle": "SCSI:01:00:00:00", "id": "cdrom", "logicalname": ["/dev/cdrom", "/dev/cdrw", "/dev/dvd", "/dev/dvdrw", "/dev/sr0"], "physid": "0.0.0", "product": "DVD A DH16AASH", "vendor": "ATAPI", "version": "SA15"}], "claimed": true, "class": "storage", "id": "scsi:1", "logicalname": "scsi1", "physid": "3"}], "claimed": true, "class": "bus", "description": "Motherboard", "handle": "DMI:0002", "id": "core", "physid": "0", "product": "Veriton M480", "slot": "To Be Filled By O.E.M.", "vendor": "Acer"}], "claimed": true, "class": "system", "configuration": {"administrator_password": "disabled", "boot": "normal", "chassis": "desktop", "cpus": "2", "family": "Acer Desktop", "power-on_password": "disabled", "sku": "To Be Filled By O.E.M.", "uuid": "40618659-433F-2009-1124-074502000000"}, "description": "Desktop Computer", "handle": "DMI:0001", "id": "debian", "product": "Veriton M480G (To Be Filled By O.E.M.)", "serial": "P1FUR7ZG7S948048A12700", "vendor": "Acer", "width": 32}}, "device": {"actions": [{"elapsed": 60, "severity": "Info", "type": "StressTest"}, {"elapsed": 1, "rate": 1.0826, "type": "BenchmarkRamSysbench"}], "chassis": "Tower", "manufacturer": "Acer", "model": "Veriton M480G", "serialNumber": "P1FUR7ZG7S948048A12700", "sku": null, "type": "Desktop", "version": null}, "elapsed": 231, "endTime": "2021-02-11T11:21:08.173728+00:00", "software": "Workbench", "type": "Snapshot", "uuid": "e47769ec-5238-46f3-9dbe-6da3df86fa0a", "version": "11.0b11"} \ No newline at end of file From 06c5137b329207a68a2e70956e4330c26b875c87 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 30 Jun 2021 15:05:44 +0200 Subject: [PATCH 04/15] implementation of hash3 for snapshots --- ereuse_devicehub/resources/action/views/snapshot.py | 12 +++++++++++- ereuse_devicehub/resources/action/views/views.py | 7 +------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/ereuse_devicehub/resources/action/views/snapshot.py b/ereuse_devicehub/resources/action/views/snapshot.py index 1718b043..c268670f 100644 --- a/ereuse_devicehub/resources/action/views/snapshot.py +++ b/ereuse_devicehub/resources/action/views/snapshot.py @@ -3,10 +3,12 @@ import os import json import shutil +import hashlib from datetime import datetime from flask import current_app as app, g from sqlalchemy.util import OrderedSet +from teal.marshmallow import ValidationError from ereuse_devicehub.db import db from ereuse_devicehub.resources.action.models import RateComputer, Snapshot @@ -59,6 +61,14 @@ def move_json(tmp_snapshots, path_name, user, live=False): os.remove(path_name) +def check_hash_snapshot(snapshot_json): + debug = snapshot_json.pop('debug') + data = json.dumps(snapshot_json).encode('utf-8') + hash3 = hashlib.sha3_256(data).hexdigest() + if not hash3 in debug['hwinfo']: + txt = "This Snapshot is not valid" + raise ValidationError(txt) + class SnapshotView(): """Performs a Snapshot. @@ -75,7 +85,7 @@ class SnapshotView(): self.resource_def = resource_def self.tmp_snapshots = app.config['TMP_SNAPSHOTS'] self.path_snapshot = save_json(snapshot_json, self.tmp_snapshots, g.user.email) - snapshot_json.pop('debug', None) + check_hash_snapshot(snapshot_json) self.snapshot_json = resource_def.schema.load(snapshot_json) self.response = self.build() move_json(self.tmp_snapshots, self.path_snapshot, g.user.email) diff --git a/ereuse_devicehub/resources/action/views/views.py b/ereuse_devicehub/resources/action/views/views.py index b53c9bb7..fcc430cb 100644 --- a/ereuse_devicehub/resources/action/views/views.py +++ b/ereuse_devicehub/resources/action/views/views.py @@ -4,7 +4,6 @@ from datetime import timedelta from distutils.version import StrictVersion from uuid import UUID -import jwt from flask import current_app as app, request, g from teal.db import ResourceNotFound from teal.marshmallow import ValidationError @@ -172,12 +171,8 @@ class ActionView(View): def post(self): """Posts an action.""" json = request.get_json(validate=False) - if not json: + if not json or 'type' not in json: raise ValidationError('Post request needs a json.') - elif 'type' not in json: - # JN TODO Use the user's key instead an empty string - key = '' - json = jwt.decode(json, key, algorithms="HS256") # todo there should be a way to better get subclassess resource # defs resource_def = app.resources[json['type']] From 3d027270ccb5dd16fc2eb8f4e819867342b5d020 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Fri, 2 Jul 2021 15:25:19 +0200 Subject: [PATCH 05/15] ading jwt in snapshots --- .../resources/action/views/snapshot.py | 15 ++------ .../resources/action/views/views.py | 12 +++++++ requirements.txt | 3 +- tests/conftest.py | 19 +++++++++- tests/test_action.py | 35 +++++++++++-------- tests/test_snapshot.py | 3 +- 6 files changed, 56 insertions(+), 31 deletions(-) diff --git a/ereuse_devicehub/resources/action/views/snapshot.py b/ereuse_devicehub/resources/action/views/snapshot.py index c268670f..f0fa35db 100644 --- a/ereuse_devicehub/resources/action/views/snapshot.py +++ b/ereuse_devicehub/resources/action/views/snapshot.py @@ -3,12 +3,10 @@ import os import json import shutil -import hashlib from datetime import datetime from flask import current_app as app, g from sqlalchemy.util import OrderedSet -from teal.marshmallow import ValidationError from ereuse_devicehub.db import db from ereuse_devicehub.resources.action.models import RateComputer, Snapshot @@ -61,15 +59,6 @@ def move_json(tmp_snapshots, path_name, user, live=False): os.remove(path_name) -def check_hash_snapshot(snapshot_json): - debug = snapshot_json.pop('debug') - data = json.dumps(snapshot_json).encode('utf-8') - hash3 = hashlib.sha3_256(data).hexdigest() - if not hash3 in debug['hwinfo']: - txt = "This Snapshot is not valid" - raise ValidationError(txt) - - class SnapshotView(): """Performs a Snapshot. @@ -80,12 +69,12 @@ class SnapshotView(): # snapshot, and we want to wait to flush snapshot at the end def __init__(self, snapshot_json: dict, resource_def, schema): + # import pdb; pdb.set_trace() self.schema = schema - self.snapshot_json = snapshot_json self.resource_def = resource_def self.tmp_snapshots = app.config['TMP_SNAPSHOTS'] self.path_snapshot = save_json(snapshot_json, self.tmp_snapshots, g.user.email) - check_hash_snapshot(snapshot_json) + snapshot_json.pop('debug', None) self.snapshot_json = resource_def.schema.load(snapshot_json) self.response = self.build() move_json(self.tmp_snapshots, self.path_snapshot, g.user.email) diff --git a/ereuse_devicehub/resources/action/views/views.py b/ereuse_devicehub/resources/action/views/views.py index 082cd1d1..6d932784 100644 --- a/ereuse_devicehub/resources/action/views/views.py +++ b/ereuse_devicehub/resources/action/views/views.py @@ -167,10 +167,22 @@ class LiveView(View): return live +import jwt +import ereuse_utils +def decode_snapshot(data): + p = '7KU4ZzsEfe' + return jwt.decode(data, p, algorithms="HS256", json_encoder=ereuse_utils.JSONEncoder) + + class ActionView(View): def post(self): """Posts an action.""" + json = request.get_json(validate=False) + + if not type(json) == dict: + json = decode_snapshot(json) + if not json or 'type' not in json: raise ValidationError('Post request needs a json.') # todo there should be a way to better get subclassess resource diff --git a/requirements.txt b/requirements.txt index 15ccaa98..12ee8ef9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -35,4 +35,5 @@ psycopg2-binary==2.8.3 sortedcontainers==2.1.0 tqdm==4.32.2 python-decouple==3.3 -python-dotenv==0.14.0 \ No newline at end of file +python-dotenv==0.14.0 +pyjwt==2.1.0 diff --git a/tests/conftest.py b/tests/conftest.py index 9dd556eb..6a7ce73d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,5 +1,7 @@ import io import uuid +import jwt +import ereuse_utils from contextlib import redirect_stdout from datetime import datetime from pathlib import Path @@ -27,6 +29,7 @@ ENDT = datetime(year=2000, month=1, day=1, hour=2) T = {'start_time': STARTT, 'end_time': ENDT} """A dummy start_time/end_time to use as function keywords.""" +P = '7KU4ZzsEfe' class TestConfig(DevicehubConfig): SQLALCHEMY_DATABASE_URI = 'postgresql://dhub:ereuse@localhost/dh_test' @@ -137,12 +140,26 @@ def auth_app_context(app: Devicehub): yield app -def file(name: str) -> dict: +def json_encode(dev: str) -> dict: + """Encode json.""" + return jwt.encode(dev, + P, + algorithm="HS256", + json_encoder=ereuse_utils.JSONEncoder + ) + + +def yaml2json(name: str) -> dict: """Opens and parses a YAML file from the ``files`` subdir.""" with Path(__file__).parent.joinpath('files').joinpath(name + '.yaml').open() as f: return yaml.load(f) +def file(name: str) -> dict: + """Opens and parses a YAML file from the ``files`` subdir. And decode""" + return json_encode(yaml2json(name)) + + def file_workbench(name: str) -> dict: """Opens and parses a YAML file from the ``files`` subdir.""" with Path(__file__).parent.joinpath('workbench_files').joinpath(name + '.json').open() as f: diff --git a/tests/test_action.py b/tests/test_action.py index 4b5640cb..565f0d37 100644 --- a/tests/test_action.py +++ b/tests/test_action.py @@ -29,7 +29,7 @@ from ereuse_devicehub.resources.device.models import Desktop, Device, GraphicCar RamModule, SolidStateDrive from ereuse_devicehub.resources.enums import ComputerChassis, Severity, TestDataStorageLength from tests import conftest -from tests.conftest import create_user, file +from tests.conftest import create_user, file, yaml2json, json_encode @pytest.mark.mvp @@ -260,6 +260,7 @@ def test_live(user: UserClient, client: Client, app: Devicehub): """Tests inserting a Live into the database and GETting it.""" acer = file('acer.happy.battery.snapshot') snapshot, _ = user.post(acer, res=models.Snapshot) + acer = yaml2json('acer.happy.battery.snapshot') device_id = snapshot['device']['id'] post_request = {"transaction": "ccc", "name": "John", "endUsers": 1, "devices": [device_id], "description": "aaa", @@ -292,6 +293,7 @@ def test_live(user: UserClient, client: Client, app: Devicehub): @pytest.mark.usefixtures(conftest.app_context.__name__) def test_live_example(user: UserClient, client: Client, app: Devicehub): """Tests inserting a Live into the database and GETting it.""" + # import pdb; pdb.set_trace() acer = file('snapshotLive') snapshot, _ = user.post(acer, res=models.Snapshot) device_id = snapshot['device']['id'] @@ -304,7 +306,7 @@ def test_live_example(user: UserClient, client: Client, app: Devicehub): user.post(res=models.Allocate, data=post_request) - acer = file('live') + acer = yaml2json('live') live, _ = client.post(acer, res=models.Live) db_device = Device.query.filter_by(id=device_id).one() action_live = [a for a in db_device.actions if a.type == 'Live'] @@ -320,9 +322,9 @@ def test_live_two_users(user: UserClient, user2: UserClient, client: Client, app """Tests inserting a Live into the database and GETting it.""" acer = file('snapshotLive') snapshot, _ = user.post(acer, res=models.Snapshot) - acer2 = file('snapshotLive') + acer2 = yaml2json('snapshotLive') acer2['uuid'] = '3b6a9288-0ba6-4bdd-862a-2b1f660e7115' - snapshot2, _ = user2.post(acer2, res=models.Snapshot) + snapshot2, _ = user2.post(json_encode(acer2), res=models.Snapshot) device_id = snapshot['device']['id'] post_request = {"transaction": "ccc", "name": "John", "endUsers": 1, "devices": [device_id], "description": "aaa", @@ -333,7 +335,7 @@ def test_live_two_users(user: UserClient, user2: UserClient, client: Client, app user.post(res=models.Allocate, data=post_request) - acer = file('live') + acer = yaml2json('live') live, _ = client.post(acer, res=models.Live) db_device = Device.query.filter_by(id=device_id).one() action_live = [a for a in db_device.actions if a.type == 'Live'] @@ -349,9 +351,9 @@ def test_live_two_allocated(user: UserClient, user2: UserClient, client: Client, """Tests inserting a Live into the database and GETting it.""" acer = file('snapshotLive') snapshot, _ = user.post(acer, res=models.Snapshot) - acer2 = file('snapshotLive') + acer2 = yaml2json('snapshotLive') acer2['uuid'] = '3b6a9288-0ba6-4bdd-862a-2b1f660e7115' - snapshot2, _ = user2.post(acer2, res=models.Snapshot) + snapshot2, _ = user2.post(json_encode(acer2), res=models.Snapshot) device_id = snapshot['device']['id'] device_id2 = snapshot2['device']['id'] post_request = {"transaction": "ccc", "name": "John", "endUsers": 1, @@ -370,7 +372,7 @@ def test_live_two_allocated(user: UserClient, user2: UserClient, client: Client, user.post(res=models.Allocate, data=post_request) user2.post(res=models.Allocate, data=post_request2) - acer = file('live') + acer = yaml2json('live') live, _ = client.post(acer, res=models.Live, status=422) message = 'Expected only one Device but multiple where found' assert live['message'] == message @@ -396,6 +398,7 @@ def test_live_without_TestDataStorage(user: UserClient, client: Client, app: Dev } user.post(res=models.Allocate, data=post_request) + acer = yaml2json('acer.happy.battery.snapshot') acer['uuid'] = "490fb8c0-81a1-42e9-95e0-5e7db7038ec3" actions = [a for a in acer['components'][7]['actions'] if a['type'] != 'TestDataStorage'] acer['components'][7]['actions'] = actions @@ -429,6 +432,7 @@ def test_live_without_hdd_1(user: UserClient, client: Client, app: Devicehub): } user.post(res=models.Allocate, data=post_request) + acer = yaml2json('acer.happy.battery.snapshot') acer['uuid'] = "490fb8c0-81a1-42e9-95e0-5e7db7038ec3" components = [a for a in acer['components'] if a['type'] != 'HardDrive'] acer['components'] = components @@ -446,10 +450,10 @@ def test_live_without_hdd_2(user: UserClient, client: Client, app: Devicehub): """Tests inserting a Live into the database and GETting it. The snapshot haven't hdd and the live neither, and response 404 """ - acer = file('acer.happy.battery.snapshot') + acer = yaml2json('acer.happy.battery.snapshot') components = [a for a in acer['components'] if a['type'] != 'HardDrive'] acer['components'] = components - snapshot, _ = user.post(acer, res=models.Snapshot) + snapshot, _ = user.post(json_encode(acer), res=models.Snapshot) device_id = snapshot['device']['id'] db_device = Device.query.filter_by(id=device_id).one() post_request = {"transaction": "ccc", "name": "John", "endUsers": 1, @@ -476,7 +480,7 @@ def test_live_without_hdd_3(user: UserClient, client: Client, app: Devicehub): The snapshot haven't hdd and the live have, and save the live with usage_time_allocate == 0 """ - acer = file('acer.happy.battery.snapshot') + acer = yaml2json('acer.happy.battery.snapshot') acer['uuid'] = "490fb8c0-81a1-42e9-95e0-5e7db7038ec3" components = [a for a in acer['components'] if a['type'] != 'HardDrive'] acer['components'] = components @@ -491,7 +495,7 @@ def test_live_without_hdd_3(user: UserClient, client: Client, app: Devicehub): } user.post(res=models.Allocate, data=post_request) - acer = file('acer.happy.battery.snapshot') + acer = yaml2json('acer.happy.battery.snapshot') acer.pop('elapsed') acer['licence_version'] = '1.0.0' live, _ = client.post(acer, res=models.Live) @@ -524,7 +528,7 @@ def test_live_with_hdd_with_old_time(user: UserClient, client: Client, app: Devi } user.post(res=models.Allocate, data=post_request) - acer = file('acer.happy.battery.snapshot') + acer = yaml2json('acer.happy.battery.snapshot') acer['uuid'] = "490fb8c0-81a1-42e9-95e0-5e7db7038ec3" action = [a for a in acer['components'][7]['actions'] if a['type'] == 'TestDataStorage'] action[0]['lifetime'] -= 100 @@ -557,6 +561,7 @@ def test_live_search_last_allocate(user: UserClient, client: Client, app: Device } user.post(res=models.Allocate, data=post_request) + acer = yaml2json('acer.happy.battery.snapshot') acer['uuid'] = "490fb8c0-81a1-42e9-95e0-5e7db7038ec3" hdd = [c for c in acer['components'] if c['type'] == 'HardDrive'][0] hdd_action = [a for a in hdd['actions'] if a['type'] == 'TestDataStorage'][0] @@ -576,8 +581,8 @@ def test_live_search_last_allocate(user: UserClient, client: Client, app: Device @pytest.mark.mvp def test_save_live_json(app: Devicehub, user: UserClient, client: Client): """ This test check if works the function save_snapshot_in_file """ - acer = file('acer.happy.battery.snapshot') - snapshot, _ = user.post(acer, res=models.Snapshot) + acer = yaml2json('acer.happy.battery.snapshot') + snapshot, _ = user.post(json_encode(acer), res=models.Snapshot) debug = 'AAA' acer['debug'] = debug device_id = snapshot['device']['id'] diff --git a/tests/test_snapshot.py b/tests/test_snapshot.py index 82989f17..897e5fe6 100644 --- a/tests/test_snapshot.py +++ b/tests/test_snapshot.py @@ -847,4 +847,5 @@ def test_bug_141(user: UserClient): with a big number in the parameter command_timeout of the DataStorage """ - user.post(file('2021-5-4-13-41_time_out_test_datastorage'), res=Snapshot) + dev = file('2021-5-4-13-41_time_out_test_datastorage') + user.post(dev, res=Snapshot) From 57007b3d92cbbb0e65250ae841034a8cf9a00902 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Fri, 2 Jul 2021 17:40:20 +0200 Subject: [PATCH 06/15] fixing test for jwt in snapshots --- tests/test_device.py | 66 ++++++++--------- tests/test_device_find.py | 10 +-- tests/test_documents.py | 22 +++--- tests/test_metrics.py | 14 ++-- tests/test_rate.py | 14 ++-- tests/test_snapshot.py | 82 ++++++++++----------- tests/test_tag.py | 6 +- tests/test_workbench.py | 28 +++---- tests/workbench_files/encoded.snapshot.json | 1 - 9 files changed, 121 insertions(+), 122 deletions(-) delete mode 100644 tests/workbench_files/encoded.snapshot.json diff --git a/tests/test_device.py b/tests/test_device.py index 4a058284..c428229e 100644 --- a/tests/test_device.py +++ b/tests/test_device.py @@ -29,7 +29,7 @@ from ereuse_devicehub.resources.enums import ComputerChassis, DisplayTech, Sever from ereuse_devicehub.resources.tag.model import Tag from ereuse_devicehub.resources.user import User from tests import conftest -from tests.conftest import file +from tests.conftest import file, yaml2json, json_encode @pytest.mark.mvp @@ -138,7 +138,7 @@ def test_physical_properties(): @pytest.mark.usefixtures(conftest.auth_app_context.__name__) def test_component_similar_one(): user = User.query.filter().first() - snapshot = conftest.file('pc-components.db') + snapshot = yaml2json('pc-components.db') pc = snapshot['device'] snapshot['components'][0]['serial_number'] = snapshot['components'][1]['serial_number'] = None pc = d.Desktop(**pc, components=OrderedSet(d.Component(**c) for c in snapshot['components'])) @@ -167,7 +167,7 @@ def test_add_remove(): # pc2 has c3 # c4 is not with any pc user = User.query.filter().first() - values = conftest.file('pc-components.db') + values = yaml2json('pc-components.db') pc = values['device'] c1, c2 = (d.Component(**c) for c in values['components']) pc = d.Desktop(**pc, components=OrderedSet([c1, c2])) @@ -198,7 +198,7 @@ def test_sync_run_components_empty(): """Syncs a device that has an empty components list. The system should remove all the components from the device. """ - s = conftest.file('pc-components.db') + s = yaml2json('pc-components.db') pc = d.Desktop(**s['device'], components=OrderedSet(d.Component(**c) for c in s['components'])) db.session.add(pc) db.session.commit() @@ -216,7 +216,7 @@ def test_sync_run_components_none(): """Syncs a device that has a None components. The system should keep all the components from the device. """ - s = conftest.file('pc-components.db') + s = yaml2json('pc-components.db') pc = d.Desktop(**s['device'], components=OrderedSet(d.Component(**c) for c in s['components'])) db.session.add(pc) db.session.commit() @@ -233,7 +233,7 @@ def test_sync_run_components_none(): def test_sync_execute_register_desktop_new_desktop_no_tag(): """Syncs a new d.Desktop with HID and without a tag, creating it.""" # Case 1: device does not exist on DB - pc = d.Desktop(**conftest.file('pc-components.db')['device']) + pc = d.Desktop(**yaml2json('pc-components.db')['device']) db_pc = Sync().execute_register(pc) assert pc.physical_properties == db_pc.physical_properties @@ -242,12 +242,12 @@ def test_sync_execute_register_desktop_new_desktop_no_tag(): @pytest.mark.usefixtures(conftest.auth_app_context.__name__) def test_sync_execute_register_desktop_existing_no_tag(): """Syncs an existing d.Desktop with HID and without a tag.""" - pc = d.Desktop(**conftest.file('pc-components.db')['device']) + pc = d.Desktop(**yaml2json('pc-components.db')['device']) db.session.add(pc) db.session.commit() pc = d.Desktop( - **conftest.file('pc-components.db')['device']) # Create a new transient non-db object + **yaml2json('pc-components.db')['device']) # Create a new transient non-db object # 1: device exists on DB db_pc = Sync().execute_register(pc) pc.amount = 0 @@ -262,7 +262,7 @@ def test_sync_execute_register_desktop_no_hid_no_tag(user: UserClient): """Syncs a d.Desktop without HID and no tag. This should not fail as we don't have a way to identify it. """ - device = conftest.file('pc-components.db')['device'] + device = yaml2json('pc-components.db')['device'] device['owner_id'] = user.user['id'] pc = d.Desktop(**device) # 1: device has no HID @@ -283,7 +283,7 @@ def test_sync_execute_register_desktop_tag_not_linked(): db.session.commit() # Create a new transient non-db object - pc = d.Desktop(**conftest.file('pc-components.db')['device'], tags=OrderedSet([Tag(id='foo')])) + pc = d.Desktop(**yaml2json('pc-components.db')['device'], tags=OrderedSet([Tag(id='foo')])) returned_pc = Sync().execute_register(pc) assert returned_pc == pc assert tag.device == pc, 'Tag has to be linked' @@ -300,7 +300,7 @@ def test_sync_execute_register_no_hid_tag_not_linked(tag_id: str): be linked), and thus it creates a new d.Desktop. """ tag = Tag(id=tag_id) - pc = d.Desktop(**conftest.file('pc-components.db')['device'], tags=OrderedSet([tag])) + pc = d.Desktop(**yaml2json('pc-components.db')['device'], tags=OrderedSet([tag])) db.session.add(g.user) returned_pc = Sync().execute_register(pc) db.session.commit() @@ -323,7 +323,7 @@ def test_sync_execute_register_tag_does_not_exist(): Tags have to be created before trying to link them through a Snapshot. """ user = User.query.filter().first() - pc = d.Desktop(**conftest.file('pc-components.db')['device'], tags=OrderedSet([Tag('foo')])) + pc = d.Desktop(**yaml2json('pc-components.db')['device'], tags=OrderedSet([Tag('foo')])) pc.owner_id = user.id with raises(ResourceNotFound): Sync().execute_register(pc) @@ -337,12 +337,12 @@ def test_sync_execute_register_tag_linked_same_device(): (If it has HID it validates both HID and tag point at the same device, this his checked in ). """ - orig_pc = d.Desktop(**conftest.file('pc-components.db')['device']) + orig_pc = d.Desktop(**yaml2json('pc-components.db')['device']) db.session.add(Tag(id='foo', device=orig_pc)) db.session.commit() pc = d.Desktop( - **conftest.file('pc-components.db')['device']) # Create a new transient non-db object + **yaml2json('pc-components.db')['device']) # Create a new transient non-db object pc.tags.add(Tag(id='foo')) db_pc = Sync().execute_register(pc) assert db_pc.id == orig_pc.id @@ -356,16 +356,16 @@ def test_sync_execute_register_tag_linked_other_device_mismatch_between_tags(): """Checks that sync raises an error if finds that at least two passed-in tags are not linked to the same device. """ - pc1 = d.Desktop(**conftest.file('pc-components.db')['device']) + pc1 = d.Desktop(**yaml2json('pc-components.db')['device']) db.session.add(Tag(id='foo-1', device=pc1)) - pc2 = d.Desktop(**conftest.file('pc-components.db')['device']) + pc2 = d.Desktop(**yaml2json('pc-components.db')['device']) pc2.serial_number = 'pc2-serial' pc2.hid = Naming.hid(pc2.type, pc2.manufacturer, pc2.model, pc2.serial_number) db.session.add(Tag(id='foo-2', device=pc2)) db.session.commit() pc1 = d.Desktop( - **conftest.file('pc-components.db')['device']) # Create a new transient non-db object + **yaml2json('pc-components.db')['device']) # Create a new transient non-db object pc1.tags.add(Tag(id='foo-1')) pc1.tags.add(Tag(id='foo-2')) with raises(MismatchBetweenTags): @@ -380,16 +380,16 @@ def test_sync_execute_register_mismatch_between_tags_and_hid(): In this case we set HID -> pc1 but tag -> pc2 """ - pc1 = d.Desktop(**conftest.file('pc-components.db')['device']) + pc1 = d.Desktop(**yaml2json('pc-components.db')['device']) db.session.add(Tag(id='foo-1', device=pc1)) - pc2 = d.Desktop(**conftest.file('pc-components.db')['device']) + pc2 = d.Desktop(**yaml2json('pc-components.db')['device']) pc2.serial_number = 'pc2-serial' pc2.hid = Naming.hid(pc2.type, pc2.manufacturer, pc2.model, pc2.serial_number) db.session.add(Tag(id='foo-2', device=pc2)) db.session.commit() pc1 = d.Desktop( - **conftest.file('pc-components.db')['device']) # Create a new transient non-db object + **yaml2json('pc-components.db')['device']) # Create a new transient non-db object pc1.tags.add(Tag(id='foo-2')) with raises(MismatchBetweenTagsAndHid): Sync().execute_register(pc1) @@ -623,9 +623,9 @@ def test_hid_with_mac(app: Devicehub, user: UserClient): @pytest.mark.mvp def test_hid_without_mac(app: Devicehub, user: UserClient): """Checks hid without mac.""" - snapshot = file('asus-eee-1000h.snapshot.11') + snapshot = yaml2json('asus-eee-1000h.snapshot.11') snapshot['components'] = [c for c in snapshot['components'] if c['type'] != 'NetworkAdapter'] - snap, _ = user.post(snapshot, res=m.Snapshot) + snap, _ = user.post(json_encode(snapshot), res=m.Snapshot) pc, _ = user.get(res=d.Device, item=snap['device']['devicehubID']) assert pc['hid'] == 'laptop-asustek_computer_inc-1000h-94oaaq021116' @@ -633,10 +633,10 @@ def test_hid_without_mac(app: Devicehub, user: UserClient): @pytest.mark.mvp def test_hid_with_mac_none(app: Devicehub, user: UserClient): """Checks hid with mac = None.""" - snapshot = file('asus-eee-1000h.snapshot.11') + snapshot = yaml2json('asus-eee-1000h.snapshot.11') network = [c for c in snapshot['components'] if c['type'] == 'NetworkAdapter'][0] network['serialNumber'] = None - snap, _ = user.post(snapshot, res=m.Snapshot) + snap, _ = user.post(json_encode(snapshot), res=m.Snapshot) pc, _ = user.get(res=d.Device, item=snap['device']['devicehubID']) assert pc['hid'] == 'laptop-asustek_computer_inc-1000h-94oaaq021116' @@ -644,12 +644,12 @@ def test_hid_with_mac_none(app: Devicehub, user: UserClient): @pytest.mark.mvp def test_hid_with_2networkadapters(app: Devicehub, user: UserClient): """Checks hid with 2 networks adapters""" - snapshot = file('asus-eee-1000h.snapshot.11') + snapshot = yaml2json('asus-eee-1000h.snapshot.11') network = [c for c in snapshot['components'] if c['type'] == 'NetworkAdapter'][0] network2 = copy.copy(network) snapshot['components'].append(network2) network['serialNumber'] = 'a0:24:8c:7f:cf:2d' - user.post(snapshot, res=m.Snapshot) + user.post(json_encode(snapshot), res=m.Snapshot) devices, _ = user.get(res=d.Device) laptop = devices['items'][0] @@ -660,18 +660,18 @@ def test_hid_with_2networkadapters(app: Devicehub, user: UserClient): @pytest.mark.mvp def test_hid_with_2network_and_drop_no_mac_in_hid(app: Devicehub, user: UserClient): """Checks hid with 2 networks adapters and next drop the network is not used in hid""" - snapshot = file('asus-eee-1000h.snapshot.11') + snapshot = yaml2json('asus-eee-1000h.snapshot.11') network = [c for c in snapshot['components'] if c['type'] == 'NetworkAdapter'][0] network2 = copy.copy(network) snapshot['components'].append(network2) network['serialNumber'] = 'a0:24:8c:7f:cf:2d' - snap, _ = user.post(snapshot, res=m.Snapshot) + snap, _ = user.post(json_encode(snapshot), res=m.Snapshot) pc, _ = user.get(res=d.Device, item=snap['device']['devicehubID']) assert pc['hid'] == 'laptop-asustek_computer_inc-1000h-94oaaq021116-00:24:8c:7f:cf:2d' snapshot['uuid'] = 'd1b70cb8-8929-4f36-99b7-fe052cec0abb' snapshot['components'] = [c for c in snapshot['components'] if c != network] - user.post(snapshot, res=m.Snapshot) + user.post(json_encode(snapshot), res=m.Snapshot) devices, _ = user.get(res=d.Device) laptop = devices['items'][0] assert laptop['hid'] == 'laptop-asustek_computer_inc-1000h-94oaaq021116-00:24:8c:7f:cf:2d' @@ -683,19 +683,19 @@ def test_hid_with_2network_and_drop_no_mac_in_hid(app: Devicehub, user: UserClie def test_hid_with_2network_and_drop_mac_in_hid(app: Devicehub, user: UserClient): """Checks hid with 2 networks adapters and next drop the network is used in hid""" # One tipical snapshot with 2 network cards - snapshot = file('asus-eee-1000h.snapshot.11') + snapshot = yaml2json('asus-eee-1000h.snapshot.11') network = [c for c in snapshot['components'] if c['type'] == 'NetworkAdapter'][0] network2 = copy.copy(network) snapshot['components'].append(network2) network['serialNumber'] = 'a0:24:8c:7f:cf:2d' - snap, _ = user.post(snapshot, res=m.Snapshot) + snap, _ = user.post(json_encode(snapshot), res=m.Snapshot) pc, _ = user.get(res=d.Device, item=snap['device']['devicehubID']) assert pc['hid'] == 'laptop-asustek_computer_inc-1000h-94oaaq021116-00:24:8c:7f:cf:2d' # we drop the network card then is used for to build the hid snapshot['uuid'] = 'd1b70cb8-8929-4f36-99b7-fe052cec0abb' snapshot['components'] = [c for c in snapshot['components'] if c != network2] - user.post(snapshot, res=m.Snapshot) + user.post(json_encode(snapshot), res=m.Snapshot) devices, _ = user.get(res=d.Device) laptops = [c for c in devices['items'] if c['type'] == 'Laptop'] assert len(laptops) == 2 @@ -707,7 +707,7 @@ def test_hid_with_2network_and_drop_mac_in_hid(app: Devicehub, user: UserClient) # we drop all network cards snapshot['uuid'] = 'd1b70cb8-8929-4f36-99b7-fe052cec0abc' snapshot['components'] = [c for c in snapshot['components'] if not c in [network, network2]] - user.post(snapshot, res=m.Snapshot) + user.post(json_encode(snapshot), res=m.Snapshot) devices, _ = user.get(res=d.Device) laptops = [c for c in devices['items'] if c['type'] == 'Laptop'] assert len(laptops) == 3 diff --git a/tests/test_device_find.py b/tests/test_device_find.py index fa6cd83d..306dae32 100644 --- a/tests/test_device_find.py +++ b/tests/test_device_find.py @@ -13,7 +13,7 @@ from ereuse_devicehub.resources.device.views import Filters, Sorting from ereuse_devicehub.resources.enums import ComputerChassis from ereuse_devicehub.resources.lot.models import Lot from tests import conftest -from tests.conftest import file +from tests.conftest import file, yaml2json, json_encode @pytest.mark.mvp @@ -196,9 +196,9 @@ def test_device_query_permitions(user: UserClient, user2: UserClient): i2, _ = user2.get(res=Device) assert i2['items'] == [] - basic_snapshot = file('basic.snapshot') + basic_snapshot = yaml2json('basic.snapshot') basic_snapshot['uuid'] = f"{uuid.uuid4()}" - user2.post(basic_snapshot, res=Snapshot) + user2.post(json_encode(basic_snapshot), res=Snapshot) i2, _ = user2.get(res=Device) pc2 = next(d for d in i2['items'] if d['type'] == 'Desktop') @@ -265,9 +265,9 @@ def test_device_query_search_synonyms_asus(user: UserClient): @pytest.mark.mvp def test_device_query_search_synonyms_intel(user: UserClient): - s = file('real-hp.snapshot.11') + s = yaml2json('real-hp.snapshot.11') s['device']['model'] = 'foo' # The model had the word 'HP' in it - user.post(s, res=Snapshot) + user.post(json_encode(s), res=Snapshot) i, _ = user.get(res=Device, query=[('search', 'hewlett packard')]) assert 1 == len(i['items']) i, _ = user.get(res=Device, query=[('search', 'hewlett')]) diff --git a/tests/test_documents.py b/tests/test_documents.py index 2a559fbf..1f89d96b 100644 --- a/tests/test_documents.py +++ b/tests/test_documents.py @@ -23,7 +23,7 @@ from ereuse_devicehub.resources.hash_reports import ReportHash from ereuse_devicehub.resources.enums import SessionType from ereuse_devicehub.db import db from tests import conftest -from tests.conftest import file +from tests.conftest import file, yaml2json, json_encode @pytest.mark.mvp @@ -114,8 +114,8 @@ def test_export_csv_permitions(user: UserClient, user2: UserClient, client: Clie @pytest.mark.mvp def test_export_csv_actions(user: UserClient, user2: UserClient, client: Client): """Test export device information in a csv file with others users.""" - acer = file('acer.happy.battery.snapshot') - snapshot, _ = user.post(acer, res=Snapshot) + acer = yaml2json('acer.happy.battery.snapshot') + snapshot, _ = user.post(json_encode(acer), res=Snapshot) device_id = snapshot['device']['id'] post_request = {"transaction": "ccc", "name": "John", "endUsers": 1, "devices": [device_id], "description": "aaa", @@ -156,8 +156,8 @@ def test_export_csv_actions(user: UserClient, user2: UserClient, client: Client) @pytest.mark.usefixtures(conftest.app_context.__name__) def test_live_export_csv2(user: UserClient, client: Client, app: Devicehub): """Tests inserting a Live into the database and GETting it.""" - acer = file('acer-happy.snapshot-test1') - snapshot, _ = user.post(acer, res=Snapshot) + acer = yaml2json('acer-happy.snapshot-test1') + snapshot, _ = user.post(json_encode(acer), res=Snapshot) device_id = snapshot['device']['id'] post_request = {"transaction": "ccc", "name": "John", "endUsers": 1, "devices": [device_id], "description": "aaa", @@ -168,7 +168,7 @@ def test_live_export_csv2(user: UserClient, client: Client, app: Devicehub): user.post(res=Allocate, data=post_request) - acer = file('acer-happy.live-test1') + acer = yaml2json('acer-happy.live-test1') live, _ = client.post(acer, res=Live) csv_user, _ = user.get(res=documents.DocumentDef.t, item='actions/', @@ -183,8 +183,8 @@ def test_live_export_csv2(user: UserClient, client: Client, app: Devicehub): @pytest.mark.usefixtures(conftest.app_context.__name__) def test_live_example2(user: UserClient, client: Client, app: Devicehub): """Tests inserting a Live into the database and GETting it.""" - acer = file('acer-happy.snapshot-test1') - snapshot, _ = user.post(acer, res=Snapshot) + acer = yaml2json('acer-happy.snapshot-test1') + snapshot, _ = user.post(json_encode(acer), res=Snapshot) device_id = snapshot['device']['id'] post_request = {"transaction": "ccc", "name": "John", "endUsers": 1, "devices": [device_id], "description": "aaa", @@ -195,7 +195,7 @@ def test_live_example2(user: UserClient, client: Client, app: Devicehub): user.post(res=Allocate, data=post_request) - acer = file('acer-happy.live-test1') + acer = yaml2json('acer-happy.live-test1') live, _ = client.post(acer, res=Live) db_device = d.Device.query.filter_by(id=device_id).one() action_live = [a for a in db_device.actions if a.type == 'Live'] @@ -553,8 +553,8 @@ def test_verify_stamp_devices_stock(user: UserClient, client: Client): @pytest.mark.mvp def test_verify_stamp_csv_actions(user: UserClient, client: Client): """Test verify stamp of one export device information in a csv file with others users.""" - acer = file('acer.happy.battery.snapshot') - snapshot, _ = user.post(acer, res=Snapshot) + acer = yaml2json('acer.happy.battery.snapshot') + snapshot, _ = user.post(json_encode(acer), res=Snapshot) device_id = snapshot['device']['id'] post_request = {"transaction": "ccc", "name": "John", "endUsers": 1, "devices": [device_id], "description": "aaa", diff --git a/tests/test_metrics.py b/tests/test_metrics.py index 81e966f4..54544328 100644 --- a/tests/test_metrics.py +++ b/tests/test_metrics.py @@ -3,7 +3,7 @@ import pytest from ereuse_devicehub.client import UserClient from ereuse_devicehub.resources.action import models as ma from tests import conftest -from tests.conftest import file +from tests.conftest import file, yaml2json, json_encode @pytest.mark.mvp @@ -11,10 +11,10 @@ from tests.conftest import file def test_simple_metrics(user: UserClient): """ Checks one standard query of metrics """ # Insert computer - lenovo = file('desktop-9644w8n-lenovo-0169622.snapshot') - acer = file('acer.happy.battery.snapshot') - user.post(lenovo, res=ma.Snapshot) - snapshot, _ = user.post(acer, res=ma.Snapshot) + lenovo = yaml2json('desktop-9644w8n-lenovo-0169622.snapshot') + acer = yaml2json('acer.happy.battery.snapshot') + user.post(json_encode(lenovo), res=ma.Snapshot) + snapshot, _ = user.post(json_encode(acer), res=ma.Snapshot) device_id = snapshot['device']['id'] post_request = {"transaction": "ccc", "name": "John", "endUsers": 1, "finalUserCode": "abcdefjhi", @@ -58,8 +58,8 @@ def test_simple_metrics(user: UserClient): def test_second_hdd_metrics(user: UserClient): """ Checks one standard query of metrics """ # Insert computer - acer = file('acer.happy.battery.snapshot') - snapshot, _ = user.post(acer, res=ma.Snapshot) + acer = yaml2json('acer.happy.battery.snapshot') + snapshot, _ = user.post(json_encode(acer), res=ma.Snapshot) device_id = snapshot['device']['id'] post_request = {"transaction": "ccc", "name": "John", "endUsers": 1, "finalUserCode": "abcdefjhi", diff --git a/tests/test_rate.py b/tests/test_rate.py index 9420b5f7..f38942dd 100644 --- a/tests/test_rate.py +++ b/tests/test_rate.py @@ -12,7 +12,7 @@ from ereuse_devicehub.resources.device.models import Computer, Desktop, Device, from ereuse_devicehub.resources.enums import AppearanceRange, ComputerChassis, \ FunctionalityRange from tests import conftest -from tests.conftest import file +from tests.conftest import file, yaml2json, json_encode @pytest.mark.mvp @@ -104,16 +104,16 @@ def test_when_rate_must_not_compute(user: UserClient): ... """ # Checking case 1 - s = file('basic.snapshot') + s = yaml2json('basic.snapshot') # Delete snapshot device actions to delete VisualTest del s['device']['actions'] # Post to compute rate and check to didn't do it - snapshot, _ = user.post(s, res=Snapshot) + snapshot, _ = user.post(json_encode(s), res=Snapshot) assert 'rate' not in snapshot['device'] # Checking case 2 - s = file('basic.snapshot') + s = yaml2json('basic.snapshot') # Change snapshot software source s['software'] = 'Web' del s['uuid'] @@ -121,14 +121,14 @@ def test_when_rate_must_not_compute(user: UserClient): del s['components'] # Post to compute rate and check to didn't do it - snapshot, _ = user.post(s, res=Snapshot) + snapshot, _ = user.post(json_encode(s), res=Snapshot) assert 'rate' not in snapshot['device'] # Checking case 3 - s = file('keyboard.snapshot') + s = yaml2json('keyboard.snapshot') # Post to compute rate and check to didn't do it - snapshot, _ = user.post(s, res=Snapshot) + snapshot, _ = user.post(json_encode(s), res=Snapshot) assert 'rate' not in snapshot['device'] diff --git a/tests/test_snapshot.py b/tests/test_snapshot.py index 897e5fe6..8049542f 100644 --- a/tests/test_snapshot.py +++ b/tests/test_snapshot.py @@ -31,7 +31,7 @@ from ereuse_devicehub.resources.tag import Tag from ereuse_devicehub.resources.user.models import User from ereuse_devicehub.resources.action.views.snapshot import save_json from ereuse_devicehub.resources.documents import documents -from tests.conftest import file +from tests.conftest import file, yaml2json, json_encode from tests import conftest @@ -70,7 +70,7 @@ def test_snapshot_model(): @pytest.mark.mvp def test_snapshot_schema(app: Devicehub): with app.app_context(): - s = file('basic.snapshot') + s = yaml2json('basic.snapshot') app.resources['Snapshot'].schema.load(s) @@ -79,7 +79,7 @@ def test_snapshot_post(user: UserClient): """Tests the post snapshot endpoint (validation, etc), data correctness, and relationship correctness. """ - snapshot = snapshot_and_check(user, file('basic.snapshot'), + snapshot = snapshot_and_check(user, yaml2json('basic.snapshot'), action_types=( BenchmarkProcessor.t, VisualTest.t, @@ -112,16 +112,16 @@ def test_snapshot_post(user: UserClient): @pytest.mark.mvp def test_same_device_tow_users(user: UserClient, user2: UserClient): """Two users can up the same snapshot and the system save 2 computers""" - user.post(file('basic.snapshot'), res=Snapshot) + user.post(yaml2json('basic.snapshot'), res=Snapshot) i, _ = user.get(res=m.Device) pc = next(d for d in i['items'] if d['type'] == 'Desktop') pc_id = pc['id'] devicehub_id = pc['devicehubID'] assert i['items'][0]['url'] == f'/devices/{devicehub_id}' - basic_snapshot = file('basic.snapshot') + basic_snapshot = yaml2json('basic.snapshot') basic_snapshot['uuid'] = f"{uuid.uuid4()}" - user2.post(basic_snapshot, res=Snapshot) + user2.post(json_encode(basic_snapshot), res=Snapshot) i2, _ = user2.get(res=m.Device) pc2 = next(d for d in i2['items'] if d['type'] == 'Desktop') assert pc['id'] != pc2['id'] @@ -133,13 +133,13 @@ def test_snapshot_update_timefield_updated(user: UserClient): """ Tests for check if one computer have the time mark updated when one component of it is updated """ - computer1 = file('1-device-with-components.snapshot') + computer1 = yaml2json('1-device-with-components.snapshot') snapshot = snapshot_and_check(user, computer1, action_types=(BenchmarkProcessor.t, RateComputer.t), perform_second_snapshot=False) - computer2 = file('2-second-device-with-components-of-first.snapshot') + computer2 = yaml2json('2-second-device-with-components-of-first.snapshot') snapshot_and_check(user, computer2, action_types=('Remove', 'RateComputer'), perform_second_snapshot=False) pc1_devicehub_id = snapshot['device']['devicehubID'] @@ -165,7 +165,7 @@ def test_snapshot_component_add_remove(user: UserClient): # We add the first device (2 times). The distribution of components # (represented with their S/N) should be: # PC 1: p1c1s, p1c2s, p1c3s. PC 2: ΓΈ - s1 = file('1-device-with-components.snapshot') + s1 = yaml2json('1-device-with-components.snapshot') snapshot1 = snapshot_and_check(user, s1, action_types=(BenchmarkProcessor.t, @@ -190,7 +190,7 @@ def test_snapshot_component_add_remove(user: UserClient): # It has the processor of the first one (p1c2s) # PC 1: p1c1s, p1c3s. PC 2: p2c1s, p1c2s # Actions PC1: Snapshot, Remove. PC2: Snapshot - s2 = file('2-second-device-with-components-of-first.snapshot') + s2 = yaml2json('2-second-device-with-components-of-first.snapshot') # num_actions = 2 = Remove, Add snapshot2 = snapshot_and_check(user, s2, action_types=('Remove', 'RateComputer'), perform_second_snapshot=False) @@ -220,7 +220,7 @@ def test_snapshot_component_add_remove(user: UserClient): # and moving processor from the second device to the first. # We have created 1 Remove (from PC2's processor back to PC1) # PC 0: p1c2s, p1c3s. PC 1: p2c1s - s3 = file('3-first-device-but-removing-motherboard-and-adding-processor-from-2.snapshot') + s3 = yaml2json('3-first-device-but-removing-motherboard-and-adding-processor-from-2.snapshot') snapshot_and_check(user, s3, ('Remove', 'RateComputer'), perform_second_snapshot=False) pc1, _ = user.get(res=m.Device, item=pc1_devicehub_id) pc2, _ = user.get(res=m.Device, item=pc2_devicehub_id) @@ -266,7 +266,7 @@ def test_snapshot_component_add_remove(user: UserClient): # We register the first device but without the processor, # adding a graphic card and adding a new component - s4 = file('4-first-device-but-removing-processor.snapshot-and-adding-graphic-card') + s4 = yaml2json('4-first-device-but-removing-processor.snapshot-and-adding-graphic-card') snapshot4 = snapshot_and_check(user, s4, ('RateComputer',), perform_second_snapshot=False) pc1, _ = user.get(res=m.Device, item=pc1_devicehub_id) pc2, _ = user.get(res=m.Device, item=pc2_devicehub_id) @@ -312,7 +312,7 @@ def test_snapshot_mismatch_id(): @pytest.mark.mvp def test_snapshot_tag_inner_tag(user: UserClient, tag_id: str, app: Devicehub): """Tests a posting Snapshot with a local tag.""" - b = file('basic.snapshot') + b = yaml2json('basic.snapshot') b['device']['tags'] = [{'type': 'Tag', 'id': tag_id}] snapshot_and_check(user, b, @@ -325,13 +325,13 @@ def test_snapshot_tag_inner_tag(user: UserClient, tag_id: str, app: Devicehub): @pytest.mark.mvp def test_snapshot_tag_inner_tag_mismatch_between_tags_and_hid(user: UserClient, tag_id: str): """Ensures one device cannot 'steal' the tag from another one.""" - pc1 = file('basic.snapshot') + pc1 = yaml2json('basic.snapshot') pc1['device']['tags'] = [{'type': 'Tag', 'id': tag_id}] - user.post(pc1, res=Snapshot) - pc2 = file('1-device-with-components.snapshot') - user.post(pc2, res=Snapshot) # PC2 uploads well + user.post(json_encode(pc1), res=Snapshot) + pc2 = yaml2json('1-device-with-components.snapshot') + user.post(json_encode(pc2), res=Snapshot) # PC2 uploads well pc2['device']['tags'] = [{'type': 'Tag', 'id': tag_id}] # Set tag from pc1 to pc2 - user.post(pc2, res=Snapshot, status=MismatchBetweenTagsAndHid) + user.post(json_encode(pc2), res=Snapshot, status=MismatchBetweenTagsAndHid) @pytest.mark.mvp @@ -341,17 +341,17 @@ def test_snapshot_different_properties_same_tags(user: UserClient, tag_id: str): Devicehub must fail the Snapshot. """ # 1. Upload PC1 without hid but with tag - pc1 = file('basic.snapshot') + pc1 = yaml2json('basic.snapshot') pc1['device']['tags'] = [{'type': 'Tag', 'id': tag_id}] del pc1['device']['serialNumber'] - user.post(pc1, res=Snapshot) + user.post(json_encode(pc1), res=Snapshot) # 2. Upload PC2 without hid, a different characteristic than PC1, but with same tag - pc2 = file('basic.snapshot') + pc2 = yaml2json('basic.snapshot') pc2['uuid'] = uuid4() pc2['device']['tags'] = pc1['device']['tags'] # pc2 model is unknown but pc1 model is set = different property del pc2['device']['model'] - user.post(pc2, res=Snapshot, status=MismatchBetweenProperties) + user.post(json_encode(pc2), res=Snapshot, status=MismatchBetweenProperties) @pytest.mark.mvp @@ -368,14 +368,14 @@ def test_snapshot_component_containing_components(user: UserClient): This test avoids this until an appropriate use-case is presented. """ - s = file('basic.snapshot') + s = yaml2json('basic.snapshot') s['device'] = { 'type': 'Processor', 'serialNumber': 'foo', 'manufacturer': 'bar', 'model': 'baz' } - user.post(s, res=Snapshot, status=ValidationError) + user.post(json_encode(s), res=Snapshot, status=ValidationError) @pytest.mark.mvp @@ -386,7 +386,7 @@ def test_ereuse_price(user: UserClient): This tests ensures that only the last erasure is picked up, as erasures have always custom endTime value set. """ - s = file('erase-sectors.snapshot') + s = yaml2json('erase-sectors.snapshot') assert s['components'][0]['actions'][0]['endTime'] == '2018-06-01T09:12:06+02:00' s['device']['type'] = 'Server' snapshot = snapshot_and_check(user, s, action_types=( @@ -408,7 +408,7 @@ def test_erase_privacy_standards_endtime_sort(user: UserClient): This tests ensures that only the last erasure is picked up, as erasures have always custom endTime value set. """ - s = file('erase-sectors.snapshot') + s = yaml2json('erase-sectors.snapshot') assert s['components'][0]['actions'][0]['endTime'] == '2018-06-01T09:12:06+02:00' snapshot = snapshot_and_check(user, s, action_types=( EraseSectors.t, @@ -594,7 +594,7 @@ def test_pc_2(user: UserClient): @pytest.mark.mvp def test_save_snapshot_in_file(app: Devicehub, user: UserClient): """ This test check if works the function save_snapshot_in_file """ - snapshot_no_hid = file('basic.snapshot.nohid') + snapshot_no_hid = yaml2json('basic.snapshot.nohid') tmp_snapshots = app.config['TMP_SNAPSHOTS'] path_dir_base = os.path.join(tmp_snapshots, user.user['email'], 'errors') @@ -638,9 +638,9 @@ def test_action_no_snapshot_without_save_file(app: Devicehub, user: UserClient): @pytest.mark.mvp def test_save_snapshot_with_debug(app: Devicehub, user: UserClient): """ This test check if works the function save_snapshot_in_file """ - snapshot_file = file('basic.snapshot.with_debug') + snapshot_file = yaml2json('basic.snapshot.with_debug') debug = snapshot_file['debug'] - user.post(res=Snapshot, data=snapshot_file) + user.post(res=Snapshot, data=json_encode(snapshot_file)) tmp_snapshots = app.config['TMP_SNAPSHOTS'] path_dir_base = os.path.join(tmp_snapshots, user.user['email']) @@ -664,12 +664,12 @@ def test_backup_snapshot_with_errors(app: Devicehub, user: UserClient): """ This test check if the file snapshot is create when some snapshot is wrong """ tmp_snapshots = app.config['TMP_SNAPSHOTS'] path_dir_base = os.path.join(tmp_snapshots, user.user['email'], 'errors') - snapshot_no_hid = file('basic.snapshot.badly_formed') + snapshot_no_hid = yaml2json('basic.snapshot.badly_formed') uuid = snapshot_no_hid['uuid'] snapshot = {'software': '', 'version': '', 'uuid': ''} with pytest.raises(KeyError): - response = user.post(res=Snapshot, data=snapshot_no_hid) + response = user.post(res=Snapshot, data=json_encode(snapshot_no_hid)) files = [x for x in os.listdir(path_dir_base) if uuid in x] if files: @@ -689,12 +689,12 @@ def test_snapshot_failed_missing_cpu_benchmark(app: Devicehub, user: UserClient) """ This test check if the file snapshot is create when some snapshot is wrong """ tmp_snapshots = app.config['TMP_SNAPSHOTS'] path_dir_base = os.path.join(tmp_snapshots, user.user['email'], 'errors') - snapshot_error = file('failed.snapshot.500.missing-cpu-benchmark') + snapshot_error = yaml2json('failed.snapshot.500.missing-cpu-benchmark') uuid = snapshot_error['uuid'] snapshot = {'software': '', 'version': '', 'uuid': ''} with pytest.raises(TypeError): - user.post(res=Snapshot, data=snapshot_error) + user.post(res=Snapshot, data=json_encode(snapshot_error)) files = [x for x in os.listdir(path_dir_base) if uuid in x] if files: @@ -714,12 +714,12 @@ def test_snapshot_failed_missing_hdd_benchmark(app: Devicehub, user: UserClient) """ This test check if the file snapshot is create when some snapshot is wrong """ tmp_snapshots = app.config['TMP_SNAPSHOTS'] path_dir_base = os.path.join(tmp_snapshots, user.user['email'], 'errors') - snapshot_error = file('failed.snapshot.500.missing-hdd-benchmark') + snapshot_error = yaml2json('failed.snapshot.500.missing-hdd-benchmark') uuid = snapshot_error['uuid'] snapshot = {'software': '', 'version': '', 'uuid': ''} with pytest.raises(TypeError): - user.post(res=Snapshot, data=snapshot_error) + user.post(res=Snapshot, data=json_encode(snapshot_error)) files = [x for x in os.listdir(path_dir_base) if uuid in x] if files: @@ -739,11 +739,11 @@ def test_snapshot_not_failed_null_chassis(app: Devicehub, user: UserClient): """ This test check if the file snapshot is create when some snapshot is wrong """ tmp_snapshots = app.config['TMP_SNAPSHOTS'] path_dir_base = os.path.join(tmp_snapshots, user.user['email'], 'errors') - snapshot_error = file('desktop-9644w8n-lenovo-0169622.snapshot') + snapshot_error = yaml2json('desktop-9644w8n-lenovo-0169622.snapshot') snapshot_error['device']['chassis'] = None uuid = snapshot_error['uuid'] - snapshot, res = user.post(res=Snapshot, data=snapshot_error) + snapshot, res = user.post(res=Snapshot, data=json_encode(snapshot_error)) shutil.rmtree(tmp_snapshots) @@ -757,12 +757,12 @@ def test_snapshot_failed_missing_chassis(app: Devicehub, user: UserClient): """ This test check if the file snapshot is create when some snapshot is wrong """ tmp_snapshots = app.config['TMP_SNAPSHOTS'] path_dir_base = os.path.join(tmp_snapshots, user.user['email'], 'errors') - snapshot_error = file('failed.snapshot.422.missing-chassis') + snapshot_error = yaml2json('failed.snapshot.422.missing-chassis') uuid = snapshot_error['uuid'] snapshot = {'software': '', 'version': '', 'uuid': ''} with pytest.raises(TypeError): - user.post(res=Snapshot, data=snapshot_error) + user.post(res=Snapshot, data=json_encode(snapshot_error)) files = [x for x in os.listdir(path_dir_base) if uuid in x] if files: @@ -798,9 +798,9 @@ def test_snapshot_not_failed_end_time_bug(app: Devicehub, user: UserClient): """ This test check if the end_time != 0001-01-01 00:00:00+00:00 and then we get a /devices, this create a crash """ - snapshot_file = file('asus-end_time_bug88.snapshot') + snapshot_file = yaml2json('asus-end_time_bug88.snapshot') snapshot_file['endTime'] = '2001-01-01 00:00:00+00:00' - snapshot, _ = user.post(res=Snapshot, data=snapshot_file) + snapshot, _ = user.post(res=Snapshot, data=json_encode(snapshot_file)) device, _ = user.get(res=m.Device, item=snapshot['device']['devicehubID']) end_times = [x['endTime'] for x in device['actions']] diff --git a/tests/test_tag.py b/tests/test_tag.py index 48c4b669..67d59ccc 100644 --- a/tests/test_tag.py +++ b/tests/test_tag.py @@ -19,7 +19,7 @@ from ereuse_devicehub.resources.tag import Tag from ereuse_devicehub.resources.tag.view import CannotCreateETag, LinkedToAnotherDevice, \ TagNotLinked from tests import conftest -from tests.conftest import file +from tests.conftest import file, yaml2json, json_encode @pytest.mark.mvp @@ -319,9 +319,9 @@ def test_tag_secondary_workbench_link_find(user: UserClient): with pytest.raises(ResourceNotFound): Tag.from_an_id('nope').one() - s = file('basic.snapshot') + s = yaml2json('basic.snapshot') s['device']['tags'] = [{'id': 'foo', 'secondary': 'bar', 'type': 'Tag'}] - snapshot, _ = user.post(s, res=Snapshot) + snapshot, _ = user.post(json_encode(s), res=Snapshot) device, _ = user.get(res=Device, item=snapshot['device']['devicehubID']) assert device['tags'][0]['id'] == 'foo' assert device['tags'][0]['secondary'] == 'bar' diff --git a/tests/test_workbench.py b/tests/test_workbench.py index 9e2b8da3..8dd2e65f 100644 --- a/tests/test_workbench.py +++ b/tests/test_workbench.py @@ -11,7 +11,7 @@ from ereuse_devicehub.resources.action.models import RateComputer, BenchmarkProc from ereuse_devicehub.resources.device.exceptions import NeedsId from ereuse_devicehub.resources.device.models import Device from ereuse_devicehub.resources.tag.model import Tag -from tests.conftest import file, file_workbench +from tests.conftest import file, file_workbench, yaml2json, json_encode @pytest.mark.mvp @@ -20,18 +20,18 @@ def test_workbench_server_condensed(user: UserClient): condensed in only one big ``Snapshot`` file, as described in the docs. """ - s = file('workbench-server-1.snapshot') - s['device']['actions'].append(file('workbench-server-2.stress-test')) + s = yaml2json('workbench-server-1.snapshot') + s['device']['actions'].append(yaml2json('workbench-server-2.stress-test')) s['components'][4]['actions'].extend(( - file('workbench-server-3.erase'), - file('workbench-server-4.install') + yaml2json('workbench-server-3.erase'), + yaml2json('workbench-server-4.install') )) - s['components'][5]['actions'].append(file('workbench-server-3.erase')) + s['components'][5]['actions'].append(yaml2json('workbench-server-3.erase')) # Create tags for t in s['device']['tags']: user.post({'id': t['id']}, res=Tag) - snapshot, _ = user.post(res=em.Snapshot, data=s) + snapshot, _ = user.post(res=em.Snapshot, data=json_encode(s)) pc_id = snapshot['device']['id'] cpu_id = snapshot['components'][3]['id'] ssd_id= snapshot['components'][4]['id'] @@ -77,28 +77,28 @@ def test_workbench_server_phases(user: UserClient): actions.html#snapshots-from-workbench>`_. """ # 1. Snapshot with sync / rate / benchmarks / test data storage - s = file('workbench-server-1.snapshot') - snapshot, _ = user.post(res=em.Snapshot, data=s) + s = yaml2json('workbench-server-1.snapshot') + snapshot, _ = user.post(res=em.Snapshot, data=json_encode(s)) assert not snapshot['closed'], 'Snapshot must be waiting for the new actions' # 2. stress test - st = file('workbench-server-2.stress-test') + st = yaml2json('workbench-server-2.stress-test') st['snapshot'] = snapshot['id'] stress_test, _ = user.post(res=em.StressTest, data=st) # 3. erase ssd_id, hdd_id = snapshot['components'][4]['id'], snapshot['components'][5]['id'] - e = file('workbench-server-3.erase') + e = yaml2json('workbench-server-3.erase') e['snapshot'], e['device'] = snapshot['id'], ssd_id erase1, _ = user.post(res=em.EraseSectors, data=e) # 3 bis. a second erase - e = file('workbench-server-3.erase') + e = yaml2json('workbench-server-3.erase') e['snapshot'], e['device'] = snapshot['id'], hdd_id erase2, _ = user.post(res=em.EraseSectors, data=e) # 4. Install - i = file('workbench-server-4.install') + i = yaml2json('workbench-server-4.install') i['snapshot'], i['device'] = snapshot['id'], ssd_id install, _ = user.post(res=em.Install, data=i) @@ -317,7 +317,7 @@ def test_workbench_fixtures(file: pathlib.Path, user: UserClient): """ s = json.load(file.open()) user.post(res=em.Snapshot, - data=s, + data=json_encode(s), status=201) diff --git a/tests/workbench_files/encoded.snapshot.json b/tests/workbench_files/encoded.snapshot.json deleted file mode 100644 index ba4ed574..00000000 --- a/tests/workbench_files/encoded.snapshot.json +++ /dev/null @@ -1 +0,0 @@ -eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0eXBlIjoiU25hcHNob3QiLCJ1dWlkIjoiMDA0MWQ4ZTgtNTY5Yy00NDUyLWIyOTktMDc0YjVmY2M2NDIyIiwic29mdHdhcmUiOiJXb3JrYmVuY2giLCJ2ZXJzaW9uIjoiMTIuMGIwIiwiY2xvc2VkIjp0cnVlLCJlbmRUaW1lIjoiMjAyMS0wNi0yOVQxMzo0NzoxNi42MTI5NjkrMDA6MDAiLCJlbGFwc2VkIjozMSwiZGV2aWNlIjp7ImFjdGlvbnMiOlt7ImVsYXBzZWQiOjEwLCJ0eXBlIjoiQmVuY2htYXJrUmFtU3lzYmVuY2giLCJyYXRlIjoxMC4wMDAxfV0sInR5cGUiOiJDb21wdXRlciIsIm1hbnVmYWN0dXJlciI6IkludGVsIENsaWVudCBTeXN0ZW1zIiwibW9kZWwiOiJOVUM2Q0FZSCIsInNlcmlhbE51bWJlciI6Ikc2QVk5MjIwMEw3OCIsImNoYXNzaXMiOiJWaXJ0dWFsIiwic2t1IjpudWxsLCJ2ZXJzaW9uIjoiSjI2ODQzLTQwOSJ9LCJjb21wb25lbnRzIjpbeyJhY3Rpb25zIjpbeyJlbGFwc2VkIjoxMCwidHlwZSI6IkJlbmNobWFya1Byb2Nlc3NvclN5c2JlbmNoIiwicmF0ZSI6MTAuMDA2NH0seyJlbGFwc2VkIjowLCJ0eXBlIjoiQmVuY2htYXJrUHJvY2Vzc29yIiwicmF0ZSI6MTE5ODAuOH1dLCJ0eXBlIjoiUHJvY2Vzc29yIiwibWFudWZhY3R1cmVyIjoiSW50ZWwgQ29ycC4iLCJtb2RlbCI6IkludGVsIENlbGVyb24gQ1BVIEozNDU1IEAgMS41MEdIeiIsInNlcmlhbE51bWJlciI6bnVsbCwic3BlZWQiOjEuODIxNjk0MDAwMDAwMDAwMSwiYWRkcmVzcyI6NjQsImNvcmVzIjo0LCJ0aHJlYWRzIjo0LCJicmFuZCI6IkNlbGVyb24iLCJnZW5lcmF0aW9uIjpudWxsfSx7ImFjdGlvbnMiOltdLCJ0eXBlIjoiUmFtTW9kdWxlIiwibWFudWZhY3R1cmVyIjoiVW5kZSIsIm1vZGVsIjoiQ1Q0RzNTMTg2REpNLk04RlAiLCJzZXJpYWxOdW1iZXIiOiJFMDgyMjRGRSIsImZvcm1hdCI6IlNPRElNTSIsInNpemUiOjQwOTYuMCwiaW50ZXJmYWNlIjoiRERSMyIsInNwZWVkIjoxODY2LjB9LHsiYWN0aW9ucyI6W3siZWxhcHNlZCI6MiwidHlwZSI6IkJlbmNobWFya0RhdGFTdG9yYWdlIiwicmVhZFNwZWVkIjozNjUuMCwid3JpdGVTcGVlZCI6MTYxLjB9XSwidHlwZSI6IkhhcmREcml2ZSIsIm1hbnVmYWN0dXJlciI6bnVsbCwibW9kZWwiOiJLSU5HU1RPTiBTQTQwMFMzIiwic2VyaWFsTnVtYmVyIjoiNTAwMjZCNzM4MEM5MTA5QSIsInNpemUiOjEyMDAzNC4xMjM3NzYsImludGVyZmFjZSI6IkFUQSIsInZhcmlhbnQiOiJCMUg1In0seyJhY3Rpb25zIjpbXSwidHlwZSI6IkdyYXBoaWNDYXJkIiwibWFudWZhY3R1cmVyIjoiSW50ZWwgQ29ycG9yYXRpb24iLCJtb2RlbCI6IkludGVsIENvcnBvcmF0aW9uIiwic2VyaWFsTnVtYmVyIjpudWxsLCJtZW1vcnkiOm51bGx9LHsiYWN0aW9ucyI6W10sInR5cGUiOiJOZXR3b3JrQWRhcHRlciIsIm1hbnVmYWN0dXJlciI6IkludGVsIENvcnBvcmF0aW9uIiwibW9kZWwiOiJJbnRlbCBDb3Jwb3JhdGlvbiIsInNlcmlhbE51bWJlciI6bnVsbCwic3BlZWQiOm51bGwsInZhcmlhbnQiOiIxMCIsIndpcmVsZXNzIjpmYWxzZX0seyJhY3Rpb25zIjpbXSwidHlwZSI6Ik5ldHdvcmtBZGFwdGVyIiwibWFudWZhY3R1cmVyIjoiUmVhbHRlayBTZW1pY29uZHVjdG9yIENvLiwgTHRkLiIsIm1vZGVsIjoiUlRMODExMS84MTY4Lzg0MTEgUENJIEV4cHJlc3MgR2lnYWJpdCBFdGhlcm5ldCBDb250cm9sbGVyIiwic2VyaWFsTnVtYmVyIjoiMWM6Njk6N2E6MDM6ODU6ZWQiLCJzcGVlZCI6MTAwMC4wLCJ2YXJpYW50IjoiMTUiLCJ3aXJlbGVzcyI6ZmFsc2V9LHsiYWN0aW9ucyI6W10sInR5cGUiOiJTb3VuZENhcmQiLCJtYW51ZmFjdHVyZXIiOiJJbnRlbCBDb3Jwb3JhdGlvbiIsIm1vZGVsIjoiQXRvbS9DZWxlcm9uL1BlbnRpdW0gUHJvY2Vzc29yIE40MjAwL04zMzUwL0UzOTAwIFNlcmllcyBBdWRpbyBDbHVzdGVyIiwic2VyaWFsTnVtYmVyIjpudWxsfSx7ImFjdGlvbnMiOltdLCJ0eXBlIjoiTW90aGVyYm9hcmQiLCJtYW51ZmFjdHVyZXIiOiJJbnRlbCBDb3Jwb3JhdGlvbiIsIm1vZGVsIjoiTlVDNkNBWUIiLCJzZXJpYWxOdW1iZXIiOiJHRUFZOTIxMDBVUjUiLCJ1c2IiOjEsImZpcmV3aXJlIjowLCJzZXJpYWwiOjIsInBjbWNpYSI6MCwic2xvdHMiOjAsImJpb3NEYXRlIjoiMjAxOS0wMi0xOVQwMDowMDowMCIsInZlcnNpb24iOiJBWUFQTENFTC44NkEuMDA2MC4yMDE5LjAyMTkuMTUyNyIsInJhbVNsb3RzIjo0LCJyYW1NYXhTaXplIjozMn1dfQ.7HgnMZhOIqczfYOHyqKp0YcdWBZxj2P7vbe8RbDcGpU \ No newline at end of file From 22e105e6268dc4022466f02a9f798c12fd63fcbf Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Mon, 5 Jul 2021 12:28:55 +0200 Subject: [PATCH 07/15] fixing versions of pyjwt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 12ee8ef9..2fb32710 100644 --- a/requirements.txt +++ b/requirements.txt @@ -36,4 +36,4 @@ sortedcontainers==2.1.0 tqdm==4.32.2 python-decouple==3.3 python-dotenv==0.14.0 -pyjwt==2.1.0 +pyjwt==2.0.0a From 4b4c0a14804b0ede4dc52058695cd02847d85ada Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Mon, 5 Jul 2021 12:29:21 +0200 Subject: [PATCH 08/15] fixing owner_id in computer --- ereuse_devicehub/resources/device/models.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ereuse_devicehub/resources/device/models.py b/ereuse_devicehub/resources/device/models.py index d586a102..ea585785 100644 --- a/ereuse_devicehub/resources/device/models.py +++ b/ereuse_devicehub/resources/device/models.py @@ -625,10 +625,10 @@ class Computer(Device): It is a subset of the Linux definition of DMI / DMI decode. """ amount = Column(Integer, check_range('amount', min=0, max=100), default=0) - # owner_id = db.Column(UUID(as_uuid=True), - # db.ForeignKey(User.id), - # nullable=False, - # default=lambda: g.user.id) + owner_id = db.Column(UUID(as_uuid=True), + db.ForeignKey(User.id), + nullable=False, + default=lambda: g.user.id) # author = db.relationship(User, primaryjoin=owner_id == User.id) transfer_state = db.Column(IntEnum(TransferState), default=TransferState.Initial, nullable=False) transfer_state.comment = TransferState.__doc__ From b8e9ed22f6439647e607d69c22231189a0a24540 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Mon, 5 Jul 2021 12:31:16 +0200 Subject: [PATCH 09/15] fixing new jwt into a json --- .../resources/action/views/views.py | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/ereuse_devicehub/resources/action/views/views.py b/ereuse_devicehub/resources/action/views/views.py index 6d932784..2fd8d04d 100644 --- a/ereuse_devicehub/resources/action/views/views.py +++ b/ereuse_devicehub/resources/action/views/views.py @@ -171,7 +171,11 @@ import jwt import ereuse_utils def decode_snapshot(data): p = '7KU4ZzsEfe' - return jwt.decode(data, p, algorithms="HS256", json_encoder=ereuse_utils.JSONEncoder) + try: + return jwt.decode(data['data'], p, algorithms="HS256", json_encoder=ereuse_utils.JSONEncoder) + except jwt.exceptions.InvalidSignatureError as err: + txt = 'Invalid snapshot' + raise ValidationError(txt) class ActionView(View): @@ -180,16 +184,23 @@ class ActionView(View): json = request.get_json(validate=False) - if not type(json) == dict: - json = decode_snapshot(json) - if not json or 'type' not in json: raise ValidationError('Post request needs a json.') # todo there should be a way to better get subclassess resource # defs resource_def = app.resources[json['type']] if json['type'] == Snapshot.t: - snapshot = SnapshotView(json, resource_def, self.schema) + if not 'data' in json: + txt = 'Invalid snapshot' + raise ValidationError(txt) + + snapshot_data = decode_snapshot(json) + + if not snapshot_data: + txt = 'Invalid snapshot' + raise ValidationError(txt) + + snapshot = SnapshotView(snapshot_data, resource_def, self.schema) return snapshot.post() if json['type'] == VisualTest.t: From 56078dbd8a5cb7611289d9117f3183001e8dd219 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Mon, 5 Jul 2021 12:31:43 +0200 Subject: [PATCH 10/15] fixing tests snapshots --- tests/conftest.py | 6 +++++- tests/test_snapshot.py | 8 +++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 6a7ce73d..147a907d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -142,12 +142,16 @@ def auth_app_context(app: Devicehub): def json_encode(dev: str) -> dict: """Encode json.""" - return jwt.encode(dev, + data = {"type": "Snapshot"} + data['data'] = jwt.encode(dev, P, algorithm="HS256", json_encoder=ereuse_utils.JSONEncoder ) + return data + + def yaml2json(name: str) -> dict: """Opens and parses a YAML file from the ``files`` subdir.""" diff --git a/tests/test_snapshot.py b/tests/test_snapshot.py index 8049542f..dd05534a 100644 --- a/tests/test_snapshot.py +++ b/tests/test_snapshot.py @@ -112,7 +112,8 @@ def test_snapshot_post(user: UserClient): @pytest.mark.mvp def test_same_device_tow_users(user: UserClient, user2: UserClient): """Two users can up the same snapshot and the system save 2 computers""" - user.post(yaml2json('basic.snapshot'), res=Snapshot) + # import pdb; pdb.set_trace() + user.post(file('basic.snapshot'), res=Snapshot) i, _ = user.get(res=m.Device) pc = next(d for d in i['items'] if d['type'] == 'Desktop') pc_id = pc['id'] @@ -408,6 +409,7 @@ def test_erase_privacy_standards_endtime_sort(user: UserClient): This tests ensures that only the last erasure is picked up, as erasures have always custom endTime value set. """ + # import pdb; pdb.set_trace() s = yaml2json('erase-sectors.snapshot') assert s['components'][0]['actions'][0]['endTime'] == '2018-06-01T09:12:06+02:00' snapshot = snapshot_and_check(user, s, action_types=( @@ -465,7 +467,7 @@ def test_erase_privacy_standards_endtime_sort(user: UserClient): # Let's try a second erasure with an error s['uuid'] = uuid4() s['components'][0]['actions'][0]['severity'] = 'Error' - snapshot, _ = user.post(s, res=Snapshot) + snapshot, _ = user.post(json_encode(s), res=Snapshot) storage, _ = user.get(res=m.Device, item=storage['devicehubID']) assert storage['hid'] == 'solidstatedrive-c1mr-c1ml-c1s' assert storage['privacy']['type'] == 'EraseSectors' @@ -524,7 +526,7 @@ def snapshot_and_check(user: UserClient, :return: The last resulting snapshot. """ - snapshot, _ = user.post(res=Snapshot, data=input_snapshot) + snapshot, _ = user.post(res=Snapshot, data=json_encode(input_snapshot)) assert all(e['type'] in action_types for e in snapshot['actions']) assert len(snapshot['actions']) == len(action_types) # Ensure there is no Remove action after the first Add From 2cd4fa84c138048f1dc64c5f40964322356fee5c Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Mon, 5 Jul 2021 15:03:39 +0200 Subject: [PATCH 11/15] fixing requirements pyjwt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 2fb32710..bd7e7980 100644 --- a/requirements.txt +++ b/requirements.txt @@ -36,4 +36,4 @@ sortedcontainers==2.1.0 tqdm==4.32.2 python-decouple==3.3 python-dotenv==0.14.0 -pyjwt==2.0.0a +pyjwt==2.0.0a1 From 25482125a3978a0c8ff0c72b17e10b093fe498f9 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Mon, 5 Jul 2021 15:04:14 +0200 Subject: [PATCH 12/15] pass into .env --- ereuse_devicehub/config.py | 1 + ereuse_devicehub/resources/action/views/views.py | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ereuse_devicehub/config.py b/ereuse_devicehub/config.py index 9f05c29d..01a98292 100644 --- a/ereuse_devicehub/config.py +++ b/ereuse_devicehub/config.py @@ -76,3 +76,4 @@ class DevicehubConfig(Config): """Definition of path where save the documents of customers""" PATH_DOCUMENTS_STORAGE = config('PATH_DOCUMENTS_STORAGE', '/tmp/') + JWT_PASS = config('JWT_PASS', '') diff --git a/ereuse_devicehub/resources/action/views/views.py b/ereuse_devicehub/resources/action/views/views.py index 2fd8d04d..634294f5 100644 --- a/ereuse_devicehub/resources/action/views/views.py +++ b/ereuse_devicehub/resources/action/views/views.py @@ -1,5 +1,7 @@ """ This is the view for Snapshots """ +import jwt +import ereuse_utils from datetime import timedelta from distutils.version import StrictVersion from uuid import UUID @@ -167,12 +169,9 @@ class LiveView(View): return live -import jwt -import ereuse_utils def decode_snapshot(data): - p = '7KU4ZzsEfe' try: - return jwt.decode(data['data'], p, algorithms="HS256", json_encoder=ereuse_utils.JSONEncoder) + return jwt.decode(data['data'], app.config['JWT_PASS'], algorithms="HS256", json_encoder=ereuse_utils.JSONEncoder) except jwt.exceptions.InvalidSignatureError as err: txt = 'Invalid snapshot' raise ValidationError(txt) From c554d30291027752ef3ba16694265fcb91ecdbab Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Mon, 5 Jul 2021 15:04:44 +0200 Subject: [PATCH 13/15] fixing tests --- ereuse_devicehub/dummy/dummy.py | 15 ++++++++++++++- tests/conftest.py | 4 +++- tests/test_action.py | 2 +- tests/test_snapshot.py | 1 - 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/ereuse_devicehub/dummy/dummy.py b/ereuse_devicehub/dummy/dummy.py index 183dbb9f..04fbdaf3 100644 --- a/ereuse_devicehub/dummy/dummy.py +++ b/ereuse_devicehub/dummy/dummy.py @@ -1,5 +1,6 @@ import itertools import json +import jwt from pathlib import Path from typing import Set @@ -94,7 +95,7 @@ class Dummy: for path in bar: with path.open() as f: snapshot = yaml.load(f) - s, _ = user1.post(res=m.Snapshot, data=snapshot) + s, _ = user1.post(res=m.Snapshot, data=self.json_encode(snapshot)) if s.get('uuid', None) == 'ec23c11b-80b6-42cd-ac5c-73ba7acddbc4': sample_pc = s['device']['id'] sample_pc_devicehub_id = s['device']['devicehubID'] @@ -206,3 +207,15 @@ class Dummy: response_wrapper=self.app.response_class) client.login() return client + + def json_encode(self, dev: str) -> dict: + """Encode json.""" + data = {"type": "Snapshot"} + data['data'] = jwt.encode(dev, + self.app.config['JWT_PASS'], + algorithm="HS256", + json_encoder=ereuse_utils.JSONEncoder + ) + + return data + diff --git a/tests/conftest.py b/tests/conftest.py index 147a907d..991374ba 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -5,6 +5,7 @@ import ereuse_utils from contextlib import redirect_stdout from datetime import datetime from pathlib import Path +from decouple import config import boltons.urlutils import pytest @@ -28,8 +29,8 @@ ENDT = datetime(year=2000, month=1, day=1, hour=2) """A dummy ending time to use in tests.""" T = {'start_time': STARTT, 'end_time': ENDT} """A dummy start_time/end_time to use as function keywords.""" +P = config('JWT_PASS', '') -P = '7KU4ZzsEfe' class TestConfig(DevicehubConfig): SQLALCHEMY_DATABASE_URI = 'postgresql://dhub:ereuse@localhost/dh_test' @@ -39,6 +40,7 @@ class TestConfig(DevicehubConfig): TMP_LIVES = '/tmp/lives' EMAIL_ADMIN = 'foo@foo.com' PATH_DOCUMENTS_STORAGE = '/tmp/trade_documents' + JWT_PASS = config('JWT_PASS', '') @pytest.fixture(scope='session') diff --git a/tests/test_action.py b/tests/test_action.py index 565f0d37..5c0af44f 100644 --- a/tests/test_action.py +++ b/tests/test_action.py @@ -484,7 +484,7 @@ def test_live_without_hdd_3(user: UserClient, client: Client, app: Devicehub): acer['uuid'] = "490fb8c0-81a1-42e9-95e0-5e7db7038ec3" components = [a for a in acer['components'] if a['type'] != 'HardDrive'] acer['components'] = components - snapshot, _ = user.post(acer, res=models.Snapshot) + snapshot, _ = user.post(json_encode(acer), res=models.Snapshot) device_id = snapshot['device']['id'] db_device = Device.query.filter_by(id=device_id).one() post_request = {"transaction": "ccc", "name": "John", "endUsers": 1, diff --git a/tests/test_snapshot.py b/tests/test_snapshot.py index dd05534a..94b8f04f 100644 --- a/tests/test_snapshot.py +++ b/tests/test_snapshot.py @@ -409,7 +409,6 @@ def test_erase_privacy_standards_endtime_sort(user: UserClient): This tests ensures that only the last erasure is picked up, as erasures have always custom endTime value set. """ - # import pdb; pdb.set_trace() s = yaml2json('erase-sectors.snapshot') assert s['components'][0]['actions'][0]['endTime'] == '2018-06-01T09:12:06+02:00' snapshot = snapshot_and_check(user, s, action_types=( From 45950997f815dbfb7a709c1772823935e33dac5c Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Mon, 5 Jul 2021 15:48:17 +0200 Subject: [PATCH 14/15] fixed bug manual snapshots --- ereuse_devicehub/resources/action/views/views.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ereuse_devicehub/resources/action/views/views.py b/ereuse_devicehub/resources/action/views/views.py index 634294f5..22a1754b 100644 --- a/ereuse_devicehub/resources/action/views/views.py +++ b/ereuse_devicehub/resources/action/views/views.py @@ -181,6 +181,7 @@ class ActionView(View): def post(self): """Posts an action.""" + # import pdb; pdb.set_trace() json = request.get_json(validate=False) if not json or 'type' not in json: @@ -189,6 +190,10 @@ class ActionView(View): # defs resource_def = app.resources[json['type']] if json['type'] == Snapshot.t: + if json.get('software') == 'Web': + snapshot = SnapshotView(json, resource_def, self.schema) + return snapshot.post() + if not 'data' in json: txt = 'Invalid snapshot' raise ValidationError(txt) From e63b2a50ec5004ea5364186244a605e81e7b6d16 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Mon, 5 Jul 2021 15:57:09 +0200 Subject: [PATCH 15/15] growing security --- ereuse_devicehub/resources/action/views/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ereuse_devicehub/resources/action/views/views.py b/ereuse_devicehub/resources/action/views/views.py index 22a1754b..5e5d9945 100644 --- a/ereuse_devicehub/resources/action/views/views.py +++ b/ereuse_devicehub/resources/action/views/views.py @@ -181,7 +181,6 @@ class ActionView(View): def post(self): """Posts an action.""" - # import pdb; pdb.set_trace() json = request.get_json(validate=False) if not json or 'type' not in json: @@ -190,6 +189,10 @@ class ActionView(View): # defs resource_def = app.resources[json['type']] if json['type'] == Snapshot.t: + if json.get('software') == 'Web' and json['device'] == 'Computer': + txt = 'Invalid snapshot' + raise ValidationError(txt) + if json.get('software') == 'Web': snapshot = SnapshotView(json, resource_def, self.schema) return snapshot.post()