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


Java Link.dst方法代码示例

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


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

示例1: portData

import org.onosproject.net.Link; //导入方法依赖的package包/类
private ObjectNode portData(Port p, DeviceId id) {
    ObjectNode port = objectNode();
    LinkService ls = get(LinkService.class);
    String name = p.annotations().value(AnnotationKeys.PORT_NAME);

    port.put(ID, capitalizeFully(p.number().toString()));
    port.put(TYPE, capitalizeFully(p.type().toString()));
    port.put(SPEED, p.portSpeed());
    port.put(ENABLED, p.isEnabled());
    port.put(NAME, name != null ? name : "");

    Set<Link> links = ls.getEgressLinks(new ConnectPoint(id, p.number()));
    if (!links.isEmpty()) {
        StringBuilder egressLinks = new StringBuilder();
        for (Link l : links) {
            ConnectPoint dest = l.dst();
            egressLinks.append(dest.elementId()).append("/")
                    .append(dest.port()).append(" ");
        }
        port.put(LINK_DEST, egressLinks.toString());
    }

    return port;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:25,代码来源:DeviceViewMessageHandler.java

示例2: processLink

import org.onosproject.net.Link; //导入方法依赖的package包/类
private void processLink(Link link) {
    DeviceId srcId = link.src().deviceId();
    DeviceId dstId = link.dst().deviceId();
    Port srcPort = deviceService.getPort(srcId, link.src().port());
    Port dstPort = deviceService.getPort(dstId, link.dst().port());

    if (srcPort == null || dstPort == null) {
        return; //FIXME remove this in favor of below TODO
    }

    boolean active = deviceService.isAvailable(srcId) &&
            deviceService.isAvailable(dstId) &&
            // TODO: should update be queued if src or dstPort is null?
            //srcPort != null && dstPort != null &&
            srcPort.isEnabled() && dstPort.isEnabled();

    LinkDescription desc = new DefaultLinkDescription(link.src(), link.dst(), OPTICAL);
    if (active) {
        providerService.linkDetected(desc);
    } else {
        providerService.linkVanished(desc);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:OpticalLinkProvider.java

示例3: uiLinkId

import org.onosproject.net.Link; //导入方法依赖的package包/类
/**
 * Generates the canonical link identifier for the given link.
 *
 * @param link link for which the identifier is required
 * @return link identifier
 * @throws NullPointerException if any of the required fields are null
 */
public static UiLinkId uiLinkId(Link link) {
    ConnectPoint src = link.src();
    ConnectPoint dst = link.dst();
    if (src == null || dst == null) {
        throw new NullPointerException("null src or dst connect point: " + link);
    }

    ElementId srcId = src.elementId();
    ElementId dstId = dst.elementId();

    // canonicalize
    int comp = srcId.toString().compareTo(dstId.toString());
    return comp <= 0 ? new UiLinkId(srcId, src.port(), dstId, dst.port())
            : new UiLinkId(dstId, dst.port(), srcId, src.port());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:UiLinkId.java

示例4: findTunnelAndHighlights

import org.onosproject.net.Link; //导入方法依赖的package包/类
/**
 * Handles the event of topology listeners.
*/
private void findTunnelAndHighlights() {
    Collection<Tunnel> tunnelSet = null;
    Highlights highlights = new Highlights();
    paths.removeAll(paths);
    tunnelSet = tunnelService.queryTunnel(MPLS);
    if (tunnelSet.size() == 0) {
        log.warn("Tunnel does not exist");
        sendMessage(TopoJson.highlightsMessage(highlights));
        return;
    }

    for (Tunnel tunnel : tunnelSet) {
        if (tunnel.path() == null) {
            log.error("path does not exist");
            sendMessage(TopoJson.highlightsMessage(highlights));
            return;
        }
        if (!tunnel.state().equals(Tunnel.State.ACTIVE)) {
            log.debug("Tunnel state is not active");
            sendMessage(TopoJson.highlightsMessage(highlights));
            return;
        }
        Link firstLink = tunnel.path().links().get(0);
        if (firstLink != null) {
            if (firstLink.src() != null) {
                    highlights = addBadge(highlights, firstLink.src().deviceId().toString(), SRC);
            }
        }
        Link lastLink = tunnel.path().links().get(tunnel.path().links().size() - 1);
        if (lastLink != null) {
            if (lastLink.dst() != null) {
                    highlights = addBadge(highlights, lastLink.dst().deviceId().toString(), DST);
            }
        }
        paths.add(tunnel.path());
    }

    ImmutableSet.Builder<Link> builder = ImmutableSet.builder();
    allPathLinks = buildPaths(builder).build();
    hilightAndSendPaths(highlights);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:45,代码来源:PceWebTopovMessageHandler.java

示例5: generateRules

import org.onosproject.net.Link; //导入方法依赖的package包/类
private List<FlowRule> generateRules(MplsPathIntent intent,
                                     Map<LinkKey, MplsLabel> labels) {

    Iterator<Link> links = intent.path().links().iterator();
    Link srcLink = links.next();
    ConnectPoint prev = srcLink.dst();

    Link link = links.next();
    // List of flow rules to be installed
    List<FlowRule> rules = new LinkedList<>();

    // Ingress traffic
    // Get the new MPLS label
    MplsLabel mpls = getMplsLabel(labels, linkKey(link));
    checkNotNull(mpls);
    MplsLabel prevLabel = mpls;
    rules.add(ingressFlow(prev.port(), link, intent, mpls));

    prev = link.dst();

    while (links.hasNext()) {

        link = links.next();

        if (links.hasNext()) {
            // Transit traffic
            // Get the new MPLS label
            mpls = getMplsLabel(labels, linkKey(link));
            checkNotNull(mpls);
            rules.add(transitFlow(prev.port(), link, intent,
                    prevLabel, mpls));
            prevLabel = mpls;

        } else {
            // Egress traffic
            rules.add(egressFlow(prev.port(), link, intent,
                    prevLabel));
        }

        prev = link.dst();
    }
    return rules;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:44,代码来源:MplsPathIntentCompiler.java

示例6: description

import org.onosproject.net.Link; //导入方法依赖的package包/类
/**
 * Produces a link description from the given link.
 *
 * @param link link to copy
 * @return link description
 */
static DefaultLinkDescription description(Link link) {
    return new DefaultLinkDescription(link.src(), link.dst(), link.type());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:TopologySimulator.java


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