public abstract class AbstractOpenFlowSwitch extends org.onosproject.net.driver.AbstractHandlerBehaviour implements OpenFlowSwitchDriver
| Modifier and Type | Field and Description |
|---|---|
protected String |
channelId |
protected org.projectfloodlight.openflow.protocol.OFDescStatsReply |
desc |
protected org.projectfloodlight.openflow.protocol.OFFeaturesReply |
features |
protected org.slf4j.Logger |
log |
protected org.projectfloodlight.openflow.protocol.OFMeterFeaturesStatsReply |
meterfeatures |
protected List<org.projectfloodlight.openflow.protocol.OFPortDescStatsReply> |
ports |
protected RoleState |
role |
protected boolean |
startDriverHandshakeCalled |
protected boolean |
tableFull |
| Constructor and Description |
|---|
AbstractOpenFlowSwitch() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
activateEqualSwitch()
Activate this EQUAL switch-controller relationship in the OF agent.
|
boolean |
activateMasterSwitch()
Activate this MASTER switch-controller relationship in the OF agent.
|
String |
channelId()
Identifies the channel used to communicate with the switch.
|
boolean |
connectSwitch()
Announce to the OpenFlow agent that this switch has connected.
|
String |
datapathDescription()
fetch the datapath description.
|
org.onosproject.net.Device.Type |
deviceType()
Returns the switch device type.
|
void |
disconnectSwitch()
Disconnects the switch by closing the TCP connection.
|
org.projectfloodlight.openflow.protocol.OFFactory |
factory()
Provides the factory for this OF version.
|
long |
getId()
Gets the datapathId of the switch.
|
int |
getNextTransactionId()
Gets the next transaction id to use.
|
List<org.projectfloodlight.openflow.protocol.OFPortDesc> |
getPorts()
Fetches the ports of this switch.
|
RoleState |
getRole()
Fetch the role for this switch.
|
String |
getStringId()
Gets a string version of the ID for this switch.
|
void |
handleMessage(org.projectfloodlight.openflow.protocol.OFMessage m)
Handle the message coming from the dataplane.
|
void |
handleNiciraRole(org.projectfloodlight.openflow.protocol.OFMessage m)
If this driver know of Nicira style role messages, these should
be handled here.
|
void |
handleRole(org.projectfloodlight.openflow.protocol.OFMessage m)
Handle OF 1.x (where x > 0) role messages.
|
boolean |
handleRoleError(org.projectfloodlight.openflow.protocol.OFErrorMsg error)
Handle the situation where the role request triggers an error.
|
String |
hardwareDescription()
fetch the hardware description.
|
void |
init(Dpid dpid,
org.projectfloodlight.openflow.protocol.OFDescStatsReply desc,
org.projectfloodlight.openflow.protocol.OFVersion ofv)
Initialises the behaviour.
|
boolean |
isConnected()
Checks if the switch is still connected.
|
abstract boolean |
isDriverHandshakeComplete()
Checks whether the driver specific handshake is complete.
|
String |
manufacturerDescription()
fetch the manufacturer description.
|
abstract void |
processDriverHandshakeMessage(org.projectfloodlight.openflow.protocol.OFMessage m)
Process a message during the driver specific handshake.
|
void |
reassertRole()
Reasserts this controllers role to the switch.
|
void |
removeConnectedSwitch()
Remove this switch from the openflow agent.
|
void |
returnRoleReply(RoleState requested,
RoleState response)
Notifies the controller that the device has responded to a set-role request.
|
void |
sendHandshakeMessage(org.projectfloodlight.openflow.protocol.OFMessage message)
Allows the handshaker behaviour to send messages during the
handshake phase only.
|
void |
sendMsg(List<org.projectfloodlight.openflow.protocol.OFMessage> msgs)
Writes the OFMessage list to the driver.
|
void |
sendMsg(org.projectfloodlight.openflow.protocol.OFMessage msg)
Writes the message to the driver.
|
void |
sendRoleRequest(org.projectfloodlight.openflow.protocol.OFMessage msg)
Sends only role request messages.
|
String |
serialNumber()
fetch the serial number.
|
void |
setAgent(OpenFlowAgent ag)
Sets the OpenFlow agent to be used.
|
void |
setChannel(org.jboss.netty.channel.Channel channel)
Sets the associated Netty channel for this switch.
|
void |
setConnected(boolean connected)
Sets whether the switch is connected.
|
void |
setFeaturesReply(org.projectfloodlight.openflow.protocol.OFFeaturesReply featuresReply)
Sets the features reply for this switch.
|
void |
setMeterFeaturesReply(org.projectfloodlight.openflow.protocol.OFMeterFeaturesStatsReply meterFeaturesReply)
Sets the meter features reply for this switch.
|
void |
setOFVersion(org.projectfloodlight.openflow.protocol.OFVersion ofV)
Sets the OF version for this switch.
|
void |
setPortDescReplies(List<org.projectfloodlight.openflow.protocol.OFPortDescStatsReply> portDescReplies)
Sets the ports on this switch.
|
void |
setPortDescReply(org.projectfloodlight.openflow.protocol.OFPortDescStatsReply portDescReply)
Sets the ports on this switch.
|
void |
setRole(RoleState role)
Sets the role for this switch.
|
void |
setRoleHandler(RoleHandler roleHandler)
Sets the Role handler object.
|
void |
setSwitchDescription(org.projectfloodlight.openflow.protocol.OFDescStatsReply d)
Sets the switch description.
|
void |
setTableFull(boolean full)
Sets this switch has having a full flowtable.
|
String |
softwareDescription()
fetch the software description.
|
abstract void |
startDriverHandshake()
Starts the driver specific handshake process.
|
abstract Boolean |
supportNxRole()
Does this switch support Nicira Role messages.
|
String |
toString() |
void |
transitionToEqualSwitch()
Transition this switch-controller relationship to an EQUAL state.
|
void |
transitionToMasterSwitch()
Transition this switch-controller relationship to an Master state.
|
handler, setHandlerprotected final org.slf4j.Logger log
protected String channelId
protected boolean startDriverHandshakeCalled
protected List<org.projectfloodlight.openflow.protocol.OFPortDescStatsReply> ports
protected boolean tableFull
protected volatile RoleState role
protected org.projectfloodlight.openflow.protocol.OFFeaturesReply features
protected org.projectfloodlight.openflow.protocol.OFDescStatsReply desc
protected org.projectfloodlight.openflow.protocol.OFMeterFeaturesStatsReply meterfeatures
public void init(Dpid dpid, org.projectfloodlight.openflow.protocol.OFDescStatsReply desc, org.projectfloodlight.openflow.protocol.OFVersion ofv)
OpenFlowSwitchDriverinit in interface OpenFlowSwitchDriverdpid - a dpiddesc - a switch descriptionofv - OpenFlow versionpublic final void disconnectSwitch()
OpenFlowSwitchdisconnectSwitch in interface OpenFlowSwitchpublic void sendMsg(org.projectfloodlight.openflow.protocol.OFMessage msg)
OpenFlowSwitchNote: Messages may be silently dropped/lost due to IOExceptions or role. If this is a concern, then a caller should use barriers.
sendMsg in interface OpenFlowSwitchmsg - the message to writepublic final void sendMsg(List<org.projectfloodlight.openflow.protocol.OFMessage> msgs)
OpenFlowSwitchNote: Messages may be silently dropped/lost due to IOExceptions or role. If this is a concern, then a caller should use barriers.
sendMsg in interface OpenFlowSwitchmsgs - the messages to be writtenpublic final void sendRoleRequest(org.projectfloodlight.openflow.protocol.OFMessage msg)
OpenFlowSwitchDriversendRoleRequest in interface OpenFlowSwitchDrivermsg - a role request message.public final void sendHandshakeMessage(org.projectfloodlight.openflow.protocol.OFMessage message)
OpenFlowSwitchDriversendHandshakeMessage in interface OpenFlowSwitchDrivermessage - an OpenFlow messagepublic final boolean isConnected()
OpenFlowSwitchisConnected in interface OpenFlowSwitchpublic final void setConnected(boolean connected)
OpenFlowSwitchDriversetConnected in interface OpenFlowSwitchDriverconnected - whether the switch is connectedpublic final void setChannel(org.jboss.netty.channel.Channel channel)
OpenFlowSwitchDriversetChannel in interface OpenFlowSwitchDriverchannel - the Netty channelpublic String channelId()
OpenFlowSwitchchannelId in interface OpenFlowSwitchpublic final long getId()
OpenFlowSwitchgetId in interface OpenFlowSwitchpublic final String getStringId()
OpenFlowSwitchgetStringId in interface OpenFlowSwitchpublic final void setOFVersion(org.projectfloodlight.openflow.protocol.OFVersion ofV)
OpenFlowSwitchDriversetOFVersion in interface OpenFlowSwitchDriverofV - the version to set.public void setTableFull(boolean full)
OpenFlowSwitchDriversetTableFull in interface OpenFlowSwitchDriverfull - true if full, false otherswise.public void setFeaturesReply(org.projectfloodlight.openflow.protocol.OFFeaturesReply featuresReply)
OpenFlowSwitchDriversetFeaturesReply in interface OpenFlowSwitchDriverfeaturesReply - the features to set.public void setMeterFeaturesReply(org.projectfloodlight.openflow.protocol.OFMeterFeaturesStatsReply meterFeaturesReply)
OpenFlowSwitchDriversetMeterFeaturesReply in interface OpenFlowSwitchDrivermeterFeaturesReply - the meter features to set.public abstract Boolean supportNxRole()
OpenFlowSwitchDriversupportNxRole in interface OpenFlowSwitchDriverpublic final void handleMessage(org.projectfloodlight.openflow.protocol.OFMessage m)
handleMessage in interface OpenFlowSwitchm - the actual messagepublic RoleState getRole()
OpenFlowSwitchgetRole in interface OpenFlowSwitchpublic final boolean connectSwitch()
OpenFlowSwitchDriverconnectSwitch in interface OpenFlowSwitchDriverpublic final boolean activateMasterSwitch()
OpenFlowSwitchDriveractivateMasterSwitch in interface OpenFlowSwitchDriverpublic final boolean activateEqualSwitch()
OpenFlowSwitchDriveractivateEqualSwitch in interface OpenFlowSwitchDriverpublic final void transitionToEqualSwitch()
OpenFlowSwitchDrivertransitionToEqualSwitch in interface OpenFlowSwitchDriverpublic final void transitionToMasterSwitch()
OpenFlowSwitchDrivertransitionToMasterSwitch in interface OpenFlowSwitchDriverpublic final void removeConnectedSwitch()
OpenFlowSwitchDriverremoveConnectedSwitch in interface OpenFlowSwitchDriverpublic org.projectfloodlight.openflow.protocol.OFFactory factory()
OpenFlowSwitchfactory in interface OpenFlowSwitchpublic void setPortDescReply(org.projectfloodlight.openflow.protocol.OFPortDescStatsReply portDescReply)
OpenFlowSwitchDriversetPortDescReply in interface OpenFlowSwitchDriverportDescReply - the port set and descriptionspublic void setPortDescReplies(List<org.projectfloodlight.openflow.protocol.OFPortDescStatsReply> portDescReplies)
OpenFlowSwitchDriversetPortDescReplies in interface OpenFlowSwitchDriverportDescReplies - list of port set and descriptionspublic void returnRoleReply(RoleState requested, RoleState response)
OpenFlowSwitchreturnRoleReply in interface OpenFlowSwitchrequested - the role requested by the controllerresponse - the role set at the devicepublic abstract void startDriverHandshake()
OpenFlowSwitchDriverstartDriverHandshake in interface OpenFlowSwitchDriverpublic abstract boolean isDriverHandshakeComplete()
OpenFlowSwitchDriverisDriverHandshakeComplete in interface OpenFlowSwitchDriverpublic abstract void processDriverHandshakeMessage(org.projectfloodlight.openflow.protocol.OFMessage m)
OpenFlowSwitchDriverprocessDriverHandshakeMessage in interface OpenFlowSwitchDriverm - the message to process.public void setRole(RoleState role)
OpenFlowSwitchsetRole in interface OpenFlowSwitchrole - the role to set.public void reassertRole()
OpenFlowSwitchDriverreassertRole in interface OpenFlowSwitchDriverpublic void handleRole(org.projectfloodlight.openflow.protocol.OFMessage m)
throws SwitchStateException
OpenFlowSwitchDriverhandleRole in interface OpenFlowSwitchDriverm - the role message to handleSwitchStateException - if the message received was
not a nicira role or was malformed.public void handleNiciraRole(org.projectfloodlight.openflow.protocol.OFMessage m)
throws SwitchStateException
OpenFlowSwitchDriverhandleNiciraRole in interface OpenFlowSwitchDriverm - the role message to handle.SwitchStateException - if the message received was
not a nicira role or was malformed.public boolean handleRoleError(org.projectfloodlight.openflow.protocol.OFErrorMsg error)
OpenFlowSwitchDriverhandleRoleError in interface OpenFlowSwitchDrivererror - the error to handle.public final void setAgent(OpenFlowAgent ag)
OpenFlowSwitchDriversetAgent in interface OpenFlowSwitchDriverag - the agent to set.public final void setRoleHandler(RoleHandler roleHandler)
OpenFlowSwitchDriversetRoleHandler in interface OpenFlowSwitchDriverroleHandler - the roleHandler classpublic void setSwitchDescription(org.projectfloodlight.openflow.protocol.OFDescStatsReply d)
OpenFlowSwitchDriversetSwitchDescription in interface OpenFlowSwitchDriverd - the descriptionspublic int getNextTransactionId()
OpenFlowSwitchDrivergetNextTransactionId in interface OpenFlowSwitchDriverpublic List<org.projectfloodlight.openflow.protocol.OFPortDesc> getPorts()
OpenFlowSwitchgetPorts in interface OpenFlowSwitchpublic String manufacturerDescription()
OpenFlowSwitchmanufacturerDescription in interface OpenFlowSwitchpublic String datapathDescription()
OpenFlowSwitchdatapathDescription in interface OpenFlowSwitchpublic String hardwareDescription()
OpenFlowSwitchhardwareDescription in interface OpenFlowSwitchpublic String softwareDescription()
OpenFlowSwitchsoftwareDescription in interface OpenFlowSwitchpublic String serialNumber()
OpenFlowSwitchserialNumber in interface OpenFlowSwitchpublic org.onosproject.net.Device.Type deviceType()
OpenFlowSwitchdeviceType in interface OpenFlowSwitch