A class for performing SNMP V2 BGP queries

see |
copyright | Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
author | Barry O'Donovan

### Methods

## Get the SNMP instance

    getSNMP() : \OSS_SNMP\SNMP

### Returns

`\OSS_SNMP\SNMP`Instance of the SNMP object

## Returns the local BGP identifier

    identifier() : string

> "The BGP Identifier of local system."

### Returns

`string`The BGP Identifier of local system.

## Returns the local BGP AS number

    localASN() : int

> "The local autonomous system number."

### Returns

`int`The local autonomous system number.

## Returns the BGP peer admin states (see `self::$BGP_PEER_ADMIN_STATES`)

    peerAdminStates(bool $translate = false) : array

> "The desired state of the BGP connection. A transition from 'stop' to 'start' will > cause the BGP Start Event to be generated. A transition from 'start' to 'stop' will > cause the BGP Stop Event to be generated. This parameter can be used to restart BGP > peer connections. Care should be used in providing write access to this object > without adequate authentication."

### Parameters

#### $translate

`bool`

If true, use the `$BGP_PEER_ADMIN_STATES` array to return textual representation

### Returns

`array`The BGP peer admin states (see `self::$BGP_PEER_ADMIN_STATES`)

## Returns Time interval in seconds for the ConnectRetry timer.

    peerConnectRetryIntervals() : array

> "Time interval in seconds for the ConnectRetry timer. The suggested value > for this timer is 120 seconds."

### Returns

`array`Time interval in seconds for the ConnectRetry timer.

## Returns the BGP peer connection state (see `self::$BGP_PEER_CONNECTION_STATES`)

    peerConnectionStates(bool $translate = false) : array

> "The BGP peer connection state."

### Parameters

#### $translate

`bool`

If true, use the `$BGP_PEER_CONNECTION_STATES` array to return textual representation

### Returns

`array`The BGP peer connection state (see `self::$BGP_PEER_CONNECTION_STATES`)

## Utility function to gather all peer information into a single array.

    peerDetails(bool $translate = false) : array

For example, this would return something like: Array ( .... [192.0.2.126] => Array ( [identity] => 192.0.2.45 [connectionState] => established [adminState] => start [negotiatedVersion] => 4 [localAddress] => 193.242.111.74 [localPort] => 26789 [remoteAddress] => 192.0.2.126 [remotePort] => 179 [remoteASN] => 65505 [inUpdates] => 4 [outUpdates] => 2 [inTotalMessages] => 180988 [outTotalMessages] => 181012 [lastError] => 0000 [establishedTransitions] => 1 [establishedTime] => 9867469 [connectRetryInterval] => 60 [holdTime] => 180 [keepAlive] => 60 [holdTimeConfigured] => 180 [keepAliveConfigured] => 60 [minASOriginationInterval] => 30 [minRouteAdvertisementInterval] => 30 [inUpdateElapsedTime] => 0 ) .... )

### Parameters

#### $translate

`bool`

Where a called function supports translation, if true then translate

### Returns

`array`Array of peer details - see example above.

## Returns The total number of times the BGP FSM transitioned into the established state.

    peerEstabledTransitions() : array

> "The total number of times the BGP FSM transitioned into the established state."

### Returns

`array`The total number of times the BGP FSM transitioned into the established state.

## Returns how long (in seconds) this peer has been in the Established state or how long since this peer was last in the Established state

    peerEstablishedTimes() : array

> "This timer indicates how long (in seconds) this peer has been in the > Established state or how long since this peer was last in the > Established state. It is set to zero when a new peer is configured or the router is > booted"

### Returns

`array`How long (secs) this peer has been in (or since it was last in) the Established state

## Returns Time interval in seconds for the Hold Timer established with the peer.

    peerHoldTimes() : array

> "Time interval in seconds for the Hold Timer established with the peer. The > value of this object is calculated by this BGP speaker by using the smaller of the > value in bgpPeerHoldTimeConfigured and the Hold Time received in the OPEN message. > This value must be at lease three seconds if it is not zero (0) in which case the > Hold Timer has not been established with the peer, or, the value of > bgpPeerHoldTimeConfigured is zero (0)."

