Source
<?php
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
require_once dirname(__FILE__).'/../common/testLowLevelDiscovery.php';
/**
* @onBefore prepareLLDData
*
* @onAfter deleteData
*/
class testFormLowLevelDiscoveryFromHost extends testLowLevelDiscovery {
protected static $groupid;
protected static $hostid;
protected static $empty_hostid;
protected static $interfaces_hostid;
protected static $update_lld = 'LLD for update scenario';
public function prepareLLDData() {
static::$groupid = CDataHelper::call('hostgroup.create', [['name' => 'Host group for lld']])['groupids'][0];
$result = CDataHelper::createHosts([
[
'host' => 'Host for LLD form test with all interfaces',
'groups' => ['groupid' => static::$groupid],
'items' => [
[
'name' => 'Master item',
'key_' => 'master.test',
'type' => ITEM_TYPE_TRAPPER,
'value_type' => ITEM_VALUE_TYPE_UINT64
]
],
'interfaces' => [
[
'type' => INTERFACE_TYPE_AGENT,
'main' => INTERFACE_PRIMARY,
'useip' => INTERFACE_USE_IP,
'ip' => '127.0.0.1',
'dns' => '',
'port' => '10050'
],
[
'type'=> INTERFACE_TYPE_SNMP,
'main' => INTERFACE_PRIMARY,
'useip' => INTERFACE_USE_IP,
'ip' => '127.0.0.2',
'dns' => '',
'port' => '161',
'details' => [
'version' => SNMP_V2C,