本文整理汇总了Java中org.openflow.protocol.OFError.OFErrorType.values方法的典型用法代码示例。如果您正苦于以下问题:Java OFErrorType.values方法的具体用法?Java OFErrorType.values怎么用?Java OFErrorType.values使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openflow.protocol.OFError.OFErrorType
的用法示例。
在下文中一共展示了OFErrorType.values方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getErrorString
import org.openflow.protocol.OFError.OFErrorType; //导入方法依赖的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;
}
示例2: logError
import org.openflow.protocol.OFError.OFErrorType; //导入方法依赖的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;
}
}
示例3: logError
import org.openflow.protocol.OFError.OFErrorType; //导入方法依赖的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;
}
}
示例4: getOFErrorString
import org.openflow.protocol.OFError.OFErrorType; //导入方法依赖的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;
}