SSF.OS.BGP4.Path
Class ASpath

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

public class ASpath
extends Attribute

The AS path attribute. An AS path is composed of a sequence of AS path segments, where each segment is either an unordered set of AS numbers or an ordered sequence of AS numbers. It is well-known and mandatory.

See Also:
Serialized Form

Field Summary
static java.lang.String dmlname
          The name of the path attribute as a DML attribute.
static java.lang.String name
          The name of the attribute as a string.
static java.lang.String nhidmlname
          The name of the NHI form of the path attribute as a DML attribute.
 java.util.ArrayList segs
          An ordered list of AS path segments.
static int TYPECODE
          The AS path attribute type code.
 
Fields inherited from class SSF.OS.BGP4.Path.Attribute
dmlnames, MAX_TYPECODE, MIN_TYPECODE, names, nhidmlnames, undefined
 
Constructor Summary
ASpath()
          Empty constructor.
ASpath(java.util.ArrayList l)
          Constructs an AS path attribute given a list of path segments.
 
Method Summary
 void append_segment(Segment ps)
          Appends a path segment to the list of segments.
 int bytecount()
          Returns the number of octets (bytes) needed to represent this AS path attribute in an update message.
 boolean contains(java.lang.String asnh)
          Determines whether or not the path contains a given AS.
 Attribute copy()
          Constructs and returns a copy of the attribute.
 boolean equals(Attribute attrib)
          Determines whether or not this path attribute is equivalent to another.
 int length()
          Returns the number of ASes in the path.
 boolean opt()
          Returns whether the path attribute is optional (true) or well-known (false).
 boolean partial()
          Returns whether or not the information contained in the optional transitive attribute is partial (true) or complete (false).
 void prepend_as(java.lang.String asnh)
          Prepends an AS NHI address prefix to an AS_SEQUENCE segment at the beginning of the list of segments.
 void readExternal(java.io.DataInput in)
          Reads the contents of this object from a serialization stream.
 void readExternal(java.io.ObjectInput in)
           
 java.lang.String toMinString()
          Returns the AS path as a string, leaving out set/sequence information.
 java.lang.String toMinString(char sepchar, boolean usenhi)
          Returns the AS path as a string, leaving out set/sequence information.
 java.lang.String toString()
          Returns the AS path as a string.
 boolean trans()
          Returns whether an optional attribute is transitive (true) or non-transitive (false).
 void writeExternal(java.io.DataOutput out)
          Writes the contents of this object to a serialization stream.
 void writeExternal(java.io.ObjectOutput out)
          Writes the contents of this object to a data stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPECODE

public static final int TYPECODE
The AS path attribute type code.

See Also:
Constant Field Values

name

public static final java.lang.String name
The name of the attribute as a string.

See Also:
Constant Field Values

dmlname

public static final java.lang.String dmlname
The name of the path attribute as a DML attribute.

See Also:
Constant Field Values

nhidmlname

public static final java.lang.String nhidmlname
The name of the NHI form of the path attribute as a DML attribute.

See Also:
Constant Field Values

segs

public java.util.ArrayList segs
An ordered list of AS path segments.

Constructor Detail

ASpath

public ASpath()
Empty constructor. Used to deserialize this object.


ASpath

public ASpath(java.util.ArrayList l)
Constructs an AS path attribute given a list of path segments.

Parameters:
l - A list of path segments.
Method Detail

copy

public Attribute copy()
Constructs and returns a copy of the attribute.

Specified by:
copy in class Attribute
Returns:
a copy of the attribute

opt

public final boolean opt()
Description copied from class: Attribute
Returns whether the path attribute is optional (true) or well-known (false).

Specified by:
opt in class Attribute

trans

public final boolean trans()
Description copied from class: Attribute
Returns whether an optional attribute is transitive (true) or non-transitive (false). For well-known attributes it must be true.

Specified by:
trans in class Attribute

partial

public final boolean partial()
Description copied from class: Attribute
Returns whether or not the information contained in the optional transitive attribute is partial (true) or complete (false). For well-known attributes and for optional non-transitive attributes, it must be false.

Specified by:
partial in class Attribute

length

public final int length()
Returns the number of ASes in the path.

Returns:
the number of ASes in the path

contains

public final boolean contains(java.lang.String asnh)
Determines whether or not the path contains a given AS.

Parameters:
asnh - The NHI prefix address of the AS to look for in the AS path.
Returns:
true only if the AS was in the AS path

append_segment

public final void append_segment(Segment ps)
Appends a path segment to the list of segments.

Parameters:
ps - The path segment to append to the list of segments.

prepend_as

public final void prepend_as(java.lang.String asnh)
Prepends an AS NHI address prefix to an AS_SEQUENCE segment at the beginning of the list of segments. A new AS_SEQUENCE segment is created at the beginning if necessary.

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

bytecount

public int 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.

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

equals

public boolean equals(Attribute attrib)
Determines whether or not this path attribute is equivalent to another.

Specified by:
equals in class Attribute
Parameters:
attrib - A path attribute to compare to this one.
Returns:
true only if the two attributes are equivalent

toMinString

public final java.lang.String 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

toMinString

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

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

toString

public final java.lang.String toString()
Returns the AS path as a string.

Overrides:
toString in class java.lang.Object
Returns:
the AS path as a string

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Description copied from class: Attribute
Writes the contents of this object to a data stream.

Specified by:
writeExternal in interface java.io.Externalizable
Overrides:
writeExternal in class Attribute
Throws:
java.io.IOException - if there's an error writing the data

writeExternal

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

Overrides:
writeExternal in class Attribute
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
Overrides:
readExternal in class Attribute
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.

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