[slot/][port-adapter/]port[:channel-group][.sub-interface]". For example, "interface Serial1/2.101".
In this example, the interface name would be "Serial1/2" and the sub-interface name would be "101". An attempt is
also made to parse out the various parts of the interface and sub-interface name which are retrievable via various
getter methods in this class. Null will be returned from these getter methods if the interface name couldn't be
parsed or when the interface name doesn't contain the piece returned by a getter method.
Note that although the sub-interface name can be set in this class, the router will not let the sub-interface be
changed if it was previously configured differently (e.g. if the router had a sub-interface configured as
point-to-point, changing it to multipoint will result in the router returning a configuration error with the
following text: "% Warning: cannot change link type".
- See Also:
- Serialized Form
| Methods inherited from class com.foxsmart.csu.config.CiscoRouterConfigComponent |
addComponent, addComponent, checkComponentType, deleteOldConfigWhenUpdating, dumpComponents, generateChildrenUpdateConfiglet, generateCompositeIos, generateCompositeIos, generateDeleteIos, generateIos, generateIos, generateIos, generateMultiLineUpdateConfiglet, generateUpdateCompositeIos, generateUpdateIos, generateUpdateIos, getAllComponents, getCiscoRouterConfig, getComment, getComponentClassName, getComponentClassName, getComponentKeys, getComponents, getComponents, getDeferredDelete, getFirstComponent, getFirstComponent, getParentComponent, getTotalComponents, getTotalComponents, getUpdateConfiglet, instantiateComponent, instantiateComponent, isValid, removeAllComponents, removeAllComponents, removeAllComponents, removeComponent, removeComponent, removeComponent, requiresCommentSeparator, setComment, setParentComponent, validateChildren |
| 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, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
protected static org.apache.commons.logging.Log log
interfaceName
protected java.lang.String interfaceName
subInterfaceName
protected java.lang.String subInterfaceName
subInterface
protected java.lang.Integer subInterface
subInterfaceType
protected SubInterfaceTypeEnum subInterfaceType
vlanInterfaceType
protected VlanInterfaceTypeEnum vlanInterfaceType
slotString
protected java.lang.String slotString
portAdapterString
protected java.lang.String portAdapterString
portString
protected java.lang.String portString
channelGroupString
protected java.lang.String channelGroupString
slotInteger
protected java.lang.Integer slotInteger
portAdapterInteger
protected java.lang.Integer portAdapterInteger
portInteger
protected java.lang.Integer portInteger
channelGroupInteger
protected java.lang.Integer channelGroupInteger
INTERFACE
public static final java.lang.String INTERFACE
- See Also:
- Constant Field Values
TYPE
public static final java.lang.String TYPE
- See Also:
- Constant Field Values
classToKeywordMap
protected static OrderedHashMap classToKeywordMap
keywordToClassMap
protected static OrderedHashMap keywordToClassMap
InterfaceComponent
public InterfaceComponent()
- Constructs an interface component.
getComponent
public static InterfaceComponent getComponent(java.lang.String interfaceTypeKeyword)
- Returns a specific instance of an InterfaceComponent based on the passed in interface keyword. The interface
keyword should contain the interface type at the beginning of the string and may contain extra characters as well
(e.g. Serial0 or Serial0.101).
- Parameters:
interfaceTypeKeyword - the interface keyword
- Returns:
- the instantiated InterfaceComponent or null if one couldn't be found or instantiated.
getKeywordToClassMap
public static OrderedHashMap getKeywordToClassMap()
- Returns an ordered map of interface keywords to interface component classes they are associated with.
- Returns:
- The ordered map.
setPackagesStatic
public static void setPackagesStatic(java.util.List packages)
- Sets the packages for this component via a static convenience method.
- Parameters:
packages - the list of packages
getPackagesStatic
public static java.util.List getPackagesStatic()
- Gets the child component keys via a static convenience method.
- Returns:
- the child component keys.
getPackages
public java.util.List getPackages()
- Description copied from interface:
CompositeComponent
- Gets a list of the packages used to instantiate components (e.g. "com.foxsmart.csu.config"). The packages will
be used in the order they are listed.
- Specified by:
getPackages in interface CompositeComponent
- Returns:
- the packages.
- See Also:
CompositeComponent.getPackages()
setChildComponentKeysStatic
public static void setChildComponentKeysStatic(java.util.List componentKeys)
- Sets the child component keys for this component via a static convenience method.
- Parameters:
componentKeys - the child component keys.
getChildComponentKeysStatic
public static java.util.List getChildComponentKeysStatic()
- Gets the child component keys via a static convenience method.
- Returns:
- the child component keys.
getChildComponentKeys
public java.util.List getChildComponentKeys()
- Description copied from interface:
CompositeComponent
- Returns the list of child keys of this composite component. The keys are stored in the order that they should be
processed for generating IOS statements. Class objects (e.g. Length.class) should be used for
supported components while strings (e.g. "ip") should be used for unsupported components.
- Specified by:
getChildComponentKeys in interface CompositeComponent
- Returns:
- The list of child component keys for generating IOS statements.
- See Also:
CompositeComponent.getChildComponentKeys()
setChildComponentUpdateKeysStatic
public static void setChildComponentUpdateKeysStatic(java.util.List componentUpdateKeys)
- Sets the child component update keys for this component via a static convenience method.
- Parameters:
componentUpdateKeys - the child component keys.
getChildComponentUpdateKeysStatic
public static java.util.List getChildComponentUpdateKeysStatic()
- Gets the child component update keys via a static convenience method.
- Returns:
- the child component update keys.
getChildComponentUpdateKeys
public java.util.List getChildComponentUpdateKeys()
- Description copied from interface:
CompositeComponent
- Returns the list of child keys of this composite component. The keys are stored in the order that they should be
processed for updating IOS statements. Class objects (e.g. Length.class) should be used for
supported components while strings (e.g. "ip") should be used for unsupported components. In most cases, this
list will be the same as getChildComponentKeys with the exception being when the order of updates matters
and is different from the order listed in a "show configuration" router command.
- Specified by:
getChildComponentUpdateKeys in interface CompositeComponent
- Returns:
- The list of child component keys for updating IOS statements.
- See Also:
CompositeComponent.getChildComponentUpdateKeys()
setInterfaceName
protected void setInterfaceName(java.lang.String interfaceName)
- Sets the interface name (i.e. "[slot/][port-adapter/]port[:channel-group]").
- Parameters:
interfaceName - The interface name.
getInterfaceNameExists
public boolean getInterfaceNameExists()
- Returns whether the interface name exists.
- Returns:
- True if the interface name exists or false if not.
getSlot
public java.lang.String getSlot()
- Returns the slot portion of the interface name if one exists. The slot is parsed from the interface name based on
the the following: "[slot/][port-adapter/]port[:channel-group][.sub-interface]". Null is returned if no slot
exists or the interface name couldn't be parsed.
- Returns:
- The slot
getPortAdapter
public java.lang.String getPortAdapter()
- Returns the port adapter portion of the interface name if one exists. The port adapter is parsed from the
interface name based on the the following: "[slot/][port-adapter/]port[:channel-group][.sub-interface]". Null is
returned if no port adapter exists or the interface name couldn't be parsed.
- Returns:
- The port adapter
getPort
public java.lang.String getPort()
- Returns the port portion of the interface name if one exists. The port is parsed from the interface name based on
the the following: "[slot/][port-adapter/]port[:channel-group][.sub-interface]". Null is returned if no port
exists or the interface name couldn't be parsed.
- Returns:
- The port
getChannelGroup
public java.lang.String getChannelGroup()
- Returns the channel group portion of the interface name if one exists. The channel group is parsed from the
interface name based on the the following: "[slot/][port-adapter/]port[:channel-group][.sub-interface]". Null is
returned if no channel group exists or the interface name couldn't be parsed.
- Returns:
- The channel group
getSlotAsInteger
public java.lang.Integer getSlotAsInteger()
- Returns the slot portion of the interface name if one exists as an Integer. The slot is parsed from the interface
name based on the the following: "[slot/][port-adapter/]port[:channel-group][.sub-interface]". Null is returned if
no slot exists or the interface name couldn't be parsed or if the slot contains any non-numeric characters.
- Returns:
- The slot as an Integer.
getPortAdapterAsInteger
public java.lang.Integer getPortAdapterAsInteger()
- Returns the port adapter portion of the interface name if one exists as an Integer. The port adapter is parsed
from the interface name based on the the following: "[slot/][port-adapter/]port[:channel-group][.sub-interface]".
Null is returned if no port adapter exists or the interface name couldn't be parsed or if the port adapter
contains any non-numeric characters.
- Returns:
- The port adapter as an Integer.
getPortAsInteger
public java.lang.Integer getPortAsInteger()
- Returns the port portion of the interface name if one exists as an Integer The port is parsed from the interface
name based on the the following: "[slot/][port-adapter/]port[:channel-group][.sub-interface]". Null is returned if
no port exists or the interface name couldn't be parsed or if the port contains any non-numeric characters.
- Returns:
- The port as an Integer.
getChannelGroupAsInteger
public java.lang.Integer getChannelGroupAsInteger()
- Returns the channel group portion of the interface name if one exists as an Integer. The channel group is parsed
from the interface name based on the the following: "[slot/][port-adapter/]port[:channel-group][.sub-interface]".
Null is returned if no channel group exists or the interface name couldn't be parsed or if the channel group
contains any non-numeric characters.
- Returns:
- The channel group as an Integer.
setInterfaceParts
protected void setInterfaceParts(java.lang.String interfaceName)
- Parses the interface name and sets the various parts of the interface name.
- Parameters:
interfaceName - The interface name
getInterfaceName
protected java.lang.String getInterfaceName()
- Gets the interface name.
- Returns:
- the interface name.
setSubInterfaceName
protected void setSubInterfaceName(java.lang.String subInterfaceName)
- Sets the sub-interface name. (i.e. ".sub-interface")
- Parameters:
subInterfaceName - The sub-interface name.
getSubInterfaceAsInteger
public java.lang.Integer getSubInterfaceAsInteger()
- Returns the sub-interface if one exists as an Integer. The channel group is parsed from the interface name based
on the the following: "[slot/][port-adapter/]port[:channel-group][.sub-interface]". Null is returned if no
sub-interface exists or if the sub-interface contains any non-numeric characters.
- Returns:
- The sub-interface as an Integer.
getSubInterfaceName
protected java.lang.String getSubInterfaceName()
- Gets the sub-interface name.
- Returns:
- the sub-interface name.
getSubInterfaceNameExists
public boolean getSubInterfaceNameExists()
- Returns whether the sub-interface name exists.
- Returns:
- True if the sub-interface name exists or false if not.
setSubInterfaceType
protected void setSubInterfaceType(SubInterfaceTypeEnum subInterfaceType)
- Sets the sub-interface type. (i.e. multipoint or point-to-point)
- Parameters:
subInterfaceType - The sub-interface type.
getSubInterfaceType
protected SubInterfaceTypeEnum getSubInterfaceType()
- Gets the sub-interface type.
- Returns:
- the sub-interface type.
getSubInterfaceTypeExists
public boolean getSubInterfaceTypeExists()
- Returns whether the sub-interface type exists.
- Returns:
- True if the sub-interface type exists or false if not.
setVlanInterfaceType
public void setVlanInterfaceType(VlanInterfaceTypeEnum vlanInterfaceType)
- Sets the Vlan Interface Type. (i.e. trbrf or ethernet).
- Parameters:
vlanInterfaceType - The Vlan Interface Type.
getVlanInterfaceType
public VlanInterfaceTypeEnum getVlanInterfaceType()
- Gets the Vlan Interface Type.
- Returns:
- the Vlan Interface Type.
getVlanInterfaceTypeExists
public boolean getVlanInterfaceTypeExists()
- Returns whether the Vlan interface type exists.
- Returns:
- True if the Vlan interface type exists or false if not.
getInterfaceType
public java.lang.String getInterfaceType()
- Gets the interface type for this class. For example, if this class is SerialInterfaceComponent, the returned
string would be "Serial". The returned string should be the prefix used for the interface (e.g. Serial0).
- Returns:
- The interface type.
buildFromIos
public java.util.List buildFromIos(java.util.List configLines)
throws InvalidConfigurationException
- Description copied from class:
CiscoRouterConfigComponent
- Parse and populate the specific CiscoRouterComponent object based on the passed in individual lines of the IOS
configuration. The passed in configuration lines should represent the first line in the configuration that applies
to the specific component. The component should use all lines needed by its specific part of the configuration and
return a List with the remaining lines that are not part of the component's configuration.
- Specified by:
buildFromIos in class CiscoRouterConfigComponent
- Parameters:
configLines - The list of IOS configuration lines.
- Returns:
- The rest of the lines that were not parsed by the component.
- Throws:
InvalidConfigurationException - if the IOS configuration can not be parsed for any reason.- See Also:
CiscoRouterConfigComponent
buildInterfaceAndSubInterfaceNames
public void buildInterfaceAndSubInterfaceNames(java.lang.String line,
java.lang.String token)
throws InvalidConfigurationException
- Builds the interface name and sub-interface name from the passed in token. For example, if the token is
Serial0.101, then the interface name will be set to Serial0 and the sub-interface name will be set to 101.
- Parameters:
line - the full line that is being parsed.token - the interface/sub-interface name token.
- Throws:
InvalidConfigurationException - if there was a problem processing the interface and/or sub-interface names.
validate
public void validate()
throws InvalidConfigurationException
- Description copied from class:
CiscoRouterConfigComponent
- Validates this object to ensure it contains a valid IOS configuration.
- Specified by:
validate in class CiscoRouterConfigComponent
- Throws:
InvalidConfigurationException - if the configuration is invalid.- See Also:
CiscoRouterConfigComponent
getParentInterfaceComponent
public InterfaceComponent getParentInterfaceComponent()
- Gets the parent interface component. This should be used when this component is a sub-interface and you wish to
return the main interface for that sub-interface. For example, if this interface is Serial0.101, then the parent
interface component would be the Serial0 interface. If no parent interface is present, null is returned.
- Returns:
- the parent interface component.
getAllInterfaceComponents
public static java.util.List getAllInterfaceComponents(CiscoRouterConfig routerConfig)
- Gets all the InterfaceComponents from the passed in CiscoRouterConfig. If no InterfaceComponents exist, an empty
list is returned.
- Parameters:
routerConfig - the Cisco Router Configuration that contains the InterfaceComponents as children.
- Returns:
- The list of all InterfaceComponents.
generateHeaderIos
public java.lang.String generateHeaderIos()
throws InvalidConfigurationException
- Description copied from interface:
CompositeComponent
- Returns the header IOS configuration string for this component. The header is the line of IOS that is used to
distinguish the parent from its children.
- Specified by:
generateHeaderIos in interface CompositeComponent
- Returns:
- The header IOS configuration string.
- Throws:
InvalidConfigurationException - if the IOS configuration is invalid and the header IOS string can not be
generated. The validate() method is used to determine if the configuration is valid.- See Also:
CompositeComponent
getInterfaceTypeAndNames
public java.lang.String getInterfaceTypeAndNames()
- Gets the interface and sub-interfaces names as a concatinated string (e.g. Serial0.101).
- Returns:
- the interface and sub-interface names.
generateIos
public Commands generateIos()
throws InvalidConfigurationException
- Description copied from class:
CiscoRouterConfigComponent
- Returns the IOS configuration commands for this component.
- Specified by:
generateIos in class CiscoRouterConfigComponent
- Returns:
- The IOS configuration string as a list of Command objects. To generate a configlet from the list of
Command objects, use Command.getConfiglet().
- Throws:
InvalidConfigurationException - if the IOS configuration is invalid and the IOS string can not be generated.
The validate() method is used to determine if the configuration is valid.- See Also:
CiscoRouterConfigComponent
equalsComponentInstance
public boolean equalsComponentInstance(CiscoRouterConfigComponent component)
throws InvalidConfigurationException
- Determines if this component and the passed in component are the same instance of component that can be compared
from an IOS configuration standpoint. The sub-interface type is not considered for equality of an instance. This
is done since sub-interface types can't be changed once they are initially set. Otherwise, a warning would be
produced by the router during an update.
- Specified by:
equalsComponentInstance in interface MultiInstanceComponent
- Parameters:
component - The component to compare to this component.
- Returns:
- True if the components are of the same instance or false if not.
- Throws:
InvalidConfigurationException - if either this or the passed in component aren't
valid.
Copyright © 2005-2008 Fox Smart, Inc. All Rights Reserved.