mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
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:
50
app/Models/MplsSap.php
Normal file
50
app/Models/MplsSap.php
Normal 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');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user