created avaya-ers.inc.php

Avaya do not use the Q-Bridge MIB for Vlans.
They also store untagged vlan info in 2 seperate ways:
rcVlanPortDefaultVlanId stores the actual native VLAN or PVID per switch port.
rcVlanPortPerformTagging tells us the ports tagging mode, this can be true (all tagged or trunk), false (no tagging or access), 3 (only tag the PVID) or 4 (untag the PVID and tag everything else).
Due to how these bits of information are presented, for each VLAN ID we then need to loop through all the ports checking if their PVID matches the VLAN ID and if the tagging mode is false or 4. If both are true we add that port to the list of untagged ports for that VLAN.
This commit is contained in:
Tom Sealey
2017-08-01 10:08:49 +01:00
committed by GitHub
parent afa5b6fd00
commit 9f65a3c1d7
@@ -0,0 +1,40 @@
<?php
echo 'RC-VLAN-MIB VLANs: ';
if ($device['os'] == 'avaya-ers') {
$vtpdomain_id = '1';
$vlans = snmpwalk_cache_oid($device, 'rcVlanName', array(), 'RC-VLAN-MIB');
$tagoruntag = snmpwalk_cache_oid($device, 'rcVlanPortMembers', array(), 'RC-VLAN-MIB', null, '-OQUs --hexOutputLength=0');
$port_pvids = snmpwalk_cache_oid($device, 'rcVlanPortDefaultVlanId', array(), 'RC-VLAN-MIB');
$port_mode = snmpwalk_cache_oid($device, 'rcVlanPortPerformTagging', array(), 'RC-VLAN-MIB');
foreach ($vlans as $vlan_id => $vlan) {
d_echo(" $vlan_id");
if (is_array($vlans_db[$vtpdomain_id][$vlan_id])) {
echo '.';
} else {
dbInsert(array(
'device_id' => $device['device_id'],
'vlan_domain' => $vtpdomain_id,
'vlan_vlan' => $vlan_id,
'vlan_name' => $vlan['rcVlanName'],
'vlan_type' => array('NULL')
), 'vlans');
echo '+';
}
$device['vlans'][$vtpdomain_id][$vlan_id] = $vlan_id;
$egress_ids = q_bridge_bits2indices($tagoruntag[$vlan_id]['rcVlanPortMembers']);
$untagged_ids = array();
foreach ($port_pvids as $port => $port_num) {
if ($port_num['rcVlanPortDefaultVlanId'] == $vlan_id &&
($port_mode[$port]['rcVlanPortPerformTagging'] == 'false' || $port_mode[$port]['rcVlanPortPerformTagging'] == 4 )) {
array_push($untagged_ids, $port);
}
}
foreach ($egress_ids as $port_id) {
$ifIndex = $base_to_index[$port_id];
$per_vlan_data[$vlan_id][$ifIndex]['untagged'] = (in_array($port_id, $untagged_ids) ? 1 : 0);
}
}
}