Java 类org.projectfloodlight.openflow.protocol.OFPortDescPropOpticalTransport 实例源码

项目:athena    文件:OfOpticalSwitchImplLinc13.java   
/**
 * Creates an OpenFlow optical port based on the given port and transport type.
 *
 * @param port OpenFlow optical port
 * @param type transport type
 * @return OpenFlow optical port
 */
private OFPortOptical createOpticalPort(OFPortOptical port, short type) {
    List<OFPortDescPropOpticalTransport> descList = new ArrayList<>(port.getDesc().size());

    for (OFPortDescPropOpticalTransport desc : port.getDesc()) {
        OFPortDescPropOpticalTransport newDesc = desc.createBuilder()
                .setType(desc.getType())
                .setPortSignalType(type)
                .setPortType(desc.getPortType())
                .setReserved(desc.getReserved())
                .build();
        descList.add(newDesc);
    }

    OFPortOptical newPort = port.createBuilder()
            .setConfig(port.getConfig())
            .setDesc(descList)
            .setHwAddr(port.getHwAddr())
            .setName(port.getName())
            .setPortNo(port.getPortNo())
            .setState(port.getState())
            .build();

    return newPort;
}
项目:onos    文件:OfOpticalSwitchImplLinc13.java   
/**
 * Creates an OpenFlow optical port based on the given port and transport type.
 *
 * @param port OpenFlow optical port
 * @param type transport type
 * @return OpenFlow optical port
 */
private OFPortOptical createOpticalPort(OFPortOptical port, short type) {
    List<OFPortDescPropOpticalTransport> descList = new ArrayList<>(port.getDesc().size());

    for (OFPortDescPropOpticalTransport desc : port.getDesc()) {
        OFPortDescPropOpticalTransport newDesc = desc.createBuilder()
                .setType(desc.getType())
                .setPortSignalType(type)
                .setPortType(desc.getPortType())
                .setReserved(desc.getReserved())
                .build();
        descList.add(newDesc);
    }

    OFPortOptical newPort = port.createBuilder()
            .setConfig(port.getConfig())
            .setDesc(descList)
            .setHwAddr(port.getHwAddr())
            .setName(port.getName())
            .setPortNo(port.getPortNo())
            .setState(port.getState())
            .build();

    return newPort;
}
项目:athena    文件:OpenFlowDeviceProvider.java   
/**
 * Build a portDescription from a given a port description describing some
 * Optical port.
 *
 * @param port description property type.
 * @param port the port to build from.
 * @return portDescription for the port.
 */
private PortDescription buildPortDescription(PortDescPropertyType ptype, OFPortOptical port) {
    checkArgument(port.getDesc().size() >= 1);

    // Minimally functional fixture. This needs to be fixed as we add better support.
    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());

    if (port.getVersion() == OFVersion.OF_13
            && ptype == PortDescPropertyType.OPTICAL_TRANSPORT) {
        // At this point, not much is carried in the optical port message.
        LOG.debug("Optical transport port message {}", port.toString());
    } else {
        // removable once 1.4+ support complete.
        LOG.debug("Unsupported optical port properties");
    }

    OFPortDescPropOpticalTransport desc = port.getDesc().get(0);
    switch (desc.getPortSignalType()) {
        // FIXME: use constants once loxi has full optical extensions
        case 2:     // OMS port
            // Assume complete optical spectrum and 50 GHz grid
            // LINC-OE is only supported optical OF device for now
            return omsPortDescription(portNo, enabled,
                    Spectrum.U_BAND_MIN, Spectrum.O_BAND_MAX, Frequency.ofGHz(50), annotations);
        case 5:     // OCH port
            OchSignal signal = new OchSignal(GridType.DWDM, ChannelSpacing.CHL_50GHZ, 0, 4);
            return ochPortDescription(portNo, enabled, OduSignalType.ODU4,
                    true, signal, annotations);
        default:
            break;
    }

    return new DefaultPortDescription(portNo, enabled, FIBER, 0, annotations);
}
项目:onos    文件:OpenFlowDeviceProvider.java   
/**
 * Build a portDescription from a given a port description describing some
 * Optical port.
 *
 * @param port description property type.
 * @param port the port to build from.
 * @return portDescription for the port.
 */
private PortDescription buildPortDescription(PortDescPropertyType ptype, OFPortOptical port,
        OpenFlowOpticalSwitch opsw) {
    checkArgument(!port.getDesc().isEmpty());

    // Minimally functional fixture. This needs to be fixed as we add better support.
    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();

    if (port.getVersion() == OFVersion.OF_13
            && ptype == PortDescPropertyType.OPTICAL_TRANSPORT) {
        // At this point, not much is carried in the optical port message.
        LOG.debug("Optical transport port message {}", port.toString());
    } else {
        // removable once 1.4+ support complete.
        LOG.debug("Unsupported optical port properties");
    }

    OFPortDescPropOpticalTransport desc = port.getDesc().get(0);
    switch (desc.getPortSignalType()) {
        // FIXME: use constants once loxi has full optical extensions
        case 2:     // OMS port
            // Assume complete optical spectrum and 50 GHz grid
            Set<OchSignal> signals = null;
            if (opsw instanceof HandlerBehaviour) {
                DriverHandler driverHandler = ((HandlerBehaviour) opsw).handler();
                if (driverHandler != null && driverHandler.hasBehaviour(LambdaQuery.class)) {
                    try {
                        signals = driverHandler.behaviour(LambdaQuery.class).queryLambdas(portNo);
                    } catch (NullPointerException e) {
                        signals = null;
                    }
                }
            }
            Frequency minFreq;
            Frequency maxFreq;
            Frequency channelSpacing;
            if (signals == null || signals.isEmpty()) {
                minFreq = Spectrum.U_BAND_MIN;
                maxFreq = Spectrum.O_BAND_MAX;
                channelSpacing = Frequency.ofGHz(50);
            } else {
                Comparator<OchSignal> compare =
                        (OchSignal a, OchSignal b) -> a.spacingMultiplier() - b.spacingMultiplier();
                OchSignal minOch = Collections.min(signals, compare);
                OchSignal maxOch = Collections.max(signals, compare);
                minFreq = minOch.centralFrequency();
                maxFreq = maxOch.centralFrequency();
                channelSpacing = minOch.channelSpacing().frequency();
            }
            return omsPortDescription(portNo, enabled, minFreq,
                    maxFreq, channelSpacing, annotations);
        case 5:     // OCH port
            OchSignal signal = new OchSignal(GridType.DWDM, ChannelSpacing.CHL_50GHZ, 0, 4);
            return ochPortDescription(portNo, enabled, OduSignalType.ODU4,
                    true, signal, annotations);
        default:
            break;
    }

    return new DefaultPortDescription(portNo, enabled, FIBER, 0, annotations);
}