be.ac.ucl.ingi.totem.repository
Class CBGP

java.lang.Object
  extended by be.ac.ucl.ingi.totem.repository.CBGP
All Implemented Interfaces:
CBGPSimulator, TotemAlgorithm

public class CBGP
extends java.lang.Object
implements CBGPSimulator

This class implements the Routing interface and is used to compute the interdomain routes available from a node towards a destination. The class relies on the C-BGP's JNI interface.

Author:
Bruno Quoitin (bqu@info.ucl.ac.be), Olivier Delcourt (delcourt@run.montefiore.ulg.ac.be)

TODO: - enhance the error handling. There is currently no information provided by the JNI interface about the cause of errors. - support multiple domains (waiting for multiple domains support in the InterDomainManager class). - add all the C-BGP JNI methods... - the C-BGP JNI methods are currently not synchronized. It is the responsibility of the developper to avoid calling these methods simultaneously from multiple execution threads.

****************************************************************** WARNING: DO NOT CALL THE METHODS DEFINED BELOW SIMULTANEOUSLY FROM MULTIPLE EXECUTION THREADS. UNEXPECTED RESULTS MAY OCCUR ! ******************************************************************


Field Summary
protected  boolean optVerbose
           
protected static java.util.ArrayList<ParameterDescriptor> params
           
 
Constructor Summary
CBGP()
           
 
Method Summary
 void bgpDomainRescan(Domain domain)
          Used to rescan the routes after IGP changes
 java.util.Vector<be.ac.ucl.ingi.cbgp.bgp.Route> bgpRouterGetAdjRib(java.lang.String sRouterAddr, java.lang.String sPeerAddr, java.lang.String sPrefix, boolean bIn)
          Returns a vector with the BGP routes in the Adj-RIB(s) of this router.
 java.util.Vector<be.ac.ucl.ingi.cbgp.bgp.Peer> bgpRouterGetPeers(java.lang.String sRouterAddr)
          Returns a vector with the neighbors of this router.
 java.util.Vector bgpRouterGetRib(java.lang.String sRouterAddr, java.lang.String sPrefix)
          Returns a vector with the BGP routes in the RIB of this node.
 void bgpRouterLoadRib(java.lang.String sRouterAddr, java.lang.String sFileName)
          Load the RIB contained in the given filename into the given router's RIB.
 void bgpRouterPeerRecv(java.lang.String sRouterAddr, java.lang.String sPeerAddr, java.lang.String sMsg)
          Send a BGP message in MRT format to the given router, through the given peer.
 void bgpRouterPeerUp(java.lang.String sRouterAddr, java.lang.String sPeerAddr, boolean bUp)
          Change the status of the BGP session between a router and one of its neighbors.
 void computeIGP(Domain domain)
          For each domain, for each node, compute the intradomain routes.
 java.util.HashMap getRunningParameters()
          Returns the parameters given when the algorithm was started
 java.util.List<ParameterDescriptor> getStartAlgoParameters()
          Returns the optional parameters that can be given when starting the algorithm
 void netLinkUp(java.lang.String sSrcAddr, java.lang.String sDstAddr, boolean bUp)
          Change the status of a link
 void netLinkWeight(java.lang.String sSrcAddr, java.lang.String sDstAddr, int iWeight)
          Change the metric of a link
 java.util.Vector netNodeGetLinks(java.lang.String sNodeAddr)
          Returns a vector with the links adjacent to this node.
 java.util.Vector netNodeGetRT(java.lang.String sNodeAddr, java.lang.String sPrefix)
          Returns a vector with the routes currently in the routing table of this node.
 be.ac.ucl.ingi.cbgp.IPTrace netNodeRecordRoute(java.lang.String sNodeAddr, java.lang.String sDstAddr)
          Returns an IPTrace object that contains the record-route status, the list of IP address hops, the total delay and the total IGP weight.
 void runCmd(java.lang.String sCommand)
          Send a "raw" command to the C-BGP instance.
 void simRun()
          Run the C-BGP simulator.
 void start()
          Implements the 'start' method defined by the TotemAlgorithm interface.
 void start(java.util.HashMap params)
          Implements the 'start' method defined by the TotemAlgorithm interface.
 void stop()
          Implements the 'stop' method defined by the TotemAlgorithm interface.
 void updateLinksWeights(Domain domain)
          Update Weights in CBGP with TE weights values TODO: solve the problem with asymmetric links
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

