All Packages Class Hierarchy This Package Previous Next Index
Class calypso.core.atmswitch.Switch
java.lang.Object
|
+----calypso.core.atmswitch.Switch
- public abstract class Switch
- extends Object
API to control an ATM switch connected to the system.
Switch class makes it possible to create connection points and to
create connections that connect two connection points to form a
point-to-point connection. It is also possible to create multicast
connections by defining the incoming (sending) connection point.
Outgoing (receiver) connection points can be added to multicast
connections through the corresponding multicast connection objects.
- Author:
- Juha Pääjärvi / TCM laboratory / HUT
- See Also:
- PPConnection, MCConnection, VCPoint, SwitchMgmt
-
DEBUG
- DEBUG flag controls if we want to compile debug messages.
-
FSR_SWITCH
- Constant that is used to define for createSwitch-method that user
wants to create an FSR switch.
-
INTERNAL_ERROR_MSG
- Common part for all internal error messages!
-
listeners
- Vector object keeping knowledge about current switch listeners.
-
maxMCConn
- Maximum number of multicast connections.
-
maxPortNum
- Maximum number for port.
-
maxPPConn
- Maximum number of point-to-point connections.
-
MCConnList
- DList containing all the ongoing multicast connections.
-
numOfMCConns
- Current number of multicast connections.
-
numOfPPConns
- Current number of point-to-point connections.
-
ports
- Holds references to the ports of the switch.
-
PPConnList
- DList containing all the ongoing point-to-point connections.
-
ss
- Keeps record of statistical data for each port in the FSR-switch.
-
VCI_ANY
- Wildcard to describe, that VCI number can be chosen freely by
switch control software.
-
VCI_EVEN
- Wildcard to describe, that VCI number can be chosen freely
from all even numbers by switch control software.
-
VCI_ODD
- Wildcard to describe, that VCI number can be chosen freely
from all odd numbers by switch control software.
-
VPI_ANY
- Wildcard to describe, that VPI number can be chosen freely by
switch control software.
-
VPI_EVEN
- Wildcard to describe, that VPI number can be chosen freely
from all even numbers by switch control software.
-
VPI_ODD
- Wildcard to describe, that VPI number can be chosen freely
from all odd numbers by switch control software.
-
Switch()
- Constructs a Switch object.
-
addPointToMCConn(MCConnection, VCPoint)
- Adds a point to multicast connection.
-
addSwitchListener(SwitchListener)
- Method to add listener.
-
archDepCreateMCConn(VCPoint, TrafficDescr)
- Creates a multicast connection on FSR hardware based on the sending
connection point and a traffic descriptor.
-
archDepCreatePPConn(VCPoint, VCPoint, TrafficDescr)
- Creates a point-to-point connection on FSR hardware based on two
connection points and a traffic descriptor.
-
archDepInitSwitch()
- Performs the acrhitecture dependent part of switch initialization.
-
archDepResetSwitch()
- Performs the acrhitecture dependent part of switch reset.
-
clearInfo(int)
- Clears statistical counters.
-
createMCConnection(VCPoint, TrafficDescr)
- Creates a multicast connection based on the sending connection
point and a traffic descriptor.
-
createPPConnection(VCPoint, VCPoint, TrafficDescr)
- Creates a point-to-point connection based on two connection points
and a traffic descriptor.
-
createSwitch(int)
- Creates an Switch class instance of type described by switchType
-variable.
-
createVCPoint(int)
- Creates a connection point for normal virtual channel connections
(point-to-point and multicast).
-
createVCPoint(int, int, int)
- Creates a connection point for normal virtual channel connections
(point-to-point and multicast).
-
getArchDepParameterValue(String)
- Checks the parameter requested and returns its value.
-
getError()
- Gets the description about the last error occured.
-
getInfo(int, int)
- Gets statistical info, events happend before last cleared.
-
getInterface(int)
- Checks the physical interfaces connected to the port.
-
getLineStatus(int)
- Indicates wether the FSR interface card has synchronized to the
SDH/STM-1 frame coming from the fiber.
-
getMaxPortNumber()
- Returns the maximum number of ports supported by the switch.
-
getMCConns()
-
-
getParameterValue(String)
- Checks the parameter requested and returns its value.
-
getPPConns()
-
-
initPorts()
- Initializes the ports of this switch.
-
initSwitch()
- Initializes the ATM switch hardware and library functions.
-
instance()
- Returns a reference to the Switch instance representing the ATM
switch.
-
isActivePort(int)
- Returns true if port with specified number exists and is active.
-
notifySwitchState(String)
- Method that notifies the event to all listeners.
-
rebindMCConnPoint(MCConnection, VCPoint, VCPoint)
- Rebinds a point of a multicast connection to another point.
-
rebindPPConnPoint(PPConnection, VCPoint, VCPoint)
- Rebinds one point of a point-to-point connection to another point.
-
releaseMCConnection(MCConnection)
- Releases a multicast connection.
-
releasePPConnection(PPConnection)
- Releases a point-to-point connection.
-
removeOutPointFromMCConn(MCConnection, VCPoint)
- Removes a point from multicast connection.
-
removeSwitchListener(SwitchListener)
- Method to remove listener.
-
resetSwitch()
- Resets the switch by releasing all ongoing connections and
releasing all the resources.
-
setPortType(int, int)
- Sets the type of a port.
-
switchAvailable()
- Checks if the connection between the switch and the control station
is working and the switch is available.
ports
protected Port ports[]
- Holds references to the ports of the switch.
PPConnList
protected DList PPConnList
- DList containing all the ongoing point-to-point connections.
MCConnList
protected DList MCConnList
- DList containing all the ongoing multicast connections.
numOfPPConns
protected long numOfPPConns
- Current number of point-to-point connections.
numOfMCConns
protected long numOfMCConns
- Current number of multicast connections.
listeners
protected Vector listeners
- Vector object keeping knowledge about current switch listeners.
ss
protected SwitchStatistics ss
- Keeps record of statistical data for each port in the FSR-switch.
maxPortNum
protected int maxPortNum
- Maximum number for port. This is used for checking that there is
no calls to ports that do not exist.
maxPPConn
protected int maxPPConn
- Maximum number of point-to-point connections.
maxMCConn
protected int maxMCConn
- Maximum number of multicast connections.
FSR_SWITCH
public static final int FSR_SWITCH
- Constant that is used to define for createSwitch-method that user
wants to create an FSR switch.
VPI_ANY
public static final int VPI_ANY
- Wildcard to describe, that VPI number can be chosen freely by
switch control software.
VPI_EVEN
public static final int VPI_EVEN
- Wildcard to describe, that VPI number can be chosen freely
from all even numbers by switch control software.
VPI_ODD
public static final int VPI_ODD
- Wildcard to describe, that VPI number can be chosen freely
from all odd numbers by switch control software.
VCI_ANY
public static final int VCI_ANY
- Wildcard to describe, that VCI number can be chosen freely by
switch control software.
VCI_EVEN
public static final int VCI_EVEN
- Wildcard to describe, that VCI number can be chosen freely
from all even numbers by switch control software.
VCI_ODD
public static final int VCI_ODD
- Wildcard to describe, that VCI number can be chosen freely
from all odd numbers by switch control software.
INTERNAL_ERROR_MSG
protected static final String INTERNAL_ERROR_MSG
- Common part for all internal error messages!
DEBUG
protected static final boolean DEBUG
- DEBUG flag controls if we want to compile debug messages.
Switch
protected Switch()
- Constructs a Switch object.
createSwitch
public static synchronized void createSwitch(int switchType_) throws SwitchException
- Creates an Switch class instance of type described by switchType
-variable. Note that there can only be one switch instance and
thus this method can be called only once. The new Switch object
can be obtained with a call to instance()-method of this class.
If previously created switch object does not exist and thus new
switch object is created, this method returns a SwitchMgmt object
that can be used to manage the switch. This feature allows the
program that starts the switch software by creating an switch
object to become the manager of the switch.
- Parameters:
- switchType_ - Type of the switch to be created (use the
*_SWITCH constants).
- Returns:
- Reference to a SwitchMgmt object NOT
- Throws: SwitchException
- If a Switch object has already been created.
- Throws: SwitchException
- If defined switch type is unknown.
instance
public static Switch instance()
- Returns a reference to the Switch instance representing the ATM
switch.
- Returns:
- Reference to the Switch class instance
getMaxPortNumber
public int getMaxPortNumber()
- Returns the maximum number of ports supported by the switch.
Note that since different kind of switches might have different
numbering schemes for ports, users should also check the
existence of a port with isActivePort-method. Valid port numbers
start from zero (0) and range up to the number returned by this
method. In some switches (like FSR) port numbers start actually
from one (1). It is also possible that the port with the biggest
number is not available. This is why the availability of ports
has to be tested.
- Returns:
- maximum number of ports supported by the switch.
isActivePort
public boolean isActivePort(int portNumber_)
- Returns true if port with specified number exists and is active.
Look for the documentation of getMaxPortNubmer-method for
additional information about the use of this method.
- Parameters:
- portNumber_ - The number of the port.
- Returns:
- True if port exists and is active, otherwise false.
createVCPoint
public VCPoint createVCPoint(int port_,
int VPI_,
int VCI_) throws SwitchException
- Creates a connection point for normal virtual channel connections
(point-to-point and multicast).
- Parameters:
- port_ - port number
- VPI_ - virtual path identifier
- VCI_ - virtual channel identifier
- Returns:
- VCPoint object representing the connection point.
- Throws: SwitchException
- If connection point with similar parameters already
exists.
- Throws: SwitchException
- If defined VPI is reserved/full or there is no free
VPIs.
- Throws: SwitchException
- If this methos is called witch wildcard for VPI and
an explicit value for VCI.
createVCPoint
public VCPoint createVCPoint(int port_) throws SwitchException
- Creates a connection point for normal virtual channel connections
(point-to-point and multicast). This version of createVCPoint takes
only the port number and leaves the job of choosing VPI and VCI
number to the software controling the switch. VPI and VCI numbers
can be obtained by calling getVPI() and getVCI() -methods of the
returned VCPoint object.
- Parameters:
- port_ - port number
- Returns:
- VCPoint object representing the connection point.
- Throws: SwitchException
- If there is no free VPIs.
createPPConnection
public synchronized PPConnection createPPConnection(VCPoint inPoint_,
VCPoint outPoint_,
TrafficDescr td_) throws SwitchException
- Creates a point-to-point connection based on two connection points
and a traffic descriptor.
- Parameters:
- inPoint_ - Identifies the connection point of 'incoming' data.
- outPoint_ - Identifies the connection point of 'outgoing' data.
- td_ - Traffic descriptor defining the characteristics of
this connection.
- Returns:
- PPConnection object representing the created connection.
- Throws: SwitchException
- If traffic descriptor defines that there is no traffic.
- Throws: SwitchException
- If maximum number of point-to-point connections exists.
- Throws: SwitchException
- If either of the points is already connected.
createMCConnection
public synchronized MCConnection createMCConnection(VCPoint inPoint_,
TrafficDescr td_) throws SwitchException
- Creates a multicast connection based on the sending connection
point and a traffic descriptor. Receiving connection points can be
added to the multicast connection through the multicast connection
object returned by this method.
Note that since multicast connections have traffic only in tranfer
direction (from single incoming point to multiple outgoing points),
traffic descriptor must define some kind of traffic in that
direction. Traffic information for receiving direction is ignored.
- Parameters:
- inPoint_ - Identifies the sender in a multicast connection.
- td_ - Traffic descriptor defining the characteristics
of the connection.
- Returns:
- MCConnection object representing the created connection.
- Throws: SwitchException
- If traffic descriptor defines that there is no traffic.
- Throws: SwitchException
- If maximum number of multicast connections exists.
- Throws: SwitchException
- If the incoming point is already connected.
getPPConns
public Enumeration getPPConns()
- Returns:
- java.util.Enumeration of all point-to-point connections
over the switch
getMCConns
public Enumeration getMCConns()
- Returns:
- java.util.Enumeration of all multicast connections
over the switch
archDepCreatePPConn
protected abstract FSRPPConnection archDepCreatePPConn(VCPoint inPoint_,
VCPoint outPoint_,
TrafficDescr td_) throws InternalException
- Creates a point-to-point connection on FSR hardware based on two
connection points and a traffic descriptor.
- Parameters:
- inPoint_ - Identifies the connection point of 'incoming' data.
- outPoint_ - Identifies the connection point of 'outgoing' data.
- td_ - Traffic descriptor defining the characteristics of
the connection.
- Returns:
- FSRPPConnection object representing the created connection.
- Throws: InternalException
- If some internal error occurs.
archDepCreateMCConn
protected abstract FSRMCConnection archDepCreateMCConn(VCPoint inPoint_,
TrafficDescr td_) throws InternalException
- Creates a multicast connection on FSR hardware based on the sending
connection point and a traffic descriptor.
- Parameters:
- inPoint_ - Identifies the sender in a multicast connection.
- td_ - Traffic descriptor defining the characteristics
of the connection.
- Returns:
- MCConnection object representing the created connection.
- Throws: InternalException
- If some internal error occurs.
initSwitch
protected synchronized void initSwitch() throws InternalException
- Initializes the ATM switch hardware and library functions. There
will be no connections after this method call.
- Throws: InternalException
- If some internal error occurs.
archDepInitSwitch
protected abstract void archDepInitSwitch() throws InternalException
- Performs the acrhitecture dependent part of switch initialization.
- Throws: InternalException
- If some internal error occurs.
resetSwitch
protected synchronized void resetSwitch() throws InternalException
- Resets the switch by releasing all ongoing connections and
releasing all the resources.
- Throws: InternalException
- If some internal error occurs.
archDepResetSwitch
protected abstract void archDepResetSwitch() throws InternalException
- Performs the acrhitecture dependent part of switch reset.
- Throws: InternalException
- If some internal error occurs.
setPortType
protected abstract void setPortType(int portNumber_,
int portType_) throws InternalException
- Sets the type of a port. Port type is one one of the constants
defined in Port class, Port.UNI (for user to network interface)
or Port.NNI (for network to network interface).
- Parameters:
- portNumber_ - Number of the port for which the type is set.
- portType_ - Type of the port.
- Throws: InternalException
- If some internal error occurs.
releasePPConnection
protected abstract void releasePPConnection(PPConnection connection_) throws InternalException
- Releases a point-to-point connection. This method can only be
called inside the ATM switch package and is part of the internal
implementation of this package.
- Parameters:
- connection_ - The connection to be released.
- Throws: InternalException
- If some internal error occurs.
releaseMCConnection
protected abstract void releaseMCConnection(MCConnection connection_) throws InternalException
- Releases a multicast connection. This method can only be called
inside the ATM switch package and is part of the internal
implementation of this package.
- Parameters:
- connection_ - The connection to be released.
- Throws: InternalException
- If some internal error occurs.
rebindPPConnPoint
protected abstract void rebindPPConnPoint(PPConnection connection_,
VCPoint old_,
VCPoint new_) throws InternalException
- Rebinds one point of a point-to-point connection to another point.
- Parameters:
- connection_ - The connection to be modified.
- old_ - The VCPoint object of point to be replaced.
- new_ - The VCPoint object of the new point.
- Throws: InternalException
- If some internal error occurs.
addPointToMCConn
protected abstract void addPointToMCConn(MCConnection connection_,
VCPoint newPoint_) throws InternalException
- Adds a point to multicast connection.
- Parameters:
- connection_ - Connection to which the point is added.
- newPoint_ - The point to be added.
- Throws: InternalException
- If some internal error occurs.
removeOutPointFromMCConn
protected abstract void removeOutPointFromMCConn(MCConnection connection_,
VCPoint point_) throws InternalException
- Removes a point from multicast connection.
- Parameters:
- connection_ - Connection from which the point is removed.
- point_ - The point to be removed.
- Throws: InternalException
- If some internal error occurs.
rebindMCConnPoint
protected abstract void rebindMCConnPoint(MCConnection connection_,
VCPoint old_,
VCPoint new_) throws InternalException
- Rebinds a point of a multicast connection to another point.
- Parameters:
- connection_ - The connection to be modified.
- old_ - The VCPoint object of point to be replaced.
- new_ - The VCPoint object of the new point.
- Throws: InternalException
- If some internal error occurs.
initPorts
protected abstract void initPorts() throws InternalException
- Initializes the ports of this switch. This port initialization
cannot be done in Port class constructor because that constructor
is called from Switch class contructor (or to be precise from
a constructor of a class that is inherited from Switch class).
This method is in turn an instance method and thus needs an
instance for which to be called. So, because the instance is
being constructed while contructing Port class instances, the
ports cannot be initialized.
- Throws: InternalException
- If some internal error occurs.
switchAvailable
protected abstract boolean switchAvailable() throws InternalException
- Checks if the connection between the switch and the control station
is working and the switch is available.
- Returns:
- true if the fiber between the control station and
the switch is working.
- Throws: InternalException
- If some internal error occurs.
getError
protected abstract String getError()
- Gets the description about the last error occured.
- Returns:
- description about the error.
getInterface
protected abstract int getInterface(int portNumber_) throws InternalException
- Checks the physical interfaces connected to the port.
- Parameters:
- portNumer_ - The number of the port investigated.
- Returns:
- integer between 0-4, zero no interface, 1-4 different types.
- Throws: InternalException
- If some internal error occurs.
getArchDepParameterValue
protected abstract long getArchDepParameterValue(String name) throws IllegalArgumentException
- Checks the parameter requested and returns its value.
- Parameters:
- name - The parameter of the desired value.
- Returns:
- returns the parameter requested.
- Throws: IllegalArgumentException
- If the query is unknown.
getParameterValue
protected long getParameterValue(String name) throws IllegalArgumentException
- Checks the parameter requested and returns its value.
- Parameters:
- name - The parameter of the desired value.
- Returns:
- returns the parameter requested.
- Throws: IllegalArgumentException
- If the query is unknown.
getLineStatus
protected abstract boolean getLineStatus(int portNumber_) throws InternalException
- Indicates wether the FSR interface card has synchronized to the
SDH/STM-1 frame coming from the fiber.
- Parameters:
- portNumber_ - The number of port investigated.
- Returns:
- true if in synch and false if not.
- Throws: InternalException
- If some internal error occurs.
getInfo
protected abstract int getInfo(int portNumber_,
int info_) throws InternalException, IllegalArgumentException
- Gets statistical info, events happend before last cleared.
- Parameters:
- portNumber_ - The port investigated.
- info_ - The type of info requested (0-3).
- Returns:
- The value of the counter requested.
clearInfo
protected abstract void clearInfo(int portNumber_) throws InternalException
- Clears statistical counters.
- Parameters:
- portNumber_ - The port beeing investigated.
- Throws: InternalException
- If some internal error occurs.
removeSwitchListener
public synchronized void removeSwitchListener(SwitchListener sl_)
- Method to remove listener.
- Parameters:
- sl_ - The listener removed.
addSwitchListener
public synchronized void addSwitchListener(SwitchListener sl_)
- Method to add listener.
- Parameters:
- sl_ - The listener added.
notifySwitchState
protected void notifySwitchState(String command_)
- Method that notifies the event to all listeners.
- Parameters:
- command_ - The command occured to the switch.
All Packages Class Hierarchy This Package Previous Next Index