SNMP::Info::FDP - Perl5 Interface to Foundry Discovery Protocol (FDP) using SNMP
Max Baker (max@warped.org)
my $fdp = new SNMP::Info (
AutoSpecify => 1,
Debug => 1,
DestHost => 'router',
Community => 'public',
Version => 2
);
my $class = $fdp->class(); print " Using device sub class : $class\n";
$hasfdp = $fdp->hasFDP() ? 'yes' : 'no';
# Print out a map of device ports with FDP neighbors: my $interfaces = $fdp->interfaces(); my $fdp_if = $fdp->fdp_if(); my $fdp_ip = $fdp->fdp_ip(); my $fdp_port = $fdp->fdp_port();
foreach my $fdp_key (keys %$fdp_ip){
my $iid = $fdp_if->{$fdp_key};
my $port = $interfaces->{$iid};
my $neighbor = $fdp_ip->{$fdp_key};
my $neighbor_port = $fdp_port->{$fdp_key};
print "Port : $port connected to $neighbor / $neighbor_port\n";
}
SNMP::Info::FDP is a subclass of SNMP::Info that provides an object oriented interface to FDP information through SNMP.
FDP is a Layer 2 protocol that supplies topology information of devices that also speak FDP, mostly switches and routers. It has similar functionality to Cisco's CDP, and the SNMP interface is virtually identical. FDP is implemented in Foundry devices, including the Bigiron and Fastiron range.
Create or use a device subclass that inherits this class. Do not use directly.
Each device implements a subset of the global and cache entries. Check the return value to see if that data is held by the device.
None.
MIBs are normally distributed with each code update. Contact your vendor, or trawl through google...
These are methods that return scalar values from SNMP
hasFDP()Accounts for SNMP version 1 devices which may have FDP but not fdp_run()
fdp_run()(fdpGlobalRun)
fdp_interval()(fdpGlobalMessageInterval)
fdp_holdtime()(fdpGlobalHoldTime)
fdp_id()This is the device id broadcast via FDP to other devices, and is what is retrieved from remote devices with $fdp->id().
(fdpGlobalDeviceId)
These are methods that return tables of information in the form of a reference to a hash.
fdp_capabilities()From http://www.cisco.com/univercd/cc/td/doc/product/lan/trsrb/frames.htm#18843:
(Bit) - Description
Thanks to Martin Lorensen martin -at- lorensen.dk for a pointer to this information.
(fdpCacheCapabilities)
fdp_domain()(fdpCacheVTPMgmtDomain)
fdp_duplex()(fdpCacheDuplex)
fdp_id()(fdpCacheDeviceId)
fdp_if()Note that a lot devices don't implement $fdp->fdp_index(), So if it isn't around, we fake it.
In order to map the fdp table entry back to the interfaces() entry, we truncate the last number
off of it :
# it exists, yay. my $fdp_index = $device->fdp_index(); return $fdp_index if defined $fdp_index;
# if not, let's fake it
my $fdp_ip = $device->fdp_ip();
my %fdp_if
foreach my $key (keys %$fdp_ip){
$iid = $key;
## Truncate off .1 from fdp response
$iid =~ s/\.\d+$//;
$fdp_if{$key} = $iid;
}
return \%fdp_if;
fdp_index()Most devices don't implement this, so you probably want to use $fdp->fdp_if() instead.
See fdp_if() entry.
(fdpCacheIfIndex)
fdp_ip()(fdpCacheAddress)
fdp_platform()(fdpCachePlatform)
fdp_port()(fdpDevicePort)
fdp_proto()(fdpCacheAddressType)
fdp_ver()(fdpCacheVersion)
fdp_vlan()(fdpCacheNativeVLAN)