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.
|
MessageContext |
createMsgContext(OpenflowEventType type,
OpenflowMessage msg,
DataPathId dpid,
int auxId,
ProtocolVersion pv) |
MessageContextForHost |
createMsgContextForHost(MessageContext context,
boolean bL3Forwarding) |
MessageContextForPath |
createMsgContextForPath(MessageContext context,
boolean bL3Forwarding) |
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.
|
ControllerMx |
getControllerMx()
Returns an instance of the management interface.
|
DataPathInfo |
getDataPathInfo(DataPathId dpid)
Returns information describing a specific OpenFlow datapath.
|
MBodyDesc |
getDesc(DataPathInfo dpinfo) |
List<MBodyExperimenter> |
getExperimenter(DataPathId dpid)
Returns meter configuration or statistics (for OF 1.0 datapaths),
encoded in experimenter multipart replies.
|
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.
|
List<SequencedPacketListener> |
getPacketListeners(PacketListenerRole role)
Returns an ordered list of packet listeners registered with the
packet sequencer, for the specified role.
|
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.
|
ControllerStats |
getStats()
Returns statistical information about 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 |
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.
|
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 ControllerServicelistener - 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 ControllerServicelistener - 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)
ControllerServiceremovePacketListener in interface ControllerServicelistener - the listener to be removedpublic List<SequencedPacketListener> getPacketListeners(PacketListenerRole role)
ControllerServicegetPacketListeners in interface ControllerServicerole - the role to examinepublic 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 ControllerServicelistener - the listener to be addedtypes - the message types the listener cares aboutpublic void removeMessageListener(MessageListener listener)
ControllerServiceremoveMessageListener in interface ControllerServicelistener - the listener to be removedpublic void addDataPathListener(DataPathListener listener)
ControllerServiceaddDataPathListener in interface ControllerServicelistener - the listener to be addedpublic void removeDataPathListener(DataPathListener listener)
ControllerServiceremoveDataPathListener in interface ControllerServicelistener - the listener to be removedpublic Set<DataPathInfo> getAllDataPathInfo()
ControllerServicegetAllDataPathInfo in interface ControllerServicepublic DataPathInfo getDataPathInfo(DataPathId dpid)
ControllerServiceNotFoundException will be thrown if there is no datapath
connected to the controller with the given ID.getDataPathInfo in interface ControllerServicedpid - the datapath idpublic ProtocolVersion versionOf(DataPathId dpid)
ControllerServiceNotFoundException will be thrown if there is no datapath
connected to the controller with the given ID.versionOf in interface ControllerServicedpid - the datapath IDpublic ControllerStats getStats()
ControllerServicegetStats in interface ControllerServicepublic List<MBodyPortStats> getPortStats(DataPathId dpid)
ControllerServiceNote that this is a synchronous call that blocks until all the port statistics replies have returned from the datapath.
getPortStats in interface ControllerServicedpid - the target datapathpublic MBodyPortStats getPortStats(DataPathId dpid, BigPortNumber portNumber)
ControllerServiceNote that this is a synchronous call that blocks until the port statistics reply has returned from the datapath.
getPortStats in interface ControllerServicedpid - the target datapathportNumber - the target portpublic MessageFuture enablePort(DataPathId dpid, BigPortNumber port, boolean enable)
ControllerServiceenablePort in interface ControllerServicedpid - the target datapathport - the target portenable - true to enable; false to disablepublic 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.h3c.of.lib.msg.OfmFlowMod, com.h3c.of.lib.dt.DataPathId) instead.
send in interface ControllerServicemsg - 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.h3c.of.lib.msg.OfmFlowMod, com.h3c.of.lib.dt.DataPathId) instead.
send in interface ControllerServicemsgs - 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() throws AuthorizationException
ControllerServiceControllerManagementAuthorizer.getControllerMx in interface ControllerServiceAuthorizationException - if the caller is not authorizedpublic List<MBodyFlowStats> getFlowStats(DataPathId dpid, TableId tableId)
ControllerServicetableId 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 ControllerServicedpid - the datapath from which the flows are requestedtableId - the ID of the flow tablepublic MessageFuture sendFlowMod(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.
sendFlowMod in interface ControllerServiceflowMod - the FlowMod message to senddpid - the target datapathOpenflowException - if there was an issue sending the messageFlowModCommandpublic void addFlowListener(FlowListener listener)
ControllerServiceaddFlowListener in interface ControllerServicelistener - the flow listener to be addedpublic void removeFlowListener(FlowListener listener)
ControllerServiceremoveFlowListener in interface ControllerServicelistener - the flow listener to be removedpublic List<MBodyGroupDescStats> getGroupDescription(DataPathId dpid)
ControllerServiceNote that this is a synchronous call that blocks until all the group description replies have returned from the datapath.
getGroupDescription in interface ControllerServicedpid - the target datapathpublic MBodyGroupDescStats getGroupDescription(DataPathId dpid, GroupId groupId)
ControllerServiceNote that this is a synchronous call that blocks until the group description reply has returned from the datapath.
getGroupDescription in interface ControllerServicedpid - the target datapathgroupId - the ID of the grouppublic List<MBodyGroupStats> getGroupStats(DataPathId dpid)
ControllerServiceNote that this is a synchronous call that blocks until all the group statistics replies have returned from the datapath.
getGroupStats in interface ControllerServicedpid - the target datapathpublic MBodyGroupStats getGroupStats(DataPathId dpid, GroupId groupId)
ControllerServiceNote that this is a synchronous call that blocks until the group statistics reply has returned from the datapath.
getGroupStats in interface ControllerServicedpid - the target datapathgroupId - the target group IDpublic MBodyGroupFeatures getGroupFeatures(DataPathId dpid)
ControllerServiceNote that this is a synchronous call that blocks until the group features reply has returned from the datapath.
getGroupFeatures in interface ControllerServicedpid - 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 ControllerServicegroupMod - the GroupMod message to senddpid - the target datapathOpenflowException - if there was an issue sending the messageGroupModCommandpublic void addGroupListener(GroupListener listener)
ControllerServiceaddGroupListener in interface ControllerServicelistener - the group listener to be addedpublic void removeGroupListener(GroupListener listener)
ControllerServiceremoveGroupListener in interface ControllerServicelistener - the group listener to be removedpublic List<MBodyMeterConfig> getMeterConfig(DataPathId dpid)
ControllerServiceNote that this is a synchronous call that blocks until all the meter configuration replies have returned from the datapath.
getMeterConfig in interface ControllerServicedpid - the target datapathpublic MBodyMeterConfig getMeterConfig(DataPathId dpid, MeterId meterId)
ControllerServiceNote that this is a synchronous call that blocks until all the meter configuration reply has returned from the datapath.
getMeterConfig in interface ControllerServicedpid - the target datapathmeterId - the ID of the meterpublic List<MBodyMeterStats> getMeterStats(DataPathId dpid)
ControllerServiceNote that this is a synchronous call that blocks until all the meter statistics replies have returned from the datapath.
getMeterStats in interface ControllerServicedpid - the target datapathpublic MBodyMeterStats getMeterStats(DataPathId dpid, MeterId meterId)
ControllerServiceNote that this is a synchronous call that blocks until the meter statistics reply has returned from the datapath.
getMeterStats in interface ControllerServicedpid - the target datapathmeterId - the target meter IDpublic MBodyMeterFeatures getMeterFeatures(DataPathId dpid)
ControllerServiceNote that this is a synchronous call that blocks until the meter features reply has returned from the datapath.
getMeterFeatures in interface ControllerServicedpid - the target datapathpublic List<MBodyExperimenter> getExperimenter(DataPathId dpid)
ControllerServiceNote that this is a synchronous call that blocks until the replies have returned from the datapath.
getExperimenter in interface ControllerServicedpid - 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 ControllerServicemeterMod - the MeterMod message to senddpid - the target datapathOpenflowException - if there was an issue sending the messageMeterModCommandpublic void addMeterListener(MeterListener listener)
ControllerServiceaddMeterListener in interface ControllerServicelistener - the meter listener to be addedpublic void removeMeterListener(MeterListener listener)
ControllerServiceremoveMeterListener in interface ControllerServicelistener - the meter listener to be removedpublic PipelineDefinition getPipelineDefinition(DataPathId dpId)
ControllerServicePipelineDefinition for the given datapath.getPipelineDefinition in interface ControllerServicedpId - the target datapathpublic MBodyDesc getDesc(DataPathInfo dpinfo)
getDesc in interface ControllerServicepublic MessageContext createMsgContext(OpenflowEventType type, OpenflowMessage msg, DataPathId dpid, int auxId, ProtocolVersion pv)
createMsgContext in interface ControllerServicepublic MessageContextForHost createMsgContextForHost(MessageContext context, boolean bL3Forwarding)
createMsgContextForHost in interface ControllerServicepublic MessageContextForPath createMsgContextForPath(MessageContext context, boolean bL3Forwarding)
createMsgContextForPath in interface ControllerServiceCopyright © 2014. All Rights Reserved.