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

Variable Index

 o DEBUG
DEBUG flag controls if we want to compile debug messages.
 o FSR_SWITCH
Constant that is used to define for createSwitch-method that user wants to create an FSR switch.
 o INTERNAL_ERROR_MSG
Common part for all internal error messages!
 o listeners
Vector object keeping knowledge about current switch listeners.
 o maxMCConn
Maximum number of multicast connections.
 o maxPortNum
Maximum number for port.
 o maxPPConn
Maximum number of point-to-point connections.
 o MCConnList
DList containing all the ongoing multicast connections.
 o numOfMCConns
Current number of multicast connections.
 o numOfPPConns
Current number of point-to-point connections.
 o ports
Holds references to the ports of the switch.
 o PPConnList
DList containing all the ongoing point-to-point connections.
 o ss
Keeps record of statistical data for each port in the FSR-switch.
 o VCI_ANY
Wildcard to describe, that VCI number can be chosen freely by switch control software.
 o VCI_EVEN
Wildcard to describe, that VCI number can be chosen freely from all even numbers by switch control software.
 o VCI_ODD
Wildcard to describe, that VCI number can be chosen freely from all odd numbers by switch control software.
 o VPI_ANY
Wildcard to describe, that VPI number can be chosen freely by switch control software.
 o VPI_EVEN
Wildcard to describe, that VPI number can be chosen freely from all even numbers by switch control software.
 o VPI_ODD
Wildcard to describe, that VPI number can be chosen freely from all odd numbers by switch control software.

Constructor Index

 o Switch()
Constructs a Switch object.

Method Index

 o addPointToMCConn(MCConnection, VCPoint)
Adds a point to multicast connection.
 o addSwitchListener(SwitchListener)
Method to add listener.
 o archDepCreateMCConn(VCPoint, TrafficDescr)
Creates a multicast connection on FSR hardware based on the sending connection point and a traffic descriptor.
 o archDepCreatePPConn(VCPoint, VCPoint, TrafficDescr)
Creates a point-to-point connection on FSR hardware based on two connection points and a traffic descriptor.
 o archDepInitSwitch()
Performs the acrhitecture dependent part of switch initialization.
 o archDepResetSwitch()
Performs the acrhitecture dependent part of switch reset.
 o clearInfo(int)
Clears statistical counters.
 o createMCConnection(VCPoint, TrafficDescr)
Creates a multicast connection based on the sending connection point and a traffic descriptor.
 o createPPConnection(VCPoint, VCPoint, TrafficDescr)
Creates a point-to-point connection based on two connection points and a traffic descriptor.
 o createSwitch(int)
Creates an Switch class instance of type described by switchType -variable.
 o createVCPoint(int)
Creates a connection point for normal virtual channel connections (point-to-point and multicast).
 o createVCPoint(int, int, int)
Creates a connection point for normal virtual channel connections (point-to-point and multicast).
 o getArchDepParameterValue(String)
Checks the parameter requested and returns its value.
 o getError()
Gets the description about the last error occured.
 o getInfo(int, int)
Gets statistical info, events happend before last cleared.
 o getInterface(int)
Checks the physical interfaces connected to the port.
 o getLineStatus(int)
Indicates wether the FSR interface card has synchronized to the SDH/STM-1 frame coming from the fiber.
 o getMaxPortNumber()
Returns the maximum number of ports supported by the switch.
 o getMCConns()
 o getParameterValue(String)
Checks the parameter requested and returns its value.
 o getPPConns()
 o initPorts()
Initializes the ports of this switch.
 o initSwitch()
Initializes the ATM switch hardware and library functions.
 o instance()
Returns a reference to the Switch instance representing the ATM switch.
 o isActivePort(int)
Returns true if port with specified number exists and is active.
 o notifySwitchState(String)
Method that notifies the event to all listeners.
 o rebindMCConnPoint(MCConnection, VCPoint, VCPoint)
Rebinds a point of a multicast connection to another point.
 o rebindPPConnPoint(PPConnection, VCPoint, VCPoint)
Rebinds one point of a point-to-point connection to another point.
 o releaseMCConnection(MCConnection)
Releases a multicast connection.
 o releasePPConnection(PPConnection)
Releases a point-to-point connection.
 o removeOutPointFromMCConn(MCConnection, VCPoint)
Removes a point from multicast connection.
 o removeSwitchListener(SwitchListener)
Method to remove listener.
 o resetSwitch()
Resets the switch by releasing all ongoing connections and releasing all the resources.
 o setPortType(int, int)
Sets the type of a port.
 o switchAvailable()
Checks if the connection between the switch and the control station is working and the switch is available.

Variables

 o ports
 protected Port ports[]
Holds references to the ports of the switch.

 o PPConnList
 protected DList PPConnList
DList containing all the ongoing point-to-point connections.

 o MCConnList
 protected DList MCConnList
DList containing all the ongoing multicast connections.

 o numOfPPConns
 protected long numOfPPConns
Current number of point-to-point connections.

 o numOfMCConns
 protected long numOfMCConns
Current number of multicast connections.

 o listeners
 protected Vector listeners
Vector object keeping knowledge about current switch listeners.

 o ss
 protected SwitchStatistics ss
Keeps record of statistical data for each port in the FSR-switch.

 o maxPortNum
 protected int maxPortNum
Maximum number for port. This is used for checking that there is no calls to ports that do not exist.

 o maxPPConn
 protected int maxPPConn
Maximum number of point-to-point connections.

 o maxMCConn
 protected int maxMCConn
Maximum number of multicast connections.

 o 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.

 o VPI_ANY
 public static final int VPI_ANY
Wildcard to describe, that VPI number can be chosen freely by switch control software.

 o 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.

 o 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.

 o VCI_ANY
 public static final int VCI_ANY
Wildcard to describe, that VCI number can be chosen freely by switch control software.

 o 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.

 o 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.

 o INTERNAL_ERROR_MSG
 protected static final String INTERNAL_ERROR_MSG
Common part for all internal error messages!

 o DEBUG
 protected static final boolean DEBUG
DEBUG flag controls if we want to compile debug messages.

Constructors

 o Switch
 protected Switch()
Constructs a Switch object.

Methods

 o 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.
 o instance
 public static Switch instance()
Returns a reference to the Switch instance representing the ATM switch.

Returns:
Reference to the Switch class instance
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o getPPConns
 public Enumeration getPPConns()
Returns:
java.util.Enumeration of all point-to-point connections over the switch
 o getMCConns
 public Enumeration getMCConns()
Returns:
java.util.Enumeration of all multicast connections over the switch
 o 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.
 o 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.
 o 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.
 o archDepInitSwitch
 protected abstract void archDepInitSwitch() throws InternalException
Performs the acrhitecture dependent part of switch initialization.

Throws: InternalException
If some internal error occurs.
 o 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.
 o archDepResetSwitch
 protected abstract void archDepResetSwitch() throws InternalException
Performs the acrhitecture dependent part of switch reset.

Throws: InternalException
If some internal error occurs.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o getError
 protected abstract String getError()
Gets the description about the last error occured.

Returns:
description about the error.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o removeSwitchListener
 public synchronized void removeSwitchListener(SwitchListener sl_)
Method to remove listener.

Parameters:
sl_ - The listener removed.
 o addSwitchListener
 public synchronized void addSwitchListener(SwitchListener sl_)
Method to add listener.

Parameters:
sl_ - The listener added.
 o 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