optVerbose

protected boolean optVerbose

params

protected static final java.util.ArrayList<ParameterDescriptor> params
Constructor Detail

CBGP

public CBGP()
Method Detail

updateLinksWeights

public void updateLinksWeights(Domain domain)
                        throws RoutingException
Update Weights in CBGP with TE weights values TODO: solve the problem with asymmetric links

Parameters:
domain -
Throws:
RoutingException

computeIGP

public void computeIGP(Domain domain)
                throws RoutingException
For each domain, for each node, compute the intradomain routes.

AT THIS TIME, COMPUTES THE IGP ROUTES AS IF THERE WAS A SINGLE DOMAIN !

Throws:
RoutingException

start

public void start(java.util.HashMap params)
Implements the 'start' method defined by the TotemAlgorithm interface. The method retrieves the topology contained in the topology manager, and setup nodes, links and BGP routers inside the CBGP instance.

Specified by:
start in interface TotemAlgorithm

start

public void start()
Implements the 'start' method defined by the TotemAlgorithm interface. The method retrieves the topology contained in the topology manager, and setup nodes, links and BGP routers inside the CBGP instance.


stop

public void stop()
Implements the 'stop' method defined by the TotemAlgorithm interface.

Specified by:
stop in interface TotemAlgorithm

runCmd

public void runCmd(java.lang.String sCommand)
            throws RoutingException
Send a "raw" command to the C-BGP instance.

Specified by:
runCmd in interface CBGPSimulator
Parameters:
sCommand - the command
Throws:
RoutingException

simRun

public void simRun()
            throws RoutingException
Run the C-BGP simulator.

Specified by:
simRun in interface CBGPSimulator
Throws:
RoutingException

netNodeGetLinks

public java.util.Vector netNodeGetLinks(java.lang.String sNodeAddr)
                                 throws RoutingException
Returns a vector with the links adjacent to this node. Each element in the vector is an object of class be.ac.ucl.ingi.cbgp.Link

Specified by:
netNodeGetLinks in interface CBGPSimulator
Parameters:
sNodeAddr - the IP address of the node
Returns:
a vector with Link objects describing the node's links
Throws:
RoutingException

netNodeGetRT

public java.util.Vector netNodeGetRT(java.lang.String sNodeAddr,
                                     java.lang.String sPrefix)
                              throws RoutingException
Returns a vector with the routes currently in the routing table of this node. Each element in the vector is an object of class be.ac.ucl.ingi.cbgp.IPRoute

Specified by:
netNodeGetRT in interface CBGPSimulator
Parameters:
sNodeAddr - the IP address of the node
sPrefix - a filter for routes to return
Returns:
a vector with IPRoute objects describing the node's routes
Throws:
RoutingException

netNodeRecordRoute

public be.ac.ucl.ingi.cbgp.IPTrace netNodeRecordRoute(java.lang.String sNodeAddr,
                                                      java.lang.String sDstAddr)
                                               throws RoutingException
Returns an IPTrace object that contains the record-route status, the list of IP address hops, the total delay and the total IGP weight.

Specified by:
netNodeRecordRoute in interface CBGPSimulator
Parameters:
sNodeAddr - the IP address of the source node
sDstAddr - the IP address of the destination node
Returns:
an IPTrace object containing the results
Throws:
RoutingException

bgpDomainRescan

public void bgpDomainRescan(Domain domain)
                     throws RoutingException
Used to rescan the routes after IGP changes

Parameters:
domain -
Throws:
RoutingException

bgpRouterGetPeers

public java.util.Vector<be.ac.ucl.ingi.cbgp.bgp.Peer> bgpRouterGetPeers(java.lang.String sRouterAddr)
                                                                 throws RoutingException
Returns a vector with the neighbors of this router. Each element in the vector is an object of class be.ac.ucl.ingi.cbgp.BGPPeer

Specified by:
bgpRouterGetPeers in interface CBGPSimulator
Parameters:
sRouterAddr - the IP address of the BGP router
Returns:
a vector with BGPPeer objects describing the router's neighbors
Throws:
RoutingException

bgpRouterGetRib

public java.util.Vector bgpRouterGetRib(java.lang.String sRouterAddr,
                                        java.lang.String sPrefix)
                                 throws RoutingException
