mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Add MPLS Support (#10263)
* WIP - Add MPLS Support This introduce the generic MPLS support - New database tables for MPLS LSPs - actually discovery and polling on NOKIA SR OS (Timetra) devices - new routing->MPLS HTML pages - ToDo MPLS LSP paths table and views Suggestions and improvements are welcome * add db schema * some fixes * add path table, discovery and polling * add path views * add test data * Convert MPLS module to new style Implement a SyncsModels trait to simplify code a lot * abs() for negative value from snmp (bug?), test data * fix db schema * Fix up test data, remove uneeded data in json * fix whitespace
This commit is contained in:
@@ -574,6 +574,16 @@ class Device extends BaseModel
|
||||
return $this->hasMany('App\Models\Mempool', 'device_id');
|
||||
}
|
||||
|
||||
public function mplsLsps()
|
||||
{
|
||||
return $this->hasMany('App\Models\MplsLsp', 'device_id');
|
||||
}
|
||||
|
||||
public function mplsLspPaths()
|
||||
{
|
||||
return $this->hasMany('App\Models\MplsLspPath', 'device_id');
|
||||
}
|
||||
|
||||
public function syslogs()
|
||||
{
|
||||
return $this->hasMany('App\Models\Syslog', 'device_id', 'device_id');
|
||||
|
||||
33
app/Models/Mpls.php
Normal file
33
app/Models/Mpls.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Mpls.php
|
||||
*
|
||||
* -Description-
|
||||
*
|
||||
* 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 2019 Vitali Kari
|
||||
* @author Vitali Kari <vitali.kari@gmail.com>
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class Mpls extends DeviceRelatedModel
|
||||
{
|
||||
public $timestamps = false;
|
||||
protected $table = 'mpls_lsps';
|
||||
protected $primaryKey = 'lsp_id';
|
||||
}
|
||||
53
app/Models/MplsLsp.php
Normal file
53
app/Models/MplsLsp.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use LibreNMS\Interfaces\Models\Keyable;
|
||||
|
||||
class MplsLsp extends Model implements Keyable
|
||||
{
|
||||
protected $primaryKey = 'lsp_id';
|
||||
public $timestamps = false;
|
||||
protected $fillable = [
|
||||
'vrf_oid',
|
||||
'lsp_oid',
|
||||
'device_id',
|
||||
'mplsLspRowStatus',
|
||||
'mplsLspLastChange',
|
||||
'mplsLspName',
|
||||
'mplsLspAdminState',
|
||||
'mplsLspOperState',
|
||||
'mplsLspFromAddr',
|
||||
'mplsLspToAddr',
|
||||
'mplsLspType',
|
||||
'mplsLspFastReroute',
|
||||
'mplsLspAge',
|
||||
'mplsLspTimeUp',
|
||||
'mplsLspTimeDown',
|
||||
'mplsLspPrimaryTimeUp',
|
||||
'mplsLspTransitions',
|
||||
'mplsLspLastTransition',
|
||||
'mplsLspConfiguredPaths',
|
||||
'mplsLspStandbyPaths',
|
||||
'mplsLspOperationalPaths',
|
||||
];
|
||||
|
||||
// ---- Helper Functions ----
|
||||
|
||||
/**
|
||||
* Get a string that can identify a unique instance of this model
|
||||
* @return string
|
||||
*/
|
||||
public function getCompositeKey()
|
||||
{
|
||||
return $this->vrf_oid . '-' . $this->lsp_oid;
|
||||
}
|
||||
|
||||
// ---- Define Relationships ----
|
||||
|
||||
public function paths()
|
||||
{
|
||||
return $this->hasMany('App\Models\MplsLspPath', 'lsp_id');
|
||||
}
|
||||
}
|
||||
50
app/Models/MplsLspPath.php
Normal file
50
app/Models/MplsLspPath.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use LibreNMS\Interfaces\Models\Keyable;
|
||||
|
||||
class MplsLspPath extends Model implements Keyable
|
||||
{
|
||||
protected $primaryKey = 'lsp_path_id';
|
||||
public $timestamps = false;
|
||||
protected $fillable = [
|
||||
'lsp_id',
|
||||
'path_oid',
|
||||
'device_id',
|
||||
'mplsLspPathRowStatus',
|
||||
'mplsLspPathLastChange',
|
||||
'mplsLspPathType',
|
||||
'mplsLspPathBandwidth',
|
||||
'mplsLspPathOperBandwidth',
|
||||
'mplsLspPathAdminState',
|
||||
'mplsLspPathOperState',
|
||||
'mplsLspPathState',
|
||||
'mplsLspPathFailCode',
|
||||
'mplsLspPathFailNodeAddr',
|
||||
'mplsLspPathMetric',
|
||||
'mplsLspPathOperMetric',
|
||||
'mplsLspPathTimeUp',
|
||||
'mplsLspPathTimeDown',
|
||||
'mplsLspPathTransitionCount',
|
||||
];
|
||||
|
||||
// ---- Helper Functions ----
|
||||
|
||||
/**
|
||||
* Get a string that can identify a unique instance of this model
|
||||
* @return string
|
||||
*/
|
||||
public function getCompositeKey()
|
||||
{
|
||||
return $this->lsp_id . '-' . $this->path_oid;
|
||||
}
|
||||
|
||||
// ---- Define Relationships ----
|
||||
|
||||
public function lsp()
|
||||
{
|
||||
return $this->belongsTo('App\Models\MplsLsp', 'lsp_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user