MPLS Services (#10421)

* initial database migrations

* first part, discovery

* second part, polling

* add SAP polling and discovery

* style checks

* rename variables in more generic way

* html global pages for sdp and sdp binds

* add Services and SAPs

* port links, database, etc.

* html device routing pages

* add tests

* checks

* rework database id relationship

* scruntinizer inspection

* fix unit test for new mpls tables
This commit is contained in:
Vitali Kari
2019-07-28 06:11:04 +02:00
committed by Tony Murray
parent 60c538ad8c
commit 1de640c3aa
20 changed files with 6774 additions and 43 deletions

View File

@@ -566,6 +566,26 @@ class Device extends BaseModel
return $this->hasMany('App\Models\MplsLspPath', 'device_id');
}
public function mplsSdps()
{
return $this->hasMany('App\Models\MplsSdp', 'device_id');
}
public function mplsServices()
{
return $this->hasMany('App\Models\MplsService', 'device_id');
}
public function mplsSaps()
{
return $this->hasMany('App\Models\MplsSap', 'device_id');
}
public function mplsSdpBinds()
{
return $this->hasMany('App\Models\MplsSdpBind', 'device_id');
}
public function syslogs()
{
return $this->hasMany('App\Models\Syslog', 'device_id', 'device_id');

50
app/Models/MplsSap.php Normal file
View File

@@ -0,0 +1,50 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use LibreNMS\Interfaces\Models\Keyable;
class MplsSap extends Model implements Keyable
{
protected $primaryKey = 'sap_id';
public $timestamps = false;
protected $fillable = [
'svc_id',
'svc_oid',
'sapPortId',
'ifName',
'sapEncapValue',
'device_id',
'sapRowStatus',
'sapType',
'sapDescription',
'sapAdminStatus',
'sapOperStatus',
'sapLastMgmtChange',
'sapLastStatusChange',
];
// ---- Helper Functions ----
/**
* Get a string that can identify a unique instance of this model
* @return string
*/
public function getCompositeKey()
{
return $this->svc_oid . '-' . $this->sapPortId . '-' . $this->sapEncapValue;
}
// ---- Define Relationships ----
public function binds()
{
return $this->hasMany('App\Models\MplsSdpBind', 'svc_id');
}
public function services()
{
return $this->hasMany('App\Models\MplsService', 'svc_id');
}
}

46
app/Models/MplsSdp.php Normal file
View File

@@ -0,0 +1,46 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use LibreNMS\Interfaces\Models\Keyable;
class MplsSdp extends Model implements Keyable
{
protected $primaryKey = 'sdp_id';
public $timestamps = false;
protected $fillable = [
'sdp_oid',
'device_id',
'sdpRowStatus',
'sdpDelivery',
'sdpDescription',
'sdpAdminStatus',
'sdpOperStatus',
'sdpAdminPathMtu',
'sdpOperPathMtu',
'sdpLastMgmtChange',
'sdpLastStatusChange',
'sdpActiveLspType',
'sdpFarEndInetAddressType',
'sdpFarEndInetAddress',
];
// ---- Helper Functions ----
/**
* Get a string that can identify a unique instance of this model
* @return string
*/
public function getCompositeKey()
{
return $this->sdp_oid;
}
// ---- Define Relationships ----
public function binds()
{
return $this->hasMany('App\Models\MplsSdpBind', 'sdp_id');
}
}

View File

@@ -0,0 +1,53 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use LibreNMS\Interfaces\Models\Keyable;
class MplsSdpBind extends Model implements Keyable
{
protected $primaryKey = 'bind_id';
public $timestamps = false;
protected $fillable = [
'sdp_id',
'svc_id',
'sdp_oid',
'svc_oid',
'device_id',
'sdpBindRowStatus',
'sdpBindAdminStatus',
'sdpBindOperStatus',
'sdpBindLastMgmtChange',
'sdpBindLastStatusChange',
'sdpBindType',
'sdpBindVcType',
'sdpBindBaseStatsIngFwdPackets',
'sdpBindBaseStatsIngFwdOctets',
'sdpBindBaseStatsEgrFwdPackets',
'sdpBindBaseStatsEgrFwdOctets',
];
// ---- Helper Functions ----
/**
* Get a string that can identify a unique instance of this model
* @return string
*/
public function getCompositeKey()
{
return $this->sdp_oid . '-' . $this->svc_oid;
}
// ---- Define Relationships ----
public function sdp()
{
return $this->belongsTo('App\Models\MplsSdp', 'sdp_id');
}
public function service()
{
return $this->belongsTo('App\Models\MplsService', 'svc_id');
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use LibreNMS\Interfaces\Models\Keyable;
class MplsService extends Model implements Keyable
{
protected $primaryKey = 'svc_id';
public $timestamps = false;
protected $fillable = [
'svc_oid',
'device_id',
'svcRowStatus',
'svcType',
'svcCustId',
'svcAdminStatus',
'svcOperStatus',
'svcDescription',
'svcMtu',
'svcNumSaps',
'svcNumSdps',
'svcLastMgmtChange',
'svcLastStatusChange',
'svcVRouterId',
'svcTlsMacLearning',
'svcTlsStpAdminStatus',
'svcTlsStpOperStatus',
'svcTlsFdbTableSize',
'svcTlsFdbNumEntries',
];
// ---- Helper Functions ----
/**
* Get a string that can identify a unique instance of this model
* @return string
*/
public function getCompositeKey()
{
return $this->svc_oid;
}
// ---- Define Relationships ----
public function binds()
{
return $this->hasMany('App\Models\MplsSdpBind', 'svc_id');
}
}