com.foxsmart.csu.config.global
Class IpRouteEntry

java.lang.Object
  extended by com.foxsmart.csu.config.CiscoRouterConfigParser
      extended by com.foxsmart.csu.config.global.IpRouteEntry
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable

public class IpRouteEntry
extends CiscoRouterConfigParser
implements java.io.Serializable, java.lang.Comparable

The IpRouteEntry class represents a unique IP route.

See Also:
Serialized Form

Field Summary
static java.lang.String GLOBAL
           
static java.lang.Integer MAX_DISTANCE_METRIC
          The maximum distance metric.
static java.lang.Long MAX_TAG_VALUE
          The maximum tag value.
static java.lang.Integer MIN_DISTANCE_METRIC
          The minimum distance metric.
static java.lang.Long MIN_TAG_VALUE
          The minimum tag value.
static java.lang.String NAME
           
static java.lang.String PERMANENT
           
static java.lang.String TAG
           
static java.lang.String VRF
           
 
Fields inherited from class com.foxsmart.csu.config.CiscoRouterConfigParser
log, NO, tokenIndex
 
Constructor Summary
IpRouteEntry()
          Constructs an IP route entry.
 
Method Summary
 void buildFromIos(java.lang.String line)
          Builds the IP route entry from the passed in IOS line.
 int compareTo(java.lang.Object object)
          Compares this object to the passed in IpRouteEntry object.
 boolean equals(java.lang.Object object)
          Checks the passed in IpRouteEntry object for equality.
 java.lang.String generateDeleteIosStringForDestination()
          Generates the IOS configuration to delete this route entry and all others that share the same destination (i.e.
 java.lang.String generateIosString()
          Generates the IOS configuration for this route entry.
 IpAddress getDestinationPrefix()
          Gets the destination prefix.
 IpAddress getDestinationPrefixMask()
          Gets the destination prefix mask.
 java.lang.Integer getDistanceMetric()
          Gets the distance metric for this route.
 boolean getGlobalFlag()
          Gets whether the next hop is global.
 IpAddress getNextHopAddress()
          Gets the next hop address.
 InterfaceComponent getNextHopInterface()
          Gets the next hop interface.
 java.lang.String getNextHopName()
          Gets the name of the next hop.
 boolean getPermanentRouteFlag()
          Gets whether this route is permanent.
 java.lang.Long getTagValue()
          Gets the tag value for this route.
 java.lang.String getVrfName()
          Gets the VRF name.
 void setDestinationPrefix(IpAddress destinationPrefix)
          Sets the destination prefix.
 void setDestinationPrefixMask(IpAddress destinationPrefixMask)
          Sets the destination prefix mask.
 void setDistanceMetric(java.lang.Integer distanceMetric)
          Sets the distance metric for this route.
 void setGlobalFlag(boolean globalFlag)
          Sets whether the next hop is global.
 void setNextHopAddress(IpAddress nextHopAddress)
          Sets the next hop address.
 void setNextHopInterface(InterfaceComponent nextHopInterface)
          Sets the next hop interface.
 void setNextHopName(java.lang.String nextHopName)
          Sets the name of the next hop.
 void setPermanentRouteFlag(boolean permanentRouteFlag)
          Sets whether this route is permanent.
 void setTagValue(java.lang.Long tagValue)
          Sets the tag value for this route.
 void setVrfName(java.lang.String vrfName)
          Sets the VPN Routing/Forwarding instance name for a VPN Routing/Forwarding instance static route.
 void validate()
           
 void validateDestination()
          Validates that a destination has been set.
 void validateNextHopSet()
          Validates that a next hop has been set.
 
Methods inherited from class com.foxsmart.csu.config.CiscoRouterConfigParser
checkExists, checkLineComplete, checkNotEmpty, checkRange, checkTokenCount, checkTokenCount, checkTokenMatch, checkTokenMatch, decrementTokenIndex, generateCommands, getBigDecimalNumberFromString, getDoubleNumberFromString, getEnum, getHexadecimalNumberFromString, getIntegerNumberFromString, getIpAddressFromString, getLine, getLongNumberFromString, getMacAddressFromString, getNextOptionalToken, getNextToken, getToken, getTokenIndex, getTokens, getTotalIndentedLines, getTotalLines, incrementTokenIndex, invalidConfiguration, invalidTokenFound, isEmpty, moreIndentedLines, moreLines, moreTokens, removeLines, resetTokenIndex, setTokenIndex, tokensLeft
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VRF

public static final java.lang.String VRF
See Also:
Constant Field Values

GLOBAL

public static final java.lang.String GLOBAL
See Also:
Constant Field Values

NAME

public static final java.lang.String NAME
See Also:
Constant Field Values

PERMANENT

public static final java.lang.String PERMANENT
See Also:
Constant Field Values

TAG

public static final java.lang.String TAG
See Also:
Constant Field Values

MIN_TAG_VALUE

public static final java.lang.Long MIN_TAG_VALUE
The minimum tag value.


MAX_TAG_VALUE

public static final java.lang.Long MAX_TAG_VALUE
The maximum tag value.


MIN_DISTANCE_METRIC

public static final java.lang.Integer MIN_DISTANCE_METRIC
The minimum distance metric.


MAX_DISTANCE_METRIC

public static final java.lang.Integer MAX_DISTANCE_METRIC
The maximum distance metric.

Constructor Detail

IpRouteEntry

public IpRouteEntry()
Constructs an IP route entry.

Method Detail

getDestinationPrefix

public IpAddress getDestinationPrefix()
Gets the destination prefix.

Returns:
the destination prefix.

setDestinationPrefix

public void setDestinationPrefix(IpAddress destinationPrefix)
Sets the destination prefix.

Parameters:
destinationPrefix - the destination prefix.

getDestinationPrefixMask

public IpAddress getDestinationPrefixMask()
Gets the destination prefix mask.

Returns:
the destination prefix mask.

setDestinationPrefixMask

public void setDestinationPrefixMask(IpAddress destinationPrefixMask)
Sets the destination prefix mask.

Parameters:
destinationPrefixMask - the destination prefix mask.

getVrfName

public java.lang.String getVrfName()
Gets the VRF name.

Returns:
the VRF name.

setVrfName

public void setVrfName(java.lang.String vrfName)
Sets the VPN Routing/Forwarding instance name for a VPN Routing/Forwarding instance static route. This setting is optional, but if configured, the VRF configuration must be present.

Parameters:
vrfName - the VRF name.

getGlobalFlag

public boolean getGlobalFlag()
Gets whether the next hop is global.

Returns:
True if the next hop is global or false if not.

setGlobalFlag

public void setGlobalFlag(boolean globalFlag)
Sets whether the next hop is global. If true, a VRF name also be configured.

Parameters:
globalFlag - True if the next hop is global or false if not.

getNextHopName

public java.lang.String getNextHopName()
Gets the name of the next hop.

Returns:
the next hop name.

setNextHopName

public void setNextHopName(java.lang.String nextHopName)
Sets the name of the next hop. This parameter is optional.

Parameters:
nextHopName - the name of the next hop.

getPermanentRouteFlag

public boolean getPermanentRouteFlag()
Gets whether this route is permanent.

Returns:
True if the route is permanent or false if not.

setPermanentRouteFlag

public void setPermanentRouteFlag(boolean permanentRouteFlag)
Sets whether this route is permanent.

Parameters:
permanentRouteFlag - True if the route is permanent or false if not.

getTagValue

public java.lang.Long getTagValue()
Gets the tag value for this route.

Returns:
the tag value.

setTagValue

public void setTagValue(java.lang.Long tagValue)
Sets the tag value for this route.

Parameters:
tagValue - The tag value.

getDistanceMetric

public java.lang.Integer getDistanceMetric()
Gets the distance metric for this route.

Returns:
the distance metric.

setDistanceMetric

public void setDistanceMetric(java.lang.Integer distanceMetric)
Sets the distance metric for this route.

Parameters:
distanceMetric - the distance metric.

getNextHopInterface

public InterfaceComponent getNextHopInterface()
Gets the next hop interface.

Returns:
the next hop interface.

setNextHopInterface

public void setNextHopInterface(InterfaceComponent nextHopInterface)
Sets the next hop interface. If set, a valid interface name must be set. The other attributes of the interface are not used.

The next hope interface or the next hop address (or both) must be set.

Parameters:
nextHopInterface - the next hop interface.

getNextHopAddress

public IpAddress getNextHopAddress()
Gets the next hop address.

Returns:
the next hop address.

setNextHopAddress

public void setNextHopAddress(IpAddress nextHopAddress)
Sets the next hop address.

The next hope interface or the next hop address (or both) must be set.

Parameters:
nextHopAddress - the next hop address

buildFromIos

public void buildFromIos(java.lang.String line)
                  throws InvalidConfigurationException
Builds the IP route entry from the passed in IOS line.

Parameters:
line - the IOS line.
Throws:
InvalidConfigurationException - if the configuration is invalid.
See Also:
CiscoRouterConfigComponent.buildFromIos(java.util.List).

validate

public void validate()
              throws InvalidConfigurationException
Throws:
InvalidConfigurationException - if the route entry is not valid.
See Also:
CiscoRouterConfigComponent

validateDestination

public void validateDestination()
                         throws InvalidConfigurationException
Validates that a destination has been set.

Throws:
InvalidConfigurationException - if the destination prefix or destination prefix mask are not set.

validateNextHopSet

public void validateNextHopSet()
                        throws InvalidConfigurationException
Validates that a next hop has been set.

Throws:
InvalidConfigurationException - if at least a next hop interface or next hop address has not been set.

generateIosString

public java.lang.String generateIosString()
                                   throws InvalidConfigurationException
Generates the IOS configuration for this route entry. Validation will be performed.

Returns:
the generated IOS.
Throws:
InvalidConfigurationException - if the configuration is invalid.
See Also:
CiscoRouterConfigComponent

generateDeleteIosStringForDestination

public java.lang.String generateDeleteIosStringForDestination()
                                                       throws InvalidConfigurationException
Generates the IOS configuration to delete this route entry and all others that share the same destination (i.e. only the destination and mask are generated on the statement).

Returns:
the generated IOS.
Throws:
InvalidConfigurationException - if the configuration is invalid.
See Also:
CiscoRouterConfigComponent

equals

public boolean equals(java.lang.Object object)
Checks the passed in IpRouteEntry object for equality.

Overrides:
equals in class java.lang.Object
Parameters:
object - the IpRouteEntry object to compare.
Returns:
True if the objects are equal or false if not.
See Also:
Object.equals(Object)

compareTo

public int compareTo(java.lang.Object object)
Compares this object to the passed in IpRouteEntry object.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
object - the IpRouteEntry object to compare.
Returns:
the comparrison valid.
See Also:
Comparable.compareTo(Object)


Copyright © 2005-2008 Fox Smart, Inc. All Rights Reserved.