Files
librenms-librenms/html/pages/routing/cisco-otv.inc.php
Tony Murray b8e9b2d917 Implement an autoloader (#4140)
* Implement an autoloader

When cleaning up classes for psr2, things got a bit unwieldy, so I implemented a class autoloader.
I created a PSR-0 compliant LibreNMS directory and moved all classes there that made sense.
Implemented LibreNMS\ClassLoader which supports adding manual class mappings

This reduces the file includes needed and only loads classes when needed.

* Add teh autoloader to graph.php

* Add a small bit of docs
Fix incomplete class in includes/discovery/functions.inc.php
2016-08-21 14:07:14 +01:00

56 lines
2.7 KiB
PHP

<?php
$COMPONENT = new LibreNMS\Component();
$options = array();
$options['filter']['ignore'] = array('=',0);
$options['type'] = 'Cisco-OTV';
$COMPONENTS = $COMPONENT->getComponents(null, $options);
foreach ($COMPONENTS as $DEVICE_ID => $COMP) {
$LINK = generate_url(array('page' => 'device', 'device' => $DEVICE_ID, 'tab' => 'routing', 'proto' => 'cisco-otv'));
?>
<div class="panel panel-default" id="overlays-<?php echo $DEVICE_ID?>">
<div class="panel-heading">
<h3 class="panel-title"><a href="<?php echo $LINK?>"><?php echo gethostbyid($DEVICE_ID)?> - Overlay's & Adjacencies</a></h3>
</div>
<div class="panel list-group">
<?php
// Loop over each component, pulling out the Overlays.
foreach ($COMP as $OID => $OVERLAY) {
if ($OVERLAY['otvtype'] == 'overlay') {
if ($OVERLAY['status'] == 0) {
$OVERLAY_STATUS = "<span class='green pull-right'>Normal</span>";
$GLI = "";
} else {
$OVERLAY_STATUS = "<span class='pull-right'>".$OVERLAY['error']." - <span class='red'>Alert</span></span>";
$GLI = "list-group-item-danger";
}
?>
<a class="list-group-item <?php echo $GLI?>" data-toggle="collapse" data-target="#<?php echo $OVERLAY['index']?>" data-parent="#overlays-<?php echo $DEVICE_ID?>"><?php echo $OVERLAY['label']?> - <?php echo $OVERLAY['transport']?> <?php echo $OVERLAY_STATUS?></a>
<div id="<?php echo $OVERLAY['index']?>" class="sublinks collapse">
<?php
foreach ($COMP as $AID => $ADJACENCY) {
if (($ADJACENCY['otvtype'] == 'adjacency') && ($ADJACENCY['index'] == $OVERLAY['index'])) {
if ($ADJACENCY['status'] == 0) {
$ADJ_STATUS = "<span class='green pull-right'>Normal</span>";
$GLI = "";
} else {
$ADJ_STATUS = "<span class='pull-right'>".$ADJACENCY['error']." - <span class='red'>Alert</span></span>";
$GLI = "list-group-item-danger";
}
?>
<a class="list-group-item <?php echo $GLI?> small"><span class="glyphicon glyphicon-chevron-right"></span> <?php echo $ADJACENCY['label']?> - <?php echo $ADJACENCY['endpoint']?> <?php echo $ADJ_STATUS?></a>
<?php
}
}
?>
</div>
<?php
}
}
?>
</div>
</div>
<?php
}