### Returns

`array`Time interval in seconds for the Hold Timer established with the peer.

## Returns Time interval in seconds for the Hold Time configured for this BGP speaker with this peer.

    peerHoleTimesConfigured() : array

> "Time interval in seconds for the Hold Time configured for this BGP speaker with this > peer. This value is placed in an OPEN message sent to this peer by this BGP > speaker, and is compared with the Hold Time field in an OPEN message received > from the peer when determining the Hold Time (bgpPeerHoldTime) with the peer. > This value must not be less than three seconds if it is not zero (0) in which > case the Hold Time is NOT to be established with the peer. The suggested > value for this timer is 90 seconds."

### Returns

`array`Time interval in seconds for the Hold Time configured for this BGP speaker with this peer.

## Returns the BGP identifier of all peers indexed by neighbour IPv4 address

    peerIdentifiers() : array

> "The BGP Identifier of this entry's BGP peer."

### Returns

`array`Returns the BGP identifier of all peers indexed by neighbour IPv4 address

## Returns The total number of messages received from the remote peer on this connection.

    peerInTotalMessages() : array

> "The total number of messages received from the remote peer on this connection. > This object should be initialized to zero when the connection is established."

### Returns

`array`The total number of messages received from the remote peer on this connection.

## Returns Elapsed time in seconds since the last BGP UPDATE message was received from the peer.

    peerInUpdateElapsedTimes() : array

> "Elapsed time in seconds since the last BGP UPDATE message was received from the peer. > Each time bgpPeerInUpdates is incremented, the value of this object is set to zero (0)."

### Returns

`array`Elapsed time in seconds since the last BGP UPDATE message was received from the peer.

## Returns The number of BGP UPDATE messages received on this connection.

    peerInUpdates() : array

> "The number of BGP UPDATE messages received on this connection. This object > should be initialized to zero (0) when the connection is established."

### Returns

`array`The number of BGP UPDATE messages received on this connection.

## Returns Time interval in seconds for the KeepAlive timer established with the peer.

    peerKeepAlives() : array

> "Time interval in seconds for the KeepAlive timer established with the peer. The value > of this object is calculated by this BGP speaker such that, when compared with > bgpPeerHoldTime, it has the same proportion as what bgpPeerKeepAliveConfigured has when > compared with bgpPeerHoldTimeConfigured. If the value of this object is zero (0), > it indicates that the KeepAlive timer has not been established with the peer, or, > the value of bgpPeerKeepAliveConfigured is zero (0)."

### Returns

`array`Time interval in seconds for the KeepAlive timer established with the peer.

## Returns Time interval in seconds for the KeepAlive timer configured for this BGP speaker with this peer.

    peerKeepAlivesConfigured() : array

> "Time interval in seconds for the KeepAlive timer configured for this BGP > speaker with this peer. The value of this object will only determine the > KEEPALIVE messages' frequency relative to the value specified in > bgpPeerHoldTimeConfigured; the actual time interval for the KEEPALIVE messages > is indicated by bgpPeerKeepAlive. A reasonable maximum value for this timer > would be configured to be one third of that of bgpPeerHoldTimeConfigured. > If the value of this object is zero (0), no periodical KEEPALIVE messages are sent > to the peer after the BGP connection has been established. The suggested value for > this timer is 30 seconds"

### Returns

`array`Time interval in seconds for the KeepAlive timer configured for this BGP speaker with this peer.

## Returns The last error code and subcode seen by this peer on this connection.

    peerLastErrors() : array

> "The last error code and subcode seen by this peer on this connection. If no error has > occurred, this field is zero. Otherwise, the first byte of this two byte OCTET STRING > contains the error code, and the second byte contains the subcode."

### Returns

`array`The last error code and subcode seen by this peer on this connection.

## Returns the local IP address of this entry's BGP connection.

    peerLocalAddresses() : array

> "The local IP address of this entry's BGP connection."

### Returns

`array`The local IP address of this entry's BGP connection.

## Returns the local ports for the TCP connections between the BGP peers.

    peerLocalPorts() : array

> "The local port for the TCP connection between the BGP peers."

### Returns

`array`The local ports for the TCP connections between the BGP peers.

