initial Eltex-mes IPv6 address discovery (#13594)

* initial Eltex-mes IPv6 address discovery

* styleci

* add Eltex-mes devices in group: radlan

* merge two OIDs

* styleci

* ipv6 normalize
This commit is contained in:
Peca Nesovanovic 2021-12-03 22:48:48 +01:00 committed by GitHub
parent b32524294c
commit 528d8e55b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 3535 additions and 863 deletions

View File

@ -14,6 +14,7 @@ discovery:
- .1.3.6.1.4.1.35265.1.43
mib_dir: eltexmes21xx
group: radlan
bad_iftype:
- tunnel

View File

@ -15,6 +15,7 @@ discovery:
- .1.3.6.1.4.1.35265.1.83
mib_dir: eltexmes23xx
group: radlan
bad_iftype:
- tunnel

View File

@ -0,0 +1,46 @@
<?php
/**
* mes21xx.inc.php
*
* IPv6 address discovery file for eltex-mes21xx OS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* @link https://www.librenms.org
*
* @copyright 2021 Peca Nesovanovic
* @author Peca Nesovanovic <peca.nesovanovic@sattrakt.com>
*/
//IP-MIB
$oids = SnmpQuery::walk('IP-MIB::ipAddressIfIndex.ipv6')->table(2);
//merge Radlan-IPv6 with IP-MIB
$oidm = SnmpQuery::walk('RADLAN-IPv6::rlIpAddressTable')->table(2, $oids);
if ($oidm) {
d_echo('Eltex IPv6: discovering ...');
foreach ($oidm['ipv6'] as $ip => $iparray) {
d_echo('Eltex IPv6: processing ' . $ip);
$index = $iparray['IP-MIB::ipAddressIfIndex'];
$prefixlen = $iparray['RADLAN-IPv6::rlIpAddressPrefixLength'];
$type = $iparray['RADLAN-IPv6::rlIpAddressType'];
$v6addr = normalize_snmp_ip_address($ip); //convert from xx:xx:xx:xx to xxxx:xxxx
if ($type == 1 && $index && $prefixlen) {
discover_process_ipv6($valid, $index, $v6addr, $prefixlen, 'manual', $device['context_name']);
}
}
}

View File

@ -0,0 +1,46 @@
<?php
/**
* mes23xx.inc.php
*
* IPv6 address discovery file for eltex-mes23xx OS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* @link https://www.librenms.org
*
* @copyright 2021 Peca Nesovanovic
* @author Peca Nesovanovic <peca.nesovanovic@sattrakt.com>
*/
//IP-MIB
$oids = SnmpQuery::walk('IP-MIB::ipAddressIfIndex.ipv6')->table(2);
//merge Radlan-IPv6 with IP-MIB
$oidm = SnmpQuery::walk('RADLAN-IPv6::rlIpAddressTable')->table(2, $oids);
if ($oidm) {
d_echo('Eltex IPv6: discovering ...');
foreach ($oidm['ipv6'] as $ip => $iparray) {
d_echo('Eltex IPv6: processing ' . $ip);
$index = $iparray['IP-MIB::ipAddressIfIndex'];
$prefixlen = $iparray['RADLAN-IPv6::rlIpAddressPrefixLength'];
$type = $iparray['RADLAN-IPv6::rlIpAddressType'];
$v6addr = normalize_snmp_ip_address($ip); //convert from xx:xx:xx:xx to xxxx:xxxx
if ($type == 1 && $index && $prefixlen) {
discover_process_ipv6($valid, $index, $v6addr, $prefixlen, 'manual', $device['context_name']);
}
}
}

File diff suppressed because it is too large Load Diff

1949
mibs/radlan/RADLAN-IPv6 Normal file

File diff suppressed because it is too large Load Diff