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


Java OFPortOpticalTransportSignalType.OTU2属性代码示例

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


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

示例1: buildPortDescription

/**
 * 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,代码行数:70,代码来源:OpenFlowDeviceProvider.java

示例2: buildPortDescription

/**
 * 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,代码行数:73,代码来源:OpenFlowDeviceProvider.java


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