Commit a66a7f4b authored by Johan Cwiklinski's avatar Johan Cwiklinski Committed by Johan Cwiklinski
Browse files

Update inventory lib; use lib examples for tests

Remove useless inventory fixtures
parent ae1bc497
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "087449288541ba61dffffff4cc7ce073",
"content-hash": "b847c36ca3588eead2009c286119fbf3",
"packages": [
{
"name": "blueimp/jquery-file-upload",
......@@ -207,16 +207,16 @@
},
{
"name": "glpi-project/inventory_format",
"version": "1.0.8",
"version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/glpi-project/inventory_format.git",
"reference": "6a69de14433a5e3a2a1d837d4e776ca2cb859fda"
"reference": "c740e12ced299222b48da236ccc26193a113dc37"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/glpi-project/inventory_format/zipball/6a69de14433a5e3a2a1d837d4e776ca2cb859fda",
"reference": "6a69de14433a5e3a2a1d837d4e776ca2cb859fda",
"url": "https://api.github.com/repos/glpi-project/inventory_format/zipball/c740e12ced299222b48da236ccc26193a113dc37",
"reference": "c740e12ced299222b48da236ccc26193a113dc37",
"shasum": ""
},
"require": {
......@@ -264,7 +264,7 @@
"issues": "https://github.com/glpi-project/inventory_format/issues",
"source": "https://github.com/glpi-project/inventory_format"
},
"time": "2021-05-17T14:13:51+00:00"
"time": "2021-06-28T07:07:43+00:00"
},
{
"name": "guzzlehttp/guzzle",
......
......@@ -112,7 +112,7 @@ class NetworkEquipment extends MainAsset
$switches = $this->getStackedSwitches();
foreach ($switches as $switch) {
$stack = clone $val;
$stack->firmware = $switch->version;
$stack->firmware = $switch->firmware ?? $switch->version ?? '';
$stack->serial = $switch->serial;
$stack->model = $switch->model;
$stack->$model_field = $switch->model;
......@@ -151,7 +151,7 @@ class NetworkEquipment extends MainAsset
$firmware->description = $ap->comment ?? '';
$firmware->name = $ap->model ?? '';
$firmware->devicefirmwaretypes_id = 'device';
$firmware->version = $ap->version ?? '';
$firmware->version = $ap->firware ?? $ap->version ?? '';
$wcontrol->firmware = $firmware;
$this->data[] = $wcontrol;
......
......@@ -42,7 +42,16 @@ class Simcard extends Device
}
public function prepare() :array {
//no mapping needed
$mapping = [
'imsi' => 'serial'
];
foreach ($this->data as $k => &$val) {
foreach ($mapping as $origin => $dest) {
if (property_exists($val, $origin)) {
$val->$dest = $val->$origin;
}
}
}
return $this->data;
}
......
This diff is collapsed.
{
"content": {
"batteries": [
{
"capacity": 57570,
"real_capacity": 40570,
"chemistry": "lithium-ion",
"date": "2019-07-06",
"manufacturer": "SMP",
"name": "DELL RWT1R43",
"serial": "34605",
"voltage": 8465,
"designation": "DELL RWT1R43",
"manufacturers_id": 23,
"manufacturing_date": "2019-07-06",
"devicebatterytypes_id": 2
}
],
"bios": {
"bdate": "2016-02-06",
"bmanufacturer": "Dell Inc.",
"bversion": "1.4.3",
"mmanufacturer": "Dell Inc.",
"mmodel": "07TYC2",
"msn": "\/640HP72\/CE129536461378\/",
"skunumber": "0704",
"smanufacturer": "Dell Inc.",
"smodel": "XPS 13 9350",
"ssn": "640HP72"
},
"hardware": {
"chassis_type": "Laptop",
"checksum": "513",
"datelastloggeduser": "Fri Jun 12 14:15",
"defaultgateway": "192.168.1.1",
"dns": "192.168.1.1",
"etime": 4,
"ipaddr": "192.168.1.142\/192.168.1.118\/192.168.122.1",
"lastloggeduser": "root",
"memory": 7800,
"name": "glpixps",
"oscomments": "#1 SMP Fri May 29 14:59:49 UTC 2020",
"osname": "Fedora 31 (Workstation Edition)",
"osversion": "5.6.15-200.fc31.x86_64",
"processorn": "1",
"processors": "2300",
"processort": "Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz",
"swap": 7951,
"userid": "root",
"uuid": "4c4c4544-0034-3010-8048-b6c04f503732",
"vmsystem": "Physical"
},
"versionclient": "FusionInventory-Agent_v2.5.2-1.fc31"
},
"deviceid": "glpixps-2018-07-09-09-07-13",
"query": "INVENTORY",
"partial": true
}
{
"content": {
"bios": {
"bdate": "2016-02-06",
"bmanufacturer": "Dell Inc.",
"bversion": "1.4.3",
"mmanufacturer": "Dell Inc.",
"mmodel": "07TYC2",
"msn": "\/640HP72\/CE129536461378\/",
"skunumber": "0704",
"smanufacturer": "Dell Inc.",
"smodel": "XPS 13 9350",
"ssn": "640HP72"
},
"hardware": {
"chassis_type": "Laptop",
"checksum": "513",
"datelastloggeduser": "Fri Jun 12 14:15",
"defaultgateway": "192.168.1.1",
"dns": "192.168.1.1",
"etime": 4,
"ipaddr": "192.168.1.142\/192.168.1.118\/192.168.122.1",
"lastloggeduser": "root",
"memory": 7800,
"name": "glpixps",
"oscomments": "#1 SMP Fri May 29 14:59:49 UTC 2020",
"osname": "Fedora 31 (Workstation Edition)",
"osversion": "5.6.15-200.fc31.x86_64",
"processorn": "1",
"processors": "2300",
"processort": "Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz",
"swap": 7951,
"userid": "root",
"uuid": "4c4c4544-0034-3010-8048-b6c04f503732",
"vmsystem": "Physical"
},
"operatingsystem": {
"arch": "x86_64",
"boot_time": "2020-06-09 07:58:08",
"fqdn": "glpixps",
"full_name": "Fedora 31 (Workstation Edition)",
"hostid": "a8c07601",
"kernel_name": "linux",
"kernel_version": "5.6.15-200.fc31.x86_64",
"name": "Fedora",
"ssh_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC97EYvzhYeYM+okVuSRKErAIVIIrteBZTiNpz3Z9WM4J4xFG37bN4MmBjRjz+4nypI1kblO8CsJPJ6alN5O0DlDoo+oEJdDVOpiNGBnQevCJuusQrHGkP9XgaLIRyfI0s7usJIC96J8CRNtYGwVluoLqhvLU1P8lLvysVBY6ZyruRpPRoCLQDUg4PhJQiDoh8Y1IlFnXlrPHcLeMlJvqdGNdIUotCu3UXxpAhiUkxbZoxSk2QKGShlkLk7tGyotvyKO5c8q0s3y43uG1mVi37pCE3gzxXh3dAEzLYeC8NQ+eL3bwMnOAXs4mrP8w\/s61wDg+DMqzfTNv6okc87qipz",
"timezone": {
"name": "CEST",
"offset": "+0200"
},
"version": "31 (Workstation Edition)"
},
"softwares": [
{
"arch": "x86_64",
"comments": "GTK+ graphical interface for the git revision control system",
"filesize": 2335956,
"from": "rpm",
"name": "gitg",
"publisher": "Fedora Project",
"system_category": "Unspecified",
"version": "3.33.0-1.fc31",
"install_date": "2019-12-19",
"manufacturers_id": 16,
"comment": "GTK+ graphical interface for the git revision control system",
"date_install": "2020-01-15",
"_system_category": "Unspecified",
"operatingsystems_id": 0,
"entities_id": 0,
"is_template_item": 0,
"is_deleted_item": 0,
"is_recursive": 0
},
{
"arch": "x86_64",
"comments": "An XML parser library",
"filesize": 268027,
"from": "rpm",
"name": "expat",
"publisher": "Fedora Project",
"system_category": "Unspecified",
"version": "2.2.8-1.fc31",
"install_date": "2019-12-19",
"manufacturers_id": 16,
"comment": "An XML parser library",
"date_install": "2019-12-19",
"_system_category": "Unspecified",
"operatingsystems_id": 0,
"entities_id": 0,
"is_template_item": 0,
"is_deleted_item": 0,
"is_recursive": 0
},
{
"arch": "x86_64",
"comments": "A desktop calculator",
"filesize": 5951772,
"from": "rpm",
"name": "gnome-calculator",
"publisher": "Fedora Project",
"system_category": "Unspecified",
"version": "3.34.1-1.fc31",
"install_date": "2019-12-19",
"manufacturers_id": 16,
"comment": "A desktop calculator",
"date_install": "2019-12-19",
"_system_category": "Unspecified",
"operatingsystems_id": 0,
"entities_id": 0,
"is_template_item": 0,
"is_deleted_item": 0,
"is_recursive": 0
},
{
"arch": "x86_64",
"comments": "Interface components for OpenPGP",
"filesize": 4395473,
"from": "rpm",
"name": "libcryptui",
"publisher": "Fedora Project",
"system_category": "Unspecified",
"version": "3.12.2-18.fc31",
"install_date": "2019-12-19",
"manufacturers_id": 16,
"comment": "Interface components for OpenPGP",
"date_install": "2019-12-19",
"_system_category": "Unspecified",
"operatingsystems_id": 0,
"entities_id": 0,
"is_template_item": 0,
"is_deleted_item": 0,
"is_recursive": 0
},
{
"arch": "x86_64",
"comments": "A GNU file archiving program",
"filesize": 3134685,
"from": "rpm",
"name": "tar",
"publisher": "Fedora Project",
"system_category": "Unspecified",
"version": "1.32-2.fc31",
"install_date": "2019-12-19",
"manufacturers_id": 16,
"comment": "A GNU file archiving program",
"date_install": "2019-12-19",
"_system_category": "Unspecified",
"operatingsystems_id": 0,
"entities_id": 0,
"is_template_item": 0,
"is_deleted_item": 0,
"is_recursive": 0
},
{
"arch": "x86_64",
"comments": "GNU libraries and utilities for producing multi-lingual messages",
"filesize": 5202337,
"from": "rpm",
"name": "gettext",
"publisher": "Fedora Project",
"system_category": "Unspecified",
"version": "0.20.1-3.fc31",
"install_date": "2020-01-15",
"manufacturers_id": 16,
"comment": "GNU libraries and utilities for producing multi-lingual messages",
"date_install": "2020-01-15",
"_system_category": "Unspecified",
"operatingsystems_id": 0,
"entities_id": 0,
"is_template_item": 0,
"is_deleted_item": 0,
"is_recursive": 0
}
],
"versionclient": "FusionInventory-Agent_v2.5.2-1.fc31"
},
"deviceid": "glpixps-2018-07-09-09-07-13",
"query": "INVENTORY",
"partial": true
}
{
"content": {
"bios": {
"bdate": "2016-02-06",
"bmanufacturer": "Dell Inc.",
"bversion": "1.4.3",
"mmanufacturer": "Dell Inc.",
"mmodel": "07TYC2",
"msn": "\/640HP72\/CE129536461378\/",
"skunumber": "0704",
"smanufacturer": "Dell Inc.",
"smodel": "XPS 13 9350",
"ssn": "640HP72"
},
"drives": [
{
"encrypt_algo": "aes-xts-plain64",
"encrypt_name": "LUKS1",
"encrypt_status": "Yes",
"filesystem": "ext4",
"free": 11883,
"serial": "e2d02a40-829a-44ce-b863-cf765ac2c9eb",
"total": 40189,
"type": "\/",
"volumn": "\/dev\/mapper\/xps-root",
"device": "\/dev\/mapper\/xps-root",
"filesystems_id": 4,
"totalsize": 40189,
"freesize": 11883,
"encryption_tool": "LUKS1",
"encryption_algorithm": "aes-xts-plain64",
"encryption_status": 1,
"name": "\/",
"mountpoint": "\/"
},
{
"filesystem": "ext4",
"free": 15924,
"serial": "80e8e3bb-7d19-4d1e-a8d5-3fb798627a5e",
"total": 20030,
"type": "\/var\/www",
"volumn": "\/dev\/mapper\/xps-www",
"device": "\/dev\/mapper\/xps-www",
"filesystems_id": 4,
"totalsize": 20030,
"freesize": 15924,
"name": "\/var\/www",
"mountpoint": "\/var\/www"
},
{
"filesystem": "ext4",
"free": 603,
"serial": "dca65bdb-c073-4bcb-bd0d-210031a532c9",
"total": 975,
"type": "\/boot",
"volumn": "\/dev\/nvme0n1p2",
"device": "\/dev\/nvme0n1p2",
"filesystems_id": 4,
"totalsize": 975,
"freesize": 603,
"name": "\/boot",
"mountpoint": "\/boot"
},
{
"encrypt_algo": "aes-xts-plain64",
"encrypt_name": "LUKS1",
"encrypt_status": "Yes",
"filesystem": "ext4",
"free": 10740,
"serial": "79d60190-518f-4de4-8ed5-74146414b890",
"total": 20030,
"type": "\/var\/lib\/mysql",
"volumn": "\/dev\/mapper\/xps-maria",
"device": "\/dev\/mapper\/xps-maria",
"filesystems_id": 4,
"totalsize": 20030,
"freesize": 10740,
"encryption_tool": "LUKS1",
"encryption_algorithm": "aes-xts-plain64",
"encryption_status": 1,
"name": "\/var\/lib\/mysql",
"mountpoint": "\/var\/lib\/mysql"
},
{
"encrypt_algo": "aes-xts-plain64",
"encrypt_name": "LUKS1",
"encrypt_status": "Yes",
"filesystem": "ext4",
"free": 20872,
"serial": "b61d4fbf-32da-4c7a-8b15-45ae81b946b2",
"total": 120439,
"type": "\/home",
"volumn": "\/dev\/mapper\/xps-home",
"device": "\/dev\/mapper\/xps-home",
"filesystems_id": 4,
"totalsize": 120439,
"freesize": 20872,
"encryption_tool": "LUKS1",
"encryption_algorithm": "aes-xts-plain64",
"encryption_status": 1,
"name": "\/home",
"mountpoint": "\/home"
},
{
"filesystem": "vfat",
"free": 191,
"serial": "A710-491B",
"total": 199,
"type": "\/boot\/efi",
"volumn": "\/dev\/nvme0n1p1",
"device": "\/dev\/nvme0n1p1",
"filesystems_id": 7,
"totalsize": 199,
"freesize": 191,
"name": "\/boot\/efi",
"mountpoint": "\/boot\/efi"
}
],
"hardware": {
"chassis_type": "Laptop",
"checksum": "513",
"datelastloggeduser": "Fri Jun 12 14:15",
"defaultgateway": "192.168.1.1",
"dns": "192.168.1.1",
"etime": 4,
"ipaddr": "192.168.1.142\/192.168.1.118\/192.168.122.1",
"lastloggeduser": "root",
"memory": 7800,
"name": "glpixps",
"oscomments": "#1 SMP Fri May 29 14:59:49 UTC 2020",
"osname": "Fedora 31 (Workstation Edition)",
"osversion": "5.6.15-200.fc31.x86_64",
"processorn": "1",
"processors": "2300",
"processort": "Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz",
"swap": 7951,
"userid": "root",
"uuid": "4c4c4544-0034-3010-8048-b6c04f503732",
"vmsystem": "Physical"
},
"versionclient": "FusionInventory-Agent_v2.5.2-1.fc31"
},
"deviceid": "glpixps-2018-07-09-09-07-13",
"query": "INVENTORY",
"partial": true
}
{
"content": {
"bios": {
"assettag": "COMP1",
"bdate": "2016-01-03",
"bmanufacturer": "Dell Inc.",
"bversion": "1.3.3",
"mmanufacturer": "Dell Inc.",
"mmodel": "07TYC2",
"msn": "\/2FAGP34\/CN124536460043\/",
"skunumber": "0704",
"smanufacturer": "Dell Inc.",
"smodel": "XPS 13 9350",
"ssn": "2FAGP34"
},
"hardware": {
"archname": "x86_64-linux-gnu-thread-multi",
"chassis_type": "Laptop",
"checksum": "131071",
"datelastloggeduser": "Mon Feb 20 14:21",
"defaultgateway": "172.28.220.1",
"dns": "127.0.1.1",
"etime": 5,
"ipaddr": "172.28.220.83\/172.17.0.1\/172.19.0.1\/172.18.0.1",
"lastloggeduser": "local",
"memory": 7830,
"name": "COMP1",
"oscomments": "#201701090438 SMP Mon Jan 9 09:40:28 UTC 2017",
"osname": "Ubuntu 16.10",
"osversion": "4.8.17-040817-generic",
"processorn": "1",
"processors": "2300",
"processort": "Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz",
"swap": 8038,
"userid": "local",
"uuid": "4BDRGGFE-0046-4710-8047-B2C04F503732",
"vmsystem": "Physical"
},
"versionclient": "FusionInventory-Agent_v2.3.19",
"virtualmachines": [
{
"image": "skydive\/skydive",
"name": "skydive-agent_1",
"status": "off",
"uuid": "5506c9cf948e",
"vmtype": "docker"
},
{
"image": "skydive\/skydive",
"name": "skydive-analyzer_1",
"status": "off",
"uuid": "a814985472a1",
"vmtype": "docker"
},
{
"image": "elasticsearch:2",
"name": "elasticsearch_1",
"status": "off",
"uuid": "0288ea1fb928",
"vmtype": "docker"
},
{
"image": "webdevops\/php-apache",
"name": "a'pache",
"status": "off",
"uuid": "ed9bef0322b8",
"vmtype": "docker"
},
{
"image": "postgres",
"name": "db",
"status": "running",
"uuid": "7e64b4b09941",
"vmtype": "docker"
},
{
"name": "'T",
"owner": "local",
"subsystem": "Oracle VM VirtualBox",
"vcpu": 1,
"vmtype": "virtualbox"
}
]
},
"deviceid": "acomputer-2021-01-26-14-32-36",
"query": "INVENTORY",
"itemtype": "Computer"
}
{
"content": {
"bios": {
"assettag": "COMP1",
"bdate": "2016-01-03",
"bmanufacturer": "Dell Inc.",
"bversion": "1.3.3",
"mmanufacturer": "Dell Inc.",
"mmodel": "07TYC2",
"msn": "\/2FAGP34\/CN124536460043\/",
"skunumber": "0704",
"smanufacturer": "Dell Inc.",
"smodel": "XPS 13 9350",
"ssn": "2FAGP34"
},
"hardware": {
"archname": "x86_64-linux-gnu-thread-multi",
"chassis_type": "Laptop",
"checksum": "131071",