Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSPF display improvements #10206

Merged
merged 1 commit into from May 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 9 additions & 7 deletions includes/html/pages/device/routing/ospf.inc.php
Expand Up @@ -27,7 +27,7 @@
$nbr_count = dbFetchCell('SELECT COUNT(*) FROM `ospf_nbrs` WHERE `device_id` = ?', array($device['device_id']));

$status_color = $abr_status_color = $asbr_status_color = 'default';

if ($instance['ospfAdminStat'] == 'enabled') {
$status_color = 'success';
}
Expand All @@ -39,7 +39,7 @@
if ($instance['ospfASBdrRtrStatus'] == 'true') {
$asbr_status_color = 'success';
}

echo '
<tbody>
<tr data-toggle="collapse" data-target="#ospf-panel' . $i . '" class="accordion-toggle">
Expand Down Expand Up @@ -70,7 +70,7 @@
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_enabled = dbFetchCell("SELECT COUNT(*) FROM `ospf_ports` WHERE `ospfIfAdminStat` = 'enabled' AND `device_id` = ? AND `ospfIfAreaId` = ?", array($device['device_id'], $area['ospfAreaId']));

echo '
<tbody>
<tr>
Expand All @@ -94,24 +94,26 @@
<th>Port Type</th>
<th>Port State</th>
<th>Status</th>
<th>Area ID</th>
</tr>
</thead>
</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);
$port_status_color = 'default';

if ($ospfport['ospfIfAdminStat'] == 'enabled') {
$port_status_color = 'success';
}

echo '
<tbody>
<tr>
<td>' . generate_port_link($ospfport) . '</td>
<td>' . $ospfport['ospfIfType'] . '</td>
<td>' . $ospfport['ospfIfState'] . '</td>
<td><span class="label label-' . $port_status_color . '">' . $ospfport['ospfIfAdminStat'] . '</span></td>
<td>' . $ospfport['ospfIfAreaId'] . '</td>
</tr>
</tbody>';
}
Expand All @@ -133,10 +135,10 @@
</thead>';
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']));

$rtr_id = 'unknown';
$ospfnbr_status_color = 'default';

if (is_array($host)) {
$rtr_id = generate_device_link($host);
}
Expand Down