.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "SNMP::Info::CDP 3pm" .TH SNMP::Info::CDP 3pm "2019-02-25" "perl v5.28.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" SNMP::Info::CDP \- SNMP Interface to Cisco Discovery Protocol (CDP) using SNMP .SH "AUTHOR" .IX Header "AUTHOR" Max Baker .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 7 \& my $cdp = new SNMP::Info ( \& AutoSpecify => 1, \& Debug => 1, \& DestHost => \*(Aqrouter\*(Aq, \& Community => \*(Aqpublic\*(Aq, \& Version => 2 \& ); \& \& my $class = $cdp\->class(); \& print " Using device sub class : $class\en"; \& \& $hascdp = $cdp\->hasCDP() ? \*(Aqyes\*(Aq : \*(Aqno\*(Aq; \& \& # Print out a map of device ports with CDP neighbors: \& my $interfaces = $cdp\->interfaces(); \& my $cdp_if = $cdp\->cdp_if(); \& my $cdp_ip = $cdp\->cdp_ip(); \& my $cdp_port = $cdp\->cdp_port(); \& \& foreach my $cdp_key (keys %$cdp_ip){ \& my $iid = $cdp_if\->{$cdp_key}; \& my $port = $interfaces\->{$iid}; \& my $neighbor = $cdp_ip\->{$cdp_key}; \& my $neighbor_port = $cdp_port\->{$cdp_key}; \& print "Port : $port connected to $neighbor / $neighbor_port\en"; \& } .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" SNMP::Info::CDP is a subclass of SNMP::Info that provides an object oriented interface to \s-1CDP\s0 information through \s-1SNMP.\s0 .PP \&\s-1CDP\s0 is a Layer 2 protocol that supplies topology information of devices that also speak \s-1CDP,\s0 mostly switches and routers. \s-1CDP\s0 is implemented in Cisco and some \s-1HP\s0 devices. .PP Create or use a device subclass that inherits this class. Do not use directly. .PP 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. .SS "Inherited Classes" .IX Subsection "Inherited Classes" None. .SS "Required MIBs" .IX Subsection "Required MIBs" .IP "\fICISCO-CDP-MIB\fR" 4 .IX Item "CISCO-CDP-MIB" .PP MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz .SH "GLOBAL METHODS" .IX Header "GLOBAL METHODS" These are methods that return scalar values from \s-1SNMP\s0 .ie n .IP "$cdp\->\fBhasCDP()\fR" 4 .el .IP "\f(CW$cdp\fR\->\fBhasCDP()\fR" 4 .IX Item "$cdp->hasCDP()" Is \s-1CDP\s0 is active in this device? .Sp Accounts for \s-1SNMP\s0 version 1 devices which may have \s-1CDP\s0 but not \fBcdp_run()\fR .ie n .IP "$cdp\->\fBcdp_run()\fR" 4 .el .IP "\f(CW$cdp\fR\->\fBcdp_run()\fR" 4 .IX Item "$cdp->cdp_run()" Is \s-1CDP\s0 enabled on this device? Note that a lot of Cisco devices that implement \s-1CDP\s0 don't implement this value. @#%$! .Sp (\f(CW\*(C`cdpGlobalRun\*(C'\fR) .ie n .IP "$cdp\->\fBcdp_interval()\fR" 4 .el .IP "\f(CW$cdp\fR\->\fBcdp_interval()\fR" 4 .IX Item "$cdp->cdp_interval()" Interval in seconds at which \s-1CDP\s0 messages are generated. .Sp (\f(CW\*(C`cdpGlobalMessageInterval\*(C'\fR) .ie n .IP "$cdp\->\fBcdp_holdtime()\fR" 4 .el .IP "\f(CW$cdp\fR\->\fBcdp_holdtime()\fR" 4 .IX Item "$cdp->cdp_holdtime()" Time in seconds that \s-1CDP\s0 messages are kept. .Sp (\f(CW\*(C`cdpGlobalHoldTime\*(C'\fR) .ie n .IP "$cdp\->\fBcdp_gid()\fR" 4 .el .IP "\f(CW$cdp\fR\->\fBcdp_gid()\fR" 4 .IX Item "$cdp->cdp_gid()" Returns \s-1CDP\s0 device \s-1ID.\s0 .Sp This is the device id broadcast via \s-1CDP\s0 to other devices, and is what is retrieved from remote devices with \f(CW$cdp\fR\->\fBid()\fR. .Sp (\f(CW\*(C`cdpGlobalDeviceId\*(C'\fR) .SH "TABLE METHODS" .IX Header "TABLE METHODS" These are methods that return tables of information in the form of a reference to a hash. .SS "\s-1CDP CACHE ENTRIES\s0" .IX Subsection "CDP CACHE ENTRIES" .ie n .IP "$cdp\->\fBcdp_capabilities()\fR" 4 .el .IP "\f(CW$cdp\fR\->\fBcdp_capabilities()\fR" 4 .IX Item "$cdp->cdp_capabilities()" Returns Device Functional Capabilities. Results are munged into an ascii binary string, \s-1MSB.\s0 Each digit represents a bit from the table below from the \s-1CDP\s0 Capabilities Mapping to Smartport Type table within the Cisco Small Business 200 Series Smart Switch Administration Guide, : .Sp (Bit) \- Description .RS 4 .IP "(0x400) \- Two-Port \s-1MAC\s0 Relay." 4 .IX Item "(0x400) - Two-Port MAC Relay." .PD 0 .IP "(0x200) \- \s-1CAST\s0 Phone Port / \s-1CVTA /\s0 Supports-STP-Dispute depending upon platform." 4 .IX Item "(0x200) - CAST Phone Port / CVTA / Supports-STP-Dispute depending upon platform." .IP "(0x100) \- Remotely-Managed Device." 4 .IX Item "(0x100) - Remotely-Managed Device." .IP "(0x80) \- VoIP Phone." 4 .IX Item "(0x80) - VoIP Phone." .IP "(0x40) \- Provides level 1 functionality." 4 .IX Item "(0x40) - Provides level 1 functionality." .IP "(0x20) \- The bridge or switch does not forward \s-1IGMP\s0 Report packets on non router ports." 4 .IX Item "(0x20) - The bridge or switch does not forward IGMP Report packets on non router ports." .IP "(0x10) \- Sends and receives packets for at least one network layer protocol. If the device is routing the protocol, this bit should not be set." 4 .IX Item "(0x10) - Sends and receives packets for at least one network layer protocol. If the device is routing the protocol, this bit should not be set." .IP "(0x08) \- Performs level 2 switching. The difference between this bit and bit 0x02 is that a switch does not run the Spanning-Tree Protocol. This device is assumed to be deployed in a physical loop-free topology." 4 .IX Item "(0x08) - Performs level 2 switching. The difference between this bit and bit 0x02 is that a switch does not run the Spanning-Tree Protocol. This device is assumed to be deployed in a physical loop-free topology." .IP "(0x04) \- Performs level 2 source-route bridging. A source-route bridge would set both this bit and bit 0x02." 4 .IX Item "(0x04) - Performs level 2 source-route bridging. A source-route bridge would set both this bit and bit 0x02." .IP "(0x02) \- Performs level 2 transparent bridging." 4 .IX Item "(0x02) - Performs level 2 transparent bridging." .IP "(0x01) \- Performs level 3 routing for at least one network layer protocol." 4 .IX Item "(0x01) - Performs level 3 routing for at least one network layer protocol." .RE .RS 4 .PD .Sp Thanks to Martin Lorensen for a pointer to the original information and \&\s-1CPAN\s0 user Alex for updates. .Sp (\f(CW\*(C`cdpCacheCapabilities\*(C'\fR) .RE .ie n .IP "$cdp\->\fBcdp_domain()\fR" 4 .el .IP "\f(CW$cdp\fR\->\fBcdp_domain()\fR" 4 .IX Item "$cdp->cdp_domain()" Returns remote \s-1VTP\s0 Management Domain as defined in \&\f(CW\*(C`CISCO\-VTP\-MIB::managementDomainName\*(C'\fR .Sp (\f(CW\*(C`cdpCacheVTPMgmtDomain\*(C'\fR) .ie n .IP "$cdp\->\fBcdp_duplex()\fR" 4 .el .IP "\f(CW$cdp\fR\->\fBcdp_duplex()\fR" 4 .IX Item "$cdp->cdp_duplex()" Returns the port duplex status from remote devices. .Sp (\f(CW\*(C`cdpCacheDuplex\*(C'\fR) .ie n .IP "$cdp\->\fBcdp_id()\fR" 4 .el .IP "\f(CW$cdp\fR\->\fBcdp_id()\fR" 4 .IX Item "$cdp->cdp_id()" Returns remote device id string .Sp (\f(CW\*(C`cdpCacheDeviceId\*(C'\fR) .ie n .IP "$cdp\->\fBcdp_if()\fR" 4 .el .IP "\f(CW$cdp\fR\->\fBcdp_if()\fR" 4 .IX Item "$cdp->cdp_if()" Returns the mapping to the \s-1SNMP\s0 Interface Table. .Sp Note that a lot devices don't implement \f(CW$cdp\fR\->\fBcdp_index()\fR, So if it isn't around, we fake it. .Sp In order to map the cdp table entry back to the \fBinterfaces()\fR entry, we truncate the last number off of it : .Sp .Vb 3 \& # it exists, yay. \& my $cdp_index = $device\->cdp_index(); \& return $cdp_index if defined $cdp_index; \& \& # if not, let\*(Aqs fake it \& my $cdp_ip = $device\->cdp_ip(); \& \& my %cdp_if \& foreach my $key (keys %$cdp_ip){ \& $iid = $key; \& ## Truncate off .1 from cdp response \& $iid =~ s/\e.\ed+$//; \& $cdp_if{$key} = $iid; \& } \& \& return \e%cdp_if; .Ve .ie n .IP "$cdp\->\fBcdp_index()\fR" 4 .el .IP "\f(CW$cdp\fR\->\fBcdp_index()\fR" 4 .IX Item "$cdp->cdp_index()" Returns the mapping to the \s-1SNMP2\s0 Interface table for \s-1CDP\s0 Cache Entries. .Sp Most devices don't implement this, so you probably want to use \f(CW$cdp\fR\->\fBcdp_if()\fR instead. .Sp See \fBcdp_if()\fR entry. .Sp (\f(CW\*(C`cdpCacheIfIndex\*(C'\fR) .ie n .IP "$cdp\->\fBcdp_ip()\fR" 4 .el .IP "\f(CW$cdp\fR\->\fBcdp_ip()\fR" 4 .IX Item "$cdp->cdp_ip()" If \f(CW$cdp\fR\->\fBcdp_proto()\fR is supported, returns remote \s-1IPV4\s0 address only. Otherwise it will return all addresses. .Sp (\f(CW\*(C`cdpCacheAddress\*(C'\fR) .ie n .IP "$cdp\->\fBcdp_addr()\fR" 4 .el .IP "\f(CW$cdp\fR\->\fBcdp_addr()\fR" 4 .IX Item "$cdp->cdp_addr()" Returns remote address .Sp (\f(CW\*(C`cdpCacheAddress\*(C'\fR) .ie n .IP "$cdp\->\fBcdp_platform()\fR" 4 .el .IP "\f(CW$cdp\fR\->\fBcdp_platform()\fR" 4 .IX Item "$cdp->cdp_platform()" Returns remote platform id .Sp (\f(CW\*(C`cdpCachePlatform\*(C'\fR) .ie n .IP "$cdp\->\fBcdp_port()\fR" 4 .el .IP "\f(CW$cdp\fR\->\fBcdp_port()\fR" 4 .IX Item "$cdp->cdp_port()" Returns remote port \s-1ID\s0 .Sp (\f(CW\*(C`cdpDevicePort\*(C'\fR) .ie n .IP "$cdp\->\fBcdp_proto()\fR" 4 .el .IP "\f(CW$cdp\fR\->\fBcdp_proto()\fR" 4 .IX Item "$cdp->cdp_proto()" Returns remote address type received. Usually \s-1IP.\s0 .Sp (\f(CW\*(C`cdpCacheAddressType\*(C'\fR) .ie n .IP "$cdp\->\fBcdp_ver()\fR" 4 .el .IP "\f(CW$cdp\fR\->\fBcdp_ver()\fR" 4 .IX Item "$cdp->cdp_ver()" Returns remote hardware version .Sp (\f(CW\*(C`cdpCacheVersion\*(C'\fR) .ie n .IP "$cdp\->\fBcdp_vlan()\fR" 4 .el .IP "\f(CW$cdp\fR\->\fBcdp_vlan()\fR" 4 .IX Item "$cdp->cdp_vlan()" Returns the remote interface native \s-1VLAN.\s0 .Sp (\f(CW\*(C`cdpCacheNativeVLAN\*(C'\fR) .ie n .IP "$cdp\->\fBcdp_power()\fR" 4 .el .IP "\f(CW$cdp\fR\->\fBcdp_power()\fR" 4 .IX Item "$cdp->cdp_power()" Returns the amount of power consumed by remote device in milliwatts munged for decimal placement. .Sp (\f(CW\*(C`cdpCachePowerConsumption\*(C'\fR) .ie n .IP "$cdp\->\fBcdp_cap()\fR" 4 .el .IP "\f(CW$cdp\fR\->\fBcdp_cap()\fR" 4 .IX Item "$cdp->cdp_cap()" Returns hash of arrays with each array containing the system capabilities supported by the remote system. Possible elements in the array are \&\f(CW\*(C`Router\*(C'\fR, \f(CW\*(C`Trans\-Bridge\*(C'\fR, \f(CW\*(C`Source\-Route\-Bridge\*(C'\fR, \f(CW\*(C`Switch\*(C'\fR, \f(CW\*(C`Host\*(C'\fR, \&\f(CW\*(C`IGMP\*(C'\fR, \f(CW\*(C`Repeater\*(C'\fR, \f(CW\*(C`VoIP\-Phone\*(C'\fR, \f(CW\*(C`Remotely\-Managed\-Device\*(C'\fR, \&\f(CW\*(C`Supports\-STP\-Dispute\*(C'\fR, and \f(CW\*(C`Two\-port Mac Relay\*(C'\fR. .SH "Data Munging Callback Subroutines" .IX Header "Data Munging Callback Subroutines" .ie n .IP "$cdp\->\fBmunge_power()\fR" 4 .el .IP "\f(CW$cdp\fR\->\fBmunge_power()\fR" 4 .IX Item "$cdp->munge_power()" Inserts a decimal at the proper location.