public class OfmError extends OpenflowMessage
The type
value indicates the high-level type
of error. The code
value is interpreted based on
the type. The data
is variable in length and
interpreted based on the type
and
code
.
Unless specified otherwise, the data field contains at least 64 bytes
of the failed request that caused the error message to be generated;
if the failed request is shorter than 64 bytes it should be the full
request without any padding.
As a convenience, the getErrorMessage()
method will return the
data interpreted as an ASCII string, if the message type is
HELLO_FAILED
.
If the error message is in response to a specific message from the
controller, e.g.
BAD_REQUEST
,
BAD_ACTION
,
BAD_INSTRUCTION
,
BAD_MATCH
, or
FLOW_MOD_FAILED
, then the
xid
field of the header must match that of the offending message.
EPERM
error codes correspond to a permissions error generated by,
for example, an OpenFlow hypervisor interposing between a controller
and switch.
length
Modifier and Type | Method and Description |
---|---|
byte[] |
getData()
Returns data associated with the error; Since 1.0.
|
ErrorCode |
getErrorCode()
Returns the error code; Since 1.0.
|
String |
getErrorMessage()
Returns the associated error message; Since 1.0.
|
ErrorType |
getErrorType()
Returns the high-level type of error; Since 1.0.
|
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 ErrorType getErrorType()
public ErrorCode getErrorCode()
type
.public byte[] getData()
public String getErrorMessage()
For errors of type HELLO_FAILED
, the data bytes are interpreted
as an ASCII string, and this is returned. For all other error types, the
data bytes are assumed to be the beginning of the OpenFlow message that
caused the error; the header bytes of which are decoded and a string
representation returned.
Copyright © 2016. All Rights Reserved.