crawl()
globalHoldTime()
globalLastChange()
globalMessageInterval()
globalRun()
id()
interfaceEnabled()
interfaceNames()
linkTopology()
neighbourAddressTypes()
neighbourAddresses()
neighbourCapabilities()
neighbourCapability()
neighbourDuplexMode()
neighbourHasCapability()
neighbourId()
neighbourLastChange()
neighbourNativeVLAN()
neighbourPlatforms()
neighbourPort()
neighbourVTPMgmtDomain()
neighbourVersions()
neighbours()
$CDP_CACHE_NEIGHBOUR_ADDRESS_TYPES
$CDP_CACHE_NEIGHBOUR_CAPABILITIES
$CDP_CACHE_NEIGHBOUR_DUPLEXES
CDP_CACHE_NEIGHBOUR_ADDRESS_TYPE_IP
CDP_CACHE_NEIGHBOUR_CAPABILITY_HOST
CDP_CACHE_NEIGHBOUR_CAPABILITY_IGMP_CAPABLE
CDP_CACHE_NEIGHBOUR_CAPABILITY_REPEATER
CDP_CACHE_NEIGHBOUR_CAPABILITY_ROUTER
CDP_CACHE_NEIGHBOUR_CAPABILITY_SOURCE_ROUTE_BRIDGE
CDP_CACHE_NEIGHBOUR_CAPABILITY_SWITCH
CDP_CACHE_NEIGHBOUR_CAPABILITY_TRANSPARENT_BRIDGE
CDP_CACHE_NEIGHBOUR_DUPLEX_FULL
CDP_CACHE_NEIGHBOUR_DUPLEX_HALF
CDP_CACHE_NEIGHBOUR_DUPLEX_UNKNOWN
OID_CDP_CACHE_NEIGHBOUR_ADDRESS
OID_CDP_CACHE_NEIGHBOUR_ADDRESS_TYPE
OID_CDP_CACHE_NEIGHBOUR_CAPABILITY
OID_CDP_CACHE_NEIGHBOUR_DUPLEX
OID_CDP_CACHE_NEIGHBOUR_ID
OID_CDP_CACHE_NEIGHBOUR_LAST_CHANGE
OID_CDP_CACHE_NEIGHBOUR_NATIVE_VLAN
OID_CDP_CACHE_NEIGHBOUR_PLATFORM
OID_CDP_CACHE_NEIGHBOUR_PORT
OID_CDP_CACHE_NEIGHBOUR_VERSION
OID_CDP_CACHE_NEIGHBOUR_VTP_MGMT_DOMAIN
OID_CDP_GLOBAL_DEVICE_ID
OID_CDP_GLOBAL_HOLDTIME
OID_CDP_GLOBAL_LAST_CHANGE
OID_CDP_GLOBAL_MESSAGE_INTERVAL
OID_CDP_GLOBAL_RUN
OID_CDP_INTERFACE_ENABLED
OID_CDP_INTERFACE_NAME
A class for performing SNMP V2 queries on Cisco devices
| copyright | Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland |
|---|---|
| author | Barry O'Donovan |
crawl(array $devices, string $device, array $ignore) : array
Array form is same as that returned by neighbours()
| see | \neighbours() |
|---|
arrayUnless you're doing something funky, just pass an empty array. This is where the result will be found.
stringCDP device ID of next host to crawl. On first pass, set to null - used internally when recursing
arrayAn array of CDP device IDs to ignore. I.e. to not include in recursive crawling
arrayThe resultant array of all crawled devices (same as that passed in the @param $devices parameter)globalHoldTime() : int
"The time for the receiving device holds CDP message. The default value is 180 seconds."
intThe time for the receiving device holds CDP messageglobalLastChange() : int
"Indicates the time when the cache table was last changed. It is the most recent time at which any row was last created, modified or deleted."
intThe time (timeticks) when the cache table was last changedglobalMessageInterval() : int
"The interval at which CDP messages are to be generated. The default value is 60 seconds."
intThe interval at which CDP messages are to be generatedglobalRun() : boolean
"An indication of whether the Cisco Discovery Protocol is currently running. Entries in cdpCacheTable are deleted when CDP is disabled."
booleanTrue if enabled globally, else falseid() : string
stringThe device's CDP (Cisco Discovery Protocol) IDinterfaceEnabled() : array
Applies the TruthValue post processor (self::ppTruthValue()) to turn SNMP values into true / false.
arrayThe device's interfaces CDP enabled status' (as boolean true / false)interfaceNames() : array
"The name of the local interface as advertised by CDP in the Port-ID TLV"
arrayThe device's interface names as seen in CDPlinkTopology(array $devices) : array
Huh? This function:
I.e. if a link is found A -> B, then the same B -> A link will not be included
The array returned is, for example:
[cr-sw04.degkcp.example.ie] => Array ( [cd-sw02.degkcp.example.ie] => Array ( [GigabitEthernet1/0/3] => Array ( [remotePort] => FastEthernet0/1 [isLAG] => false )
[cr-sw03.degkcp.example.ie] => Array
(
[GigabitEthernet1/0/23] => Array
(
[remotePort] => GigabitEthernet1/0/23
[isLAG] => false
)
[GigabitEthernet1/0/24] => Array
(
[remotePort] => GigabitEthernet1/0/24
[isLAG] => false
)
)
)
This tells us that cr-sw04(GigabitEthernet1/0/3) is connected to cd-sw02(FastEthernet0/1).
It also tells us that cr-sw04 has two connections to cr-sw03.
You'll notice it also tells us if it's a LAG or not. More information can be added as needed.
| see | \crawl() |
|---|
arrayThe result of crawl() (if null, this function performs a crawl())
arrayL2 topology as described above.neighbourAddressTypes(boolean $translate) : array
"An indication of the type of address contained in the corresponding instance of cdpCacheAddress"
booleanIf true, return the string representation via self::$VTP_VLAN_TYPES
arrayThe CDP neighbours' address type indexed by the current device's port IDneighbourAddresses() : array
"The (first) network-layer address of the device as reported in the Address TLV of the most recently received CDP message. For example, if the corresponding instance of cacheAddressType had the value 'ip(1)', then this object would be an IPv4-address. If the neighbor device is SNMP-manageable, it is supposed to generate its CDP messages such that this address is one at which it will receive SNMP messages. Use cdpCtAddressTable to extract the remaining addresses from the Address TLV received most recently."
arrayThe device's CDP neighbour addresses indexed by the current device's port IDneighbourCapabilities(int $portId, int $translate) : array
Example:
print_r( $host->useCisco_CDP()->neighbourCapabilities( 10111 ) )
[0] => 8 // self::CDP_CACHE_NEIGHBOUR_CAPABILITY_SWITCH
[1] => 32 // self::CDP_CACHE_NEIGHBOUR_CAPABILITY_IGMP_CAPABLE
print_r( $host->useCisco_CDP()->neighbourCapabilities( 10111, true ) )
[0] => "Switch" // self::CDP_CACHE_NEIGHBOUR_CAPABILITY_SWITCH
[1] => "IGMP Capable" // self::CDP_CACHE_NEIGHBOUR_CAPABILITY_IGMP_CAPABLE
intThe CDP neighbour by connected local port ID
intSet to true to return descriptions rather than integers
arrayIndividual capabilities of a given neighbourneighbourCapability() : array
"The Device's Functional Capabilities as reported in the most recent CDP message. For latest set of specific values, see the latest version of the CDP specification. The zero-length string indicates no Capabilities field (TLV) was reported in the most recent CDP message."
| see | \REFERENCE |
|---|---|
| see | \http://www.cisco.com/univercd/cc/td/doc/product/lan/trsrb/frames.htm#xtocid12 |
| see | \http://wiki.wireshark.org/CDP |
arrayThe device's CDP neighbour capabilities (as a decimal integer) indexed by the current device's port IDneighbourDuplexMode(boolean $translate) : array
"The remote device's interface's duplex mode, as reported in the most recent CDP message. The value unknown(1) indicates no duplex mode field (TLV) was reported in the most recent CDP message."
booleanIf true, return the string representation via self::$VTP_VLAN_TYPES
arrayThe remote device's interface's duplex mode (indexed by local portId)neighbourHasCapability(int $portId, int $capability) : boolean
Example:
if( $host->useCisco_CDP()->neighbourHasCapability( $portId, \OSS\SNMP\MIBS\Cisco\CDP::CDP_CACHE_NEIGHBOUR_CAPABILITY_SWITCH ) echo "Host is a switch!!";
intThe CDP neighbour by connected local port ID
intThe capability to query for (defined by self::CDP_CACHE_NEIGHBOUR_CAPABILITY_XXX constants)
booleanTrue if the neighbour has the given capabilityneighbourId() : array
"The Device-ID string as reported in the most recent CDP message. The zero-length string indicates no Device-ID field (TLV) was reported in the most recent CDP message."
arrayThe device's CDP neighbours (by their CDP ID) indexed by the current device's port IDneighbourLastChange() : array
"Indicates the time when this cache entry was last changed. This object is initialised to the current time when the entry gets created and updated to the current time whenever the value of any (other) object instance in the corresponding row is modified."
arrayThe remote device's last change time(indexed by local portId)neighbourNativeVLAN() : array
"The remote device's interface's native VLAN, as reported in the most recent CDP message. The value 0 indicates no native VLAN field (TLV) was reported in the most recent CDP message."
arrayThe remote device's interface's native VLAN (indexed by local portId)neighbourPlatforms() : array
"The Device's Hardware Platform as reported in the most recent CDP message. The zero-length string indicates that no Platform field (TLV) was reported in the most recent CDP message."
arrayThe device's CDP neighbour platforms indexed by the current device's port IDneighbourPort() : array
E.g. a sample call may return:
Array ( [10101] => GigabitEthernet0/1 [10102] => FastEthernet0/2 [10103] => GigabitEthernet1/0/24 [10105] => GigabitEthernet1/0/2 )
meaning, for example, that our local port with ID 10101 is connected to port GigabitEthernet0/1 on the neighbour connected to that local port. You can discover the neighbour ID via neighbourId().
"The Port-ID string as reported in the most recent CDP message. This will typically be the value of the ifName object (e.g., 'Ethernet0'). The zero-length string indicates no Port-ID field (TLV) was reported in the most recent CDP message."
| see | \neighbourId() |
|---|
arrayThe device's CDP neighbours connected port *description* indexed by the current device's port IDneighbourVTPMgmtDomain() : array
"The VTP Management Domain for the remote device's interface, as reported in the most recently received CDP message. This object is not instantiated if no VTP Management Domain field (TLV) was reported in the most recently received CDP message."
| see | \REFERENCE |
|---|
arrayThe device's CDP neighbours' VTP management domain indexed by the current device's port IDneighbourVersions() : array
"The Version string as reported in the most recent CDP message. The zero-length string indicates no Version field (TLV) was reported in the most recent CDP message."
arrayThe device's CDP neighbour version indexed by the current device's port IDneighbours() : array
Returns an array of neighbours indexed by the neighbour CDP ID. For example:
Array ( [cr-sw03.ixdub1.opensolutions.ie] => Array ( [0] => Array ( [localPortId] => 10101 [localPort] => GigabitEthernet1/0/1 [remotePort] => GigabitEthernet0/1 )
[1] => Array
(
[localPortId] => 10102
[localPort] => GigabitEthernet1/0/2
[remotePort] => FastEthernet0/2
)
)
[ ... ]
)
| see | \neighbourId() |
|---|---|
| see | \OSS\SNMP\MIBS\Interface::descriptions() |
| see | \neighbourPort() |
arrayCDP neighbours and their connected ports$CDP_CACHE_NEIGHBOUR_ADDRESS_TYPES
$CDP_CACHE_NEIGHBOUR_CAPABILITIES
$CDP_CACHE_NEIGHBOUR_DUPLEXES
CDP_CACHE_NEIGHBOUR_ADDRESS_TYPE_IP
CDP_CACHE_NEIGHBOUR_CAPABILITY_HOST
CDP_CACHE_NEIGHBOUR_CAPABILITY_IGMP_CAPABLE
CDP_CACHE_NEIGHBOUR_CAPABILITY_REPEATER
CDP_CACHE_NEIGHBOUR_CAPABILITY_ROUTER
CDP_CACHE_NEIGHBOUR_CAPABILITY_SOURCE_ROUTE_BRIDGE
CDP_CACHE_NEIGHBOUR_CAPABILITY_SWITCH
CDP_CACHE_NEIGHBOUR_CAPABILITY_TRANSPARENT_BRIDGE
CDP_CACHE_NEIGHBOUR_DUPLEX_FULL
CDP_CACHE_NEIGHBOUR_DUPLEX_HALF
CDP_CACHE_NEIGHBOUR_DUPLEX_UNKNOWN
OID_CDP_CACHE_NEIGHBOUR_ADDRESS
OID_CDP_CACHE_NEIGHBOUR_ADDRESS_TYPE
OID_CDP_CACHE_NEIGHBOUR_CAPABILITY
OID_CDP_CACHE_NEIGHBOUR_DUPLEX
OID_CDP_CACHE_NEIGHBOUR_ID
OID_CDP_CACHE_NEIGHBOUR_LAST_CHANGE
OID_CDP_CACHE_NEIGHBOUR_NATIVE_VLAN
OID_CDP_CACHE_NEIGHBOUR_PLATFORM
OID_CDP_CACHE_NEIGHBOUR_PORT
OID_CDP_CACHE_NEIGHBOUR_VERSION
OID_CDP_CACHE_NEIGHBOUR_VTP_MGMT_DOMAIN
OID_CDP_GLOBAL_DEVICE_ID
OID_CDP_GLOBAL_HOLDTIME
OID_CDP_GLOBAL_LAST_CHANGE
OID_CDP_GLOBAL_MESSAGE_INTERVAL
OID_CDP_GLOBAL_RUN
OID_CDP_INTERFACE_ENABLED
OID_CDP_INTERFACE_NAME