Java 类org.projectfloodlight.openflow.protocol.errormsg.OFRoleRequestFailedErrorMsg 实例源码

项目:fresco_floodlight    文件:OFConnectionTest.java   
/** 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));
}
项目:iTAP-controller    文件:OFConnectionTest.java   
/** 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));
}
项目:SDN-Multicast    文件:OFConnectionTest.java   
/** 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));
}
项目:arscheduler    文件:OFConnectionTest.java   
/** 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));
}
项目:floodlight1.2-delay    文件:OFConnectionTest.java   
/** 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));
}
项目:floodlight-hardware    文件:OFConnectionTest.java   
/** 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));
}
项目:ACAMPController    文件:OFConnectionTest.java   
/** 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));
}
项目:fast-failover-demo    文件:OFConnectionTest.java   
/** 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));
}
项目:floodlightLB    文件:OFConnectionTest.java   
/** 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));
}
项目:DSC    文件:OFConnectionTest.java   
/** 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));
}
项目:floodlight    文件:OFConnectionTest.java   
/** 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));
}
项目:athena    文件:RoleManager.java   
/**
 * Called if we receive an  error message. If the xid matches the
 * pending request we handle it otherwise we ignore it.
 *
 * Note: since we only keep the last pending request we might get
 * error messages for earlier role requests that we won't be able
 * to handle
 */
@Override
public synchronized RoleRecvStatus deliverError(OFErrorMsg error)
        throws SwitchStateException {
    RoleState errorRole = pendingReplies.getIfPresent(error.getXid());
    if (errorRole == null) {
        if (error.getErrType() == OFErrorType.ROLE_REQUEST_FAILED) {
            log.debug("Received an error msg from sw {} for a role request,"
                    + " but not for pending request in role-changer; "
                    + " ignoring error {} ...",
                    sw.getStringId(), error);
        } else {
            log.debug("Received an error msg from sw {}, but no pending "
                    + "requests in role-changer; not handling ...",
                    sw.getStringId());
        }
        return RoleRecvStatus.OTHER_EXPECTATION;
    }
    // it is an error related to a currently pending role request message
    if (error.getErrType() == OFErrorType.BAD_REQUEST) {
        log.error("Received a error msg {} from sw {} for "
                + "pending role request {}. Switch driver indicates "
                + "role-messaging is supported. Possible issues in "
                + "switch driver configuration?",
                ((OFBadRequestErrorMsg) error).toString(),
                sw.getStringId(),
                errorRole);
        return RoleRecvStatus.UNSUPPORTED;
    }

    if (error.getErrType() == OFErrorType.ROLE_REQUEST_FAILED) {
        OFRoleRequestFailedErrorMsg rrerr =
                (OFRoleRequestFailedErrorMsg) error;
        switch (rrerr.getCode()) {
        case BAD_ROLE:
            // switch says that current-role-req has bad role?
            // for now we disconnect
            // fall-thru
        case STALE:
            // switch says that current-role-req has stale gen-id?
            // for now we disconnect
            // fall-thru
        case UNSUP:
            // switch says that current-role-req has role that
            // cannot be supported? for now we disconnect
            String msgx = String.format("Switch: [%s], "
                    + "received Error to for pending role request [%s]. "
                    + "Error:[%s]. Disconnecting switch ... ",
                    sw.getStringId(),
                    errorRole, rrerr);
            throw new SwitchStateException(msgx);
        default:
            break;
        }
    }

    // This error message was for a role request message but we dont know
    // how to handle errors for nicira role request messages
    return RoleRecvStatus.OTHER_EXPECTATION;
}
项目:ravikumaran201504    文件:RoleManager.java   
/**
 * Called if we receive an  error message. If the xid matches the
 * pending request we handle it otherwise we ignore it.
 *
 * Note: since we only keep the last pending request we might get
 * error messages for earlier role requests that we won't be able
 * to handle
 */
@Override
public synchronized RoleRecvStatus deliverError(OFErrorMsg error)
        throws SwitchStateException {
    RoleState errorRole = pendingReplies.getIfPresent(error.getXid());
    if (errorRole == null) {
        if (error.getErrType() == OFErrorType.ROLE_REQUEST_FAILED) {
            log.debug("Received an error msg from sw {} for a role request,"
                    + " but not for pending request in role-changer; "
                    + " ignoring error {} ...",
                    sw.getStringId(), error);
        } else {
            log.debug("Received an error msg from sw {}, but no pending "
                    + "requests in role-changer; not handling ...",
                    sw.getStringId());
        }
        return RoleRecvStatus.OTHER_EXPECTATION;
    }
    // it is an error related to a currently pending role request message
    if (error.getErrType() == OFErrorType.BAD_REQUEST) {
        log.error("Received a error msg {} from sw {} for "
                + "pending role request {}. Switch driver indicates "
                + "role-messaging is supported. Possible issues in "
                + "switch driver configuration?", new Object[] {
                        ((OFBadRequestErrorMsg) error).toString(),
                        sw.getStringId(), errorRole
                });
        return RoleRecvStatus.UNSUPPORTED;
    }

    if (error.getErrType() == OFErrorType.ROLE_REQUEST_FAILED) {
        OFRoleRequestFailedErrorMsg rrerr =
                (OFRoleRequestFailedErrorMsg) error;
        switch (rrerr.getCode()) {
        case BAD_ROLE:
            // switch says that current-role-req has bad role?
            // for now we disconnect
            // fall-thru
        case STALE:
            // switch says that current-role-req has stale gen-id?
            // for now we disconnect
            // fall-thru
        case UNSUP:
            // switch says that current-role-req has role that
            // cannot be supported? for now we disconnect
            String msgx = String.format("Switch: [%s], "
                    + "received Error to for pending role request [%s]. "
                    + "Error:[%s]. Disconnecting switch ... ",
                    sw.getStringId(),
                    errorRole, rrerr);
            throw new SwitchStateException(msgx);
        default:
            break;
        }
    }

    // This error message was for a role request message but we dont know
    // how to handle errors for nicira role request messages
    return RoleRecvStatus.OTHER_EXPECTATION;
}
项目:spring-open    文件:OFChannelHandler.java   
/**
 * Called if we receive an error message. If the xid matches the pending
 * request we handle it otherwise we ignore it.
 *
 * Note: since we only keep the last pending request we might get error
 * messages for earlier role requests that we won't be able to handle
 */
