$tmp) { $vlan_num = $vlan_oids[$index]['extremeVlanIfVlanId']; foreach ($tmp as $slot => $vlan) { $binary = hex2binmap($vlan['extremeVlanOpaqueUntaggedPorts']); // Assign binary vlans map to ports $length = strlen($binary); for ($i = 0; $i < $length; $i++) { if ($binary[$i] && $i > 0) { $trunk = 'dot1Q'; // Hardcode all detected ports as trunk, since no way for detect it correctly $port_map = $slot.':'.($i + 1); //$ifIndex = dbFetchCell("SELECT `ifIndex` FROM `ports` WHERE `device_id` = ? AND (`ifDescr` LIKE ? OR `ifName` = ?) AND `deleted` = ? LIMIT 1", array($device['device_id'], '% '.$port_map, $port_map, 0)); foreach ($port_stats as $ifIndex => $entry) { if ($entry['ifName'] == $port_map || str_ends($entry['ifDescr'], ' '.$port_map)) { $vlan_rows[] = array($ifIndex, $vlan_num, $trunk); // Set Vlan and Trunk $port_stats[$ifIndex]['ifVlan'] = $vlan_num; $port_stats[$ifIndex]['ifTrunk'] = $trunk; break; // Stop ports loop } } } } } } } $headers = array('%WifIndex%n', '%WVlan%n', '%WTrunk%n'); print_cli_table($vlan_rows, $headers); //$process_port_functions[$port_module] = $GLOBALS['snmp_status']; // Additional db fields for update //$process_port_db[$port_module][] = 'ifVlan'; //$process_port_db[$port_module][] = 'ifTrunk'; // EOF