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


Java OFErrorType.values方法代码示例

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


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

示例1: getErrorString

import org.openflow.protocol.OFError.OFErrorType; //导入方法依赖的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

示例2: logError

import org.openflow.protocol.OFError.OFErrorType; //导入方法依赖的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

示例3: logError

import org.openflow.protocol.OFError.OFErrorType; //导入方法依赖的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

示例4: getOFErrorString

import org.openflow.protocol.OFError.OFErrorType; //导入方法依赖的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


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