<?php echo 'IEEE8021-Q-BRIDGE-MIB VLANs: '; $vlanversion = snmp_get($device, 'dot1qVlanVersionNumber.0', '-Oqv', 'IEEE8021-Q-BRIDGE-MIB'); if ($vlanversion == 'version1' || $vlanversion == '2') { echo "ver $vlanversion "; $vtpdomain_id = '1'; $untag = snmpwalk_cache_oid($device, 'dot1qVlanCurrentUntaggedPorts', array(), 'Q-BRIDGE-MIB', null, ['-OQUs', '--hexOutputLength=0']); $tagoruntag = snmpwalk_cache_oid($device, 'dot1qVlanCurrentEgressPorts', array(), 'Q-BRIDGE-MIB', null, ['-OQUs', '--hexOutputLength=0']); if ($tagoruntag == $null && $untag == $null) { // if dot1qVlanCurrentTable doesn't exist then use the dot1qVlanStaticTable $untaggedports = 'dot1qVlanStaticUntaggedPorts'; $tagoruntagports = 'dot1qVlanStaticEgressPorts'; $untag = snmpwalk_cache_oid($device, $untaggedports, array(), 'Q-BRIDGE-MIB', null, ['-OQUs', '--hexOutputLength=0']); $tagoruntag = snmpwalk_cache_oid($device, $tagoruntagports, array(), 'Q-BRIDGE-MIB', null, ['-OQUs', '--hexOutputLength=0']); } else { $untaggedports = 'dot1qVlanCurrentUntaggedPorts'; $tagoruntagports = 'dot1qVlanCurrentEgressPorts'; // drop dot1qVlanTimeMark, we don't care about it $result[$new_key] = $tagoruntag[$key]; return $result; }, []); $result[$new_key] = $untag[$key]; return $result; }, []); } foreach ($vlans as $vlan_id => $vlan) { d_echo(" $vlan_id"); $vlan_data = $vlans_db[$vtpdomain_id][$vlan_id]; if ($vlan_data['vlan_name'] != $vlan['dot1qVlanStaticName']) { $vlan_upd['vlan_name'] = $vlan['dot1qVlanStaticName']; log_event("VLAN $vlan_id changed name {$vlan_data['vlan_name']} -> {$vlan['dot1qVlanStaticName']} ", $device, 'vlan', 3, $vlan_data['vlan_id']); echo 'U'; } else { echo '.'; } } else { 'device_id' => $device['device_id'], 'vlan_domain' => $vtpdomain_id, 'vlan_vlan' => $vlan_id, 'vlan_name' => $vlan['dot1qVlanStaticName'], ), 'vlans'); echo '+'; } $device['vlans'][$vtpdomain_id][$vlan_id] = $vlan_id; $untagged_ids = q_bridge_bits2indices($untag[$vlan_id][$untaggedports]); $egress_ids = q_bridge_bits2indices($tagoruntag[$vlan_id][$tagoruntagports]); foreach ($egress_ids as $port_id) { $ifIndex = $base_to_index[$port_id]; } } } } echo PHP_EOL;