Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorIvo Kurzemnieks <ivo.kurzemnieks@zabbix.com>2022-01-14 17:51:36 +0300
committerIvo Kurzemnieks <ivo.kurzemnieks@zabbix.com>2022-01-14 17:51:36 +0300
commit54058566bb02645976e63914b349966929c9f1ba (patch)
tree947522aea849067e11774af9cdf60fad02155936 /ui
parent73d6578772209dceb95f16b811360d91ef3ff74e (diff)
A......... [ZBX-19815] fixed SNMP interfaces being missing after import, fixed no longer valid unit tests
Diffstat (limited to 'ui')
-rw-r--r--ui/include/classes/import/converters/C44ImportConverter.php7
-rw-r--r--ui/tests/unit/include/classes/import/CImportDataAdapterTest.php29
-rw-r--r--ui/tests/unit/include/classes/import/converters/C10ImportConverterTest.php252
-rw-r--r--ui/tests/unit/include/classes/import/converters/C20ImportConverterTest.php205
4 files changed, 299 insertions, 194 deletions
diff --git a/ui/include/classes/import/converters/C44ImportConverter.php b/ui/include/classes/import/converters/C44ImportConverter.php
index 8e5f7563b69..2c952c9aff0 100644
--- a/ui/include/classes/import/converters/C44ImportConverter.php
+++ b/ui/include/classes/import/converters/C44ImportConverter.php
@@ -409,9 +409,10 @@ class C44ImportConverter extends CConverter {
// Find interfaces having same SNMP version.
$same_ver_interfaces = array_filter($new_interfaces[$interfaceid],
- function (array $iface) use ($item): bool {
+ function (array $iface) use (&$item): bool {
// Use default SNMP V2 interface for SNMP traps.
if ($item['type'] === CXmlConstantName::SNMP_TRAP) {
+ $item['community'] = '{$SNMP_COMMUNITY}';
$item['type'] = CXmlConstantName::SNMPV2;
}
@@ -425,7 +426,9 @@ class C44ImportConverter extends CConverter {
// If item port differs from interface ports it is 100% new interface.
if ($item['port'] === '') {
// Item port not set and interface port not equal parent port.
- return ($iface['port'] === $parent_interface['port']);
+ if ($iface['port'] !== $parent_interface['port']) {
+ return false;
+ }
}
else {
// If item port not equal interface ports it is 100% new interface.
diff --git a/ui/tests/unit/include/classes/import/CImportDataAdapterTest.php b/ui/tests/unit/include/classes/import/CImportDataAdapterTest.php
index 7e652d82e99..199fbfdfd17 100644
--- a/ui/tests/unit/include/classes/import/CImportDataAdapterTest.php
+++ b/ui/tests/unit/include/classes/import/CImportDataAdapterTest.php
@@ -2009,9 +2009,7 @@ class CImportDataAdapterTest extends TestCase {
]
],
'templates' => [],
- 'proxy' => [
- 'name' => '0'
- ],
+ 'proxy' => [],
'description' => '',
'name' => 'host',
'tags' => [],
@@ -2125,9 +2123,7 @@ class CImportDataAdapterTest extends TestCase {
'description' => 'Free disk space on / in %',
'inventory_link' => '0',
'preprocessing' => [],
- 'valuemap' => [
- 'name' => '0'
- ]
+ 'valuemap' => []
]
],
'Template_Simple' => [
@@ -2183,9 +2179,7 @@ class CImportDataAdapterTest extends TestCase {
'description' => 'FTP check',
'inventory_link' => '0',
'preprocessing' => [],
- 'valuemap' => [
- 'name' => '0'
- ]
+ 'valuemap' => []
],
'net.tcp.service[ftp,,{$PORT.FTP}]' => [
'uuid' => '37c5c2d56a1c49ecaa7d6d0f70eb8a35',
@@ -2239,9 +2233,7 @@ class CImportDataAdapterTest extends TestCase {
'description' => 'FTP check with macro',
'inventory_link' => '0',
'preprocessing' => [],
- 'valuemap' => [
- 'name' => '0'
- ]
+ 'valuemap' => []
]
]
]
@@ -2477,10 +2469,7 @@ class CImportDataAdapterTest extends TestCase {
'details' => []
]
],
- 'proxy' =>
- [
- 'name' => '0'
- ],
+ 'proxy' => [],
'inventory_mode' => '-1',
'description' => '',
'inventory' => [],
@@ -2575,9 +2564,7 @@ class CImportDataAdapterTest extends TestCase {
'units' => '',
'url' => '',
'username' => '',
- 'valuemap' => [
- 'name' => '0'
- ],
+ 'valuemap' => [],
'key_' => 'net.tcp.service[ftp,,21]',
'trapper_hosts' => ''
],
@@ -2631,9 +2618,7 @@ class CImportDataAdapterTest extends TestCase {
'units' => '',
'url' => '',
'username' => '',
- 'valuemap' => [
- 'name' => '0'
- ],
+ 'valuemap' => [],
'key_' => 'net.tcp.service[ftp,,{$PORT.FTP}]',
'trapper_hosts' => ''
]
diff --git a/ui/tests/unit/include/classes/import/converters/C10ImportConverterTest.php b/ui/tests/unit/include/classes/import/converters/C10ImportConverterTest.php
index 31860a5f3c4..438998fb639 100644
--- a/ui/tests/unit/include/classes/import/converters/C10ImportConverterTest.php
+++ b/ui/tests/unit/include/classes/import/converters/C10ImportConverterTest.php
@@ -34,19 +34,23 @@ class C10ImportConverterTest extends CImportConverterTest {
$source = $this->createSource([
'hosts' => [
[
- 'name' => 'Template 1'
+ 'name' => 'Template 1',
+ 'proxy_hostid' => 0
],
[
'name' => 'Template 2',
- 'status' => HOST_STATUS_TEMPLATE
+ 'status' => HOST_STATUS_TEMPLATE,
+ 'proxy_hostid' => 0
],
[
'name' => 'Host 1',
- 'status' => HOST_STATUS_NOT_MONITORED
+ 'status' => HOST_STATUS_NOT_MONITORED,
+ 'proxy_hostid' => 0
],
[
'name' => 'Host 2',
- 'status' => HOST_STATUS_MONITORED
+ 'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0
]
]
]);
@@ -60,9 +64,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'inventory' => [
'inventory_mode' => HOST_INVENTORY_DISABLED
],
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
],
[
'host' => 'Host 2',
@@ -71,9 +73,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'inventory' => [
'inventory_mode' => HOST_INVENTORY_DISABLED
],
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
]
],
'templates' => [
@@ -96,11 +96,13 @@ class C10ImportConverterTest extends CImportConverterTest {
'hosts' => [
[
'name' => 'host1',
- 'status' => HOST_STATUS_MONITORED
+ 'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0
],
[
'name' => 'host2',
'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0,
'groups' => [
'Zabbix server',
'Linux server'
@@ -109,6 +111,7 @@ class C10ImportConverterTest extends CImportConverterTest {
[
'name' => 'host3',
'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0,
'groups' => [
'Zabbix server',
'My group'
@@ -117,6 +120,7 @@ class C10ImportConverterTest extends CImportConverterTest {
[
'name' => 'template',
'status' => HOST_STATUS_TEMPLATE,
+ 'proxy_hostid' => 0,
'groups' => [
'Templates'
]
@@ -147,9 +151,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'inventory' => [
'inventory_mode' => HOST_INVENTORY_DISABLED
],
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
],
[
'host' => 'host2',
@@ -166,9 +168,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'name' => 'Linux server'
]
],
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
],
[
'host' => 'host3',
@@ -185,9 +185,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'name' => 'My group'
]
],
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
]
],
'templates' => [
@@ -220,11 +218,13 @@ class C10ImportConverterTest extends CImportConverterTest {
'hosts' => [
[
'name' => 'host1',
- 'status' => HOST_STATUS_MONITORED
+ 'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0
],
[
'name' => 'host2',
- 'status' => HOST_STATUS_MONITORED
+ 'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => '12345'
]
]
]);
@@ -237,9 +237,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'inventory' => [
'inventory_mode' => HOST_INVENTORY_DISABLED
],
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
],
[
'host' => 'host2',
@@ -249,7 +247,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'inventory_mode' => HOST_INVENTORY_DISABLED
],
'proxy' => [
- 'name' => ''
+ 'name' => '12345'
]
]
]
@@ -262,12 +260,14 @@ class C10ImportConverterTest extends CImportConverterTest {
'hosts' => [
[
'name' => 'host1',
- 'status' => HOST_STATUS_MONITORED
+ 'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0
],
// host with an agent interface
[
'name' => 'host2',
'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0,
'useip' => 1,
'ip' => '127.0.0.1',
'dns' => 'http://zabbix.com',
@@ -289,6 +289,7 @@ class C10ImportConverterTest extends CImportConverterTest {
[
'name' => 'host3',
'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0,
'useip' => 1,
'ip' => '127.0.0.1'
],
@@ -296,6 +297,7 @@ class C10ImportConverterTest extends CImportConverterTest {
[
'name' => 'host4',
'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0,
'ip' => '127.0.0.1',
'ipmi_ip' => '127.0.0.2',
'ipmi_port' => '123',
@@ -312,6 +314,7 @@ class C10ImportConverterTest extends CImportConverterTest {
[
'name' => 'host5',
'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0,
'ip' => '127.0.0.1',
'ipmi_port' => '123',
'items' => [
@@ -327,6 +330,7 @@ class C10ImportConverterTest extends CImportConverterTest {
[
'name' => 'host6',
'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0,
'useip' => 1,
'ip' => '127.0.0.1',
'dns' => 'http://zabbix.com',
@@ -366,6 +370,7 @@ class C10ImportConverterTest extends CImportConverterTest {
[
'name' => 'host7',
'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0,
'items' => [
[
'key' => 'item1',
@@ -384,9 +389,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'inventory' => [
'inventory_mode' => HOST_INVENTORY_DISABLED
],
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
],
// host with an agent interface
[
@@ -433,9 +436,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'snmpv3_privprotocol' => ''
]
],
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
],
// missing interface data
[
@@ -445,9 +446,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'inventory' => [
'inventory_mode' => HOST_INVENTORY_DISABLED
],
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
],
// host with an IPMI interface
[
@@ -482,9 +481,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'snmpv3_privprotocol' => ''
]
],
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
],
// host with an IPMI interface, fallback to "ip"
[
@@ -519,9 +516,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'snmpv3_privprotocol' => ''
]
],
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
],
// host with SNMP interfaces
[
@@ -570,7 +565,9 @@ class C10ImportConverterTest extends CImportConverterTest {
'inventory_link' => '',
'snmpv3_contextname' => '',
'snmpv3_authprotocol' => '',
- 'snmpv3_privprotocol' => ''
+ 'snmpv3_privprotocol' => '',
+ 'interface_ref' => 'if0',
+ 'port' => '1'
],
[
'key' => 'item2',
@@ -581,7 +578,9 @@ class C10ImportConverterTest extends CImportConverterTest {
'inventory_link' => '',
'snmpv3_contextname' => '',
'snmpv3_authprotocol' => '',
- 'snmpv3_privprotocol' => ''
+ 'snmpv3_privprotocol' => '',
+ 'interface_ref' => 'if1',
+ 'port' => '2'
],
[
'key' => 'item3',
@@ -592,7 +591,9 @@ class C10ImportConverterTest extends CImportConverterTest {
'inventory_link' => '',
'snmpv3_contextname' => '',
'snmpv3_authprotocol' => '',
- 'snmpv3_privprotocol' => ''
+ 'snmpv3_privprotocol' => '',
+ 'interface_ref' => 'if2',
+ 'port' => '3'
],
[
'key' => 'item4',
@@ -603,7 +604,9 @@ class C10ImportConverterTest extends CImportConverterTest {
'inventory_link' => '',
'snmpv3_contextname' => '',
'snmpv3_authprotocol' => '',
- 'snmpv3_privprotocol' => ''
+ 'snmpv3_privprotocol' => '',
+ 'interface_ref' => 'if0',
+ 'port' => '1'
],
[
'key' => 'item5',
@@ -617,9 +620,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'snmpv3_privprotocol' => ''
]
],
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
],
// missing item type
[
@@ -641,9 +642,7 @@ class C10ImportConverterTest extends CImportConverterTest {
]
],
'name' => 'host7',
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
]
]
]);
@@ -656,17 +655,20 @@ class C10ImportConverterTest extends CImportConverterTest {
'hosts' => [
[
'name' => 'host1',
- 'status' => HOST_STATUS_MONITORED
+ 'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0
],
[
'name' => 'host1',
'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0,
'host_profile' => [],
'host_profiles_ext' => []
],
[
'name' => 'host1',
'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0,
'host_profile' => [
'devicetype' => 'device type',
'name' => 'name',
@@ -753,9 +755,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'inventory_mode' => HOST_INVENTORY_DISABLED
],
'name' => 'host1',
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
],
[
'host' => 'host1',
@@ -764,9 +764,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'inventory_mode' => HOST_INVENTORY_MANUAL
],
'name' => 'host1',
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
],
[
'host' => 'host1',
@@ -843,9 +841,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'poc_2_notes' => 'poc 2 notes'
],
'name' => 'host1',
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
]
]
]);
@@ -858,16 +854,19 @@ class C10ImportConverterTest extends CImportConverterTest {
'hosts' => [
[
'name' => 'host1',
- 'status' => HOST_STATUS_MONITORED
+ 'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0
],
[
'name' => 'host1',
'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0,
'items' => []
],
[
'name' => 'host1',
'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0,
'items' => [
[
'key' => 'item',
@@ -918,9 +917,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'inventory_mode' => HOST_INVENTORY_DISABLED
],
'name' => 'host1',
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
],
[
'host' => 'host1',
@@ -930,9 +927,7 @@ class C10ImportConverterTest extends CImportConverterTest {
],
'items' => [],
'name' => 'host1',
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
],
[
'host' => 'host1',
@@ -990,9 +985,7 @@ class C10ImportConverterTest extends CImportConverterTest {
]
],
'name' => 'host1',
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
]
],
'templates' => [
@@ -1004,7 +997,6 @@ class C10ImportConverterTest extends CImportConverterTest {
'key' => 'item',
'description' => 'item',
'name' => 'item',
- 'port' => '',
'valuemap' => [],
'inventory_link' => '',
'snmpv3_contextname' => '',
@@ -1023,7 +1015,6 @@ class C10ImportConverterTest extends CImportConverterTest {
]
],
'description' => 'My item',
- 'port' => '',
'valuemap' => [],
'inventory_link' => '',
'snmpv3_contextname' => '',
@@ -1051,16 +1042,19 @@ class C10ImportConverterTest extends CImportConverterTest {
'hosts' => [
[
'name' => 'host1',
- 'status' => HOST_STATUS_MONITORED
+ 'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0
],
[
'name' => 'host2',
'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0,
'triggers' => ''
],
[
'name' => 'host3',
'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0,
'triggers' => [
[
'description' => 'My trigger',
@@ -1080,6 +1074,7 @@ class C10ImportConverterTest extends CImportConverterTest {
[
'name' => 'host4',
'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0,
'triggers' => [
[
'description' => 'My trigger',
@@ -1129,9 +1124,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'inventory_mode' => HOST_INVENTORY_DISABLED
],
'name' => 'host1',
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
],
[
'host' => 'host2',
@@ -1140,9 +1133,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'inventory_mode' => HOST_INVENTORY_DISABLED
],
'name' => 'host2',
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
],
[
'host' => 'host3',
@@ -1151,9 +1142,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'inventory_mode' => HOST_INVENTORY_DISABLED
],
'name' => 'host3',
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
],
[
'host' => 'host4',
@@ -1162,9 +1151,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'inventory_mode' => HOST_INVENTORY_DISABLED
],
'name' => 'host4',
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
]
],
'templates' => [
@@ -1203,10 +1190,12 @@ class C10ImportConverterTest extends CImportConverterTest {
'hosts' => [
[
'name' => 'host1',
+ 'proxy_hostid' => 0,
'status' => HOST_STATUS_MONITORED
],
[
'name' => 'host2',
+ 'proxy_hostid' => 0,
'status' => HOST_STATUS_MONITORED
]
],
@@ -1226,9 +1215,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'inventory_mode' => HOST_INVENTORY_DISABLED
],
'name' => 'host1',
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
],
[
'host' => 'host2',
@@ -1237,9 +1224,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'inventory_mode' => HOST_INVENTORY_DISABLED
],
'name' => 'host2',
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
]
]
]);
@@ -1251,11 +1236,13 @@ class C10ImportConverterTest extends CImportConverterTest {
[
'name' => 'host1',
'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0,
'triggers' => []
],
[
'name' => 'host2',
'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0,
'triggers' => [
[
'description' => 'trigger',
@@ -1266,6 +1253,7 @@ class C10ImportConverterTest extends CImportConverterTest {
[
'name' => 'host3',
'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0,
'triggers' => [
[
'description' => 'trigger2',
@@ -1310,9 +1298,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'inventory_mode' => HOST_INVENTORY_DISABLED
],
'name' => 'host1',
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
],
[
'host' => 'host2',
@@ -1321,9 +1307,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'inventory_mode' => HOST_INVENTORY_DISABLED
],
'name' => 'host2',
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
],
[
'host' => 'host3',
@@ -1332,9 +1316,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'inventory_mode' => HOST_INVENTORY_DISABLED
],
'name' => 'host3',
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
]
]
]);
@@ -1345,6 +1327,7 @@ class C10ImportConverterTest extends CImportConverterTest {
[
'name' => 'host2',
'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0,
'triggers' => [
[
'description' => 'common-trigger',
@@ -1356,6 +1339,7 @@ class C10ImportConverterTest extends CImportConverterTest {
[
'name' => 'host1',
'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0,
'triggers' => [
[
'description' => 'common-trigger',
@@ -1443,9 +1427,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'inventory_mode' => HOST_INVENTORY_DISABLED
],
'name' => 'host2',
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
],
[
'host' => 'host1',
@@ -1454,9 +1436,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'inventory_mode' => HOST_INVENTORY_DISABLED
],
'name' => 'host1',
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
]
],
'templates' => [
@@ -1488,16 +1468,19 @@ class C10ImportConverterTest extends CImportConverterTest {
'hosts' => [
[
'name' => 'host1',
- 'status' => HOST_STATUS_MONITORED
+ 'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0
],
[
'name' => 'host1',
'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0,
'templates' => []
],
[
'name' => 'host2',
'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0,
'templates' => [
'template1',
'template2'
@@ -1523,9 +1506,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'inventory_mode' => HOST_INVENTORY_DISABLED
],
'name' => 'host1',
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
],
[
'host' => 'host1',
@@ -1535,9 +1516,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'inventory_mode' => HOST_INVENTORY_DISABLED
],
'templates' => [],
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
],
[
'host' => 'host2',
@@ -1554,9 +1533,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'name' => 'template2'
]
],
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
]
],
'templates' => [
@@ -1583,16 +1560,19 @@ class C10ImportConverterTest extends CImportConverterTest {
'hosts' => [
[
'name' => 'host1',
- 'status' => HOST_STATUS_MONITORED
+ 'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0
],
[
'name' => 'host1',
'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0,
'graphs' => ''
],
[
'name' => 'host2',
'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0,
'graphs' => [
[
'name' => 'graph1',
@@ -1653,6 +1633,7 @@ class C10ImportConverterTest extends CImportConverterTest {
[
'name' => 'host3',
'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0,
'graphs' => [
[
'name' => 'two-host graph',
@@ -1808,9 +1789,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'inventory_mode' => HOST_INVENTORY_DISABLED
],
'name' => 'host1',
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
],
[
'host' => 'host1',
@@ -1819,9 +1798,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'inventory_mode' => HOST_INVENTORY_DISABLED
],
'name' => 'host1',
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
],
[
'host' => 'host2',
@@ -1830,9 +1807,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'inventory_mode' => HOST_INVENTORY_DISABLED
],
'name' => 'host2',
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
],
[
'host' => 'host3',
@@ -1841,9 +1816,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'inventory_mode' => HOST_INVENTORY_DISABLED
],
'name' => 'host3',
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
]
],
'templates' => [
@@ -1862,16 +1835,19 @@ class C10ImportConverterTest extends CImportConverterTest {
'hosts' => [
[
'name' => 'host1',
- 'status' => HOST_STATUS_MONITORED
+ 'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0
],
[
'name' => 'host2',
'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0,
'macros' => ''
],
[
'name' => 'host3',
'status' => HOST_STATUS_MONITORED,
+ 'proxy_hostid' => 0,
'macros' => [
[
'name' => '{$MACRO}',
@@ -1901,9 +1877,7 @@ class C10ImportConverterTest extends CImportConverterTest {
'inventory_mode' => HOST_INVENTORY_DISABLED
],
'name' => 'host1',
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
],
[
'host' => 'host2',
@@ -1913,9 +1887,7 @@ class C10ImportConverterTest extends CImportConverterTest {
],
'macros' => '',
'name' => 'host2',
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
],
[
'host' => 'host3',
@@ -1930,9 +1902,7 @@ class C10ImportConverterTest extends CImportConverterTest {
]
],
'name' => 'host3',
- 'proxy' => [
- 'name' => ''
- ]
+ 'proxy' => []
]
],
'templates' => [
diff --git a/ui/tests/unit/include/classes/import/converters/C20ImportConverterTest.php b/ui/tests/unit/include/classes/import/converters/C20ImportConverterTest.php
index be8e26c5d99..07b1b4a993a 100644
--- a/ui/tests/unit/include/classes/import/converters/C20ImportConverterTest.php
+++ b/ui/tests/unit/include/classes/import/converters/C20ImportConverterTest.php
@@ -39,9 +39,30 @@ class C20ImportConverterTest extends CImportConverterTest {
],
[
'items' => [
- ['key' => 'agent.ping', 'status' => ITEM_STATUS_ACTIVE],
- ['key' => 'net.tcp.service[ntp]', 'status' => ITEM_STATUS_DISABLED],
- ['key' => 'net.tcp.service[tcp,,5432]', 'status' => ITEM_STATUS_NOTSUPPORTED]
+ [
+ 'key' => 'agent.ping',
+ 'status' => ITEM_STATUS_ACTIVE,
+ 'snmpv3_contextname' => '',
+ 'snmpv3_authprotocol' => '',
+ 'snmpv3_privprotocol' => '',
+ 'logtimefmt' => ''
+ ],
+ [
+ 'key' => 'net.tcp.service[ntp]',
+ 'status' => ITEM_STATUS_DISABLED,
+ 'snmpv3_contextname' => '',
+ 'snmpv3_authprotocol' => '',
+ 'snmpv3_privprotocol' => '',
+ 'logtimefmt' => ''
+ ],
+ [
+ 'key' => 'net.tcp.service[tcp,,5432]',
+ 'status' => ITEM_STATUS_NOTSUPPORTED,
+ 'snmpv3_contextname' => '',
+ 'snmpv3_authprotocol' => '',
+ 'snmpv3_privprotocol' => '',
+ 'logtimefmt' => ''
+ ]
]
],
[
@@ -53,10 +74,18 @@ class C20ImportConverterTest extends CImportConverterTest {
'filter' => [],
'item_prototypes' => [
[
- 'key' => 'net.if.in[{#IFNAME}]'
+ 'key' => 'net.if.in[{#IFNAME}]',
+ 'snmpv3_contextname' => '',
+ 'snmpv3_authprotocol' => '',
+ 'snmpv3_privprotocol' => '',
+ 'logtimefmt' => ''
],
[
- 'key' => 'net.tcp.service[ntp, {#HOST}, {#PORT}]'
+ 'key' => 'net.tcp.service[ntp, {#HOST}, {#PORT}]',
+ 'snmpv3_contextname' => '',
+ 'snmpv3_authprotocol' => '',
+ 'snmpv3_privprotocol' => '',
+ 'logtimefmt' => ''
]
],
'graph_prototypes' => [
@@ -96,7 +125,11 @@ class C20ImportConverterTest extends CImportConverterTest {
'filter' => '',
'item_prototypes' => [],
'graph_prototypes' => [],
- 'trigger_prototypes' => []
+ 'trigger_prototypes' => [],
+ 'snmpv3_contextname' => '',
+ 'snmpv3_authprotocol' => '',
+ 'snmpv3_privprotocol' => '',
+ 'logtimefmt' => ''
],
[
'type' => ITEM_TYPE_SNMPV3,
@@ -105,7 +138,11 @@ class C20ImportConverterTest extends CImportConverterTest {
'filter' => ':',
'item_prototypes' => [],
'graph_prototypes' => [],
- 'trigger_prototypes' => []
+ 'trigger_prototypes' => [],
+ 'snmpv3_contextname' => '',
+ 'snmpv3_authprotocol' => '',
+ 'snmpv3_privprotocol' => '',
+ 'logtimefmt' => ''
],
[
'type' => ITEM_TYPE_ZABBIX,
@@ -113,7 +150,11 @@ class C20ImportConverterTest extends CImportConverterTest {
'filter' => '{#MACRO}:regex',
'item_prototypes' => [],
'graph_prototypes' => [],
- 'trigger_prototypes' => []
+ 'trigger_prototypes' => [],
+ 'snmpv3_contextname' => '',
+ 'snmpv3_authprotocol' => '',
+ 'snmpv3_privprotocol' => '',
+ 'logtimefmt' => ''
]
]
]
@@ -145,9 +186,30 @@ class C20ImportConverterTest extends CImportConverterTest {
],
[
'items' => [
- ['key' => 'agent.ping', 'status' => ITEM_STATUS_ACTIVE],
- ['key' => 'net.udp.service[ntp]', 'status' => ITEM_STATUS_DISABLED],
- ['key' => 'net.tcp.service[tcp,,5432]', 'status' => ITEM_STATUS_ACTIVE]
+ [
+ 'key' => 'agent.ping',
+ 'status' => ITEM_STATUS_ACTIVE,
+ 'snmpv3_contextname' => '',
+ 'snmpv3_authprotocol' => '',
+ 'snmpv3_privprotocol' => '',
+ 'logtimefmt' => ''
+ ],
+ [
+ 'key' => 'net.udp.service[ntp]',
+ 'status' => ITEM_STATUS_DISABLED,
+ 'snmpv3_contextname' => '',
+ 'snmpv3_authprotocol' => '',
+ 'snmpv3_privprotocol' => '',
+ 'logtimefmt' => ''
+ ],
+ [
+ 'key' => 'net.tcp.service[tcp,,5432]',
+ 'status' => ITEM_STATUS_ACTIVE,
+ 'snmpv3_contextname' => '',
+ 'snmpv3_authprotocol' => '',
+ 'snmpv3_privprotocol' => '',
+ 'logtimefmt' => ''
+ ]
],
'description' => '',
'tls_connect' => '1',
@@ -167,11 +229,19 @@ class C20ImportConverterTest extends CImportConverterTest {
'item_prototypes' => [
[
'key' => 'net.if.in[{#IFNAME}]',
- 'application_prototypes' => ''
+ 'application_prototypes' => '',
+ 'snmpv3_contextname' => '',
+ 'snmpv3_authprotocol' => '',
+ 'snmpv3_privprotocol' => '',
+ 'logtimefmt' => ''
],
[
'key' => 'net.udp.service[ntp, {#HOST}, {#PORT}]',
- 'application_prototypes' => ''
+ 'application_prototypes' => '',
+ 'snmpv3_contextname' => '',
+ 'snmpv3_authprotocol' => '',
+ 'snmpv3_privprotocol' => '',
+ 'logtimefmt' => ''
]
],
'graph_prototypes' => [
@@ -203,7 +273,10 @@ class C20ImportConverterTest extends CImportConverterTest {
'expression' => '{host:item.last(0)}<>0 or {host:item.last(0)}<>1'
]
],
- 'host_prototypes' => []
+ 'host_prototypes' => [],
+ 'snmpv3_contextname' => '',
+ 'snmpv3_authprotocol' => '',
+ 'snmpv3_privprotocol' => ''
],
[
'type' => ITEM_TYPE_SNMPV2C,
@@ -217,7 +290,11 @@ class C20ImportConverterTest extends CImportConverterTest {
'item_prototypes' => [],
'graph_prototypes' => [],
'trigger_prototypes' => [],
- 'host_prototypes' => []
+ 'host_prototypes' => [],
+ 'snmpv3_contextname' => '',
+ 'snmpv3_authprotocol' => '',
+ 'snmpv3_privprotocol' => '',
+ 'logtimefmt' => ''
],
[
'type' => ITEM_TYPE_SNMPV3,
@@ -231,7 +308,11 @@ class C20ImportConverterTest extends CImportConverterTest {
'item_prototypes' => [],
'graph_prototypes' => [],
'trigger_prototypes' => [],
- 'host_prototypes' => []
+ 'host_prototypes' => [],
+ 'snmpv3_contextname' => '',
+ 'snmpv3_authprotocol' => '',
+ 'snmpv3_privprotocol' => '',
+ 'logtimefmt' => ''
],
[
'type' => ITEM_TYPE_ZABBIX,
@@ -250,7 +331,11 @@ class C20ImportConverterTest extends CImportConverterTest {
'item_prototypes' => [],
'graph_prototypes' => [],
'trigger_prototypes' => [],
- 'host_prototypes' => []
+ 'host_prototypes' => [],
+ 'snmpv3_contextname' => '',
+ 'snmpv3_authprotocol' => '',
+ 'snmpv3_privprotocol' => '',
+ 'logtimefmt' => ''
]
],
'description' => '',
@@ -340,9 +425,30 @@ class C20ImportConverterTest extends CImportConverterTest {
[],
[
'items' => [
- ['key' => 'agent.ping', 'status' => ITEM_STATUS_ACTIVE],
- ['key' => 'net.tcp.service[ntp]', 'status' => ITEM_STATUS_DISABLED],
- ['key' => 'net.tcp.service[tcp,,5432]', 'status' => ITEM_STATUS_NOTSUPPORTED]
+ [
+ 'key' => 'agent.ping',
+ 'status' => ITEM_STATUS_ACTIVE,
+ 'snmpv3_contextname' => '',
+ 'snmpv3_authprotocol' => '',
+ 'snmpv3_privprotocol' => '',
+ 'logtimefmt' => ''
+ ],
+ [
+ 'key' => 'net.tcp.service[ntp]',
+ 'status' => ITEM_STATUS_DISABLED,
+ 'snmpv3_contextname' => '',
+ 'snmpv3_authprotocol' => '',
+ 'snmpv3_privprotocol' => '',
+ 'logtimefmt' => ''
+ ],
+ [
+ 'key' => 'net.tcp.service[tcp,,5432]',
+ 'status' => ITEM_STATUS_NOTSUPPORTED,
+ 'snmpv3_contextname' => '',
+ 'snmpv3_authprotocol' => '',
+ 'snmpv3_privprotocol' => '',
+ 'logtimefmt' => ''
+ ]
]
],
[
@@ -425,9 +531,30 @@ class C20ImportConverterTest extends CImportConverterTest {
],
[
'items' => [
- ['key' => 'agent.ping', 'status' => ITEM_STATUS_ACTIVE],
- ['key' => 'net.udp.service[ntp]', 'status' => ITEM_STATUS_DISABLED],
- ['key' => 'net.tcp.service[tcp,,5432]', 'status' => ITEM_STATUS_ACTIVE]
+ [
+ 'key' => 'agent.ping',
+ 'status' => ITEM_STATUS_ACTIVE,
+ 'snmpv3_contextname' => '',
+ 'snmpv3_authprotocol' => '',
+ 'snmpv3_privprotocol' => '',
+ 'logtimefmt' => ''
+ ],
+ [
+ 'key' => 'net.udp.service[ntp]',
+ 'status' => ITEM_STATUS_DISABLED,
+ 'snmpv3_contextname' => '',
+ 'snmpv3_authprotocol' => '',
+ 'snmpv3_privprotocol' => '',
+ 'logtimefmt' => ''
+ ],
+ [
+ 'key' => 'net.tcp.service[tcp,,5432]',
+ 'status' => ITEM_STATUS_ACTIVE,
+ 'snmpv3_contextname' => '',
+ 'snmpv3_authprotocol' => '',
+ 'snmpv3_privprotocol' => '',
+ 'logtimefmt' => ''
+ ]
],
'description' => ''
],
@@ -441,11 +568,19 @@ class C20ImportConverterTest extends CImportConverterTest {
'item_prototypes' => [
[
'key' => 'net.if.in[{#IFNAME}]',
- 'application_prototypes' => ''
+ 'application_prototypes' => '',
+ 'snmpv3_contextname' => '',
+ 'snmpv3_authprotocol' => '',
+ 'snmpv3_privprotocol' => '',
+ 'logtimefmt' => ''
],
[
'key' => 'net.udp.service[ntp, {#HOST}, {#PORT}]',
- 'application_prototypes' => ''
+ 'application_prototypes' => '',
+ 'snmpv3_contextname' => '',
+ 'snmpv3_authprotocol' => '',
+ 'snmpv3_privprotocol' => '',
+ 'logtimefmt' => ''
]
],
'graph_prototypes' => [
@@ -477,7 +612,10 @@ class C20ImportConverterTest extends CImportConverterTest {
'expression' => '{host:item.last(0)}<>0 or {host:item.last(0)}<>1'
]
],
- 'host_prototypes' => []
+ 'host_prototypes' => [],
+ 'snmpv3_contextname' => '',
+ 'snmpv3_authprotocol' => '',
+ 'snmpv3_privprotocol' => ''
],
[
'type' => ITEM_TYPE_ZABBIX,
@@ -490,7 +628,10 @@ class C20ImportConverterTest extends CImportConverterTest {
'item_prototypes' => [],
'graph_prototypes' => [],
'trigger_prototypes' => [],
- 'host_prototypes' => []
+ 'host_prototypes' => [],
+ 'snmpv3_contextname' => '',
+ 'snmpv3_authprotocol' => '',
+ 'snmpv3_privprotocol' => ''
],
[
'type' => ITEM_TYPE_ZABBIX,
@@ -503,7 +644,10 @@ class C20ImportConverterTest extends CImportConverterTest {
'item_prototypes' => [],
'graph_prototypes' => [],
'trigger_prototypes' => [],
- 'host_prototypes' => []
+ 'host_prototypes' => [],
+ 'snmpv3_contextname' => '',
+ 'snmpv3_authprotocol' => '',
+ 'snmpv3_privprotocol' => ''
],
[
'type' => ITEM_TYPE_ZABBIX,
@@ -522,7 +666,10 @@ class C20ImportConverterTest extends CImportConverterTest {
'item_prototypes' => [],
'graph_prototypes' => [],
'trigger_prototypes' => [],
- 'host_prototypes' => []
+ 'host_prototypes' => [],
+ 'snmpv3_contextname' => '',
+ 'snmpv3_authprotocol' => '',
+ 'snmpv3_privprotocol' => ''
]
],
'description' => ''