/** write a request which triggers an OFErrorMsg response */ @Test(timeout = 5000) public void testWriteRequestOFErrorMsg() throws InterruptedException, ExecutionException { Capture<List<OFMessage>> cMsgList = prepareChannelForWriteList(); OFRoleRequest roleRequest = factory.buildRoleRequest().setRole(OFControllerRole.ROLE_MASTER).build(); ListenableFuture<OFRoleReply> future = conn.writeRequest(roleRequest); assertThat("Connection should have 1 pending request", conn.getPendingRequestIds().size(), equalTo(1)); eventLoop.runTasks(); assertThat("Should have captured MsgList", cMsgList.getValue(), Matchers.<OFMessage> contains(roleRequest)); assertThat("Future should not be complete yet", future.isDone(), equalTo(false)); OFRoleRequestFailedErrorMsg roleError = factory.errorMsgs().buildRoleRequestFailedErrorMsg() .setXid(roleRequest.getXid()) .setCode(OFRoleRequestFailedCode.STALE) .build(); assertThat("Connection should have accepted the response", conn.deliverResponse(roleError), equalTo(true)); OFErrorMsgException e = FutureTestUtils.assertFutureFailedWithException(future, OFErrorMsgException.class); assertThat(e.getErrorMessage(), CoreMatchers.<OFErrorMsg>equalTo(roleError)); }
/** write a request which triggers an OFErrorMsg response */ @Test(timeout = 5000) public void testWriteRequestOFErrorMsg() throws InterruptedException, ExecutionException { Capture<List<OFMessage>> cMsgList = prepareChannelForWriteList(); OFRoleRequest roleRequest = factory.buildRoleRequest().setRole(OFControllerRole.ROLE_MASTER).build(); ListenableFuture<OFRoleReply> future = conn.writeRequest(roleRequest); assertThat("Connection should have 1 pending request", conn.getPendingRequestIds().size(), equalTo(1)); assertThat("Should have captured MsgList", cMsgList.getValue(), Matchers.<OFMessage> contains(roleRequest)); assertThat("Future should not be complete yet", future.isDone(), equalTo(false)); OFRoleRequestFailedErrorMsg roleError = factory.errorMsgs().buildRoleRequestFailedErrorMsg() .setXid(roleRequest.getXid()) .setCode(OFRoleRequestFailedCode.STALE) .build(); assertThat("Connection should have accepted the response", conn.deliverResponse(roleError), equalTo(true)); OFErrorMsgException e = FutureTestUtils.assertFutureFailedWithException(future, OFErrorMsgException.class); assertThat(e.getErrorMessage(), CoreMatchers.<OFErrorMsg>equalTo(roleError)); }
public static OFRoleRequestFailedCode readFrom(ChannelBuffer bb) throws OFParseError { try { return ofWireValue(bb.readShort()); } catch (IllegalArgumentException e) { throw new OFParseError(e); } }
public static OFRoleRequestFailedCode ofWireValue(short val) { switch(val) { case STALE_VAL: return OFRoleRequestFailedCode.STALE; case UNSUP_VAL: return OFRoleRequestFailedCode.UNSUP; case BAD_ROLE_VAL: return OFRoleRequestFailedCode.BAD_ROLE; default: throw new IllegalArgumentException("Illegal wire value for type OFRoleRequestFailedCode in version 1.2: " + val); } }
public static short toWireValue(OFRoleRequestFailedCode e) { switch(e) { case STALE: return STALE_VAL; case UNSUP: return UNSUP_VAL; case BAD_ROLE: return BAD_ROLE_VAL; default: throw new IllegalArgumentException("Illegal enum value for type OFRoleRequestFailedCode in version 1.2: " + e); } }
public static OFRoleRequestFailedCode ofWireValue(short val) { switch(val) { case STALE_VAL: return OFRoleRequestFailedCode.STALE; case UNSUP_VAL: return OFRoleRequestFailedCode.UNSUP; case BAD_ROLE_VAL: return OFRoleRequestFailedCode.BAD_ROLE; default: throw new IllegalArgumentException("Illegal wire value for type OFRoleRequestFailedCode in version 1.3: " + val); } }
public static short toWireValue(OFRoleRequestFailedCode e) { switch(e) { case STALE: return STALE_VAL; case UNSUP: return UNSUP_VAL; case BAD_ROLE: return BAD_ROLE_VAL; default: throw new IllegalArgumentException("Illegal enum value for type OFRoleRequestFailedCode in version 1.3: " + e); } }
public static OFRoleRequestFailedCode ofWireValue(short val) { switch(val) { case STALE_VAL: return OFRoleRequestFailedCode.STALE; case UNSUP_VAL: return OFRoleRequestFailedCode.UNSUP; case BAD_ROLE_VAL: return OFRoleRequestFailedCode.BAD_ROLE; default: throw new IllegalArgumentException("Illegal wire value for type OFRoleRequestFailedCode in version 1.4: " + val); } }
public static short toWireValue(OFRoleRequestFailedCode e) { switch(e) { case STALE: return STALE_VAL; case UNSUP: return UNSUP_VAL; case BAD_ROLE: return BAD_ROLE_VAL; default: throw new IllegalArgumentException("Illegal enum value for type OFRoleRequestFailedCode in version 1.4: " + e); } }
public static OFRoleRequestFailedCode readFrom(ByteBuf bb) throws OFParseError { try { return ofWireValue(bb.readShort()); } catch (IllegalArgumentException e) { throw new OFParseError(e); } }
public static OFRoleRequestFailedCode ofWireValue(short val) { switch(val) { case STALE_VAL: return OFRoleRequestFailedCode.STALE; case UNSUP_VAL: return OFRoleRequestFailedCode.UNSUP; case BAD_ROLE_VAL: return OFRoleRequestFailedCode.BAD_ROLE; default: throw new IllegalArgumentException("Illegal wire value for type OFRoleRequestFailedCode in version 1.5: " + val); } }
public static short toWireValue(OFRoleRequestFailedCode e) { switch(e) { case STALE: return STALE_VAL; case UNSUP: return UNSUP_VAL; case BAD_ROLE: return BAD_ROLE_VAL; default: throw new IllegalArgumentException("Illegal enum value for type OFRoleRequestFailedCode in version 1.5: " + e); } }
public static void writeTo(ChannelBuffer bb, OFRoleRequestFailedCode e) { bb.writeShort(toWireValue(e)); }
public static void putTo(OFRoleRequestFailedCode e, PrimitiveSink sink) { sink.putShort(toWireValue(e)); }
public static void writeTo(ByteBuf bb, OFRoleRequestFailedCode e) { bb.writeShort(toWireValue(e)); }