mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
newdevice: Added FDB and ARP support for edgeswitch devices (#7199)
This commit is contained in:
@@ -33,8 +33,12 @@ foreach ($vrfs_lite_cisco as $vrf) {
|
||||
$context = $vrf['context_name'];
|
||||
$device['context_name']=$context;
|
||||
|
||||
$arp_data = snmpwalk_group($device, 'ipNetToPhysicalPhysAddress', 'IP-MIB');
|
||||
$arp_data = snmpwalk_group($device, 'ipNetToMediaPhysAddress', 'IP-MIB', 1, $arp_data);
|
||||
if (file_exists($config['install_dir'] . "/includes/discovery/arp-table/{$device['os']}.inc.php")) {
|
||||
include $config['install_dir'] . "/includes/discovery/arp-table/{$device['os']}.inc.php";
|
||||
} else {
|
||||
$arp_data = snmpwalk_group($device, 'ipNetToPhysicalPhysAddress', 'IP-MIB');
|
||||
$arp_data = snmpwalk_group($device, 'ipNetToMediaPhysAddress', 'IP-MIB', 1, $arp_data);
|
||||
}
|
||||
|
||||
$existing_data = dbFetchRows(
|
||||
"SELECT * from `ipv4_mac` WHERE `device_id`=? AND `context_name`=?",
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* edgeswitch.inc.php
|
||||
*
|
||||
* Arp Table discovery file for EdgeSwitch
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @link http://librenms.org
|
||||
* @copyright 2017 Tony Murray
|
||||
* @author Tony Murray <[email protected]>
|
||||
*/
|
||||
|
||||
$binding = snmpwalk_group($device, 'agentDynamicDsBindingTable', 'EdgeSwitch-SWITCHING-MIB', 1);
|
||||
|
||||
foreach ($binding as $mac => $data) {
|
||||
$arp_data[$data['agentDynamicDsBindingIfIndex']]['ipNetToMediaPhysAddress'][$data['agentDynamicDsBindingIpAddr']] = $data['agentDynamicDsBindingMacAddr'];
|
||||
$arp_data[$data['agentDynamicDsBindingIfIndex']]['ipNetToPhysicalPhysAddress']['ipv4'][$data['agentDynamicDsBindingIpAddr']] = $data['agentDynamicDsBindingMacAddr'];
|
||||
}
|
||||
@@ -15,7 +15,9 @@ foreach ($sql_result as $entry) {
|
||||
}
|
||||
|
||||
$insert = array(); // populate $insert with database entries
|
||||
if ($device['os'] == 'ios' || $device['os'] == 'iosxe') {
|
||||
if (file_exists($config['install_dir'] . "/includes/discovery/fdb-table/{$device['os']}.inc.php")) {
|
||||
require $config['install_dir'] . "/includes/discovery/fdb-table/{$device['os']}.inc.php";
|
||||
} elseif ($device['os'] == 'ios' || $device['os'] == 'iosxe') {
|
||||
include $config['install_dir'] . '/includes/discovery/fdb-table/ios.inc.php';
|
||||
} else {
|
||||
// Check generic Q-BRIDGE-MIB and BRIDGE-MIB
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* edgeswitch.inc.php
|
||||
*
|
||||
* FDP Table discovery file for EdgeSwitch
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @link http://librenms.org
|
||||
* @copyright 2017 Tony Murray
|
||||
* @author Tony Murray <[email protected]>
|
||||
*/
|
||||
|
||||
$binding = snmpwalk_group($device, 'agentDynamicDsBindingTable', 'EdgeSwitch-SWITCHING-MIB', 1);
|
||||
|
||||
foreach ($binding as $mac => $data) {
|
||||
$port = get_port_by_index_cache($device['device_id'], $data['agentDynamicDsBindingIfIndex']);
|
||||
$port_id = $port['port_id'];
|
||||
$mac_address = implode(array_map('zeropad', explode(':', $mac)));
|
||||
$vlan_id = $data['agentDynamicDsBindingVlanId'] ?: 0;
|
||||
$insert[$vlan_id][$mac_address]['port_id'] = $port_id;
|
||||
d_echo("vlan $vlan_id mac $mac_address port $port_id\n");
|
||||
}
|
||||
Reference in New Issue
Block a user