Package onep :: Package routing :: Module RIB :: Class RIB
[frames] | no frames]

Class RIB


RIB class represents service provided by RIB (Routing Information Base).

Instance Methods
 
__init__(self, parent_rss)
Constructor for RIB
 
get_route_list(self, scope, filter, range)
Gets the RIB routes from the network element for the specified scope, filter and range.
int
add_route_state_listener(self, route_state_listener, scope, filter, flag, client_data)
Adds a route state listener to the RIB object.
 
remove_route_state_listener(self, eventHandle)
Removes the RouteStateListener listener object.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables
  RouteState = enum('UP', 'DOWN', 'UNKNOWN')
  TRIGER_INITIAL_WALK = 1
Properties

Inherited from object: __class__

Method Details

__init__(self, parent_rss)
(Constructor)

 

Constructor for RIB

Overrides: object.__init__

get_route_list(self, scope, filter, range)

 

Gets the RIB routes from the network element for the specified scope, filter and range. This method will make remote procedure call and response time may be long.

Only routes which satisfy the filter and range are retrieved. This method may not return all the number of routes as specified in the range count per invocation. The platform controls the maximum number of routes returned per invocation. To retrieve all the routes matching the criteria, the application may have to call the method multiple times, adjusting the start prefix and the type in the range argument accordingly, until a list of size 0 is returned.

Also, to prevent connection timeout when getting a long list of routes, application should increase the timeout by calling the following method before connecting to a network element #NetworkApplicaiton.set_default_socket_timeout(300)

Parameters:
  • scope (L3unicastScope) - Indicates which table in the RIB to retrieve route from.
  • filter (L3UnicastRIBFilter) - Specifies characteristic of a route must match for it to be retrieved. Use default filter (instantiated with default constructor) if no filtering is needed.the same as if a filter with all default values passed in.
  • range (L3UnicastRouteRange) - Specifies range of route to be retrieved. Use default range (instantiated with default constructor) if no range matching is needed.

add_route_state_listener(self, route_state_listener, scope, filter, flag, client_data)

 

Adds a route state listener to the RIB object.

Parameters:
  • route_state_listener (RIBRouteStateListener) - The RouteStateListener object that handles the events.
  • scope (L3UnicastScope) - Indicates which table in the RIB to retrieve route from.
  • filter (L3UnicastRIBFilter) - Specifies characteristic of a route must match for it to be retrieved
  • client_data (str) - The client data associated with the listener. This client data will be part of input parameters when the handleEvent method in the listener is invoked.
  • flag (int) - Additional request when the listener is installed. If TRIGER_INITIAL_WALK is set, triggers an initial walk of the RIB and reports an UP event to the application for each route that matches rib_filter. The TRIGER_INITIAL_WALK flag is supported only on network elements that run IOS Classic or IOS-XE. On IOS-XR and NXOS, TRIGER_INITIAL_WALK is ignored; an initial walk is always performed.
Returns: int
EventHandle, a numeric ID associated with this event registration. The eventHandle is used to unregister the listener using the removeRouteStateListener method. If registration fails, -1 is returned.
Raises:

remove_route_state_listener(self, eventHandle)

 

Removes the RouteStateListener listener object. This method will remove the listener associated with the specified eventHandle and also remove the corresponding registered event on the RIB.

Parameters:
  • eventHandle (int) - Registered event identifier
Raises: