當前位置: 首頁>>代碼示例>>Java>>正文


Java OFPortOpticalTransportSignalType類代碼示例

本文整理匯總了Java中org.projectfloodlight.openflow.protocol.OFPortOpticalTransportSignalType的典型用法代碼示例。如果您正苦於以下問題:Java OFPortOpticalTransportSignalType類的具體用法?Java OFPortOpticalTransportSignalType怎麽用?Java OFPortOpticalTransportSignalType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


OFPortOpticalTransportSignalType類屬於org.projectfloodlight.openflow.protocol包,在下文中一共展示了OFPortOpticalTransportSignalType類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: matchingOtuPortSignalTypes

import org.projectfloodlight.openflow.protocol.OFPortOpticalTransportSignalType; //導入依賴的package包/類
private boolean matchingOtuPortSignalTypes(OFPortOpticalTransportSignalType sigType,
                                           OduSignalType oduSignalType) {
    switch (sigType) {
        case OTU2:
            if (oduSignalType == OduSignalType.ODU2) {
                return true;
            }
            break;
        case OTU4:
            if (oduSignalType == OduSignalType.ODU4) {
                return true;
            }
            break;
        default:
            break;
    }
    return false;
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:19,代碼來源:OpenFlowDeviceProvider.java

示例2: matchingOtuPortSignalTypes

import org.projectfloodlight.openflow.protocol.OFPortOpticalTransportSignalType; //導入依賴的package包/類
private boolean matchingOtuPortSignalTypes(OFPortOpticalTransportSignalType sigType,
        OduSignalType oduSignalType) {
    switch (sigType) {
    case OTU2:
        if (oduSignalType == OduSignalType.ODU2) {
            return true;
        }
        break;
    case OTU4:
        if (oduSignalType == OduSignalType.ODU4) {
            return true;
        }
        break;
    default:
        break;
    }
    return false;
}
 
開發者ID:opennetworkinglab,項目名稱:onos,代碼行數:19,代碼來源:OpenFlowDeviceProvider.java

示例3: buildPortDescription

import org.projectfloodlight.openflow.protocol.OFPortOpticalTransportSignalType; //導入依賴的package包/類
/**
 * Build a portDescription from a given a port description describing some
 * Optical port.
 *
 * @param ptype description property type.
 * @param port  the port to build from.
 * @return portDescription for the port.
 */
private PortDescription buildPortDescription(PortDescPropertyType ptype, OFExpPort port) {
    PortNumber portNo = PortNumber.portNumber(port.getPortNo().getPortNumber());
    boolean enabled = !port.getState().contains(OFPortState.LINK_DOWN)
            && !port.getConfig().contains(OFPortConfig.PORT_DOWN);
    SparseAnnotations annotations = makePortAnnotation(port.getName(), port.getHwAddr().toString());

    OFExpPortDescPropOpticalTransport firstProp = port.getProperties().get(0);
    OFPortOpticalTransportSignalType sigType = firstProp.getPortSignalType();

    PortDescription portDes = null;
    switch (sigType) {
        case OMSN:
            portDes = omsPortDescription(portNo, enabled,
                    FREQ191_7, FREQ191_7.add(FREQ4_4), FREQ50, annotations);
            break;
        case OCH:
            OFExpPortOpticalTransportLayerEntry entry = firstProp.getFeatures().get(0).getValue().get(0);
            OFPortOpticalTransportLayerClass layerClass = entry.getLayerClass();
            if (!OFPortOpticalTransportLayerClass.ODU.equals(layerClass)) {
                LOG.error("Unsupported layer Class {} ", layerClass);
                return null;
            }

            // convert to ONOS OduSignalType
            OduSignalType oduSignalType = OpenFlowDeviceValueMapper.
                    lookupOduSignalType((byte) entry.getSignalType());
            //OchSignal is needed for OchPortDescription constructor,
            //yet not relevant for tunable OCH port, creating with default parameters
            OchSignal signalId = new OchSignal(GridType.DWDM, ChannelSpacing.CHL_50GHZ, 1, 1);

            portDes = ochPortDescription(portNo, enabled,
                    oduSignalType, true,
                    signalId, annotations);

            break;
        case OTU2:
        case OTU4:
            entry = firstProp.getFeatures().get(0).getValue().get(0);
            layerClass = entry.getLayerClass();
            if (!OFPortOpticalTransportLayerClass.ODU.equals(layerClass)) {
                LOG.error("Unsupported layer Class {} ", layerClass);
                return null;
            }

            // convert to ONOS OduSignalType
            OduSignalType oduSignalTypeOtuPort = OpenFlowDeviceValueMapper.
                    lookupOduSignalType((byte) entry.getSignalType());
            if (!matchingOtuPortSignalTypes(sigType, oduSignalTypeOtuPort)) {
                LOG.error("Wrong oduSignalType {} for OTU Port sigType {} ", oduSignalTypeOtuPort, sigType);
                return null;
            }
            OtuSignalType otuSignalType =
                    ((sigType == OFPortOpticalTransportSignalType.OTU2) ? OtuSignalType.OTU2 :
                            OtuSignalType.OTU4);
            portDes = otuPortDescription(portNo, enabled, otuSignalType, annotations);
            break;
        default:
            break;
    }

    return portDes;
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:71,代碼來源:OpenFlowDeviceProvider.java

示例4: buildPortDescription

import org.projectfloodlight.openflow.protocol.OFPortOpticalTransportSignalType; //導入依賴的package包/類
/**
 * Build a portDescription from a given a port description describing some
 * Optical port.
 *
 * @param ptype description property type.
 * @param port the port to build from.
 * @return portDescription for the port.
 */
private PortDescription buildPortDescription(PortDescPropertyType ptype, OFExpPort port) {
    PortNumber portNo = PortNumber.portNumber(port.getPortNo().getPortNumber());
    boolean enabled = !port.getState().contains(OFPortState.LINK_DOWN)
            && !port.getConfig().contains(OFPortConfig.PORT_DOWN);
    boolean adminDown = port.getConfig().contains(OFPortConfig.PORT_DOWN);
    SparseAnnotations annotations = makePortAnnotation(port.getName(),
                                                       port.getHwAddr().toString(),
                                                       adminDown).build();

    OFExpPortDescPropOpticalTransport firstProp = port.getProperties().get(0);
    OFPortOpticalTransportSignalType sigType = firstProp.getPortSignalType();

    PortDescription portDes = null;
    switch (sigType) {
    case OMSN:
        portDes = omsPortDescription(portNo, enabled,
                FREQ191_7, FREQ191_7.add(FREQ4_4), FREQ50, annotations);
        break;
    case OCH:
        OFExpPortOpticalTransportLayerEntry entry = firstProp.getFeatures().get(0).getValue().get(0);
        OFPortOpticalTransportLayerClass layerClass =  entry.getLayerClass();
        if (!OFPortOpticalTransportLayerClass.ODU.equals(layerClass)) {
            LOG.error("Unsupported layer Class {} ", layerClass);
            return null;
        }

        // convert to ONOS OduSignalType
        OduSignalType oduSignalType = OpenFlowDeviceValueMapper.
                lookupOduSignalType((byte) entry.getSignalType());
        //OchSignal is needed for OchPortDescription constructor,
        //yet not relevant for tunable OCH port, creating with default parameters
        OchSignal signalId = new OchSignal(GridType.DWDM, ChannelSpacing.CHL_50GHZ, 1, 1);

        portDes = ochPortDescription(portNo, enabled,
                                     oduSignalType, true,
                                     signalId, annotations);

        break;
    case OTU2:
    case OTU4:
        entry = firstProp.getFeatures().get(0).getValue().get(0);
        layerClass =  entry.getLayerClass();
        if (!OFPortOpticalTransportLayerClass.ODU.equals(layerClass)) {
            LOG.error("Unsupported layer Class {} ", layerClass);
            return null;
        }

        // convert to ONOS OduSignalType
        OduSignalType oduSignalTypeOtuPort = OpenFlowDeviceValueMapper.
                lookupOduSignalType((byte) entry.getSignalType());
        if (!matchingOtuPortSignalTypes(sigType, oduSignalTypeOtuPort)) {
            LOG.error("Wrong oduSignalType {} for OTU Port sigType {} ", oduSignalTypeOtuPort, sigType);
            return null;
        }
        OtuSignalType otuSignalType =
                ((sigType == OFPortOpticalTransportSignalType.OTU2) ? OtuSignalType.OTU2 :
                    OtuSignalType.OTU4);
        portDes = otuPortDescription(portNo, enabled, otuSignalType, annotations);
        break;
    default:
        break;
    }

    return portDes;
}
 
開發者ID:opennetworkinglab,項目名稱:onos,代碼行數:74,代碼來源:OpenFlowDeviceProvider.java


注:本文中的org.projectfloodlight.openflow.protocol.OFPortOpticalTransportSignalType類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。