From 5f1426a0a3b2854d84e69d771bad902ac07425d8 Mon Sep 17 00:00:00 2001 From: "Eric A. Miller" Date: Tue, 21 Oct 2014 23:23:20 -0400 Subject: [PATCH] Support obtaining FDB in Avaya SPBM edge deployments in L2::Baystack NOTE: This requires a RAPID-CITY MIB with the rcBridgeSpbmMacTable --- ChangeLog | 5 +++ Info/Layer2/Baystack.pm | 72 +++++++++++++++++++++++++++++++++++++ Info/RapidCity.pm | 78 ++++++++++++++++++++++++++++++++++++++++- 3 files changed, 154 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ae91dd75..db631a54 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,11 @@ SNMP::Info - Friendly OO-style interface to Network devices using SNMP. version 3.21 () + [NEW FEATURES] + + * Support obtaining FDB in Avaya SPBM edge deployments in L2::Baystack + NOTE: This requires a RAPID-CITY MIB with the rcBridgeSpbmMacTable + [ENHANCEMENTS] * No longer ignore interfaces based on name, in base L2/L3/L7 device diff --git a/Info/Layer2/Baystack.pm b/Info/Layer2/Baystack.pm index e1c11193..d8c9d6a4 100644 --- a/Info/Layer2/Baystack.pm +++ b/Info/Layer2/Baystack.pm @@ -341,6 +341,52 @@ sub peth_port_ifindex { return \%peth_port_ifindex; } +# Currently only ERS 4800 v5.8+ support the rcBridgeSpbmMacTable +# which holds the FDB for a SPBM edge deployment. +# +# Q-BRIDGE still holds some entries when the rcBridgeSpbmMacTable is in use +# so we merge hash entries. + +sub fw_mac { + my $rapidcity = shift; + + my $qb = $rapidcity->SUPER::fw_mac() || {}; + my $spbm = $rapidcity->rc_spbm_fw_mac() || {}; + my $fw_mac = { %$qb, %$spbm }; + + return $fw_mac; +} + +sub fw_port { + my $rapidcity = shift; + + my $qb = $rapidcity->SUPER::fw_port() || {}; + my $spbm = $rapidcity->rc_spbm_fw_port() || {}; + my $fw_port = { %$qb, %$spbm }; + + return $fw_port; +} + +sub fw_status { + my $rapidcity = shift; + + my $qb = $rapidcity->SUPER::fw_status() || {}; + my $spbm = $rapidcity->rc_spbm_fw_status() || {}; + my $fw_status = { %$qb, %$spbm }; + + return $fw_status; +} + +sub qb_fw_vlan { + my $rapidcity = shift; + + my $qb = $rapidcity->SUPER::qb_fw_vlan() || {}; + my $spbm = $rapidcity->rc_spbm_fw_vlan() || {}; + my $qb_fw_vlan = { %$qb, %$spbm }; + + return $qb_fw_vlan; +} + 1; __END__ @@ -600,6 +646,32 @@ ns_e_vendor(). =back +=head2 Layer 2 Forwarding Database + +These methods try to obtain the layer 2 forwarding database entries via the +normal bridge methods as well as SPBM entries via rapid city methods. + +=over + +=item $baystack->fw_mac() + +Returns reference to hash of forwarding table MAC Addresses + +=item $baystack->fw_port() + +Returns reference to hash of forwarding table entries port interface +identifier (iid) + +=item $baystack->qb_fw_vlan() + +Returns reference to hash of forwarding table entries VLAN ID + +=item $baystack->fw_status() + +Returns reference to hash of forwarding table entries status + +=back + =head2 Table Methods imported from SNMP::Info::SONMP See L for details. diff --git a/Info/RapidCity.pm b/Info/RapidCity.pm index 25027d8d..c5f7769c 100644 --- a/Info/RapidCity.pm +++ b/Info/RapidCity.pm @@ -1,7 +1,7 @@ # SNMP::Info::RapidCity # $Id$ # -# Copyright (c) 2008 Eric Miller +# Copyright (c) 2014 Eric Miller # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -153,6 +153,11 @@ $VERSION = '3.20'; 'rc_mlt_ports' => 'rcMltPortMembers', 'rc_mlt_index' => 'rcMltIfIndex', 'rc_mlt_dp' => 'rcMltDesignatedPort', + + # From RAPID-CITY::rcBridgeSpbmMacTable + 'rc_spbm_fw_port' => 'rcBridgeSpbmMacCPort', + 'rc_spbm_fw_status' => 'rcBridgeSpbmMacStatus', + 'rc_spbm_fw_vlan' => 'rcBridgeSpbmMacCVlanId', ); %MUNGE = ( @@ -601,6 +606,40 @@ sub agg_ports { return $ret; } +# break up the rcBridgeSpbmMacEntry INDEX into ISID and MAC Address. +sub _spbm_fdbtable_index { + my $idx = shift; + my @values = split( /\./, $idx ); + my $isid = shift(@values); + return ( $isid, join( ':', map { sprintf "%02x", $_ } @values ) ); +} + +sub rc_spbm_fw_mac { + my $rapidcity = shift; + my $partial = shift; + + my $spbm_fw_ports = $rapidcity->rc_spbm_fw_port($partial); + my $spbm_fw_mac = {}; + foreach my $idx ( keys %$spbm_fw_ports ) { + my ( $isid, $mac ) = _spbm_fdbtable_index($idx); + $spbm_fw_mac->{$idx} = $mac; + } + return $spbm_fw_mac; +} + +sub rc_spbm_fw_isid { + my $rapidcity = shift; + my $partial = shift; + + my $spbm_fw_ports = $rapidcity->rc_spbm_fw_port($partial); + my $spbm_fw_isid = {}; + foreach my $idx ( keys %$spbm_fw_ports ) { + my ( $isid, $mac ) = _spbm_fdbtable_index($idx); + $spbm_fw_isid->{$idx} = $isid; + } + return $spbm_fw_isid; +} + 1; __END__ @@ -1090,6 +1129,43 @@ Values are ifIndex of the corresponding master ports. =back +=head2 RAPID-CITY Bridge SPBM MAC Table (C) + +=over + +=item $bridge->rc_spbm_fw_mac() + +Returns reference to hash of forwarding table MAC Addresses + +(C) + +=item $rapidcity->rc_spbm_fw_port() + +Returns reference to hash of forwarding table entries port interface +identifier (iid) + +(C) + +=item $rapidcity->rc_spbm_fw_status() + +Returns reference to hash of forwarding table entries status + +(C) + +=item $rapidcity->rc_spbm_fw_vlan() + +Returns reference to hash of forwarding table entries Customer VLAN ID + +(C) + +=item $rapidcity->rc_spbm_fw_isid() + +Returns reference to hash of forwarding table entries ISID + +(C) + +=back + =head1 SET METHODS These are methods that provide SNMP set functionality for overridden methods