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


Java OFError.getErrorType方法代码示例

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


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

示例1: handleErrorMessage

import org.openflow.protocol.OFError; //导入方法依赖的package包/类
protected void handleErrorMessage(OFError err, long dpid, int xid) {
    short errorType = err.getErrorType();
    short errorCode = err.getErrorCode();
    if (errorType == OFError.OFErrorType.OFPET_BAD_REQUEST.getValue() &&
            errorCode == (short)OFError.OFBadRequestCode.OFPBRC_EPERM.ordinal()) {
        Set<Integer> xids = sentIPRequests.get(dpid);

        if (xids != null && xids.contains(xid)) {
            logger.warn("Switch {} not configured with tunnel-endpoint " +
                    "information (missing /etc/bsn_tunnel_interface file)",
                    HexString.toHexString(dpid));
            xids.remove(xid);
            return;
        }
    } else {
        // ignoring all other error messages
    }
}
 
开发者ID:opendaylight,项目名称:archived-net-virt-platform,代码行数:19,代码来源:TunnelManager.java

示例2: processOFError

import org.openflow.protocol.OFError; //导入方法依赖的package包/类
@Override
void processOFError(OFChannelHandler h, OFError m) {
    if (m.getErrorType() == OFErrorType.OFPET_BAD_REQUEST.getValue()
            && m.getErrorCode() ==
                OFBadRequestCode.OFPBRC_BAD_VENDOR.ordinal()) {
        log.debug("Switch {} has multiple tables but does not " +
                "support L2 table extension",
                h.getSwitchInfoString());
        return;
    }
    logErrorDisconnect(h, m);
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:13,代码来源:OFChannelHandler.java

示例3: getErrorString

import org.openflow.protocol.OFError; //导入方法依赖的package包/类
/**
 * Get a useable error string from the OFError.
 * @param error
 * @return
 */
public static String getErrorString(OFError error) {
    // TODO: this really should be OFError.toString. Sigh.
    int etint = 0xffff & error.getErrorType();
    if (etint < 0 || etint >= OFErrorType.values().length) {
        return String.format("Unknown error type %d", etint);
    }
    OFErrorType et = OFErrorType.values()[etint];
    switch (et) {
        case OFPET_HELLO_FAILED:
            OFHelloFailedCode hfc =
                OFHelloFailedCode.values()[0xffff & error.getErrorCode()];
            return String.format("Error %s %s", et, hfc);
        case OFPET_BAD_REQUEST:
            OFBadRequestCode brc =
                OFBadRequestCode.values()[0xffff & error.getErrorCode()];
            return String.format("Error %s %s", et, brc);
        case OFPET_BAD_ACTION:
            OFBadActionCode bac =
                OFBadActionCode.values()[0xffff & error.getErrorCode()];
            return String.format("Error %s %s", et, bac);
        case OFPET_FLOW_MOD_FAILED:
            OFFlowModFailedCode fmfc =
                OFFlowModFailedCode.values()[0xffff & error.getErrorCode()];
            return String.format("Error %s %s", et, fmfc);
        case OFPET_PORT_MOD_FAILED:
            OFPortModFailedCode pmfc =
                OFPortModFailedCode.values()[0xffff & error.getErrorCode()];
            return String.format("Error %s %s", et, pmfc);
        case OFPET_QUEUE_OP_FAILED:
            OFQueueOpFailedCode qofc =
                OFQueueOpFailedCode.values()[0xffff & error.getErrorCode()];
            return String.format("Error %s %s", et, qofc);
        case OFPET_VENDOR_ERROR:
            // no codes known for vendor error
            return String.format("Error %s", et);
    }
    return null;
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:44,代码来源:OFChannelHandler.java

示例4: deliverError

import org.openflow.protocol.OFError; //导入方法依赖的package包/类
/**
 * Called if we receive an  error message. If the xid matches the
 * pending request we handle it otherwise we ignore it. We also
 * set SWITCH_SUPPORTS_NX_ROLE to false.
 *
 * 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
 * @param xid
 * @return true if the error was handled by us, false otherwise
 * @throws SwitchStateException if the error was for the pending
 * role request but was unexpected
 */
synchronized boolean deliverError(OFError error) {
    if (!requestPending)
        return false;

    if (pendingXid == error.getXid()) {
        boolean isBadRequestError =
                (error.getErrorType() == OFError.OFErrorType.
                OFPET_BAD_REQUEST.getValue());
        if (isBadRequestError) {
            counters.roleReplyErrorUnsupported.updateCounterWithFlush();
            setSwitchRole(pendingRole, RoleRecvStatus.UNSUPPORTED);
        } else {
            // TODO: Is this the right thing to do if we receive
            // some other error besides a bad request error?
            // Presumably that means the switch did actually
            // understand the role request message, but there
            // was some other error from processing the message.
            // OF 1.2 specifies a OFPET_ROLE_REQUEST_FAILED
            // error code, but it doesn't look like the Nicira
            // role request has that. Should check OVS source
            // code to see if it's possible for any other errors
            // to be returned.
            // If we received an error the switch is not
            // in the correct role, so we need to disconnect it.
            // We could also resend the request but then we need to
            // check if there are other pending request in which
            // case we shouldn't resend. If we do resend we need
            // to make sure that the switch eventually accepts one
            // of our requests or disconnect the switch. This feels
            // cumbersome.
            String msg = String.format("Switch: [%s], State: [%s], "
                            + "Unexpected error %s in respone to our "
                            + "role request for %s.",
                            OFChannelHandler.this.getSwitchInfoString(),
                            OFChannelHandler.this.state.toString(),
                            getErrorString(error),
                            pendingRole);
            throw new SwitchStateException(msg);
        }
        return true;
    }
    return false;
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:57,代码来源:OFChannelHandler.java

示例5: logError

import org.openflow.protocol.OFError; //导入方法依赖的package包/类
/**
 * Log an OpenFlow error message from a switch
 * @param sw The switch that sent the error
 * @param error The error message
 */
@LogMessageDoc(level="ERROR",
        message="Error {error type} {error code} from {switch}",
        explanation="The switch responded with an unexpected error" +
                "to an OpenFlow message from the controller",
        recommendation="This could indicate improper network operation. " +
                "If the problem persists restarting the switch and " +
                "controller may help."
        )
protected void logError(IOFSwitch sw, OFError error) {
    int etint = 0xffff & error.getErrorType();
    if (etint < 0 || etint >= OFErrorType.values().length) {
        log.error("Unknown error code {} from sw {}", etint, sw);
    }
    OFErrorType et = OFErrorType.values()[etint];
    switch (et) {
        case OFPET_HELLO_FAILED:
            OFHelloFailedCode hfc = 
                OFHelloFailedCode.values()[0xffff & error.getErrorCode()];
            log.error("Error {} {} from {}", new Object[] {et, hfc, sw});
            break;
        case OFPET_BAD_REQUEST:
            OFBadRequestCode brc = 
                OFBadRequestCode.values()[0xffff & error.getErrorCode()];
            log.error("Error {} {} from {}", new Object[] {et, brc, sw});
            break;
        case OFPET_BAD_ACTION:
            OFBadActionCode bac =
                OFBadActionCode.values()[0xffff & error.getErrorCode()];
            log.error("Error {} {} from {}", new Object[] {et, bac, sw});
            break;
        case OFPET_FLOW_MOD_FAILED:
            OFFlowModFailedCode fmfc =
                OFFlowModFailedCode.values()[0xffff & error.getErrorCode()];
            log.error("Error {} {} from {}", new Object[] {et, fmfc, sw});
            break;
        case OFPET_PORT_MOD_FAILED:
            OFPortModFailedCode pmfc =
                OFPortModFailedCode.values()[0xffff & error.getErrorCode()];
            log.error("Error {} {} from {}", new Object[] {et, pmfc, sw});
            break;
        case OFPET_QUEUE_OP_FAILED:
            OFQueueOpFailedCode qofc =
                OFQueueOpFailedCode.values()[0xffff & error.getErrorCode()];
            log.error("Error {} {} from {}", new Object[] {et, qofc, sw});
            break;
        default:
            break;
    }
}
 
开发者ID:smartenit-eu,项目名称:smartenit,代码行数:55,代码来源:Controller.java

示例6: getErrorString

import org.openflow.protocol.OFError; //导入方法依赖的package包/类
/**
 * Get an error string from the OFError.
 *
 * @param error the OpenFlow error
 * @return the error string
 */
private static String getErrorString(OFError error) {
    // TODO: this really should be OFError.toString. Sigh.
    int etint = 0xffff & error.getErrorType();
    if (etint < 0 || etint >= OFErrorType.values().length) {
        return String.format("Unknown error type %d", etint);
    }
    OFErrorType et = OFErrorType.values()[etint];
    switch (et) {
    case OFPET_HELLO_FAILED:
        OFHelloFailedCode hfc = OFHelloFailedCode.values()[0xffff & error
                .getErrorCode()];
        return String.format("Error %s %s", et, hfc);
    case OFPET_BAD_REQUEST:
        OFBadRequestCode brc = OFBadRequestCode.values()[0xffff & error
                .getErrorCode()];
        return String.format("Error %s %s", et, brc);
    case OFPET_BAD_ACTION:
        OFBadActionCode bac = OFBadActionCode.values()[0xffff & error
                .getErrorCode()];
        return String.format("Error %s %s", et, bac);
    case OFPET_FLOW_MOD_FAILED:
        OFFlowModFailedCode fmfc = OFFlowModFailedCode.values()[0xffff & error
                .getErrorCode()];
        return String.format("Error %s %s", et, fmfc);
    case OFPET_PORT_MOD_FAILED:
        OFPortModFailedCode pmfc = OFPortModFailedCode.values()[0xffff & error
                .getErrorCode()];
        return String.format("Error %s %s", et, pmfc);
    case OFPET_QUEUE_OP_FAILED:
        OFQueueOpFailedCode qofc = OFQueueOpFailedCode.values()[0xffff & error
                .getErrorCode()];
        return String.format("Error %s %s", et, qofc);
    case OFPET_VENDOR_ERROR:
        // no codes known for vendor error
        return String.format("Error %s", et);
    default:
        break;
    }
    return null;
}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:47,代码来源:OVXError.java

示例7: deliverRoleRequestError

import org.openflow.protocol.OFError; //导入方法依赖的package包/类
@LogMessageDocs({
    @LogMessageDoc(level="ERROR",
        message="Received ERROR from sw {switch} that indicates roles " +
                "are not supported but we have received a valid role " +
                "reply earlier",
        explanation="Switch is responding to HA role request in an " +
                    "inconsistent manner.",
        recommendation=LogMessageDoc.CHECK_SWITCH),
    @LogMessageDoc(level="ERROR",
        message="Unexpected error {error} from switch {switch} " +
                "disconnecting",
        explanation="Swith sent an error reply to request, but the error " +
                    "type is not OPET_BAD_REQUEST as required by the protocol",
        recommendation=LogMessageDoc.CHECK_SWITCH)
})
protected void deliverRoleRequestError(IOFSwitch sw, OFError error) {
    // We expect to receive a bad request error when
    // we're connected to a switch that doesn't support
    // the Nicira vendor extensions (i.e. not OVS or
    // derived from OVS).  By protocol, it should also be
    // BAD_VENDOR, but too many switch implementations
    // get it wrong and we can already check the xid()
    // so we can ignore the type with confidence that this
    // is not a spurious error
    boolean isBadRequestError =
            (error.getErrorType() == OFError.OFErrorType.
            OFPET_BAD_REQUEST.getValue());
    if (isBadRequestError) {
        if (sw.getHARole() != null) {
            log.warn("Received ERROR from sw {} that "
                    +"indicates roles are not supported "
                    +"but we have received a valid "
                    +"role reply earlier", sw);
        }
        // First, clean up pending requests
        deliverRoleRequestNotSupported(sw, error.getXid());
    } else {
        // TODO: Is this the right thing to do if we receive
        // some other error besides a bad request error?
        // Presumably that means the switch did actually
        // understand the role request message, but there
        // was some other error from processing the message.
        // OF 1.2 specifies a OFPET_ROLE_REQUEST_FAILED
        // error code, but it doesn't look like the Nicira
        // role request has that. Should check OVS source
        // code to see if it's possible for any other errors
        // to be returned.
        // If we received an error the switch is not
        // in the correct role, so we need to disconnect it.
        // We could also resend the request but then we need to
        // check if there are other pending request in which
        // case we shouldn't resend. If we do resend we need
        // to make sure that the switch eventually accepts one
        // of our requests or disconnect the switch. This feels
        // cumbersome.
        log.error("Unexpected error {} from switch {}, disconnecting",
                error, sw);
        sw.disconnectOutputStream();
    }
}
 
开发者ID:opendaylight,项目名称:archived-net-virt-platform,代码行数:61,代码来源:RoleChanger.java

示例8: logError

import org.openflow.protocol.OFError; //导入方法依赖的package包/类
/**
 * Log an OpenFlow error message from a switch
 * @param sw The switch that sent the error
 * @param error The error message
 */
@LogMessageDoc(level="ERROR",
        message="Error {error type} {error code} from {switch}",
        explanation="The switch responded with an unexpected error" +
                "to an OpenFlow message from the controller",
        recommendation="This could indicate improper network operation. " +
                "If the problem persists restarting the switch and " +
                "controller may help."
        )
protected void logError(IOFSwitch sw, OFError error) {
    int etint = 0xffff & error.getErrorType();
    if (etint < 0 || etint >= OFErrorType.values().length) {
        log.error("Unknown error code {} from sw {}", etint, sw);
    }
    OFErrorType et = OFErrorType.values()[etint];
    switch (et) {
        case OFPET_HELLO_FAILED:
            OFHelloFailedCode hfc =
                OFHelloFailedCode.values()[0xffff & error.getErrorCode()];
            log.error("Error {} {} from {}", new Object[] {et, hfc, sw});
            break;
        case OFPET_BAD_REQUEST:
            OFBadRequestCode brc =
                OFBadRequestCode.values()[0xffff & error.getErrorCode()];
            log.error("Error {} {} from {}", new Object[] {et, brc, sw});
            break;
        case OFPET_BAD_ACTION:
            OFBadActionCode bac =
                OFBadActionCode.values()[0xffff & error.getErrorCode()];
            log.error("Error {} {} from {}", new Object[] {et, bac, sw});
            break;
        case OFPET_FLOW_MOD_FAILED:
            OFFlowModFailedCode fmfc =
                OFFlowModFailedCode.values()[0xffff & error.getErrorCode()];
            log.error("Error {} {} from {}", new Object[] {et, fmfc, sw});
            break;
        case OFPET_PORT_MOD_FAILED:
            OFPortModFailedCode pmfc =
                OFPortModFailedCode.values()[0xffff & error.getErrorCode()];
            log.error("Error {} {} from {}", new Object[] {et, pmfc, sw});
            break;
        case OFPET_QUEUE_OP_FAILED:
            OFQueueOpFailedCode qofc =
                OFQueueOpFailedCode.values()[0xffff & error.getErrorCode()];
            log.error("Error {} {} from {}", new Object[] {et, qofc, sw});
            break;
        default:
            break;
    }
}
 
开发者ID:opendaylight,项目名称:archived-net-virt-platform,代码行数:55,代码来源:Controller.java

示例9: getOFErrorString

import org.openflow.protocol.OFError; //导入方法依赖的package包/类
static String getOFErrorString(OFError error) {
    // Handle VENDOR extension errors here
    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);
        bb.rewind();
        er.readFrom(bb);
        return er.toString();
    }

    // Handle OF1.0 errors here
    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;
    case OFPET_PORT_MOD_FAILED:
        OFPortModFailedCode pmfc = OFPortModFailedCode.values()[0xffff & error
                .getErrorCode()];
        errorStr += " " + pmfc.toString();
        break;
    case OFPET_QUEUE_OP_FAILED:
        OFQueueOpFailedCode qofc = OFQueueOpFailedCode.values()[0xffff & error
                .getErrorCode()];
        errorStr += " " + qofc.toString();
        break;
    default:
        break;
    }
    return errorStr;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:52,代码来源:Utils.java

示例10: V6Error

import org.openflow.protocol.OFError; //导入方法依赖的package包/类
public V6Error(OFError e) {
    this.length = (short)e.getLengthU();
    this.errorType = e.getErrorType();
    this.errorCode = e.getErrorCode();
    this.xid = e.getXid();
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:7,代码来源:V6Error.java


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