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


Java Link.state方法代码示例

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


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

示例1: removeOrDownLink

import org.onosproject.net.Link; //导入方法依赖的package包/类
@Override
public LinkEvent removeOrDownLink(ConnectPoint src, ConnectPoint dst) {
    Link link = getLink(src, dst);
    if (link == null) {
        return null;
    }

    if (link.isDurable()) {
        return link.state() == INACTIVE ? null :
                updateLink(linkKey(link.src(), link.dst()), link,
                           DefaultLink.builder()
                                   .providerId(link.providerId())
                                   .src(link.src())
                                   .dst(link.dst())
                                   .type(link.type())
                                   .state(INACTIVE)
                                   .isExpected(link.isExpected())
                                   .annotations(link.annotations()).build());
    }
    return removeLink(src, dst);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:22,代码来源:SimpleLinkStore.java

示例2: removeOrDownLink

import org.onosproject.net.Link; //导入方法依赖的package包/类
@Override
public LinkEvent removeOrDownLink(ConnectPoint src, ConnectPoint dst) {
    Link link = getLink(src, dst);
    if (link == null) {
        return null;
    }

    if (linkDiscoveryMode == LinkDiscoveryMode.PERMISSIVE && link.isExpected()) {
        // FIXME: this will not sync link state!!!
        return link.state() == INACTIVE ? null :
                updateLink(linkKey(link.src(), link.dst()), link,
                           DefaultLink.builder()
                                   .providerId(link.providerId())
                                   .src(link.src())
                                   .dst(link.dst())
                                   .type(link.type())
                                   .state(INACTIVE)
                                   .isExpected(link.isExpected())
                                   .annotations(link.annotations())
                                   .build());
    }
    return removeLink(src, dst);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:ECLinkStore.java

示例3: weight

import org.onosproject.net.Link; //导入方法依赖的package包/类
@Override
public double weight(TopologyEdge edge) {
    Link l = edge.link();

    // Avoid inactive links
    if (l.state() == Link.State.INACTIVE) {
        return -1.0;
    }

    // Avoid cross connect links with used ports
    if (isCrossConnectLink(l) && usedCrossConnectLinks.contains(l)) {
        return -1.0;
    }

    // Check availability of bandwidth
    if (bandwidth != null) {
        if (hasEnoughBandwidth(l.src()) && hasEnoughBandwidth(l.dst())) {
            return 1.0;
        } else {
            return -1.0;
        }
    } else {
        // TODO needs to differentiate optical and packet?
        if (l.type() == Link.Type.OPTICAL) {
            // Transport links
            return 1.0;
        } else {
            // Packet links
            return 1.0;
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:33,代码来源:OpticalPathProvisioner.java

示例4: encode

import org.onosproject.net.Link; //导入方法依赖的package包/类
@Override
public ObjectNode encode(Link link, CodecContext context) {
    checkNotNull(link, "Link cannot be null");
    JsonCodec<ConnectPoint> codec = context.codec(ConnectPoint.class);
    ObjectNode result = context.mapper().createObjectNode();
    result.set(SRC, codec.encode(link.src(), context));
    result.set(DST, codec.encode(link.dst(), context));
    result.put(TYPE, link.type().toString());
    if (link.state() != null) {
        result.put(STATE, link.state().toString());
    }
    return annotate(result, link, context);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:14,代码来源:LinkCodec.java

示例5: updateLink

import org.onosproject.net.Link; //导入方法依赖的package包/类
private LinkEvent updateLink(LinkKey key, Link oldLink, Link newLink) {
    if (oldLink.state() != newLink.state() ||
            (oldLink.type() == INDIRECT && newLink.type() == DIRECT) ||
            !AnnotationsUtil.isEqual(oldLink.annotations(), newLink.annotations())) {

        links.put(key, newLink);
        // strictly speaking following can be ommitted
        srcLinks.put(oldLink.src().deviceId(), key);
        dstLinks.put(oldLink.dst().deviceId(), key);
        return new LinkEvent(LINK_UPDATED, newLink);
    }
    return null;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:14,代码来源:SimpleLinkStore.java

示例6: updateLink

import org.onosproject.net.Link; //导入方法依赖的package包/类
private LinkEvent updateLink(LinkKey key, Link oldLink, Link newLink) {
    // Note: INDIRECT -> DIRECT transition only
    // so that BDDP discovered Link will not overwrite LDDP Link
    if (oldLink.state() != newLink.state() ||
            (oldLink.type() == INDIRECT && newLink.type() == DIRECT) ||
            !AnnotationsUtil.isEqual(oldLink.annotations(), newLink.annotations())) {

        links.put(key, newLink);
        return new LinkEvent(LINK_UPDATED, newLink);
    }
    return null;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:13,代码来源:ECLinkStore.java


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