mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Added support for routing table collection in discovery (#10182)
* Clean broken VRF lite code * Change DB table for route discovery * Add VRF simple support * add port_id to db and discovery * static-fy the translation arrays * sort and search cleaning * Sorting refactor and validation * formatItem shortened * Handle ifIndex==0 meaning no next hop defined (MPLS) * Sync all create/updates * purge in daily * remove old route table * get rid of inetCidrRouteNextHop_device_id * fix wonky column orders * add route snmprec * fix sorting by interface * Move to new config * rename to route the new table * Properly display ipv6 compressed addresses * Translation before merge ./lnms translation:generate * Update manifest
This commit is contained in:
@@ -269,6 +269,11 @@ if (device_permitted($vars['device']) || $permitted_by_port) {
|
||||
$routing_tabs[] = 'cisco-otv';
|
||||
}
|
||||
|
||||
$device_routing_count['routes'] = dbFetchCell('SELECT COUNT(*) FROM `route` WHERE `device_id` = ?', array($device['device_id']));
|
||||
if ($device_routing_count['routes']) {
|
||||
$routing_tabs[] = 'routes';
|
||||
}
|
||||
|
||||
if (is_array($routing_tabs)) {
|
||||
echo '<li role="presentation" '.$select['routing'].'>
|
||||
<a href="'.generate_device_url($device, array('tab' => 'routing')).'">
|
||||
|
||||
@@ -20,6 +20,7 @@ $type_text['bgp'] = 'BGP';
|
||||
$type_text['cef'] = 'CEF';
|
||||
$type_text['ospf'] = 'OSPF';
|
||||
$type_text['vrf'] = 'VRFs';
|
||||
$type_text['routes'] = 'Routing Table';
|
||||
$type_text['cisco-otv'] = 'OTV';
|
||||
$type_text['mpls'] = 'MPLS';
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
use Librenms\Config;
|
||||
|
||||
$no_refresh = true;
|
||||
?>
|
||||
<table id="routes" class="table table-condensed table-hover table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-column-id="context_name" data-width="125px">VRF</th>
|
||||
<th data-column-id="inetCidrRouteDestType" data-width="70px">Proto</th>
|
||||
<th data-column-id="inetCidrRouteDest">Destination</th>
|
||||
<th data-column-id="inetCidrRoutePfxLen" data-width="80px">Mask</th>
|
||||
<th data-column-id="inetCidrRouteNextHop">Next hop</th>
|
||||
<th data-column-id="inetCidrRouteIfIndex">Interface</th>
|
||||
<th data-column-id="inetCidrRouteMetric1" data-width="85px">Metric</th>
|
||||
<th data-column-id="inetCidrRouteType" data-width="85px">Type</th>
|
||||
<th data-column-id="inetCidrRouteProto" data-width="85px">Proto</th>
|
||||
<th data-column-id="created_at" data-width="165px">First seen</th>
|
||||
<th data-column-id="updated_at" data-width="165px">Last seen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<div>Warning: Routing Table is only retrieved during device discovery. Devices are skipped if they have more than <?php echo Config::get('routes_max_number');?> routes.</div>
|
||||
<script>
|
||||
var grid = $("#routes").bootgrid({
|
||||
ajax: true,
|
||||
post: function ()
|
||||
{
|
||||
var check_showAllRoutes = document.getElementById('check_showAllRoutes');
|
||||
if (check_showAllRoutes) {
|
||||
var showAllRoutes = document.getElementById('check_showAllRoutes').checked;
|
||||
} else {
|
||||
var showAllRoutes = false;
|
||||
}
|
||||
return {
|
||||
device_id: "<?php echo $device['device_id']; ?>",
|
||||
showAllRoutes: showAllRoutes,
|
||||
};
|
||||
},
|
||||
url: "ajax/table/routes"
|
||||
});
|
||||
|
||||
var add = $(".actionBar").append(
|
||||
'<div class="search form-group pull-left" style="width:auto">' +
|
||||
'<?php echo csrf_field() ?>'+
|
||||
'<input type="checkbox" name="check_showAllRoutes" data-size="small" id="check_showAllRoutes">' +
|
||||
' Include historical routes in the table.' +
|
||||
'</div>');
|
||||
$("#check_showAllRoutes").bootstrapSwitch({
|
||||
'onSwitchChange': function(event, state){
|
||||
$('#routes').bootgrid('reload');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user