mirror of
				https://github.com/librenms/librenms.git
				synced 2024-10-07 16:52:45 +00:00 
			
		
		
		
	* 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
		
			
				
	
	
		
			54 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			54 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?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');
 | |
|     }
 | |
| }
 |