当前位置: 首页>>代码示例>>Java>>正文


Java OFRoleRequestFailedErrorMsg.getCode方法代码示例

本文整理汇总了Java中org.projectfloodlight.openflow.protocol.errormsg.OFRoleRequestFailedErrorMsg.getCode方法的典型用法代码示例。如果您正苦于以下问题:Java OFRoleRequestFailedErrorMsg.getCode方法的具体用法?Java OFRoleRequestFailedErrorMsg.getCode怎么用?Java OFRoleRequestFailedErrorMsg.getCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.projectfloodlight.openflow.protocol.errormsg.OFRoleRequestFailedErrorMsg的用法示例。


在下文中一共展示了OFRoleRequestFailedErrorMsg.getCode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deliverError

import org.projectfloodlight.openflow.protocol.errormsg.OFRoleRequestFailedErrorMsg; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:68,代码来源:RoleManager.java

示例2: deliverError

import org.projectfloodlight.openflow.protocol.errormsg.OFRoleRequestFailedErrorMsg; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:68,代码来源:RoleManager.java

示例3: deliverError

import org.projectfloodlight.openflow.protocol.errormsg.OFRoleRequestFailedErrorMsg; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:73,代码来源:OFChannelHandler.java


注:本文中的org.projectfloodlight.openflow.protocol.errormsg.OFRoleRequestFailedErrorMsg.getCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。