synchronized RoleRecvStatus deliverError(OFErrorMsg error)
        throws SwitchStateException {
    if (!requestPending) {
        log.debug("Received an error msg from sw {}, but no pending "
                + "requests in role-changer; not handling ...",
                getSwitchInfoString());
        return RoleRecvStatus.OTHER_EXPECTATION;
    }
    if (pendingXid != error.getXid()) {
        if (error.getErrType() == OFErrorType.ROLE_REQUEST_FAILED) {
            log.debug("Received an error msg from sw {} for a role request,"
                    + " but not for pending request in role-changer; "
                    + " ignoring error {} ...",
                    getSwitchInfoString(), error);
        }
        return RoleRecvStatus.OTHER_EXPECTATION;
    }
    // it is an error related to a currently pending role request
    // message
    requestPending = false; // we got a response, even though it is an
                            // error
    if (error.getErrType() == OFErrorType.BAD_REQUEST) {
        counters.roleReplyErrorUnsupported.updateCounterWithFlush();
        log.error("Received a error msg {} from sw {} in state {} for "
                + "pending role request {}. Switch driver indicates "
                + "role-messaging is supported. Possible issues in "
                + "switch driver configuration?", new Object[] {
                ((OFBadRequestErrorMsg) error).toString(),
                getSwitchInfoString(), state, pendingRole
        });
        return RoleRecvStatus.UNSUPPORTED;
    }

    if (error.getErrType() == OFErrorType.ROLE_REQUEST_FAILED) {
        OFRoleRequestFailedErrorMsg rrerr =
                (OFRoleRequestFailedErrorMsg) error;
        switch (rrerr.getCode()) {
        case BAD_ROLE:
            // switch says that current-role-req has bad role?
            // for now we disconnect
            // fall-thru
        case STALE:
            // switch says that current-role-req has stale gen-id?
            // for now we disconnect
            // fall-thru
        case UNSUP:
            // switch says that current-role-req has role that
            // cannot be supported? for now we disconnect
            String msgx = String.format("Switch: [%s], State: [%s], "
                    + "received Error to for pending role request [%s]. "
                    + "Error:[%s]. Disconnecting switch ... ",
                    OFChannelHandler.this.getSwitchInfoString(),
                    OFChannelHandler.this.state.toString(),
                    pendingRole, rrerr);
            throw new SwitchStateException(msgx);
        default:
            break;
        }
    }

    // This error message was for a role request message but we dont
    // know
    // how to handle errors for nicira role request messages
    return RoleRecvStatus.OTHER_EXPECTATION;
}
项目:onos    文件:RoleManager.java   
/**
 * Called if we receive an  error message. If the xid matches the
 * pending request we handle it otherwise we ignore it.
 *
 * Note: since we only keep the last pending request we might get
 * error messages for earlier role requests that we won't be able
 * to handle
 */
@Override
public synchronized RoleRecvStatus deliverError(OFErrorMsg error)
        throws SwitchStateException {
    RoleState errorRole = pendingReplies.getIfPresent(error.getXid());
    if (errorRole == null) {
        if (error.getErrType() == OFErrorType.ROLE_REQUEST_FAILED) {
            log.debug("Received an error msg from sw {} for a role request,"
                    + " but not for pending request in role-changer; "
                    + " ignoring error {} ...",
                    sw.getStringId(), error);
        } else {
            log.debug("Received an error msg from sw {}, but no pending "
                    + "requests in role-changer; not handling ...",
                    sw.getStringId());
        }
        return RoleRecvStatus.OTHER_EXPECTATION;
    }
    // it is an error related to a currently pending role request message
    if (error.getErrType() == OFErrorType.BAD_REQUEST) {
        log.error("Received a error msg {} from sw {} for "
                + "pending role request {}. Switch driver indicates "
                + "role-messaging is supported. Possible issues in "
                + "switch driver configuration?",
                ((OFBadRequestErrorMsg) error).toString(),
                sw.getStringId(),
                errorRole);
        return RoleRecvStatus.UNSUPPORTED;
    }

    if (error.getErrType() == OFErrorType.ROLE_REQUEST_FAILED) {
        OFRoleRequestFailedErrorMsg rrerr =
                (OFRoleRequestFailedErrorMsg) error;
        switch (rrerr.getCode()) {
        case BAD_ROLE:
            // switch says that current-role-req has bad role?
            // for now we disconnect
            // fall-thru
        case STALE:
            // switch says that current-role-req has stale gen-id?
            // for now we disconnect
            // fall-thru
        case UNSUP:
            // switch says that current-role-req has role that
            // cannot be supported? for now we disconnect
            String msgx = String.format("Switch: [%s], "
                    + "received Error to for pending role request [%s]. "
                    + "Error:[%s]. Disconnecting switch ... ",
                    sw.getStringId(),
                    errorRole, rrerr);
            throw new SwitchStateException(msgx);
        default:
            break;
        }
    }

    // This error message was for a role request message but we dont know
    // how to handle errors for nicira role request messages
    return RoleRecvStatus.OTHER_EXPECTATION;
}