## Returns Time interval in seconds for the MinASOriginationInterval timer.

    peerMinASOriginationIntervals() : array

> "Time interval in seconds for the MinASOriginationInterval timer. > The suggested value for this timer is 15 seconds."

### Returns

`array`Time interval in seconds for the MinASOriginationInterval timer.

## Returns Time interval in seconds for the MinRouteAdvertisementInterval timer.

    peerMinRouteAdvertisementIntervals() : array

> "Time interval in seconds for the MinRouteAdvertisementInterval timer. > The suggested value for this timer is 30 seconds"

### Returns

`array`Time interval in seconds for the MinRouteAdvertisementInterval timer.

## Returns the negotiated version of BGP running between the two peers

    peerNegotiatedVersions() : array

> "The negotiated version of BGP running between the two peers"

### Returns

`array`The negotiated version of BGP running between the two peers

## Returns The total number of messages transmitted to the remote peer on this connection.

    peerOutTotalMessages() : array

> "The total number of messages transmitted to the remote peer on this connection. This > object should be initialized to zero when the connection is established."

### Returns

`array`The total number of messages transmitted to the remote peer on this connection.

## Returns The number of BGP UPDATE messages transmitted on this connection.

    peerOutUpdates() : array

> "The number of BGP UPDATE messages transmitted on this connection. This > object should be initialized to zero (0) when the connection is established."

### Returns

`array`The number of BGP UPDATE messages transmitted on this connection.

## Returns The remote autonomous system number.

    peerRemoteASNs() : array

> "The remote autonomous system number."

### Returns

`array`The remote autonomous system number.

## Returns the local IP address of this entry's BGP peer.

    peerRemoteAddresses() : array

> "The remote IP address of this entry's BGP peer."

### Returns

`array`The remote IP address of this entry's BGP peer.

## Returns the remote ports for the TCP connections between the BGP peers.

    peerRemotePorts() : array

> "The remote port for the TCP connection between the BGP peers."

### Returns

`array`The remote ports for the TCP connections between the BGP peers.

## Set the SNMP instance

    setSNMP(\OSS_SNMP\SNMP $snmp) : \OSS_SNMP\MIB

### Parameters

#### $snmp

`\OSS_SNMP\SNMP`

the SNMP instance

### Returns

`\OSS_SNMP\MIB`An instance of this class for fluent interfaces

## Returns the BGP version

    version() : string

> "Vector of supported BGP protocol version numbers. Each peer negotiates the version > from this vector. Versions are identified via the string of bits contained within this > object. The first octet contains bits 0 to 7, the second octet contains bits 8 to 15, > and so on, with the most significant bit referring to the lowest bit number in the > octet (e.g., the MSB of the first octet refers to bit 0). If a bit, i, is present > and set, then the version (i+1) of the BGP is supported."

### Returns

`string`Returns the BGP version

### Properties

## Look up for text representation of BGP peer admin states

    $BGP_PEER_ADMIN_STATES : array

### Default

`array(self::BGP_PEER_ADMIN_STATE_STOP => 'stop', self::BGP_PEER_ADMIN_STATE_START => 'start')`
Static

## Look up for text representation of BGP peer connection states

    $BGP_PEER_CONNECTION_STATES : array

### Default

`array(self::BGP_PEER_CONNECTION_STATE_IDLE => 'idle', self::BGP_PEER_CONNECTION_STATE_CONNECT => 'connect', self::BGP_PEER_CONNECTION_STATE_ACTIVE => 'active', self::BGP_PEER_CONNECTION_STATE_OPENSENT => 'opensent', self::BGP_PEER_CONNECTION_STATE_OPENCONFIRM => 'openconfirm', self::BGP_PEER_CONNECTION_STATE_ESTABLISHED => 'established')`
Static

## Instance for the SNMP object

    $_snmp

### Default

`null`

### Constants

## Possible value for peer admin state

    BGP_PEER_ADMIN_STATE_START = 2 : int

## Possible value for peer admin state

    BGP_PEER_ADMIN_STATE_STOP = 1 : int

## Possible value for peer connection state

    BGP_PEER_CONNECTION_STATE_ACTIVE = 3 : int

