SSF.OS.BGP4
Class Route

java.lang.Object
  |
  +--SSF.OS.BGP4.Route
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public class Route
extends java.lang.Object
implements java.io.Externalizable

Information describing a single route. A route is described as a unit of information that pairs a destination with the attributes of a path to that destination. In other words, route = destination + path attributes.

See Also:
Serialized Form

Field Summary
 short as1
          If using the Global.linked_aspaths AS path optimization, this is the first AS in the AS path.
 short[] aspath
          If using the Global.flat_aspaths AS path optimization, this array of short integers will be used instead of an ASpath object in the 'pas' Attribute array.
static java.lang.String[] attrib_dmlnames
          The DML string names of route attributes other than path attributes.
static java.lang.String[] attrib_nhidmlnames
          The NHI versions of the DML string names of route attributes other than path attributes.
static int MAX_TYPECODE
          The maximum route attribute type code for non- path attributes.
static int MIN_TYPECODE
          The minimum route attribute type code for non- path attributes.
 Route next_rte
          If using the Global.linked_aspaths AS path optimization, this is a link to the route which holds the next AS in the AS path.
 IPaddress nlri
          The destination of the route.
static int NLRI_TYPECODE
          A route attribute "type code" value for NLRI.
 Attribute[] pas
          An array of path attributes which describe the path to the destination.
static java.lang.String undefined
          For undefined string values.
 
Constructor Summary
Route()
          Default initializer.
Route(Route rte)
          Constructs a new route based on an existing one.
 
Method Summary
 Aggregator aggregator()
          Returns the aggregator path attribute.
 void append_cluster(long cnum)
          Appends a cluster number to the cluster list attribute.
 int aspath_bytecount()
          Returns the number of octets (bytes) needed to represent this AS path attribute in an update message.
 boolean aspath_contains(java.lang.String asnh)
          Determines whether or not a given AS NHI occurs in the AS path.
 int aspath_length()
          Returns the number of ASes in the AS path attribute.
 java.lang.String aspath_toMinString()
          Returns the AS path as a string, leaving out set/sequence information.
 java.lang.String aspath_toMinString(char sepchar, boolean usenhi)
          Returns the AS path as a string, leaving out set/sequence information.
 ClusterList cluster_list()
          Returns the cluster list path attribute.
 boolean equal_attribs(Route r)
          Returns true only if the two routes have equivalent path attributes.
 boolean equals(java.lang.Object rte)
          Returns true only if the two routes have the same NLRI and path attributes.
 boolean has_aggregator()
          Returns whether or not the aggregator attribute exists.
 boolean has_aspath()
          Returns whether or not the AS path path attribute exists.
 boolean has_atomicagg()
          Returns whether or not the atomic aggregate attribute exists.
 boolean has_cluster_list()
          Returns whether or not the cluster list attribute exists.
 boolean has_localpref()
          Returns whether or not the local preference path attribute exists.
 boolean has_med()
          Returns whether or not the multiple exit discriminator path attribute exists.
 boolean has_nexthop()
          Returns whether or not the next hop path attribute exists.
 boolean has_orig_id()
          Returns whether or not the originator ID attribute exists.
 void incorporate_route(Route r)
          Incorporates the given route into this one (aggregates the two).
 int localpref_bytecount()
          Returns the number of octets (bytes) needed to represent this local preference path attribute in an update message.
 int localpref()
          Returns the value of the local preference attribute.
 int med()
          Returns the value of the multiple exit discriminator attribute.
 int nexthop_bytecount()
          Returns the number of octets (bytes) needed to represent this next hop path attribute in an update message.
 IPaddress nexthop()
          Returns the value of the next hop path attribute.
 IPaddress orig_id()
          Returns the value of the originator ID attribute.
 int origin()
          Returns the value of the origin path attribute.
 void prepend_as(java.lang.String asnh)
          Prepends an AS NHI prefix address to the AS path attribute.
 void prepend_as(java.lang.String asnh, Route r)
          Prepends an AS NHI prefix address to the AS path attribute.
 void readExternal(java.io.DataInput in)
          Reads the contents of this object from a serialization stream.
 void readExternal(java.io.ObjectInput in)
           
 void remove_attrib(int typ)
          Removes a path attribute from the route.
 void set_aggregator(java.lang.String nh, IPaddress ipa)
          Sets the value of the aggregator path attribute.
 void set_atomicagg()
          Adds the atomic aggregate path attribute to the route.
 void set_localpref(int pref)
          Sets the value of the local preference path attribute.
 void set_med(int v)
          Sets the value of the multiple exit discriminator path attribute.
 void set_nexthop(IPaddress nhop)
          Sets the next hop path attribute for this route.
 void set_nlri(IPaddress ipa)
          Sets the value of the NLRI.
 void set_orig_id(IPaddress orig_id)
          Sets the value of the originator ID path attribute.
 void set_origin(int t)
          Sets the value of the origin path attribute.
 void writeExternal(java.io.DataOutput out)
          Writes the contents of this object to a serialization stream.
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

