public class ControllerServiceAdapter extends Object implements ControllerService
ControllerService
API, provided specifically for
unit tests to use, to insulate themselves from changes in the API.Constructor and Description |
---|
ControllerServiceAdapter() |
Modifier and Type | Method and Description |
---|---|
void |
addDataPathListener(DataPathListener listener)
Adds the specified datapath listener to the controller.
|
void |
addFlowListener(FlowListener listener)
Adds the specified flow listener to the controller.
|
void |
addGroupListener(GroupListener listener)
Adds the specified group listener to the controller.
|
void |
addMessageListener(MessageListener listener,
Set<MessageType> types)
Adds the specified message listener to the controller.
|
void |
addMeterListener(MeterListener listener)
Adds the specified meter listener to the controller.
|
void |
addPacketListener(SequencedPacketListener listener,
PacketListenerRole role,
int altitude)
Adds the specified packet listener to the packet sequencer, in the
specified role and at the specified altitude.
|
void |
addPacketListener(SequencedPacketListener listener,
PacketListenerRole role,
int altitude,
Set<ProtocolId> interest)
Adds the specified packet listener to the sequencer, in the
specified role and at the specified altitude.
|
MessageFuture |
enablePort(DataPathId dpid,
BigPortNumber port,
boolean enable)
Instructs the controller to enable or disable the given port on the
specified datapath.
|
Set<DataPathInfo> |
getAllDataPathInfo()
Returns information describing each of the OpenFlow datapaths
currently connected to the controller.
|
ControllerConfig |
getControllerConfig()
Returns the current run-time immutable configuration of the open flow
controller,
|
ControllerMx |
getControllerMx()
Returns an instance of the management interface.
|
DataPathInfo |
getDataPathInfo(DataPathId dpid)
Returns information describing a specific OpenFlow datapath.
|
List<MBodyExperimenter> |
getExperimenter(DataPathId dpid)
Returns meter configuration or statistics (for OF 1.0 datapaths),
encoded in experimenter multipart replies.
|
FlowClass |
getFlowClass(String id)
Retrieves the currently registered flow class with the specified id.
|
FlowClassAdministrator |
getFlowClassAdministrator()
Returns an instance of the flow class administration interface.
|
Set<FlowClass> |
getFlowClasses()
Retrieves the set of all currently registered flow classes.
|
List<MBodyFlowStats> |
getFlowStats(DataPathId dpid,
TableId tableId)
Returns flows installed in the specified table of the given datapath.
|
List<MBodyGroupDescStats> |
getGroupDescription(DataPathId dpid)
Returns the group descriptions from the specified datapath.
|
MBodyGroupDescStats |
getGroupDescription(DataPathId dpid,
GroupId groupId)
Returns the group description for the given group ID, from the
specified datapath.
|
MBodyGroupFeatures |
getGroupFeatures(DataPathId dpid)
Returns the supported group features for the specified datapath.
|
List<MBodyGroupStats> |
getGroupStats(DataPathId dpid)
Returns the group statistics from the specified datapath.
|
MBodyGroupStats |
getGroupStats(DataPathId dpid,
GroupId groupId)
Returns the group statistics for the given group ID, from the specified
datapath.
|
List<MBodyMeterConfig> |
getMeterConfig(DataPathId dpid)
Returns the meter configuration details from the specified datapath.
|
MBodyMeterConfig |
getMeterConfig(DataPathId dpid,
MeterId meterId)
Returns the meter configuration for the given meter ID, from the
specified datapath.
|
MBodyMeterFeatures |
getMeterFeatures(DataPathId dpid)
Returns the meter features for the specified datapath.
|
List<MBodyMeterStats> |
getMeterStats(DataPathId dpid)
Returns the meter statistics from the specified datapath.
|
MBodyMeterStats |
getMeterStats(DataPathId dpid,
MeterId meterId)
Returns the meter statistics for the given meter ID, from the specified
datapath.
|
PipelineDefinition |
getPipelineDefinition(DataPathId dpId)
Returns the
PipelineDefinition for the given datapath. |
List<MBodyPortStats> |
getPortStats(DataPathId dpid)
Returns the port statistics from the specified datapath.
|
MBodyPortStats |
getPortStats(DataPathId dpid,
BigPortNumber portNumber)
Returns the port statistics for the given port, from the specified
datapath.
|
List<SplMetric> |
getSplMetrics()
Returns a snapshot of the metrics collected for the registered
sequenced packet listeners . |
ControllerStats |
getStats()
Returns statistical information about the controller.
|
boolean |
isHybridMode()
Indicates whether or not the controller is operating in hybrid mode,
which is where it will defer primary forwarding decisions to the
connected switch.
|
void |
notifyDataPathReady(DataPathId dpid,
ProtocolVersion pv,
IpAddress ip)
Notify listeners that a datapath is ready for use.
|
FlowClass |
registerFlowClass(String id,
String passwd,
String description,
Set<String> lowerIds,
Set<String> higherIds,
Set<OxmFieldType> matchFields,
Set<FlowClass.ActionClass> actions)
Registers a flow mod class, with a dynamically assigned flow mod
priority, which is required when the controller is operating in a
mode where flow mods are strictly enforced.
|
void |
registerInitialFlowContributor(InitialFlowContributor ifc)
Registers an initial flow contributor with the controller.
|
void |
removeDataPathListener(DataPathListener listener)
Removes the specified datapath listener from the controller.
|
void |
removeFlowListener(FlowListener listener)
Removes the specified flow listener from the controller.
|
void |
removeGroupListener(GroupListener listener)
Removes the specified group listener from the controller.
|
void |
removeMessageListener(MessageListener listener)
Removes the specified message listener from the controller.
|
void |
removeMeterListener(MeterListener listener)
Removes the specified meter listener from the controller.
|
void |
removePacketListener(SequencedPacketListener listener)
Removes the specified packet listener from the packet sequencer.
|
List<MessageFuture> |
send(List<OpenflowMessage> msgs,
DataPathId dpid)
Instructs the controller to send the specified list of messages
(in order) to the specified datapath.
|
MessageFuture |
send(OpenflowMessage msg,
DataPathId dpid)
Instructs the controller to send the specified message to the
specified datapath.
|
MessageFuture |
sendConfirmedFlowMod(OfmFlowMod flowMod,
DataPathId dpid)
Sends the given FlowMod message to the specified datapath.
|
void |
sendFlowMod(OfmFlowMod flowMod,
DataPathId dpid)
Sends the given FlowMod message to the specified datapath.
|
MessageFuture |
sendGroupMod(OfmGroupMod groupMod,
DataPathId dpid)
Sends the given GroupMod message to the specified datapath.
|
MessageFuture |
sendMeterMod(OfmMeterMod meterMod,
DataPathId dpid)
Sends the given MeterMod message to the specified datapath.
|
void |
unregisterFlowClass(FlowClass flowClass,
String passwd)
Cancels flow class registration.
|
void |
unregisterInitialFlowContributor(InitialFlowContributor ifc)
Cancels the given flow contributor registration.
|
ProtocolVersion |
versionOf(DataPathId dpid)
Returns the (negotiated) protocol version of the specified datapath.
|
public void addPacketListener(SequencedPacketListener listener, PacketListenerRole role, int altitude)
ControllerService
The listener's event()
callback
will be invoked for every Packet-In message that the controller
passes to the packet sequencer.
addPacketListener
in interface ControllerService
listener
- the listener to be addedrole
- the role the listener wishes to assumealtitude
- the listener's altitudeControllerService.addPacketListener(SequencedPacketListener, PacketListenerRole, int, Set)
public void addPacketListener(SequencedPacketListener listener, PacketListenerRole role, int altitude, Set<ProtocolId> interest)
ControllerService
The interest
argument specifies the protocols that the listener
cares about. When the sequencer receives a Packet-In message,
it will be forwarded to the listener if the packet contains any protocol
that is a member of the specified set.
addPacketListener
in interface ControllerService
listener
- the listener to be addedrole
- the role the listener wishes to assumealtitude
- the listener's altitudeinterest
- the packet protocols the listener is interested inControllerService.addPacketListener(SequencedPacketListener, PacketListenerRole, int)
public void removePacketListener(SequencedPacketListener listener)
ControllerService
removePacketListener
in interface ControllerService
listener
- the listener to be removedpublic List<SplMetric> getSplMetrics()
ControllerService
sequenced packet listeners
. Note that
the list is returned in the same order that the packet listeners get
to see and process the packets.getSplMetrics
in interface ControllerService
public void addMessageListener(MessageListener listener, Set<MessageType> types)
ControllerService
The types
argument specifies the types of message that the
listener cares about. When the controller receives a message,
it will be forwarded to the listener if and only if the
message's type is a member of the specified set.
An empty set (or null) is taken to mean that the listener wants to hear about every message, regardless of type. However, PacketIn messages are not forwarded in this case; see note below.
If a listener calls this method when it is already registered, the specified set of message types completely replaces the original set.
Important Note:
PacketIn messages are processed exclusively by the packet
sequencer. To participate in PacketIn processing, you must use
ControllerService.addPacketListener(SequencedPacketListener, PacketListenerRole, int, Set)
.
Attempting to request PacketIn messages by including
PACKET_IN
in the types
set will throw an exception.
addMessageListener
in interface ControllerService
listener
- the listener to be addedtypes
- the message types the listener cares aboutpublic void removeMessageListener(MessageListener listener)
ControllerService
removeMessageListener
in interface ControllerService
listener
- the listener to be removedpublic void addDataPathListener(DataPathListener listener)
ControllerService
addDataPathListener
in interface ControllerService
listener
- the listener to be addedpublic void removeDataPathListener(DataPathListener listener)
ControllerService
removeDataPathListener
in interface ControllerService
listener
- the listener to be removedpublic Set<DataPathInfo> getAllDataPathInfo()
ControllerService
getAllDataPathInfo
in interface ControllerService
public DataPathInfo getDataPathInfo(DataPathId dpid)
ControllerService
NotFoundException
will be thrown if there is no datapath
connected to the controller with the given ID.getDataPathInfo
in interface ControllerService
dpid
- the datapath idpublic ProtocolVersion versionOf(DataPathId dpid)
ControllerService
NotFoundException
will be thrown if there is no datapath
connected to the controller with the given ID.versionOf
in interface ControllerService
dpid
- the datapath IDpublic ControllerStats getStats()
ControllerService
getStats
in interface ControllerService
public List<MBodyPortStats> getPortStats(DataPathId dpid)
ControllerService
Note that this is a synchronous call that blocks until all the port statistics replies have returned from the datapath.
getPortStats
in interface ControllerService
dpid
- the target datapathpublic MBodyPortStats getPortStats(DataPathId dpid, BigPortNumber portNumber)
ControllerService
Note that this is a synchronous call that blocks until the port statistics reply has returned from the datapath.
getPortStats
in interface ControllerService
dpid
- the target datapathportNumber
- the target portpublic MessageFuture enablePort(DataPathId dpid, BigPortNumber port, boolean enable)
ControllerService
enablePort
in interface ControllerService
dpid
- the target datapathport
- the target portenable
- true to enable; false to disablepublic void notifyDataPathReady(DataPathId dpid, ProtocolVersion pv, IpAddress ip)
ControllerService
notifyDataPathReady
in interface ControllerService
dpid
- the datapath IDpv
- Openflow Protocol versionip
- address of the devicepublic MessageFuture send(OpenflowMessage msg, DataPathId dpid) throws OpenflowException
ControllerService
Important Note:
The sending of FlowMod messages via this method is disallowed;
use ControllerService.sendFlowMod(com.hp.of.lib.msg.OfmFlowMod, com.hp.of.lib.dt.DataPathId)
instead.
send
in interface ControllerService
msg
- the OpenFlow message to senddpid
- the OpenFlow datapath to which the message is to be sentOpenflowException
- if there was a problem encoding or sending
the messagepublic List<MessageFuture> send(List<OpenflowMessage> msgs, DataPathId dpid) throws OpenflowException
ControllerService
Important Note:
The sending of FlowMod messages via this method is disallowed;
use ControllerService.sendFlowMod(com.hp.of.lib.msg.OfmFlowMod, com.hp.of.lib.dt.DataPathId)
instead.
send
in interface ControllerService
msgs
- the OpenFlow messages to senddpid
- the OpenFlow datapath to which the messages are to be sentOpenflowException
- if there was a problem encoding or sending
the messagespublic ControllerMx getControllerMx()
ControllerService
ControllerManagementAuthorizer
.getControllerMx
in interface ControllerService
public FlowClassAdministrator getFlowClassAdministrator()
ControllerService
ControllerManagementAuthorizer
.getFlowClassAdministrator
in interface ControllerService
public List<MBodyFlowStats> getFlowStats(DataPathId dpid, TableId tableId)
ControllerService
tableId
is null
) then
all tables are assumed.
If the specified table ID is TableId.ALL
, all flows from all
tables will be returned.
Note that table ID is ignored for OpenFlow 1.0 devices.
Note that this is a synchronous call that blocks until all the flow statistics replies have returned from the datapath.
getFlowStats
in interface ControllerService
dpid
- the datapath from which the flows are requestedtableId
- the ID of the flow tablepublic FlowClass registerFlowClass(String id, String passwd, String description, Set<String> lowerIds, Set<String> higherIds, Set<OxmFieldType> matchFields, Set<FlowClass.ActionClass> actions)
ControllerService
FlowClass.priority()
} must be used
in lieu of raw priority when submitting flow mods.
The id
should follow a hierarchical namespace (similar
to Java packages) and must share a prefix with an id of an installed
application; otherwise the controller may reject the request.
registerFlowClass
in interface ControllerService
id
- global flow class id that must share prefix with
application idpasswd
- secret password chosen by the registrant to allow
repeat registrations or unregistrations without the
originally issued flow class descriptordescription
- description of the purpose or intentlowerIds
- optional set of priority ids that should fall below
this onehigherIds
- optional set of priority ids that should rise above
this onematchFields
- set of field types expected to be set in the matchactions
- type of action, e.g. drop, forward, processpublic void unregisterFlowClass(FlowClass flowClass, String passwd)
ControllerService
unregisterFlowClass
in interface ControllerService
flowClass
- the record to be canceledpasswd
- optional password that can be used as an override to allow
unregistration using a public flow class recordpublic FlowClass getFlowClass(String id)
ControllerService
getFlowClass
in interface ControllerService
id
- flow class idpublic Set<FlowClass> getFlowClasses()
ControllerService
getFlowClasses
in interface ControllerService
public void registerInitialFlowContributor(InitialFlowContributor ifc)
ControllerService
registerInitialFlowContributor
in interface ControllerService
ifc
- the flow contributor to registerpublic void unregisterInitialFlowContributor(InitialFlowContributor ifc)
ControllerService
unregisterInitialFlowContributor
in interface ControllerService
ifc
- the flow contributor to unregisterpublic void sendFlowMod(OfmFlowMod flowMod, DataPathId dpid) throws OpenflowException
ControllerService
ControllerService.sendConfirmedFlowMod(com.hp.of.lib.msg.OfmFlowMod, com.hp.of.lib.dt.DataPathId)
instead.
Adds the specified flow to the given datapath if the message's
command is ADD
.
Deletes the specified flow from the given datapath if the message's
command is DELETE
.
sendFlowMod
in interface ControllerService
flowMod
- the FlowMod message to senddpid
- the target datapathOpenflowException
- if there was an issue sending the messageFlowModCommand
public MessageFuture sendConfirmedFlowMod(OfmFlowMod flowMod, DataPathId dpid) throws OpenflowException
ControllerService
Adds the specified flow to the given datapath if the message's
command is ADD
.
Deletes the specified flow from the given datapath if the message's
command is DELETE
.
sendConfirmedFlowMod
in interface ControllerService
flowMod
- the FlowMod message to senddpid
- the target datapathOpenflowException
- if there was an issue sending the messageFlowModCommand
,
MessageFuture
public void addFlowListener(FlowListener listener)
ControllerService
addFlowListener
in interface ControllerService
listener
- the flow listener to be addedpublic void removeFlowListener(FlowListener listener)
ControllerService
removeFlowListener
in interface ControllerService
listener
- the flow listener to be removedpublic PipelineDefinition getPipelineDefinition(DataPathId dpId)
ControllerService
PipelineDefinition
for the given datapath.getPipelineDefinition
in interface ControllerService
dpId
- the target datapathpublic List<MBodyGroupDescStats> getGroupDescription(DataPathId dpid)
ControllerService
Note that this is a synchronous call that blocks until all the group description replies have returned from the datapath.
getGroupDescription
in interface ControllerService
dpid
- the target datapathpublic MBodyGroupDescStats getGroupDescription(DataPathId dpid, GroupId groupId)
ControllerService
Note that this is a synchronous call that blocks until the group description reply has returned from the datapath.
getGroupDescription
in interface ControllerService
dpid
- the target datapathgroupId
- the ID of the grouppublic List<MBodyGroupStats> getGroupStats(DataPathId dpid)
ControllerService
Note that this is a synchronous call that blocks until all the group statistics replies have returned from the datapath.
getGroupStats
in interface ControllerService
dpid
- the target datapathpublic MBodyGroupStats getGroupStats(DataPathId dpid, GroupId groupId)
ControllerService
Note that this is a synchronous call that blocks until the group statistics reply has returned from the datapath.
getGroupStats
in interface ControllerService
dpid
- the target datapathgroupId
- the target group IDpublic MBodyGroupFeatures getGroupFeatures(DataPathId dpid)
ControllerService
Note that this is a synchronous call that blocks until the group features reply has returned from the datapath.
getGroupFeatures
in interface ControllerService
dpid
- the target datapathpublic MessageFuture sendGroupMod(OfmGroupMod groupMod, DataPathId dpid) throws OpenflowException
ControllerService
Adds the group entry to the specified datapath if the message's
command is ADD
.
Modifies the group entry on the specified datapath if the message's
command is MODIFY
.
Deletes the group entry from the specified datapath if the message's
command is DELETE
.
sendGroupMod
in interface ControllerService
groupMod
- the GroupMod message to senddpid
- the target datapathOpenflowException
- if there was an issue sending the messageGroupModCommand
public void addGroupListener(GroupListener listener)
ControllerService
addGroupListener
in interface ControllerService
listener
- the group listener to be addedpublic void removeGroupListener(GroupListener listener)
ControllerService
removeGroupListener
in interface ControllerService
listener
- the group listener to be removedpublic List<MBodyMeterConfig> getMeterConfig(DataPathId dpid)
ControllerService
Note that this is a synchronous call that blocks until all the meter configuration replies have returned from the datapath.
getMeterConfig
in interface ControllerService
dpid
- the target datapathpublic MBodyMeterConfig getMeterConfig(DataPathId dpid, MeterId meterId)
ControllerService
Note that this is a synchronous call that blocks until all the meter configuration reply has returned from the datapath.
getMeterConfig
in interface ControllerService
dpid
- the target datapathmeterId
- the ID of the meterpublic List<MBodyMeterStats> getMeterStats(DataPathId dpid)
ControllerService
Note that this is a synchronous call that blocks until all the meter statistics replies have returned from the datapath.
getMeterStats
in interface ControllerService
dpid
- the target datapathpublic MBodyMeterStats getMeterStats(DataPathId dpid, MeterId meterId)
ControllerService
Note that this is a synchronous call that blocks until the meter statistics reply has returned from the datapath.
getMeterStats
in interface ControllerService
dpid
- the target datapathmeterId
- the target meter IDpublic MBodyMeterFeatures getMeterFeatures(DataPathId dpid)
ControllerService
Note that this is a synchronous call that blocks until the meter features reply has returned from the datapath.
getMeterFeatures
in interface ControllerService
dpid
- the target datapathpublic List<MBodyExperimenter> getExperimenter(DataPathId dpid)
ControllerService
Note that this is a synchronous call that blocks until the replies have returned from the datapath.
getExperimenter
in interface ControllerService
dpid
- the target datapathpublic MessageFuture sendMeterMod(OfmMeterMod meterMod, DataPathId dpid) throws OpenflowException
ControllerService
Adds the meter to the specified datapath if the message's
command is ADD
.
Modifies the meter on the specified datapath if the message's
command is MODIFY
.
Deletes the meter from the specified datapath if the message's
command is DELETE
.
sendMeterMod
in interface ControllerService
meterMod
- the MeterMod message to senddpid
- the target datapathOpenflowException
- if there was an issue sending the messageMeterModCommand
public void addMeterListener(MeterListener listener)
ControllerService
addMeterListener
in interface ControllerService
listener
- the meter listener to be addedpublic void removeMeterListener(MeterListener listener)
ControllerService
removeMeterListener
in interface ControllerService
listener
- the meter listener to be removedpublic boolean isHybridMode()
ControllerService
isHybridMode
in interface ControllerService
public ControllerConfig getControllerConfig()
ControllerService
getControllerConfig
in interface ControllerService
Copyright © 2015. All Rights Reserved.