public V6Error(OFError e) { this.length = (short)e.getLengthU(); this.errorType = e.getErrorType(); this.errorCode = e.getErrorCode(); this.xid = e.getXid(); }
@Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + Arrays.hashCode(V6ErrorData); result = prime * result + V6VendorErrorCode; result = prime * result + V6VendorErrorType; result = prime * result + V6VendorId; return result; }
@Override public OFMessage instantiate() { return new OFError(); } }), ECHO_REQUEST(2, OFEchoRequest.class, new Instantiable<OFMessage>() {
@Override void processOFError(final SwitchChannelHandler h, final OFError m) throws IOException { h.log.error( "Error waiting for desc stats reply (type:{}, code:{})", m.getErrorType(), m.getErrorCode()); h.channel.disconnect(); }
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); 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;
@Override void processOFError(final SwitchChannelHandler h, final OFError m) { try { if (m.getOffendingMsg().getType() != OFType.BARRIER_REQUEST) { h.log.error( "Error waiting for features (type:{}, code:{})", m.getErrorType(), m.getErrorCode()); if (h.channel.isOpen()) { h.channel.close(); } } else { h.log.warn( "Barrier Request message not understood by switch {}; " + "if it's an HP switch you are probably ok.", HexString.toHexString(h.featuresReply .getDatapathId())); } } catch (MessageParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
private void processErrorReply(OFError errorMsg) { OFMessage offendingMsg = errorMsg.getOffendingMsg(); Integer xid; if (offendingMsg != null) { xid = offendingMsg.getXid(); } else { xid = errorMsg.getXid(); } /* * the error can be a reply to a synchronous message or to a statistic * request message */ Callable<?> worker = messageWaitingDone.remove(xid); if (worker == null) { return; } if (worker instanceof SynchronousMessage) { ((SynchronousMessage) worker).wakeup(errorMsg); } else { ((StatisticsCollector) worker).wakeup(errorMsg); } }
@Override void processOFHello(final ControllerChannelHandler h, final OFHello m) throws IOException { if (m.getVersion() == OFMessage.OFP_VERSION) { h.setState(WAIT_FT_REQ); } else { h.log.error("Unsupported OpenFlow Version"); final OFError error = new OFError(); error.setErrorType(OFErrorType.OFPET_HELLO_FAILED); error.setErrorCode(OFError.OFHelloFailedCode.OFPHFC_INCOMPATIBLE); error.setVersion(OFMessage.OFP_VERSION); final String errmsg = "we only support version " + Integer.toHexString(OFMessage.OFP_VERSION) + " and you are not it"; error.setError(errmsg.getBytes()); error.setErrorIsAscii(true); h.channel.disconnect(); } } },
@Override public void readFrom(final ChannelBuffer data) { super.readFrom(data); this.errorType = data.readShort(); this.errorCode = data.readShort(); final int dataLength = this.getLengthU() - OFError.MINIMUM_LENGTH; if (dataLength > 0) { this.error = new byte[dataLength]; data.readBytes(this.error); if (this.errorType == OFErrorType.OFPET_HELLO_FAILED.getValue()) { this.errorIsAscii = true; } } }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; V6Error other = (V6Error) obj; if (!Arrays.equals(V6ErrorData, other.V6ErrorData)) return false; if (V6VendorErrorCode != other.V6VendorErrorCode) return false; if (V6VendorErrorType != other.V6VendorErrorType) return false; if (V6VendorId != other.V6VendorId) return false; return true; } }
@Override void processOFError(final SwitchChannelHandler h, final OFError m) { h.log.error("Error waiting for Hello (type:{}, code:{})", m.getErrorType(), m.getErrorCode()); h.channel.disconnect(); }
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); 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;
private void processErrorReply(OFError errorMsg) { OFMessage offendingMsg = errorMsg.getOffendingMsg(); Integer xid; if (offendingMsg != null) { xid = offendingMsg.getXid(); } else { xid = errorMsg.getXid(); } /* * the error can be a reply to a synchronous message or to a statistic * request message */ Callable<?> worker = messageWaitingDone.remove(xid); if (worker == null) { return; } if (worker instanceof SynchronousMessage) { ((SynchronousMessage) worker).wakeup(errorMsg); } else { ((StatisticsCollector) worker).wakeup(errorMsg); } }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; V6Error other = (V6Error) obj; if (!Arrays.equals(V6ErrorData, other.V6ErrorData)) return false; if (V6VendorErrorCode != other.V6VendorErrorCode) return false; if (V6VendorErrorType != other.V6VendorErrorType) return false; if (V6VendorId != other.V6VendorId) return false; return true; } }
public V6Error(OFError e) { this.length = (short)e.getLengthU(); this.errorType = e.getErrorType(); this.errorCode = e.getErrorCode(); this.xid = e.getXid(); }
@Override void processOFError(final ControllerChannelHandler h, final OFError m) throws IOException { h.log.error("Error waiting for Hello (type:{}, code:{})", m.getErrorType(), m.getErrorCode()); h.channel.disconnect(); }
private void handleErrorMessage(ISwitch sw, OFError errorMsg) { Node node = NodeCreator.createOFNode(sw.getId()); OFMessage offendingMsg = errorMsg.getOffendingMsg(); Integer xid; if (offendingMsg != null) { xid = offendingMsg.getXid(); } else { xid = errorMsg.getXid(); } Long rid = getMessageRid(sw.getId(), xid); /* * Null or zero requestId indicates that the error message is meant for * a sync message. It will be handled by the sync message worker thread. * Hence we are done here. */ if ((rid == null) || (rid == 0)) { return; } /* * Notifies the caller that error has been reported for a previous flow * programming request */ for (Map.Entry<String, IFlowProgrammerNotifier> containerNotifier : flowProgrammerNotifiers .entrySet()) { IFlowProgrammerNotifier notifier = containerNotifier.getValue(); notifier.flowErrorReported(node, rid, Utils.getOFErrorString(errorMsg)); } }
@Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + Arrays.hashCode(V6ErrorData); result = prime * result + V6VendorErrorCode; result = prime * result + V6VendorErrorType; result = prime * result + V6VendorId; return result; }
@Override void processOFError(final SwitchChannelHandler h, final OFError m) throws IOException { h.log.error( "Error waiting for config reply (type:{}, code:{})", m.getErrorType(), m.getErrorCode()); h.channel.disconnect(); }
@Override void processOFError(final ControllerChannelHandler h, final OFError m) throws IOException { h.log.error( "Error waiting for Features Request (type:{}, code:{})", m.getErrorType(), m.getErrorCode()); h.channel.disconnect(); }