undefined

public static final java.lang.String undefined
For undefined string values.

See Also:
Constant Field Values

attrib_dmlnames

public static final java.lang.String[] attrib_dmlnames
The DML string names of route attributes other than path attributes.


attrib_nhidmlnames

public static final java.lang.String[] attrib_nhidmlnames
The NHI versions of the DML string names of route attributes other than path attributes.


MAX_TYPECODE

public static final int MAX_TYPECODE
The maximum route attribute type code for non- path attributes.

See Also:
Constant Field Values

MIN_TYPECODE

public static final int MIN_TYPECODE
The minimum route attribute type code for non- path attributes.

See Also:
Constant Field Values

NLRI_TYPECODE

public static final int NLRI_TYPECODE
A route attribute "type code" value for NLRI. It is negative since the type codes for path attributes are all positive.

See Also:
Constant Field Values

nlri

public IPaddress nlri
The destination of the route. This is actually just an IP address prefix, so it may represent a specific host, subnet, AS, or perhaps an even larger (possibly geographical) portion of the network.


pas

public Attribute[] pas
An array of path attributes which describe the path to the destination. This information is received via update messages.


aspath

public short[] aspath
If using the Global.flat_aspaths AS path optimization, this array of short integers will be used instead of an ASpath object in the 'pas' Attribute array.


as1

public short as1
If using the Global.linked_aspaths AS path optimization, this is the first AS in the AS path.


next_rte

public Route next_rte
If using the Global.linked_aspaths AS path optimization, this is a link to the route which holds the next AS in the AS path.

Constructor Detail

Route

public Route()
Default initializer.


Route

public Route(Route rte)
Constructs a new route based on an existing one.

Parameters:
rte - The existing route on which to base the new one.
Method Detail

set_nlri

public final void set_nlri(IPaddress ipa)
Sets the value of the NLRI.

Parameters:
ipa - The value to use for the NLRI.

origin

public final int origin()
Returns the value of the origin path attribute.

Returns:
the value of the origin path attribute

set_origin

public final void set_origin(int t)
Sets the value of the origin path attribute. If the attribute does not yet exist, it is created.

Parameters:
t - An origin type code.

has_aspath

public final boolean has_aspath()
Returns whether or not the AS path path attribute exists.

Returns:
true only if the AS_PATH path attribute exists

aspath_length

public final int aspath_length()
Returns the number of ASes in the AS path attribute.

Returns:
the number of ASes in the AS path attribute

aspath_contains

public final boolean aspath_contains(java.lang.String asnh)
Determines whether or not a given AS NHI occurs in the AS path.

Returns:
true if the AS NHI appears in the path

aspath_bytecount

public final int aspath_bytecount()
Returns the number of octets (bytes) needed to represent this AS path attribute in an update message. The number is the sum of the two octets needed for the attribute type (which contains attribute flags and the attribute type code), the one or two octets needed for the attribute length, and the variable number of octets needed for the attribute value.

Returns:
the number of octets (bytes) needed to represent this AS path attribute in an update message

nexthop_bytecount

public int nexthop_bytecount()
Returns the number of octets (bytes) needed to represent this next hop path attribute in an update message. The number is the sum of the two octets needed for the attribute type (which contains attribute flags and the attribute type code), the one octets needed for the attribute length, and the four octets needed for the attribute value.

Returns:
the number of octets (bytes) needed to represent this next hop path attribute in an update message

localpref_bytecount

public int localpref_bytecount()
Returns the number of octets (bytes) needed to represent this local preference path attribute in an update message. The number is the sum of the two octets needed for the attribute type (which contains attribute flags and the attribute type code), the one octet needed for the attribute length, and the four octets needed for the attribute value.

Returns:
the number of octets (bytes) needed to represent this local preference discriminator path attribute in an update message

aspath_toMinString

public final java.lang.String aspath_toMinString()
Returns the AS path as a string, leaving out set/sequence information.

Returns:
the AS path as a string, without set/sequence info

aspath_toMinString

public final java.lang.String aspath_toMinString(char sepchar,
                                                 boolean usenhi)
Returns the AS path as a string, leaving out set/sequence information.

Parameters:
sepchar - The character used to separate AS numbers in the list.
usenhi - Whether or not to show AS numbers as NHI address prefixes.
Returns:
the AS path as a string, without set/sequence info

prepend_as

public final void prepend_as(java.lang.String asnh)
Prepends an AS NHI prefix address to the AS path attribute. Creates the attribute if it does not yet exist.

