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


Java LambdaQuery类代码示例

本文整理汇总了Java中org.onosproject.net.behaviour.LambdaQuery的典型用法代码示例。如果您正苦于以下问题:Java LambdaQuery类的具体用法?Java LambdaQuery怎么用?Java LambdaQuery使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: queryLambdas

import org.onosproject.net.behaviour.LambdaQuery; //导入依赖的package包/类
private Set<OchSignal> queryLambdas(DeviceId did, PortNumber port) {
    try {
        DriverHandler handler = driverService.createHandler(did);
        if (handler == null || !handler.hasBehaviour(LambdaQuery.class)) {
            return Collections.emptySet();
        }
        LambdaQuery query = handler.behaviour(LambdaQuery.class);
        if (query != null) {
            return query.queryLambdas(port).stream()
                    .flatMap(ResourceDeviceListener::toResourceGrid)
                    .collect(Collectors.toSet());
        } else {
            return Collections.emptySet();
        }
    } catch (ItemNotFoundException e) {
        return Collections.emptySet();
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:19,代码来源:ResourceDeviceListener.java

示例2: queryLambdas

import org.onosproject.net.behaviour.LambdaQuery; //导入依赖的package包/类
private Set<OchSignal> queryLambdas(DeviceId did, PortNumber port) {
    try {
        DriverHandler handler = driverService.createHandler(did);
        if (handler == null || !handler.hasBehaviour(LambdaQuery.class)) {
            return Collections.emptySet();
        }
        LambdaQuery query = handler.behaviour(LambdaQuery.class);
        if (query != null) {
            return query.queryLambdas(port).stream()
                    .flatMap(ResourceDeviceListener::toResourceGrid)
                    .collect(ImmutableSet.toImmutableSet());
        } else {
            return Collections.emptySet();
        }
    } catch (ItemNotFoundException e) {
        return Collections.emptySet();
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:19,代码来源:ResourceDeviceListener.java

示例3: queryLambdas

import org.onosproject.net.behaviour.LambdaQuery; //导入依赖的package包/类
@Override
public Set<OchSignal> queryLambdas(DeviceId deviceId, PortNumber portNumber) {
    checkNotNull(deviceId);
    checkNotNull(portNumber);
    LambdaQuery lambdaQuery = getLambdaQuery(deviceId);
    if (lambdaQuery != null) {
        return lambdaQuery.queryLambdas(portNumber);
    }
    return Collections.emptySet();
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:11,代码来源:RoadmManager.java

示例4: validChannel

import org.onosproject.net.behaviour.LambdaQuery; //导入依赖的package包/类
@Override
public boolean validChannel(DeviceId deviceId, PortNumber portNumber, OchSignal ochSignal) {
    checkNotNull(deviceId);
    checkNotNull(portNumber);
    checkNotNull(ochSignal);
    LambdaQuery lambdaQuery = getLambdaQuery(deviceId);
    if (lambdaQuery != null) {
        Set<OchSignal> channels = lambdaQuery.queryLambdas(portNumber);
        return channels.contains(ochSignal);
    }
    return false;
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:13,代码来源:RoadmManager.java

示例5: getLambdaQuery

import org.onosproject.net.behaviour.LambdaQuery; //导入依赖的package包/类
private LambdaQuery getLambdaQuery(DeviceId deviceId) {
    Device device = deviceService.getDevice(deviceId);
    if (device != null && device.is(LambdaQuery.class)) {
        return device.as(LambdaQuery.class);
    }
    // Do not need warning here for port polling.
    log.debug("Unable to load LambdaQuery for {}", deviceId);
    return null;
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:10,代码来源:RoadmManager.java

示例6: buildPortDescription

import org.onosproject.net.behaviour.LambdaQuery; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:76,代码来源:OpenFlowDeviceProvider.java


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