Returns a vector with the BGP routes in the RIB of this node. Each element in the vector is an object of class be.ac.ucl.ingi.cbgp.BGPRoute

Specified by:
bgpRouterGetRib in interface CBGPSimulator
Parameters:
sRouterAddr - the IP address of the BGP router
sPrefix - a filter for the routes to return
Returns:
a vector with BGPRoute objects describing the router's BGP routes
Throws:
RoutingException

bgpRouterGetAdjRib

public java.util.Vector<be.ac.ucl.ingi.cbgp.bgp.Route> bgpRouterGetAdjRib(java.lang.String sRouterAddr,
                                                                          java.lang.String sPeerAddr,
                                                                          java.lang.String sPrefix,
                                                                          boolean bIn)
                                                                   throws RoutingException
Returns a vector with the BGP routes in the Adj-RIB(s) of this router. Each element in the vector is an object of class be.ac.ucl.ingi.cbgp.BGPRoute

Specified by:
bgpRouterGetAdjRib in interface CBGPSimulator
Parameters:
sRouterAddr - the IP address of the BGP router
sPeerAddr - the IP address of one peer of the router (may be null if the Adj-RIB of all peers mut be returned)
sPrefix - a filter for the routes to return
Returns:
a vector with BGPRoute objects describing the router's BGP routes
Throws:
RoutingException

bgpRouterPeerRecv

public void bgpRouterPeerRecv(java.lang.String sRouterAddr,
                              java.lang.String sPeerAddr,
                              java.lang.String sMsg)
                       throws RoutingException
Send a BGP message in MRT format to the given router, through the given peer.

Specified by:
bgpRouterPeerRecv in interface CBGPSimulator
Parameters:
sRouterAddr - the IP address of the BGP router
sPeerAddr - the IP address of the peer
sMsg - the BGP message in MRT format
Throws:
RoutingException

bgpRouterPeerUp

public void bgpRouterPeerUp(java.lang.String sRouterAddr,
                            java.lang.String sPeerAddr,
                            boolean bUp)
                     throws RoutingException
Change the status of the BGP session between a router and one of its neighbors.

Specified by:
bgpRouterPeerUp in interface CBGPSimulator
Parameters:
sRouterAddr - the IP address of the BGP router
sPeerAddr - the IP address of the BGP router's neighbor
bUp - a boolean indicating the requested status. True means the session up and false means the session down.
Throws:
RoutingException

bgpRouterLoadRib

public void bgpRouterLoadRib(java.lang.String sRouterAddr,
                             java.lang.String sFileName)
                      throws RoutingException
Load the RIB contained in the given filename into the given router's RIB. The RIB must be provided in ASCII MRT (not compressed). There are also restrictions on the BGP routes that can be loaded into the router (check on the next-hop, etc). Have a look at C-BGP's documentation for more information!

Specified by:
bgpRouterLoadRib in interface CBGPSimulator
Parameters:
sRouterAddr - the IP address of the BGP router
sFileName - the name of the file that contains the RIB.
Throws:
RoutingException

getStartAlgoParameters

public java.util.List<ParameterDescriptor> getStartAlgoParameters()
Description copied from interface: TotemAlgorithm
Returns the optional parameters that can be given when starting the algorithm

Specified by:
getStartAlgoParameters in interface TotemAlgorithm
Returns:
the list of algorithm parameters

getRunningParameters

public java.util.HashMap getRunningParameters()
Description copied from interface: TotemAlgorithm
Returns the parameters given when the algorithm was started

Specified by:
getRunningParameters in interface TotemAlgorithm
Returns:

netLinkUp

public void netLinkUp(java.lang.String sSrcAddr,
                      java.lang.String sDstAddr,
                      boolean bUp)
Change the status of a link

Parameters:
sSrcAddr - l'adresse IP du routeur source du lien
sDstAddr - l'adresse IP du routeur destination du lien
bUp - le status du noeud (true = UP)

netLinkWeight

public void netLinkWeight(java.lang.String sSrcAddr,
                          java.lang.String sDstAddr,
                          int iWeight)
                   throws RoutingException
Change the metric of a link

Parameters:
sSrcAddr - l'adresse IP du routeur source du lien
sDstAddr - l'adresse IP du routeur destination du lien
iWeight - la nouvelle métrique
Throws:
RoutingException


Copyright © 2004-2007 Research Unit in Networking, All Rights Reserved.