webui: Display vlans for all devices. #4349, #3059

This commit is contained in:
Tony Murray
2016-10-11 02:05:34 -05:00
committed by Neil Lathwood
parent b908418058
commit ead6b5b8ac

View File

@@ -103,29 +103,28 @@ if ($port[ifDuplex] != 'unknown') {
echo '-'; echo '-';
} }
if ($device['os'] == 'ios' || $device['os'] == 'iosxe') { $vlans = dbFetchColumn(
if ($port['ifTrunk']) { 'SELECT vlan FROM `ports_vlans` AS PV, vlans AS V ' .
echo '<p class=box-desc><span class=purple><a title="'; 'WHERE PV.`port_id`=? AND PV.`device_id`=? AND V.`vlan_vlan`=PV.vlan AND V.device_id = PV.device_id',
$vlans = dbFetchRows("SELECT * FROM `ports_vlans` AS PV, vlans AS V WHERE PV.`port_id` ='".$port['port_id']."' and PV.`device_id` = '".$device['device_id']."' AND V.`vlan_vlan` = PV.vlan AND V.device_id = PV.device_id"); array($port['port_id'], $device['device_id'])
foreach ($vlans as $vlan) { );
if ($vlan['state'] == 'blocking') { $vlan_count = count($vlans);
$class = 'red';
} elseif ($vlan['state'] == 'forwarding') {
$class = 'green';
} else {
$class = 'none';
}
echo '<b class='.$class.'>'.$vlan['vlan'].'</b> '.$vlan['vlan_descr'].'<br />'; if ($vlan_count > 1) {
} echo '<p class=box-desc><span class=purple><a href="';
echo generate_device_url($device, array('tab' => 'vlans'));
echo '">'.$port['ifTrunk'].'</a></span></p>'; echo '" title="';
} elseif ($port['ifVlan']) { echo implode(', ', $vlans);
echo '<p class=box-desc><span class=blue>VLAN '.$port['ifVlan'].'</span></p>'; echo '">VLANs: ';
} elseif ($port['ifVrf']) { echo $vlan_count;
$vrf = dbFetchRow('SELECT * FROM vrfs WHERE vrf_id = ?', array($port['ifVrf'])); echo '</a></span></p>';
echo "<p style='color: green;'>".$vrf['vrf_name'].'</p>'; } elseif ($vlan_count == 1 || $port['ifVlan']) {
}//end if echo '<p class=box-desc><span class=blue>VLAN: ';
echo ($vlans[0] ?: $port['ifVlan']);
echo '</span></p>';
} elseif ($port['ifVrf']) {
$vrf = dbFetchRow('SELECT * FROM vrfs WHERE vrf_id = ?', array($port['ifVrf']));
echo "<p style='color: green;'>".$vrf['vrf_name'].'</p>';
}//end if }//end if
if ($port_adsl['adslLineCoding']) { if ($port_adsl['adslLineCoding']) {