## Possible value for peer connection state

    BGP_PEER_CONNECTION_STATE_CONNECT = 2 : int

## Possible value for peer connection state

    BGP_PEER_CONNECTION_STATE_ESTABLISHED = 6 : int

## Possible value for peer connection state

    BGP_PEER_CONNECTION_STATE_IDLE = 1 : int

## Possible value for peer connection state

    BGP_PEER_CONNECTION_STATE_OPENCONFIRM = 5 : int

## Possible value for peer connection state

    BGP_PEER_CONNECTION_STATE_OPENSENT = 4 : int

## OID_BGP_IDENTIFIER

    OID_BGP_IDENTIFIER = '.1.3.6.1.2.1.15.4.0'

## OID_BGP_LOCAL_ASN

    OID_BGP_LOCAL_ASN = '.1.3.6.1.2.1.15.2.0'

## OID_BGP_PATH_ATTR_ADDR_PREFIX

    OID_BGP_PATH_ATTR_ADDR_PREFIX = '.1.3.6.1.2.1.15.6.1.3'

## OID_BGP_PATH_ATTR_ADDR_PREFIX_LENGTH

    OID_BGP_PATH_ATTR_ADDR_PREFIX_LENGTH = '.1.3.6.1.2.1.15.6.1.2'

## OID_BGP_PATH_ATTR_AGGREGATOR_ADDR

    OID_BGP_PATH_ATTR_AGGREGATOR_ADDR = '.1.3.6.1.2.1.15.6.1.11'

## OID_BGP_PATH_ATTR_AGGREGATOR_AS

    OID_BGP_PATH_ATTR_AGGREGATOR_AS = '.1.3.6.1.2.1.15.6.1.10'

## OID_BGP_PATH_ATTR_AS_PATH_SEGMENT

    OID_BGP_PATH_ATTR_AS_PATH_SEGMENT = '.1.3.6.1.2.1.15.6.1.5'

## OID_BGP_PATH_ATTR_ATOMIC_AGGREGATE

    OID_BGP_PATH_ATTR_ATOMIC_AGGREGATE = '.1.3.6.1.2.1.15.6.1.9'

## OID_BGP_PATH_ATTR_BEST

    OID_BGP_PATH_ATTR_BEST = '.1.3.6.1.2.1.15.6.1.13'

## OID_BGP_PATH_ATTR_CALC_LOCAL_PREF

    OID_BGP_PATH_ATTR_CALC_LOCAL_PREF = '.1.3.6.1.2.1.15.6.1.12'

## OID_BGP_PATH_ATTR_LOCAL_PREF

    OID_BGP_PATH_ATTR_LOCAL_PREF = '.1.3.6.1.2.1.15.6.1.8'

## OID_BGP_PATH_ATTR_MED

    OID_BGP_PATH_ATTR_MED = '.1.3.6.1.2.1.15.6.1.7'

## OID_BGP_PATH_ATTR_NEXT_HOP

    OID_BGP_PATH_ATTR_NEXT_HOP = '.1.3.6.1.2.1.15.6.1.6'

## OID_BGP_PATH_ATTR_ORIGIN

    OID_BGP_PATH_ATTR_ORIGIN = '.1.3.6.1.2.1.15.6.1.4'

## OID_BGP_PATH_ATTR_PEER

    OID_BGP_PATH_ATTR_PEER = '.1.3.6.1.2.1.15.6.1.1'

## OID_BGP_PATH_ATTR_UNKNOWN

    OID_BGP_PATH_ATTR_UNKNOWN = '.1.3.6.1.2.1.15.6.1.14'

## OID_BGP_PEER_ADMIN_STATE

    OID_BGP_PEER_ADMIN_STATE = '.1.3.6.1.2.1.15.3.1.3'

## OID_BGP_PEER_CONNECTION_STATE

    OID_BGP_PEER_CONNECTION_STATE = '.1.3.6.1.2.1.15.3.1.2'

## OID_BGP_PEER_CONNECT_RETRY_INTERVAL

    OID_BGP_PEER_CONNECT_RETRY_INTERVAL = '.1.3.6.1.2.1.15.3.1.17'