Parameters:
asnh - The AS NHI prefix address to prepend to the AS path.

prepend_as

public final void prepend_as(java.lang.String asnh,
                             Route r)
Prepends an AS NHI prefix address to the AS path attribute. This version of the method is exclusively for use with the Global.linked_aspaths option. It requires a second argument telling it which Route it should link to for the next number in the AS path.

Parameters:
asnh - The AS NHI prefix address to prepend to the AS path.
r - The Route to link the AS path to.

has_nexthop

public final boolean has_nexthop()
Returns whether or not the next hop path attribute exists.

Returns:
true only if the NEXT_HOP path attribute exists

nexthop

public final IPaddress nexthop()
Returns the value of the next hop path attribute.

Returns:
the value of the next hop path attribute

set_nexthop

public final void set_nexthop(IPaddress nhop)
Sets the next hop path attribute for this route. Creates the attribute if it does not already exist.


has_med

public final boolean has_med()
Returns whether or not the multiple exit discriminator path attribute exists.

Returns:
true only if the MED path attribute exists

med

public final int med()
Returns the value of the multiple exit discriminator attribute.

Returns:
the multiple exit discriminator value

set_med

public final void set_med(int v)
Sets the value of the multiple exit discriminator path attribute. The attribute is created if it does not yet exist.

Parameters:
v - The value to use for the MED.

has_localpref

public final boolean has_localpref()
Returns whether or not the local preference path attribute exists.

Returns:
true only if the local preference path attribute exists

localpref

public final int localpref()
Returns the value of the local preference attribute.

Returns:
the local preference of the route

set_localpref

public final void set_localpref(int pref)
Sets the value of the local preference path attribute. The attribute is created if it does not yet exist.

Parameters:
pref - The value to use for the local preference attribute.

has_atomicagg

public final boolean has_atomicagg()
Returns whether or not the atomic aggregate attribute exists.

Returns:
true only if the atomic aggregate attribute exists

set_atomicagg

public final void set_atomicagg()
Adds the atomic aggregate path attribute to the route.


has_aggregator

public final boolean has_aggregator()
Returns whether or not the aggregator attribute exists.

Returns:
true only if the aggregator attribute exists

aggregator

public final Aggregator aggregator()
Returns the aggregator path attribute.

Returns:
the aggregator path attribute

set_aggregator

public final void set_aggregator(java.lang.String nh,
                                 IPaddress ipa)
Sets the value of the aggregator path attribute. The attribute is created if it does not yet exist.

Parameters:
nh - The AS NHI address prefix of the aggregating BGP speaker.
ipa - The IP address of the aggregating BGP speaker.

has_orig_id

public final boolean has_orig_id()
Returns whether or not the originator ID attribute exists.

Returns:
true only if the originator ID attribute exists

orig_id

public final IPaddress orig_id()
Returns the value of the originator ID attribute.

Returns:
the originator ID of the route

set_orig_id

public final void set_orig_id(IPaddress orig_id)
Sets the value of the originator ID path attribute.


has_cluster_list

public final boolean has_cluster_list()
Returns whether or not the cluster list attribute exists.

Returns:
true only if the cluster list attribute exists

cluster_list

public final ClusterList cluster_list()
Returns the cluster list path attribute.

Returns:
the cluster list path attribute

append_cluster

public final void append_cluster(long cnum)
Appends a cluster number to the cluster list attribute. The attribute is created if it does not yet exist.

Parameters:
cnum - The cluster number to add to the cluster list.

remove_attrib

public final void remove_attrib(int typ)
Removes a path attribute from the route.

Parameters:
typ - The type code of the path attribute to remove.

equals

public final boolean equals(java.lang.Object rte)
Returns true only if the two routes have the same NLRI and path attributes.

Overrides:
equals in class java.lang.Object
Parameters:
rte - The route to compare with this one.
Returns:
true only if the two routes have the same NLRI and path attributes

equal_attribs

public final boolean equal_attribs(Route r)
Returns true only if the two routes have equivalent path attributes.

Returns:
true only if the two sets of path attributes are equivalent

incorporate_route

public final void incorporate_route(Route r)
Incorporates the given route into this one (aggregates the two).

Parameters:
r - The route to be aggregated into this one.

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
java.io.IOException

writeExternal

public void writeExternal(java.io.DataOutput out)
                   throws java.io.IOException
Writes the contents of this object to a serialization stream.

Throws:
java.io.IOException - if there's an error writing the data

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
java.io.IOException
java.lang.ClassNotFoundException

readExternal

public void readExternal(java.io.DataInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Reads the contents of this object from a serialization stream.

Throws:
java.io.IOException - if there's an error reading in the data
java.lang.ClassNotFoundException - if a class name is unrecognized