本文整理汇总了Java中org.openflow.protocol.OFError.getErrorCode方法的典型用法代码示例。如果您正苦于以下问题:Java OFError.getErrorCode方法的具体用法?Java OFError.getErrorCode怎么用?Java OFError.getErrorCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openflow.protocol.OFError
的用法示例。
在下文中一共展示了OFError.getErrorCode方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleErrorMessage
import org.openflow.protocol.OFError; //导入方法依赖的package包/类
protected void handleErrorMessage(OFError err, long dpid, int xid) {
short errorType = err.getErrorType();
short errorCode = err.getErrorCode();
if (errorType == OFError.OFErrorType.OFPET_BAD_REQUEST.getValue() &&
errorCode == (short)OFError.OFBadRequestCode.OFPBRC_EPERM.ordinal()) {
Set<Integer> xids = sentIPRequests.get(dpid);
if (xids != null && xids.contains(xid)) {
logger.warn("Switch {} not configured with tunnel-endpoint " +
"information (missing /etc/bsn_tunnel_interface file)",
HexString.toHexString(dpid));
xids.remove(xid);
return;
}
} else {
// ignoring all other error messages
}
}
示例2: processOFError
import org.openflow.protocol.OFError; //导入方法依赖的package包/类
@Override
void processOFError(OFChannelHandler h, OFError m) {
if (m.getErrorType() == OFErrorType.OFPET_BAD_REQUEST.getValue()
&& m.getErrorCode() ==
OFBadRequestCode.OFPBRC_BAD_VENDOR.ordinal()) {
log.debug("Switch {} has multiple tables but does not " +
"support L2 table extension",
h.getSwitchInfoString());
return;
}
logErrorDisconnect(h, m);
}
示例3: getErrorString
import org.openflow.protocol.OFError; //导入方法依赖的package包/类
/**
* Get a useable error string from the OFError.
* @param error
* @return
*/
public static String getErrorString(OFError error) {
// TODO: this really should be OFError.toString. Sigh.
int etint = 0xffff & error.getErrorType();
if (etint < 0 || etint >= OFErrorType.values().length) {
return String.format("Unknown error type %d", etint);
}
OFErrorType et = OFErrorType.values()[etint];
switch (et) {
case OFPET_HELLO_FAILED:
OFHelloFailedCode hfc =
OFHelloFailedCode.values()[0xffff & error.getErrorCode()];
return String.format("Error %s %s", et, hfc);
case OFPET_BAD_REQUEST:
OFBadRequestCode brc =
OFBadRequestCode.values()[0xffff & error.getErrorCode()];
return String.format("Error %s %s", et, brc);
case OFPET_BAD_ACTION:
OFBadActionCode bac =
OFBadActionCode.values()[0xffff & error.getErrorCode()];
return String.format("Error %s %s", et, bac);
case OFPET_FLOW_MOD_FAILED:
OFFlowModFailedCode fmfc =
OFFlowModFailedCode.values()[0xffff & error.getErrorCode()];
return String.format("Error %s %s", et, fmfc);
case OFPET_PORT_MOD_FAILED:
OFPortModFailedCode pmfc =
OFPortModFailedCode.values()[0xffff & error.getErrorCode()];
return String.format("Error %s %s", et, pmfc);
case OFPET_QUEUE_OP_FAILED:
OFQueueOpFailedCode qofc =
OFQueueOpFailedCode.values()[0xffff & error.getErrorCode()];
return String.format("Error %s %s", et, qofc);
case OFPET_VENDOR_ERROR:
// no codes known for vendor error
return String.format("Error %s", et);
}
return null;
}
示例4: logError
import org.openflow.protocol.OFError; //导入方法依赖的package包/类
/**
* Log an OpenFlow error message from a switch
* @param sw The switch that sent the error
* @param error The error message
*/
@LogMessageDoc(level="ERROR",
message="Error {error type} {error code} from {switch}",
explanation="The switch responded with an unexpected error" +
"to an OpenFlow message from the controller",
recommendation="This could indicate improper network operation. " +
"If the problem persists restarting the switch and " +
"controller may help."
)
protected void logError(IOFSwitch sw, OFError error) {
int etint = 0xffff & error.getErrorType();
if (etint < 0 || etint >= OFErrorType.values().length) {
log.error("Unknown error code {} from sw {}", etint, sw);
}
OFErrorType et = OFErrorType.values()[etint];
switch (et) {
case OFPET_HELLO_FAILED:
OFHelloFailedCode hfc =
OFHelloFailedCode.values()[0xffff & error.getErrorCode()];
log.error("Error {} {} from {}", new Object[] {et, hfc, sw});
break;
case OFPET_BAD_REQUEST:
OFBadRequestCode brc =
OFBadRequestCode.values()[0xffff & error.getErrorCode()];
log.error("Error {} {} from {}", new Object[] {et, brc, sw});
break;
case OFPET_BAD_ACTION:
OFBadActionCode bac =
OFBadActionCode.values()[0xffff & error.getErrorCode()];
log.error("Error {} {} from {}", new Object[] {et, bac, sw});
break;
case OFPET_FLOW_MOD_FAILED:
OFFlowModFailedCode fmfc =
OFFlowModFailedCode.values()[0xffff & error.getErrorCode()];
log.error("Error {} {} from {}", new Object[] {et, fmfc, sw});
break;
case OFPET_PORT_MOD_FAILED:
OFPortModFailedCode pmfc =
OFPortModFailedCode.values()[0xffff & error.getErrorCode()];
log.error("Error {} {} from {}", new Object[] {et, pmfc, sw});
break;
case OFPET_QUEUE_OP_FAILED:
OFQueueOpFailedCode qofc =
OFQueueOpFailedCode.values()[0xffff & error.getErrorCode()];
log.error("Error {} {} from {}", new Object[] {et, qofc, sw});
break;
default:
break;
}
}
示例5: getErrorString
import org.openflow.protocol.OFError; //导入方法依赖的package包/类
/**
* Get an error string from the OFError.
*
* @param error the OpenFlow error
* @return the error string
*/
private static String getErrorString(OFError error) {
// TODO: this really should be OFError.toString. Sigh.
int etint = 0xffff & error.getErrorType();
if (etint < 0 || etint >= OFErrorType.values().length) {
return String.format("Unknown error type %d", etint);
}
OFErrorType et = OFErrorType.values()[etint];
switch (et) {
case OFPET_HELLO_FAILED:
OFHelloFailedCode hfc = OFHelloFailedCode.values()[0xffff & error
.getErrorCode()];
return String.format("Error %s %s", et, hfc);
case OFPET_BAD_REQUEST:
OFBadRequestCode brc = OFBadRequestCode.values()[0xffff & error
.getErrorCode()];
return String.format("Error %s %s", et, brc);
case OFPET_BAD_ACTION:
OFBadActionCode bac = OFBadActionCode.values()[0xffff & error
.getErrorCode()];
return String.format("Error %s %s", et, bac);
case OFPET_FLOW_MOD_FAILED:
OFFlowModFailedCode fmfc = OFFlowModFailedCode.values()[0xffff & error
.getErrorCode()];
return String.format("Error %s %s", et, fmfc);
case OFPET_PORT_MOD_FAILED:
OFPortModFailedCode pmfc = OFPortModFailedCode.values()[0xffff & error
.getErrorCode()];
return String.format("Error %s %s", et, pmfc);
case OFPET_QUEUE_OP_FAILED:
OFQueueOpFailedCode qofc = OFQueueOpFailedCode.values()[0xffff & error
.getErrorCode()];
return String.format("Error %s %s", et, qofc);
case OFPET_VENDOR_ERROR:
// no codes known for vendor error
return String.format("Error %s", et);
default:
break;
}
return null;
}
示例6: logError
import org.openflow.protocol.OFError; //导入方法依赖的package包/类
/**
* Log an OpenFlow error message from a switch
* @param sw The switch that sent the error
* @param error The error message
*/
@LogMessageDoc(level="ERROR",
message="Error {error type} {error code} from {switch}",
explanation="The switch responded with an unexpected error" +
"to an OpenFlow message from the controller",
recommendation="This could indicate improper network operation. " +
"If the problem persists restarting the switch and " +
"controller may help."
)
protected void logError(IOFSwitch sw, OFError error) {
int etint = 0xffff & error.getErrorType();
if (etint < 0 || etint >= OFErrorType.values().length) {
log.error("Unknown error code {} from sw {}", etint, sw);
}
OFErrorType et = OFErrorType.values()[etint];
switch (et) {
case OFPET_HELLO_FAILED:
OFHelloFailedCode hfc =
OFHelloFailedCode.values()[0xffff & error.getErrorCode()];
log.error("Error {} {} from {}", new Object[] {et, hfc, sw});
break;
case OFPET_BAD_REQUEST:
OFBadRequestCode brc =
OFBadRequestCode.values()[0xffff & error.getErrorCode()];
log.error("Error {} {} from {}", new Object[] {et, brc, sw});
break;
case OFPET_BAD_ACTION:
OFBadActionCode bac =
OFBadActionCode.values()[0xffff & error.getErrorCode()];
log.error("Error {} {} from {}", new Object[] {et, bac, sw});
break;
case OFPET_FLOW_MOD_FAILED:
OFFlowModFailedCode fmfc =
OFFlowModFailedCode.values()[0xffff & error.getErrorCode()];
log.error("Error {} {} from {}", new Object[] {et, fmfc, sw});
break;
case OFPET_PORT_MOD_FAILED:
OFPortModFailedCode pmfc =
OFPortModFailedCode.values()[0xffff & error.getErrorCode()];
log.error("Error {} {} from {}", new Object[] {et, pmfc, sw});
break;
case OFPET_QUEUE_OP_FAILED:
OFQueueOpFailedCode qofc =
OFQueueOpFailedCode.values()[0xffff & error.getErrorCode()];
log.error("Error {} {} from {}", new Object[] {et, qofc, sw});
break;
default:
break;
}
}
示例7: getOFErrorString
import org.openflow.protocol.OFError; //导入方法依赖的package包/类
static String getOFErrorString(OFError error) {
// Handle VENDOR extension errors here
if (error.getErrorType() == V6Error.NICIRA_VENDOR_ERRORTYPE) {
V6Error er = new V6Error(error);
byte[] b = error.getError();
ByteBuffer bb = ByteBuffer.allocate(b.length);
bb.put(b);
bb.rewind();
er.readFrom(bb);
return er.toString();
}
// Handle OF1.0 errors here
OFErrorType et = OFErrorType.values()[0xffff & error.getErrorType()];
String errorStr = "Error : " + et.toString();
switch (et) {
case OFPET_HELLO_FAILED:
OFHelloFailedCode hfc = OFHelloFailedCode.values()[0xffff & error
.getErrorCode()];
errorStr += " " + hfc.toString();
break;
case OFPET_BAD_REQUEST:
OFBadRequestCode brc = OFBadRequestCode.values()[0xffff & error
.getErrorCode()];
errorStr += " " + brc.toString();
break;
case OFPET_BAD_ACTION:
OFBadActionCode bac = OFBadActionCode.values()[0xffff & error
.getErrorCode()];
errorStr += " " + bac.toString();
break;
case OFPET_FLOW_MOD_FAILED:
OFFlowModFailedCode fmfc = OFFlowModFailedCode.values()[0xffff & error
.getErrorCode()];
errorStr += " " + fmfc.toString();
break;
case OFPET_PORT_MOD_FAILED:
OFPortModFailedCode pmfc = OFPortModFailedCode.values()[0xffff & error
.getErrorCode()];
errorStr += " " + pmfc.toString();
break;
case OFPET_QUEUE_OP_FAILED:
OFQueueOpFailedCode qofc = OFQueueOpFailedCode.values()[0xffff & error
.getErrorCode()];
errorStr += " " + qofc.toString();
break;
default:
break;
}
return errorStr;
}
示例8: V6Error
import org.openflow.protocol.OFError; //导入方法依赖的package包/类
public V6Error(OFError e) {
this.length = (short)e.getLengthU();
this.errorType = e.getErrorType();
this.errorCode = e.getErrorCode();
this.xid = e.getXid();
}