本文整理汇总了Java中org.openflow.protocol.OFError.OFFlowModFailedCode类的典型用法代码示例。如果您正苦于以下问题:Java OFFlowModFailedCode类的具体用法?Java OFFlowModFailedCode怎么用?Java OFFlowModFailedCode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OFFlowModFailedCode类属于org.openflow.protocol.OFError包,在下文中一共展示了OFFlowModFailedCode类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doFlowModAdd
import org.openflow.protocol.OFError.OFFlowModFailedCode; //导入依赖的package包/类
/**
* Adds a flow entry to the FlowTable. The FlowMod is checked for overlap if
* its flag says so.
*
* @param fm the flow mod
* @return true if FlowMod should be written south
*/
private boolean doFlowModAdd(OVXFlowMod fm) {
if ((fm.getFlags() & OFFlowMod.OFPFF_CHECK_OVERLAP) == OFFlowMod.OFPFF_CHECK_OVERLAP) {
OVXFlowEntry fe = new OVXFlowEntry();
for (OVXFlowMod fmod : this.flowmodMap.values()) {
/*
* if not disjoint AND same priority send up OVERLAP error and
* drop it
*/
fe.setFlowMod(fmod);
int res = fe.compare(fm.getMatch(), false);
if ((res != OVXFlowEntry.DISJOINT)
& (fm.getPriority() == fe.getPriority())) {
this.vswitch.sendMsg(OVXMessageUtil.makeErrorMsg(
OFFlowModFailedCode.OFPFMFC_OVERLAP, fm),
this.vswitch);
return false;
}
}
}
return doFlowModModify(fm);
}
示例2: getErrorString
import org.openflow.protocol.OFError.OFFlowModFailedCode; //导入依赖的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;
}
示例3: makeErrorMsg
import org.openflow.protocol.OFError.OFFlowModFailedCode; //导入依赖的package包/类
/**
* Makes an OpenFlow error message for a failed flow mod and
* given OpenFlow message.
*
* @param code the failed flow mod code
* @param msg the OpenFlow message
* @return the OpenFlow error message
*/
public static OFMessage makeErrorMsg(final OFFlowModFailedCode code,
final OFMessage msg) {
final OVXError err = new OVXError();
err.setErrorType(OFErrorType.OFPET_FLOW_MOD_FAILED);
err.setErrorCode(code);
err.setOffendingMsg(msg);
err.setXid(msg.getXid());
return err;
}
示例4: processOFError
import org.openflow.protocol.OFError.OFFlowModFailedCode; //导入依赖的package包/类
@LogMessageDoc(level="WARN",
message="Received permission error from switch {} while" +
"being master. Reasserting master role.",
explanation="The switch has denied an operation likely " +
"indicating inconsistent controller roles",
recommendation="This situation can occurs transiently during role" +
" changes. If, however, the condition persists or happens" +
" frequently this indicates a role inconsistency. " +
LogMessageDoc.CHECK_CONTROLLER )
@Override
void processOFError(OFChannelHandler h, OFError m)
throws IOException {
// role changer will ignore the error if it isn't for it
boolean didHandle = h.roleChanger.deliverError(m);
if (didHandle)
return;
if (m.getErrorType() ==
OFErrorType.OFPET_BAD_REQUEST.getValue() &&
m.getErrorCode() ==
OFBadRequestCode.OFPBRC_EPERM.ordinal()) {
// We are the master controller and the switch returned
// a permission error. This is a likely indicator that
// the switch thinks we are slave. Reassert our
// role
// FIXME: this could be really bad during role transitions
// if two controllers are master (even if its only for
// a brief period). We might need to see if these errors
// persist before we reassert
h.counters.epermErrorWhileSwitchIsMaster.updateCounterWithFlush();
log.warn("Received permission error from switch {} while" +
"being master. Reasserting master role.",
h.getSwitchInfoString());
h.controller.reassertRole(h, Role.MASTER);
}
else if (m.getErrorType() ==
OFErrorType.OFPET_PORT_MOD_FAILED.getValue() &&
m.getErrorCode() ==
OFFlowModFailedCode.OFPFMFC_ALL_TABLES_FULL.ordinal()) {
h.sw.setTableFull(true);
}
else {
logError(h, m);
}
h.dispatchMessage(m);
}
示例5: logError
import org.openflow.protocol.OFError.OFFlowModFailedCode; //导入依赖的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;
}
}
示例6: logError
import org.openflow.protocol.OFError.OFFlowModFailedCode; //导入依赖的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.OFFlowModFailedCode; //导入依赖的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;
}