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:
@@ -26,9 +26,24 @@
|
||||
namespace LibreNMS\Util;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model as Eloquent;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class ModuleModelObserver
|
||||
{
|
||||
/**
|
||||
* Install observers to output +, -, U for models being created, deleted, and updated
|
||||
*
|
||||
* @param string $model The model name including namespace
|
||||
*/
|
||||
public static function observe($model)
|
||||
{
|
||||
$model = Str::start($model, '\\');
|
||||
// discovery output (but don't install it twice (testing can can do this)
|
||||
if (!$model::getEventDispatcher()->hasListeners('eloquent.created: ' . ltrim('\\', $model))) {
|
||||
$model::observe(new ModuleModelObserver());
|
||||
}
|
||||
}
|
||||
|
||||
public function saving(Eloquent $model)
|
||||
{
|
||||
if (!$model->isDirty()) {
|
||||
|
||||
Reference in New Issue
Block a user