public class CACAction
extends java.lang.Object
Provides a set of actions to be returned by CAC algorithms. These actions are:
String
to specify that reasonAlthough the CACAction
class is common for all actions, its meaning (i.e.
action type) depends on the constructor used to get an instance. Take a look
on the description of the constructors to obtain more information.
Important: 'Accept' and 'block' actions only can be returned when the processed event is a connection request. Upon connection release, these events are forbidden. This fact is checked by the kernel after the execution of the algorithmm.
Important: Actions don't take effect within the algorithm. This means,
for example, that if you release a connection in order to accommodate another one,
methods like netState.getLinkAvailableCapacityInErlangs()
will return
the previous values to the execution of the algorithm, instead of the current according
to the actions. Network state is actually modified by the kernel after
the execution of the algorithm, so users should deal with current network state
by their own.
Important: When connections are forced to be released using the action, the previously scheduled 'release connection' event is then removed.
ICACAlgorithm
,
CACEvent
Modifier and Type | Class and Description |
---|---|
static class |
CACAction.ActionType
Type of action.
|
Modifier and Type | Method and Description |
---|---|
static CACAction |
acceptRequest(int[] seqLinks,
double trafficVolumeInErlangs,
java.util.Map<java.lang.String,java.lang.String> attributes)
Accepts a connection request.
|
static CACAction |
acceptRequest(java.util.List<int[]> seqLinks,
double[] trafficVolumeInErlangs,
java.util.List<java.util.Map<java.lang.String,java.lang.String>> attributes)
Accepts a connection request.
|
static CACAction |
addConnectionRoute(int connId,
int[] seqLinks,
double trafficVolumeInErlangs,
java.util.Map<java.lang.String,java.lang.String> attributes)
Constructor to define a 'add connection route' action.
|
static CACAction |
blockRequest(java.lang.String reasonToBlockConnection)
Blocks connection request.
|
CACAction.ActionType |
getActionType()
Returns the action type.
|
static CACAction |
modifyConnectionRoute(int connRouteId,
double trafficVolumeInErlangs,
java.util.Map<java.lang.String,java.lang.String> attributes)
Constructor to define a 'modify connection route' action.
|
static CACAction |
releaseConnection(int connId)
Releases an existing connection.
|
java.lang.String |
toString()
Returns a
String representation of the object. |
public static CACAction blockRequest(java.lang.String reasonToBlockConnection)
reasonToBlockConnection
- String defining the reason to block the request (can be null
)public static CACAction acceptRequest(int[] seqLinks, double trafficVolumeInErlangs, java.util.Map<java.lang.String,java.lang.String> attributes)
seqLinks
- Sequence of linkstrafficVolumeInErlangs
- Traffic volume accepted (can be lower to the one requested)attributes
- Map for user-defined attributes. The key (String value) in the map will be the attribute name and the value (String value) will be whatever value is stored in that attribute. If null
, it will be assumed to be an empty HashMappublic static CACAction acceptRequest(java.util.List<int[]> seqLinks, double[] trafficVolumeInErlangs, java.util.List<java.util.Map<java.lang.String,java.lang.String>> attributes)
seqLinks
- List of sequence of linkstrafficVolumeInErlangs
- Traffic volume accepted vectorattributes
- List of maps for user-defined attributes. The key (String value) in the map will be the attribute name and the value (String value) will be whatever value is stored in that attribute. If null
, it will be assumed to be an empty HashMappublic static CACAction addConnectionRoute(int connId, int[] seqLinks, double trafficVolumeInErlangs, java.util.Map<java.lang.String,java.lang.String> attributes)
connId
- Connection identifierseqLinks
- Sequence of linkstrafficVolumeInErlangs
- New traffic volume in Erlangsattributes
- Connection route attributes (null means empty)public static CACAction modifyConnectionRoute(int connRouteId, double trafficVolumeInErlangs, java.util.Map<java.lang.String,java.lang.String> attributes)
connRouteId
- Connection route identifiertrafficVolumeInErlangs
- New traffic volume in Erlangs (-1 means 'no change')attributes
- Connection route attributes (null means 'no change')public static CACAction releaseConnection(int connId)
Releases an existing connection.
Important: A 'connection release' event will be triggered inmediately.
connId
- Connection identifier (if it doesn't exist, nothing it will happen)public CACAction.ActionType getActionType()
public java.lang.String toString()
String
representation of the object.toString
in class java.lang.Object
String
representation of the object