@Override void processOFError(OFChannelHandler h, OFErrorMsg m) throws IOException, SwitchStateException { // if we get here, then the error message is for something else if (m.getErrType() == OFErrorType.BAD_REQUEST && ((OFBadRequestErrorMsg) m).getCode() == OFBadRequestCode.EPERM) { // 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.sw.reassertRole(); } else if (m.getErrType() == OFErrorType.FLOW_MOD_FAILED && ((OFFlowModFailedErrorMsg) m).getCode() == OFFlowModFailedCode.ALL_TABLES_FULL) { h.sw.setTableFull(true); } else { logError(h, m); } h.dispatchMessage(m); }
@Override public void handleMessage(Dpid dpid, OFMessage msg) { switch (msg.getType()) { case STATS_REPLY: pushMeterStats(dpid, (OFStatsReply) msg); break; case ERROR: OFErrorMsg error = (OFErrorMsg) msg; if (error.getErrType() == OFErrorType.METER_MOD_FAILED) { MeterOperation op = pendingOperations.getIfPresent(error.getXid()); pendingOperations.invalidate(error.getXid()); if (op == null) { log.warn("Unknown Meter operation failed {}", error); } else { OFMeterModFailedErrorMsg meterError = (OFMeterModFailedErrorMsg) error; signalMeterError(meterError, op); } } break; default: break; } }
@Override void processOFError(OFErrorMsg m) { /* * HP ProCurve switches do not support * the ofpt_barrier_request message. * * Look for an error from a bad ofpt_barrier_request, * log a warning, but proceed. */ if (m.getErrType() == OFErrorType.BAD_REQUEST && ((OFBadRequestErrorMsg) m).getCode() == OFBadRequestCode.BAD_TYPE && ((OFBadRequestErrorMsg) m).getData().getParsedMessage().get() instanceof OFBarrierRequest) { log.warn("Switch does not support Barrier Request messages. Could be an HP ProCurve."); } else { logErrorDisconnect(m); } }
public static OFErrorType ofWireValue(short val) { switch(val) { case HELLO_FAILED_VAL: return OFErrorType.HELLO_FAILED; case BAD_REQUEST_VAL: return OFErrorType.BAD_REQUEST; case BAD_ACTION_VAL: return OFErrorType.BAD_ACTION; case FLOW_MOD_FAILED_VAL: return OFErrorType.FLOW_MOD_FAILED; case PORT_MOD_FAILED_VAL: return OFErrorType.PORT_MOD_FAILED; case QUEUE_OP_FAILED_VAL: return OFErrorType.QUEUE_OP_FAILED; default: throw new IllegalArgumentException("Illegal wire value for type OFErrorType in version 1.0: " + val); } }
public static short toWireValue(OFErrorType e) { switch(e) { case HELLO_FAILED: return HELLO_FAILED_VAL; case BAD_REQUEST: return BAD_REQUEST_VAL; case BAD_ACTION: return BAD_ACTION_VAL; case FLOW_MOD_FAILED: return FLOW_MOD_FAILED_VAL; case PORT_MOD_FAILED: return PORT_MOD_FAILED_VAL; case QUEUE_OP_FAILED: return QUEUE_OP_FAILED_VAL; default: throw new IllegalArgumentException("Illegal enum value for type OFErrorType in version 1.0: " + e); } }
@Override void processOFError(OFChannelHandler h, OFErrorMsg m) { if (m.getErrType() == OFErrorType.BAD_REQUEST) { OFBadRequestErrorMsg badRequest = (OFBadRequestErrorMsg) m; if (badRequest.getCode() == OFBadRequestCode.BAD_TYPE) { log.debug("{} does not support GetConfig, moving on", h.getSwitchInfoString()); try { nextState(h); return; } catch (IOException e) { log.error("Exception thrown transitioning to next", e); logErrorDisconnect(h, m); } } } logErrorDisconnect(h, m); }
@Override public void handleMessage(Dpid dpid, OFMessage msg) { if (isDisabled) { return; } try { switch (msg.getType()) { case STATS_REPLY: if (((OFStatsReply) msg).getStatsType() == OFStatsType.PORT) { OFPortStatsReply portStatsReply = (OFPortStatsReply) msg; List<OFPortStatsEntry> portStatsReplyList = portStatsReplies.get(dpid); if (portStatsReplyList == null) { portStatsReplyList = Lists.newCopyOnWriteArrayList(); } portStatsReplyList.addAll(portStatsReply.getEntries()); portStatsReplies.put(dpid, portStatsReplyList); if (!portStatsReply.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) { List<OFPortStatsEntry> statsEntries = portStatsReplies.get(dpid); if (statsEntries != null) { pushPortMetrics(dpid, statsEntries); statsEntries.clear(); } } } break; case ERROR: if (((OFErrorMsg) msg).getErrType() == OFErrorType.PORT_MOD_FAILED) { LOG.error("port mod failed"); } default: break; } } catch (IllegalStateException e) { // system is shutting down and the providerService is no longer // valid. Messages cannot be processed. } }
@Override void processOFError(OFErrorMsg m) { if ((m.getErrType() == OFErrorType.BAD_REQUEST) && ((((OFBadRequestErrorMsg)m).getCode() == OFBadRequestCode.MULTIPART_BUFFER_OVERFLOW) || ((OFBadRequestErrorMsg)m).getCode() == OFBadRequestCode.BAD_STAT)) { log.warn("Switch {} is {} but does not support OFTableFeaturesStats. Assuming all tables can perform any match, action, and instruction in the spec.", sw.getId().toString(), sw.getOFFactory().getVersion().toString()); } else { log.error("Received unexpected OFErrorMsg {} on switch {}.", m.toString(), sw.getId().toString()); } nextState(); }
@Override void processOFError(OFErrorMsg m) { // role changer will ignore the error if it isn't for it boolean didHandle = roleChanger.deliverError(m); if (didHandle) return; if ((m.getErrType() == OFErrorType.BAD_REQUEST) && (((OFBadRequestErrorMsg)m).getCode() == OFBadRequestCode.EPERM)) { // 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 switchManagerCounters.epermErrorWhileSwitchIsMaster.increment(); log.warn("Received permission error from switch {} while" + "being master. Reasserting master role.", getSwitchInfoString()); reassertRole(OFControllerRole.ROLE_MASTER); } else if ((m.getErrType() == OFErrorType.FLOW_MOD_FAILED) && (((OFFlowModFailedErrorMsg)m).getCode() == OFFlowModFailedCode.ALL_TABLES_FULL)) { sw.setTableFull(true); } else { logError(m); } dispatchMessage(m); }
@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(OFErrorMsg m) { // role changer will ignore the error if it isn't for it boolean didHandle = roleChanger.deliverError(m); if (didHandle) return; if ((m.getErrType() == OFErrorType.BAD_REQUEST) && (((OFBadRequestErrorMsg)m).getCode() == OFBadRequestCode.EPERM)) { // 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 switchManagerCounters.epermErrorWhileSwitchIsMaster.increment(); log.warn("Received permission error from switch {} while" + "being master. Reasserting master role.", getSwitchInfoString()); reassertRole(OFControllerRole.ROLE_MASTER); } else if ((m.getErrType() == OFErrorType.FLOW_MOD_FAILED) && (((OFFlowModFailedErrorMsg)m).getCode() == OFFlowModFailedCode.ALL_TABLES_FULL)) { sw.setTableFull(true); } else { logError(m); } dispatchMessage(m); }
@Override void processOFError(OFErrorMsg m) { // role changer will ignore the error if it isn't for it boolean didHandle = roleChanger.deliverError(m); if (didHandle) return; if ((m.getErrType() == OFErrorType.BAD_REQUEST) && (((OFBadRequestErrorMsg)m).getCode() == OFBadRequestCode.EPERM)) { // We are the EQUAL 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 switchManagerCounters.epermErrorWhileSwitchIsMaster.increment(); log.warn("Received permission error from switch {} while" + "being master. Reasserting master role.", getSwitchInfoString()); reassertRole(OFControllerRole.ROLE_EQUAL); } else if ((m.getErrType() == OFErrorType.FLOW_MOD_FAILED) && (((OFFlowModFailedErrorMsg)m).getCode() == OFFlowModFailedCode.ALL_TABLES_FULL)) { sw.setTableFull(true); } else { logError(m); } dispatchMessage(m); }
@Override public void handleMessage(Dpid dpid, OFMessage msg) { switch (msg.getType()) { case STATS_REPLY: pushGroupMetrics(dpid, (OFStatsReply) msg); break; case ERROR: OFErrorMsg errorMsg = (OFErrorMsg) msg; if (errorMsg.getErrType() == OFErrorType.GROUP_MOD_FAILED) { GroupId pendingGroupId = null; for (Map.Entry<GroupId, Long> entry: pendingXidMaps.entrySet()) { if (entry.getValue() == errorMsg.getXid()) { pendingGroupId = entry.getKey(); break; } } if (pendingGroupId == null) { log.warn("Error for unknown group operation: {}", errorMsg.getXid()); } else { GroupOperation operation = pendingGroupOperations.get(pendingGroupId); DeviceId deviceId = DeviceId.deviceId(Dpid.uri(dpid)); if (operation != null) { providerService.groupOperationFailed(deviceId, operation); pendingGroupOperations.remove(pendingGroupId); pendingXidMaps.remove(pendingGroupId); log.warn("Received an group mod error {}", msg); } else { log.error("Cannot find pending group operation with group ID: {}", pendingGroupId); } } break; } default: break; } }