public class OfmMultipartReply extends OpenflowMessage
Important Note: Although MULTIPART_REPLY messages were only added to the protocol at 1.3, they are semantically equivalent to the (now deprecated) STATS_REPLY messages in 1.0, 1.1 and 1.2.
For example, to create a "switch description reply" message (Stats-Reply/DESC) to send back to the controller from a mock-switch implementation emulating an OpenFlow 1.0 switch, one would do the following:
OfmMultipartRequest request = ...; // the message we are replying to OfmMutableMultipartReply reply = (OfmMutableMultipartReply) MessageFactory.create(MULTIPART_REPLY, request); MBodyMutableDesc desc = (MBodyMutableDesc) MpBodyFactory.createReplyBody(DESC); desc.mfrDesc(...).hwDesc(...).swDesc(...) .serialNum(...).dpDesc(...); reply.body((MultipartBody) desc.toImmutable()); OpenflowMessage msgToSend = reply.toImmutable();When the message is encoded, the
MessageFactory
will use the version
of the message to decide whether to encode it as a MULTIPART_REPLY or
a STATS_REPLY.OfmMultipartRequest
length
Modifier and Type | Method and Description |
---|---|
MultipartBody |
getBody()
Returns the body of the message; Since 1.3.
|
Set<MultipartReplyFlag> |
getFlags()
Returns the set of multipart message reply flags; Since 1.3.
|
MultipartType |
getMultipartType()
Returns the multipart message type; Since 1.3.
|
boolean |
hasMore()
Returns
true if the MultipartReplyFlag.REPLY_MORE
flag is present. |
String |
toDebugString()
Returns a string representation useful for debugging.
|
String |
toString() |
void |
validate()
Validates this message for completeness and throws an exception
if the message is considered "not complete".
|
decodeHeader, getType, getVersion, getXid, hex, hex, length
public String toString()
toString
in class OpenflowMessage
public String toDebugString()
OpenflowMessage
OpenflowMessage.toString()
, but
subclasses are free to override this behavior.toDebugString
in interface Structure
toDebugString
in class OpenflowMessage
public void validate() throws IncompleteMessageException
OpenflowMessage
This default implementation does nothing, i.e. default behavior is that messages are considered complete.
Subclasses should override this method to check that mandatory fields or other internal state is present, throwing an exception if it is not.
validate
in class OpenflowMessage
IncompleteMessageException
- if the message is not completepublic MultipartType getMultipartType()
public Set<MultipartReplyFlag> getFlags()
public boolean hasMore()
true
if the MultipartReplyFlag.REPLY_MORE
flag is present.
The presence of this flag indicates to the receiver that more
(related) multipart-replies are on their way; Only the last reply
in such a sequence will have this flag false
(cleared).
public MultipartBody getBody()
Copyright © 2015. All Rights Reserved.