mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Improved OSPF device display (#10206)
- Fixed ospf port listing, as current query only returned ospf ports for last AreaID in area foreach loop. - Added Area ID column to Ports table. - Removed whitespaces.
This commit is contained in:
@@ -27,7 +27,7 @@ foreach (dbFetchRows('SELECT * FROM `ospf_instances` WHERE `device_id` = ?', arr
|
|||||||
$nbr_count = dbFetchCell('SELECT COUNT(*) FROM `ospf_nbrs` WHERE `device_id` = ?', array($device['device_id']));
|
$nbr_count = dbFetchCell('SELECT COUNT(*) FROM `ospf_nbrs` WHERE `device_id` = ?', array($device['device_id']));
|
||||||
|
|
||||||
$status_color = $abr_status_color = $asbr_status_color = 'default';
|
$status_color = $abr_status_color = $asbr_status_color = 'default';
|
||||||
|
|
||||||
if ($instance['ospfAdminStat'] == 'enabled') {
|
if ($instance['ospfAdminStat'] == 'enabled') {
|
||||||
$status_color = 'success';
|
$status_color = 'success';
|
||||||
}
|
}
|
||||||
@@ -39,7 +39,7 @@ foreach (dbFetchRows('SELECT * FROM `ospf_instances` WHERE `device_id` = ?', arr
|
|||||||
if ($instance['ospfASBdrRtrStatus'] == 'true') {
|
if ($instance['ospfASBdrRtrStatus'] == 'true') {
|
||||||
$asbr_status_color = 'success';
|
$asbr_status_color = 'success';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr data-toggle="collapse" data-target="#ospf-panel' . $i . '" class="accordion-toggle">
|
<tr data-toggle="collapse" data-target="#ospf-panel' . $i . '" class="accordion-toggle">
|
||||||
@@ -70,7 +70,7 @@ foreach (dbFetchRows('SELECT * FROM `ospf_instances` WHERE `device_id` = ?', arr
|
|||||||
foreach (dbFetchRows('SELECT * FROM `ospf_areas` WHERE `device_id` = ?', array($device['device_id'])) as $area) {
|
foreach (dbFetchRows('SELECT * FROM `ospf_areas` WHERE `device_id` = ?', array($device['device_id'])) as $area) {
|
||||||
$area_port_count = dbFetchCell('SELECT COUNT(*) FROM `ospf_ports` WHERE `device_id` = ? AND `ospfIfAreaId` = ?', array($device['device_id'], $area['ospfAreaId']));
|
$area_port_count = dbFetchCell('SELECT COUNT(*) FROM `ospf_ports` WHERE `device_id` = ? AND `ospfIfAreaId` = ?', array($device['device_id'], $area['ospfAreaId']));
|
||||||
$area_port_count_enabled = dbFetchCell("SELECT COUNT(*) FROM `ospf_ports` WHERE `ospfIfAdminStat` = 'enabled' AND `device_id` = ? AND `ospfIfAreaId` = ?", array($device['device_id'], $area['ospfAreaId']));
|
$area_port_count_enabled = dbFetchCell("SELECT COUNT(*) FROM `ospf_ports` WHERE `ospfIfAdminStat` = 'enabled' AND `device_id` = ? AND `ospfIfAreaId` = ?", array($device['device_id'], $area['ospfAreaId']));
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -94,17 +94,18 @@ foreach (dbFetchRows('SELECT * FROM `ospf_instances` WHERE `device_id` = ?', arr
|
|||||||
<th>Port Type</th>
|
<th>Port Type</th>
|
||||||
<th>Port State</th>
|
<th>Port State</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
|
<th>Area ID</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
</div>';
|
</div>';
|
||||||
foreach (dbFetchRows("SELECT * FROM `ospf_ports` AS O, `ports` AS P WHERE O.`ospfIfAdminStat` = 'enabled' AND O.`device_id` = ? AND O.`ospfIfAreaId` = ? AND P.port_id = O.port_id", array($device['device_id'], $area['ospfAreaId'])) as $ospfport) {
|
foreach (dbFetchRows("SELECT * FROM `ospf_ports` AS O, `ports` AS P WHERE O.`ospfIfAdminStat` = 'enabled' AND O.`device_id` = ? AND P.port_id = O.port_id ORDER BY O.`ospfIfAreaId`", array($device['device_id'])) as $ospfport) {
|
||||||
$ospfport = cleanPort($ospfport);
|
$ospfport = cleanPort($ospfport);
|
||||||
$port_status_color = 'default';
|
$port_status_color = 'default';
|
||||||
|
|
||||||
if ($ospfport['ospfIfAdminStat'] == 'enabled') {
|
if ($ospfport['ospfIfAdminStat'] == 'enabled') {
|
||||||
$port_status_color = 'success';
|
$port_status_color = 'success';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -112,6 +113,7 @@ foreach (dbFetchRows('SELECT * FROM `ospf_instances` WHERE `device_id` = ?', arr
|
|||||||
<td>' . $ospfport['ospfIfType'] . '</td>
|
<td>' . $ospfport['ospfIfType'] . '</td>
|
||||||
<td>' . $ospfport['ospfIfState'] . '</td>
|
<td>' . $ospfport['ospfIfState'] . '</td>
|
||||||
<td><span class="label label-' . $port_status_color . '">' . $ospfport['ospfIfAdminStat'] . '</span></td>
|
<td><span class="label label-' . $port_status_color . '">' . $ospfport['ospfIfAdminStat'] . '</span></td>
|
||||||
|
<td>' . $ospfport['ospfIfAreaId'] . '</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>';
|
</tbody>';
|
||||||
}
|
}
|
||||||
@@ -133,10 +135,10 @@ foreach (dbFetchRows('SELECT * FROM `ospf_instances` WHERE `device_id` = ?', arr
|
|||||||
</thead>';
|
</thead>';
|
||||||
foreach (dbFetchRows('SELECT * FROM `ospf_nbrs` WHERE `device_id` = ?', array($device['device_id'])) as $nbr) {
|
foreach (dbFetchRows('SELECT * FROM `ospf_nbrs` WHERE `device_id` = ?', array($device['device_id'])) as $nbr) {
|
||||||
$host = @dbFetchRow('SELECT * FROM `ipv4_addresses` AS A, `ports` AS I, `devices` AS D WHERE A.ipv4_address = ? AND I.port_id = A.port_id AND D.device_id = I.device_id', array($nbr['ospfNbrRtrId']));
|
$host = @dbFetchRow('SELECT * FROM `ipv4_addresses` AS A, `ports` AS I, `devices` AS D WHERE A.ipv4_address = ? AND I.port_id = A.port_id AND D.device_id = I.device_id', array($nbr['ospfNbrRtrId']));
|
||||||
|
|
||||||
$rtr_id = 'unknown';
|
$rtr_id = 'unknown';
|
||||||
$ospfnbr_status_color = 'default';
|
$ospfnbr_status_color = 'default';
|
||||||
|
|
||||||
if (is_array($host)) {
|
if (is_array($host)) {
|
||||||
$rtr_id = generate_device_link($host);
|
$rtr_id = generate_device_link($host);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user