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


Java CltSignalType类代码示例

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


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

示例1: oduCltPortDescription

import org.onosproject.net.CltSignalType; //导入依赖的package包/类
/**
 * Creates ODU client port description based on the supplied information.
 *
 * @param number        port number
 * @param isEnabled     port enabled state
 * @param signalType    ODU client signal type
 * @param annotations   key/value annotations map
 */
public static PortDescription oduCltPortDescription(PortNumber number,
                                                    boolean isEnabled,
                                                    CltSignalType signalType,
                                                    SparseAnnotations annotations) {
    Builder builder = DefaultAnnotations.builder();
    builder.putAll(annotations);

    builder.set(SIGNAL_TYPE, signalType.toString());

    long portSpeed = signalType.bitRate();
    return new DefaultPortDescription(number,
                                      isEnabled,
                                      Port.Type.ODUCLT,
                                      portSpeed,
                                      builder.build());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:25,代码来源:OduCltPortHelper.java

示例2: asOduCltPort

import org.onosproject.net.CltSignalType; //导入依赖的package包/类
public static Optional<OduCltPort> asOduCltPort(Port port) {
    if (port instanceof OduCltPort) {
        return Optional.of((OduCltPort) port);
    }

    try {
        Annotations an = port.annotations();

        CltSignalType signalType = Enum.valueOf(CltSignalType.class,
                                                an.value(SIGNAL_TYPE));


        // Note: ODU specific annotations is not filtered-out here.
        //       DefaultOduCltPort should filter them, if necessary.
        return Optional.of(new DefaultOduCltPort(port, signalType));

    } catch (NullPointerException | IllegalArgumentException e) {

        log.warn("{} was not well-formed OduClt port.", port, e);
        return Optional.empty();
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:OduCltPortHelper.java

示例3: findOpticalConnectivityIntent

import org.onosproject.net.CltSignalType; //导入依赖的package包/类
/**
 * Returns existing and available optical connectivity intent that matches the given circuit intent.
 *
 * @param src source connect point of optical circuit intent
 * @param dst destination connect point of optical circuit intent
 * @param signalType signal type of optical circuit intent
 * @param multiplexingSupported indicates whether ODU multiplexing is supported
 * @return existing optical connectivity intent, null otherwise.
 */
private OpticalConnectivityIntent findOpticalConnectivityIntent(ConnectPoint src,
                                                                ConnectPoint dst,
                                                                CltSignalType signalType,
                                                                boolean multiplexingSupported) {

    OduSignalType oduSignalType = OduSignalUtils.mappingCltSignalTypeToOduSignalType(signalType);

    return Tools.stream(intentService.getIntents())
            .filter(x -> x instanceof OpticalConnectivityIntent)
            .map(x -> (OpticalConnectivityIntent) x)
            .filter(x -> src.deviceId().equals(x.getSrc().deviceId()))
            .filter(x -> dst.deviceId().equals(x.getDst().deviceId()))
            .filter(x -> isAllowed(src, x.getSrc()))
            .filter(x -> isAllowed(dst, x.getDst()))
            .filter(x -> isAvailable(x.id()))
            .filter(x -> !multiplexingSupported ||
                    isAvailableTributarySlots(x.getSrc(), x.getDst(), oduSignalType.tributarySlots()))
            .findFirst()
            .orElse(null);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:30,代码来源:OpticalCircuitIntentCompiler.java

示例4: testCreateWithCircuitIntent

import org.onosproject.net.CltSignalType; //导入依赖的package包/类
/**
 * Checks the construction of OpticalConnectivityId object with OpticalCircuitIntent.
 */
@Test
public void testCreateWithCircuitIntent() {
    ConnectPoint cp1 = new ConnectPoint(DeviceId.deviceId("of:0000000000000001"), PortNumber.portNumber(1L));
    ConnectPoint cp2 = new ConnectPoint(DeviceId.deviceId("of:0000000000000002"), PortNumber.portNumber(2L));
    OpticalCircuitIntent circuitIntent = OpticalCircuitIntent.builder()
            .appId(appId)
            .src(cp1)
            .dst(cp2)
            .bidirectional(true)
            .key(Key.of(0, appId))
            .signalType(CltSignalType.CLT_1GBE)
            .build();

    PacketLinkRealizedByOptical plink = PacketLinkRealizedByOptical.create(cp1, cp2, circuitIntent);

    assertNotNull(plink);
    assertEquals(plink.src(), cp1);
    assertEquals(plink.dst(), cp2);
    assertEquals((long) plink.bandwidth().bps(), CltSignalType.CLT_1GBE.bitRate());
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:24,代码来源:PacketLinkRealizedByOpticalTest.java

示例5: testIsBetween

import org.onosproject.net.CltSignalType; //导入依赖的package包/类
/**
 * Checks that isBetween() method works.
 */
@Test
public void testIsBetween() {
    ConnectPoint cp1 = new ConnectPoint(DeviceId.deviceId("of:0000000000000001"), PortNumber.portNumber(1L));
    ConnectPoint cp2 = new ConnectPoint(DeviceId.deviceId("of:0000000000000002"), PortNumber.portNumber(2L));
    ConnectPoint cp3 = new ConnectPoint(DeviceId.deviceId("of:0000000000000003"), PortNumber.portNumber(3L));
    OpticalCircuitIntent ochIntent = OpticalCircuitIntent.builder()
            .appId(appId)
            .src(cp1)
            .dst(cp2)
            .bidirectional(true)
            .key(Key.of(0, appId))
            .signalType(CltSignalType.CLT_1GBE)
            .build();

    PacketLinkRealizedByOptical plink = PacketLinkRealizedByOptical.create(cp1, cp2, ochIntent);

    assertTrue(plink.isBetween(cp1, cp2));
    assertFalse(plink.isBetween(cp1, cp3));
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:23,代码来源:PacketLinkRealizedByOpticalTest.java

示例6: oduCltPortDescription

import org.onosproject.net.CltSignalType; //导入依赖的package包/类
/**
 * Creates ODU client port description based on the supplied information.
 *
 * @param number        port number
 * @param isEnabled     port enabled state
 * @param signalType    ODU client signal type
 * @param annotations   key/value annotations map
 * @return              port description
 */
public static PortDescription oduCltPortDescription(PortNumber number,
                                                    boolean isEnabled,
                                                    CltSignalType signalType,
                                                    SparseAnnotations annotations) {
    Builder builder = DefaultAnnotations.builder();
    builder.putAll(annotations);

    builder.set(SIGNAL_TYPE, signalType.toString());

    long portSpeed = signalType.bitRate();
    return new DefaultPortDescription(number,
                                      isEnabled,
                                      Port.Type.ODUCLT,
                                      portSpeed,
                                      builder.build());
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:26,代码来源:OduCltPortHelper.java

示例7: parseT100OduPort

import org.onosproject.net.CltSignalType; //导入依赖的package包/类
private static PortDescription parseT100OduPort(HierarchicalConfiguration cfg, long count) {
    PortNumber portNumber = PortNumber.portNumber(count);
    HierarchicalConfiguration ethernetConfig = cfg.configurationAt("ethernet");
    boolean enabled = ethernetConfig.getString("administrative-state").equals("up");
    //Rate is in kbps
    CltSignalType signalType = ethernetConfig.getString("rate").equals("100000000") ?
            CltSignalType.CLT_100GBE : null;
    DefaultAnnotations annotations = DefaultAnnotations.builder().
            set(AnnotationKeys.PORT_NAME, cfg.getString("name")).
            build();
    return oduCltPortDescription(portNumber, enabled, signalType, annotations);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:13,代码来源:PortGetterFujitsuImpl.java

示例8: buildOduCltPortDescription

import org.onosproject.net.CltSignalType; //导入依赖的package包/类
private PortDescription buildOduCltPortDescription(OFPortDesc port) {
    PortNumber portNo = PortNumber.portNumber(port.getPortNo().getPortNumber());
    boolean enabled = !port.getState().contains(OFPortState.LINK_DOWN) &&
            !port.getConfig().contains(OFPortConfig.PORT_DOWN);
    Long portSpeedInMbps = portSpeed(port);
    CltSignalType sigType = null;

    switch (portSpeedInMbps.toString()) {
        case "1000":
            sigType = CltSignalType.CLT_1GBE;
            break;
        case "10000":
            sigType = CltSignalType.CLT_10GBE;
            break;
        case "40000":
            sigType = CltSignalType.CLT_40GBE;
            break;
        case "100000":
            sigType = CltSignalType.CLT_100GBE;
            break;
        default:
            throw new RuntimeException("Un recognize OduClt speed: " + portSpeedInMbps.toString());
    }

    SparseAnnotations annotations = buildOduCltAnnotation(port);
    return oduCltPortDescription(portNo, enabled, sigType, annotations);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:28,代码来源:OpenFlowDeviceProvider.java

示例9: OpticalOduIntent

import org.onosproject.net.CltSignalType; //导入依赖的package包/类
/**
 * Creates an optical ODU intent between the specified connection points.
 *
 * @param appId application identification
 * @param key intent key
 * @param src the source transponder port
 * @param dst the destination transponder port
 * @param signalType CltSignalType signal type
 * @param isBidirectional indicate if intent is bidirectional
 * @param priority priority to use for flows from this intent
 */
protected OpticalOduIntent(ApplicationId appId,
                                    Key key,
                                    ConnectPoint src,
                                    ConnectPoint dst,
                                    CltSignalType signalType,
                                    boolean isBidirectional,
                                    int priority) {
    super(appId, key, Collections.emptyList(), priority);
    this.src = checkNotNull(src);
    this.dst = checkNotNull(dst);
    this.signalType = checkNotNull(signalType);
    this.isBidirectional = isBidirectional;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:25,代码来源:OpticalOduIntent.java

示例10: findPorts

import org.onosproject.net.CltSignalType; //导入依赖的package包/类
private Pair<OchPort, OchPort> findPorts(ConnectPoint src, ConnectPoint dst, CltSignalType signalType) {
    // According to the OpticalCircuitIntent's signalType find OCH ports with available TributarySlots resources
    switch (signalType) {
        case CLT_1GBE:
        case CLT_10GBE:
            // First search for OCH ports with OduSignalType of ODU2. If not found - search for those with ODU4
            return findPorts(src, dst, OduSignalType.ODU2)
                    .orElse(findPorts(src, dst, OduSignalType.ODU4).orElse(null));
        case CLT_100GBE:
            return findPorts(src, dst, OduSignalType.ODU4).orElse(null);
        case CLT_40GBE:
        default:
            return null;
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:16,代码来源:OpticalCircuitIntentCompiler.java

示例11: parseT100OduPort

import org.onosproject.net.CltSignalType; //导入依赖的package包/类
private static PortDescription parseT100OduPort(HierarchicalConfiguration cfg, long count) {
    PortNumber portNumber = PortNumber.portNumber(count);
    HierarchicalConfiguration ethernetConfig = cfg.configurationAt("ethernet");
    boolean enabled = "up".equals(ethernetConfig.getString("administrative-state"));
    //Rate is in kbps
    CltSignalType signalType = "100000000".equals(ethernetConfig.getString("rate")) ?
            CltSignalType.CLT_100GBE : null;
    DefaultAnnotations annotations = DefaultAnnotations.builder().
            set(AnnotationKeys.PORT_NAME, cfg.getString("name")).
            build();
    return oduCltPortDescription(portNumber, enabled, signalType, annotations);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:13,代码来源:FujitsuT100DeviceDescription.java

示例12: extractPorts

import org.onosproject.net.CltSignalType; //导入依赖的package包/类
private List<PortDescription> extractPorts(String s) {
    List<PortDescription> ports = new ArrayList<>();

    if (s.length() == 0) {
        return ports;
    }

    Arrays.stream(s.split("\"\"")).forEach(p -> {
        if (p.contains(EIGHTFIFTY)) {
            PortDescription cltPort = oduCltPortDescription(
                    PortNumber.portNumber(ports.size() + 1L),
                    true,
                    CltSignalType.CLT_10GBE,
                    extractAnnotations(p));
            ports.add(cltPort);
        } else {
            PortDescription netPort = ochPortDescription(
                    PortNumber.portNumber(ports.size() + 1L),
                    true,
                    OduSignalType.ODU2e,
                    true,
                    new OchSignal(GridType.DWDM, ChannelSpacing.CHL_50GHZ, 0, 4),
                    extractAnnotations(p));
            ports.add(netPort);
        }
    });

    return ports;
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:30,代码来源:LumentumWaveReadyDiscovery.java

示例13: buildOduCltPortDescription

import org.onosproject.net.CltSignalType; //导入依赖的package包/类
private PortDescription buildOduCltPortDescription(OFPortDesc port) {
    PortNumber portNo = PortNumber.portNumber(port.getPortNo().getPortNumber());
    boolean enabled = !port.getState().contains(OFPortState.LINK_DOWN) &&
                      !port.getConfig().contains(OFPortConfig.PORT_DOWN);
    Long portSpeedInMbps = portSpeed(port);
    CltSignalType sigType = null;

    switch (portSpeedInMbps.toString()) {
        case "1000":
            sigType = CltSignalType.CLT_1GBE;
            break;
        case "10000":
            sigType = CltSignalType.CLT_10GBE;
            break;
        case "40000":
            sigType = CltSignalType.CLT_40GBE;
            break;
        case "100000":
            sigType = CltSignalType.CLT_100GBE;
            break;
        default:
            throw new IllegalArgumentException("Un recognize OduClt speed: " + portSpeedInMbps.toString());
    }

    SparseAnnotations annotations = buildOduCltAnnotation(port);
    return oduCltPortDescription(portNo, enabled, sigType, annotations);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:28,代码来源:OpenFlowDeviceProvider.java

示例14: createCircuitIntent

import org.onosproject.net.CltSignalType; //导入依赖的package包/类
private OpticalCircuitIntent createCircuitIntent(ConnectPoint src, ConnectPoint dst) {
    OpticalCircuitIntent intent = OpticalCircuitIntent.builder()
            .appId(appId)
            .bidirectional(true)
            .src(src)
            .dst(dst)
            .signalType(CltSignalType.CLT_100GBE)
            .build();

    return intent;
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:12,代码来源:OpticalConnectivityTest.java

示例15: findPorts

import org.onosproject.net.CltSignalType; //导入依赖的package包/类
private Pair<OchPort, OchPort> findPorts(ConnectPoint src, ConnectPoint dst, CltSignalType signalType) {
    // According to the OpticalCircuitIntent's signalType find OCH ports with available TributarySlots resources
    return Arrays.asList(OduSignalType.values()).stream()
            .sorted(Comparator.comparingLong(OduSignalType::bitRate))
            .filter(oduSignalType -> oduSignalType.bitRate() >= signalType.bitRate())
            .map(oduSignalType -> findPorts(src, dst, oduSignalType))
            .flatMap(Tools::stream)
            .findFirst()
            .orElse(null);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:11,代码来源:OpticalCircuitIntentCompiler.java


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