mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Improve Huawei BGP polling + BGP webui & graphs patches (#10010)
* basic adress family for VRP * Improve BGP prefixes display * Improve BGP prefixes display * Improve BGP prefixes display * climate
This commit is contained in:
committed by
Neil Lathwood
parent
e7ba1b195f
commit
e285a9268e
@@ -2,15 +2,19 @@
|
||||
|
||||
$scale_min = '0';
|
||||
|
||||
$ds = 'AcceptedPrefixes';
|
||||
$ds_in = 'AcceptedPrefixes';
|
||||
$ds_out = 'AdvertisedPrefixes';
|
||||
|
||||
$colour_area = 'AA66AA';
|
||||
$colour_line = 'FFDD88';
|
||||
$colour_area_in = 'AA66AA';
|
||||
$colour_line_in = '330033';
|
||||
$colour_area_out = 'FF6600';
|
||||
$colour_line_out = 'FFDD88';
|
||||
|
||||
$colour_area_max = 'FFEE99';
|
||||
$colour_area_in_max = 'FFEE99';
|
||||
$colour_area_out_max = 'FF7711';
|
||||
|
||||
$graph_max = 1;
|
||||
|
||||
$unit_text = 'Prefixes';
|
||||
|
||||
require 'includes/graphs/generic_simplex.inc.php';
|
||||
require 'includes/graphs/generic_duplex.inc.php';
|
||||
|
@@ -53,12 +53,12 @@ if ($vars['view'] == 'prefixes_ipv4unicast') {
|
||||
|
||||
echo ' | ';
|
||||
|
||||
if ($vars['view'] == 'prefixes_vpnv4unicast') {
|
||||
if ($vars['view'] == 'prefixes_ipv4vpn') {
|
||||
echo "<span class='pagemenu-selected'>";
|
||||
}
|
||||
|
||||
echo generate_link('VPNv4', $link_array, array('view' => 'prefixes_vpnv4unicast'));
|
||||
if ($vars['view'] == 'prefixes_vpnv4unicast') {
|
||||
echo generate_link('VPNv4 Ucast', $link_array, array('view' => 'prefixes_ipv4vpn'));
|
||||
if ($vars['view'] == 'prefixes_ipv4vpn') {
|
||||
echo '</span>';
|
||||
}
|
||||
|
||||
@@ -74,6 +74,18 @@ if ($vars['view'] == 'prefixes_ipv6unicast') {
|
||||
echo '</span>';
|
||||
}
|
||||
|
||||
echo ' | ';
|
||||
|
||||
if ($vars['view'] == 'prefixes_ipv6vpn') {
|
||||
echo "<span class='pagemenu-selected'>";
|
||||
$extra_sql = " AND `bgpPeerIdentifier` LIKE '%:%'";
|
||||
}
|
||||
|
||||
echo generate_link('VPNv6 Ucast', $link_array, array('view' => 'prefixes_ipv6vpn'));
|
||||
if ($vars['view'] == 'prefixes_ipv6vpn') {
|
||||
echo '</span>';
|
||||
}
|
||||
|
||||
echo ' | Traffic: ';
|
||||
|
||||
if ($vars['view'] == 'macaccounting_bits') {
|
||||
|
@@ -142,6 +142,17 @@ if (!LegacyAuth::user()->hasGlobalRead()) {
|
||||
echo '</span>';
|
||||
}
|
||||
|
||||
echo '|';
|
||||
|
||||
if ($vars['graph'] == 'prefixes_ipv6vpn') {
|
||||
echo "<span class='pagemenu-selected'>";
|
||||
}
|
||||
|
||||
echo generate_link('VPNv6', $vars, array('view' => 'graphs', 'graph' => 'prefixes_ipv6vpn'));
|
||||
if ($vars['graph'] == 'prefixes_ipv6vpn') {
|
||||
echo '</span>';
|
||||
}
|
||||
|
||||
echo ')';
|
||||
|
||||
echo ' | Multicast (';
|
||||
|
@@ -142,6 +142,11 @@ if (Config::get('enable_bgp')) {
|
||||
if (!empty($af_data)) {
|
||||
$af_list = build_cbgp_peers($device, $peer, $af_data, $peer2);
|
||||
}
|
||||
if ($device['os'] == 'vrp') {
|
||||
d_echo("VRP:");
|
||||
$af_data = snmpwalk_cache_oid($device, 'hwBgpPeers', $af_data, 'HUAWEI-BGP-VPN-MIB');
|
||||
$af_list = build_cbgp_peers($device, $peer, $af_data, $peer2);
|
||||
}
|
||||
|
||||
if (!$bgp4_mib && $device['os'] == 'junos') {
|
||||
$afis['ipv4'] = 'ipv4';
|
||||
|
@@ -1195,6 +1195,7 @@ function build_bgp_peers($device, $data, $peer2)
|
||||
'ARISTA-BGP4V2-MIB::aristaBgp4V2PeerRemoteAs.1.',
|
||||
'CISCO-BGP4-MIB::cbgpPeer2RemoteAs.',
|
||||
'BGP4-MIB::bgpPeerRemoteAs.',
|
||||
'HUAWEI-BGP-VPN-MIB::hwBgpPeerRemoteAs.',
|
||||
'.1.3.6.1.4.1.2636.5.1.1.2.1.1.1.13.',
|
||||
);
|
||||
$peers = trim(str_replace($remove, '', $data));
|
||||
@@ -1250,11 +1251,19 @@ function build_cbgp_peers($device, $peer, $af_data, $peer2)
|
||||
d_echo("AFISAFI = $k\n");
|
||||
|
||||
$afisafi_tmp = explode('.', $k);
|
||||
$safi = array_pop($afisafi_tmp);
|
||||
$afi = array_pop($afisafi_tmp);
|
||||
$bgp_ip = str_replace(".$afi.$safi", '', $k);
|
||||
if ($device['os_group'] === 'arista') {
|
||||
$bgp_ip = str_replace("$afi.", '', $bgp_ip);
|
||||
if ($device['os_group'] === 'vrp') {
|
||||
array_shift($afisafi_tmp); //remove 1st value, always 0 so far
|
||||
$afi = array_shift($afisafi_tmp);
|
||||
$safi = array_shift($afisafi_tmp);
|
||||
array_shift($afisafi_tmp); //type, always ipv4 so far
|
||||
$bgp_ip = implode('.', $afisafi_tmp);
|
||||
} else {
|
||||
$safi = array_pop($afisafi_tmp);
|
||||
$afi = array_pop($afisafi_tmp);
|
||||
$bgp_ip = str_replace(".$afi.$safi", '', $k);
|
||||
if ($device['os_group'] === 'arista') {
|
||||
$bgp_ip = str_replace("$afi.", '', $bgp_ip);
|
||||
}
|
||||
}
|
||||
$bgp_ip = preg_replace('/:/', ' ', $bgp_ip);
|
||||
$bgp_ip = preg_replace('/(\S+\s+\S+)\s/', '$1:', $bgp_ip);
|
||||
|
@@ -257,7 +257,7 @@ if ($config['enable_bgp']) {
|
||||
}
|
||||
|
||||
// --- Populate cbgp data ---
|
||||
if ($device['os_group'] == 'cisco' || $device['os'] == 'junos' || $device['os_group'] === 'arista') {
|
||||
if ($device['os_group'] == 'vrp' || $device['os_group'] == 'cisco' || $device['os'] == 'junos' || $device['os_group'] === 'arista') {
|
||||
// Poll each AFI/SAFI for this peer (using CISCO-BGP4-MIB or BGP4-V2-JUNIPER MIB)
|
||||
$peer_afis = dbFetchRows('SELECT * FROM bgpPeers_cbgp WHERE `device_id` = ? AND bgpPeerIdentifier = ?', array($device['device_id'], $peer['bgpPeerIdentifier']));
|
||||
foreach ($peer_afis as $peer_afi) {
|
||||
@@ -387,6 +387,15 @@ if ($config['enable_bgp']) {
|
||||
$cbgpPeerAcceptedPrefixes = $a_prefixes["1.$afi.$tmp_peer.$afi.$safi"]['aristaBgp4V2PrefixInPrefixesAccepted'];
|
||||
}
|
||||
|
||||
if ($device['os_group'] === 'vrp') {
|
||||
$vrpPrefixes = snmpwalk_cache_multi_oid($device, 'hwBgpPeerPrefixRcvCounter', $vrpPrefixes, 'HUAWEI-BGP-VPN-MIB', null, '-OQUs');
|
||||
$vrpPrefixes = snmpwalk_cache_multi_oid($device, 'hwBgpPeerPrefixAdvCounter', $vrpPrefixes, 'HUAWEI-BGP-VPN-MIB', null, '-OQUs');
|
||||
|
||||
$key = '0.'.$afi.'.'.$safi.'.ipv4.'.$peer['bgpPeerIdentifier'];
|
||||
$cbgpPeerAcceptedPrefixes = $vrpPrefixes[$key]['hwBgpPeerPrefixRcvCounter'];
|
||||
$cbgpPeerAdvertisedPrefixes = $vrpPrefixes[$key]['hwBgpPeerPrefixAdvCounter'];
|
||||
}
|
||||
|
||||
// Validate data
|
||||
$cbgpPeerAcceptedPrefixes = set_numeric($cbgpPeerAcceptedPrefixes);
|
||||
$cbgpPeerDeniedPrefixes = set_numeric($cbgpPeerDeniedPrefixes);
|
||||
|
Reference in New Issue
Block a user