## OID_BGP_PEER_FSM_ESTABLISHED_TIME

    OID_BGP_PEER_FSM_ESTABLISHED_TIME = '.1.3.6.1.2.1.15.3.1.16'

## OID_BGP_PEER_FSM_ESTABLISHED_TRANSITIONS

    OID_BGP_PEER_FSM_ESTABLISHED_TRANSITIONS = '.1.3.6.1.2.1.15.3.1.15'

## OID_BGP_PEER_HOLD_TIME

    OID_BGP_PEER_HOLD_TIME = '.1.3.6.1.2.1.15.3.1.18'

## OID_BGP_PEER_HOLD_TIME_CONFIGURED

    OID_BGP_PEER_HOLD_TIME_CONFIGURED = '.1.3.6.1.2.1.15.3.1.20'

## OID_BGP_PEER_IDENTIFIER

    OID_BGP_PEER_IDENTIFIER = '.1.3.6.1.2.1.15.3.1.1'

## OID_BGP_PEER_IN_TOTAL_MESSAGES

    OID_BGP_PEER_IN_TOTAL_MESSAGES = '.1.3.6.1.2.1.15.3.1.12'

## OID_BGP_PEER_IN_UPDATES

    OID_BGP_PEER_IN_UPDATES = '.1.3.6.1.2.1.15.3.1.10'

## OID_BGP_PEER_IN_UPDATE_ELAPSED_TIME

    OID_BGP_PEER_IN_UPDATE_ELAPSED_TIME = '.1.3.6.1.2.1.15.3.1.24'

## OID_BGP_PEER_KEEP_ALIVE

    OID_BGP_PEER_KEEP_ALIVE = '.1.3.6.1.2.1.15.3.1.19'

## OID_BGP_PEER_KEEP_ALIVE_CONFIGURED

    OID_BGP_PEER_KEEP_ALIVE_CONFIGURED = '.1.3.6.1.2.1.15.3.1.21'

## OID_BGP_PEER_LAST_ERROR

    OID_BGP_PEER_LAST_ERROR = '.1.3.6.1.2.1.15.3.1.14'

## OID_BGP_PEER_LOCAL_ADDRESS

    OID_BGP_PEER_LOCAL_ADDRESS = '.1.3.6.1.2.1.15.3.1.5'

## OID_BGP_PEER_LOCAL_PORT

    OID_BGP_PEER_LOCAL_PORT = '.1.3.6.1.2.1.15.3.1.6'

## OID_BGP_PEER_MIN_AS_ORIGINATION_INTERVAL

    OID_BGP_PEER_MIN_AS_ORIGINATION_INTERVAL = '.1.3.6.1.2.1.15.3.1.22'

## OID_BGP_PEER_MIN_ROUTE_ADVERTISEMENT_INTERVAL

    OID_BGP_PEER_MIN_ROUTE_ADVERTISEMENT_INTERVAL = '.1.3.6.1.2.1.15.3.1.23'

## OID_BGP_PEER_NEGOTIATED_VERSION

    OID_BGP_PEER_NEGOTIATED_VERSION = '.1.3.6.1.2.1.15.3.1.4'

## OID_BGP_PEER_OUT_TOTAL_MESSAGES

    OID_BGP_PEER_OUT_TOTAL_MESSAGES = '.1.3.6.1.2.1.15.3.1.13'

## OID_BGP_PEER_OUT_UPDATES

    OID_BGP_PEER_OUT_UPDATES = '.1.3.6.1.2.1.15.3.1.11'

## OID_BGP_PEER_REMOTE_ADDR

    OID_BGP_PEER_REMOTE_ADDR = '.1.3.6.1.2.1.15.3.1.7'

## OID_BGP_PEER_REMOTE_ASN

    OID_BGP_PEER_REMOTE_ASN = '.1.3.6.1.2.1.15.3.1.9'

## OID_BGP_PEER_REMOTE_PORT

    OID_BGP_PEER_REMOTE_PORT = '.1.3.6.1.2.1.15.3.1.8'

## OID_BGP_VERSION

    OID_BGP_VERSION = '.1.3.6.1.2.1.15.1.0'