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

Class AppRouteTable


This class represents an application route table. It provides application the ability to add, remove and replace route from the application route table. The following services are provided:

Add, replace and remove route from the application route table.Get notification when the added application route is promoted or demoted in the RIB.

Depending on platform, the application route table could do extra check before adding the route to the RIB. For example, route may be added to the RIB when the next hop is resolvable.

Once the application accept and return success for the operation, the application is responsible to keep the state of the routes consistent across HA switchover.

The route added will not be visible in the configuration. But the added route would be visible in routing related show commands. The show output will be able to tell which application added the route. The added route are redistributable.

If a listener is registered, the application route table will provide notification when an application route gets promoted or demoted in the RIB.

Currently, only add/delete/update route operations are supported.

Instance Methods
list of L3UnicastRouteOperation
update_routes(self, scope, opList)
Update a route.
int
async_update_routes(self, scope, op_list, listener, client_data)
Asynchronously update a route.
int
add_route_state_listener(self, routeStateListener, scope, flags, clientData)
Adds a route state listener to the ART object.
 
remove_route_state_listener(self, eventHandle)
Removes the RouteStateListener listener object.
int
add_replay_route_event_listener(self, listener, scope, client_data)
Adds a replay route event listener to the RIB object.
 
remove_replay_route_event_listener(self, eventHandle)
Removes the ReplayRouteEventListener listener object.

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

Class Variables
  RouteState = enum('PROMOTE', 'DEMOTE')
This enum represents a route state and support L2/L3 and IPv4/IPv6.
  TRIGER_INITIAL_WALK = 1
Properties

Inherited from object: __class__

Method Details

update_routes(self, scope, opList)

 

Update a route. It is a synchronous API. It is used to add, delete and replace single route in the Application Route Table. The type of operation is indicated by RouteOperationType parameter.

For route addition: If the route do not exist, create route with the provided next hops. If the route already exist in the table, any new next hop specified is added to the route. Duplicated next hop is ignored.

For route replace: If the route do not exist, it act like route addition operation. If the route already exist in the table, the all the old next hops are removed and new next hops specified are added to the route.

For route deletion: Next hop specified will be removed. If no next hop is specified, then all next hops are removed. The route will be removed when no more next hops exist.

Return error if the scope and route is not consistent.

This method will make remote procedure call and response time may be long.

Parameters:
  • scope (L3UnicastScope) - Indicate which table in the Application Route Table to send the route operation too.
  • opList (list of L3UnicastRouteOperation) - The list of route operation. If API succeeds, per route per next hop status are returned and could be accessed using Route.error_code and NextHop.eror_code
Returns: list of L3UnicastRouteOperation
A list of the route operation. This list is a copy of the routes in the input parameter, with error code for each route added.
Raises:

async_update_routes(self, scope, op_list, listener, client_data)

 

Asynchronously update a route. It is an asynchronous API that will return immediately and the application provided listener will be invoked when the all the route update requests are processed by the network element.

It is used to add, delete and replace single route in the Application Route Table. The type of operation is indicated by RouteOperationType parameter.

For route addition: If the route do not exist, create route with the provided next hops. If the route already exist in the table, any new next hop specified is added to the route Duplicated next hop is ignored.

For route replace: If the route do not exist, it act like route addition operation. If the route already exist in the table, the all the old next hops are removed and new next hops specified are added to the route.

If no next hop is specified, then all next hops are removed. The route will be removed when no more next hops exist.

Return error if the scope and route is not consistent.

This method will make remote procedure call and response time may be long.

Parameters:
  • scope (Scope) - Indicate which table in the Application Route Table to send the route operation too.
  • op_list (list of L3UnicastRouteOperation) - The list of route operation. If API succeeds, per route per next hop status are returned and could be accessed using Route.error_code and NextHop.error_code
  • listener (UpdateRouteResponseListener) - The UpdateRouteResponseListener object that handles the events.
  • client_data - 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.
Returns: int
An identifier for this asynchronous update request. Could be used to monitor the status or cancel the request.
Raises:

add_route_state_listener(self, routeStateListener, scope, flags, clientData)

 

Adds a route state listener to the ART object.

Parameters:
  • routeStateListener (ARTRouteStateListener) - The RouteStateListener object that handles the events.
  • scope (L3UnicastScope) - Indicate which table in the Application Route Table get notification from.
  • flags (int) - Additional flags to be passed to listener. This argument is reserved for future use and ignored at present.
  • clientData - 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.
Returns: int
EventHandle, a numeric ID associated with this event registration. The eventHandle is used to unregister the listener using the remove_route_state_listener 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 route table.

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

add_replay_route_event_listener(self, listener, scope, client_data)

 

Adds a replay route event listener to the RIB object.

Parameters:
  • listener (ReplayRouteEventListener) - The ReplayRouteEventListener object that handles the events.
  • scope (L3UnicastScope) - Indicate which table in the Application Route Table get notification from.
  • client_data - 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.
Returns: int
EventHandle, a numeric ID associated with this event registration. The eventHandle is used to unregister the listener using the remove_route_state_listener method If registration fails, -1 is returned.
Raises:

remove_replay_route_event_listener(self, eventHandle)

 

Removes the ReplayRouteEventListener listener object. This method will remove the listener associated with the specified eventHandle and also remove the corresponding registered event on the route table.

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

Class Variable Details

RouteState

This enum represents a route state and support L2/L3 and IPv4/IPv6. Indicates the route becomes the best route in the RIB.'PROMOTE', Indicates the route is no longer the best route in the RIB.'DEMOTE'

Value:
enum('PROMOTE', 'DEMOTE')