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


Java DisjointPath.backup方法代码示例

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


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

示例1: edgeToEdgePathD

import org.onosproject.net.DisjointPath; //导入方法依赖的package包/类
private DisjointPath edgeToEdgePathD(EdgeLink srcLink, EdgeLink dstLink, DisjointPath path,
                                     LinkWeigher weigher) {
    Path primary = null;
    Path backup = null;
    if (path != null) {
        primary = path.primary();
        backup = path.backup();
    }
    if (backup == null) {
    return new DefaultDisjointPath(PID,
            (DefaultPath) edgeToEdgePath(srcLink, dstLink, primary, weigher));
    }
    return new DefaultDisjointPath(PID,
            (DefaultPath) edgeToEdgePath(srcLink, dstLink, primary, weigher),
            (DefaultPath) edgeToEdgePath(srcLink, dstLink, backup, weigher));
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:17,代码来源:AbstractPathService.java

示例2: getDisjointPaths

import org.onosproject.net.DisjointPath; //导入方法依赖的package包/类
/**
 * Computes on-demand the set of shortest disjoint path pairs between
 * source and destination devices.
 *
 * @param src     source device
 * @param dst     destination device
 * @param weigher link weight function
 * @return set of disjoint shortest path pairs
 */
public Set<DisjointPath> getDisjointPaths(DeviceId src, DeviceId dst,
                                          LinkWeigher weigher) {
    DefaultTopologyVertex srcV = new DefaultTopologyVertex(src);
    DefaultTopologyVertex dstV = new DefaultTopologyVertex(dst);
    Set<TopologyVertex> vertices = graph.getVertexes();
    if (!vertices.contains(srcV) || !vertices.contains(dstV)) {
        // src or dst not part of the current graph
        return ImmutableSet.of();
    }

    GraphPathSearch.Result<TopologyVertex, TopologyEdge> result =
            SUURBALLE.search(graph, srcV, dstV, weigher, ALL_PATHS);
    ImmutableSet.Builder<DisjointPath> builder = ImmutableSet.builder();
    for (org.onlab.graph.Path<TopologyVertex, TopologyEdge> path : result.paths()) {
        DisjointPath disjointPath =
                networkDisjointPath((DisjointPathPair<TopologyVertex, TopologyEdge>) path);
        if (disjointPath.backup() != null) {
            builder.add(disjointPath);
        }
    }
    return builder.build();
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:32,代码来源:DefaultTopology.java

示例3: edgeToEdgePathD

import org.onosproject.net.DisjointPath; //导入方法依赖的package包/类
private DisjointPath edgeToEdgePathD(EdgeLink srcLink, EdgeLink dstLink, DisjointPath path) {
    Path primary = null;
    Path backup = null;
    if (path != null) {
        primary = path.primary();
        backup = path.backup();
    }
    return new DefaultDisjointPath(PID, (DefaultPath) edgeToEdgePath(srcLink, dstLink, primary),
                                   (DefaultPath) edgeToEdgePath(srcLink, dstLink, backup));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:11,代码来源:PathManager.java

示例4: disjointPaths

import org.onosproject.net.DisjointPath; //导入方法依赖的package包/类
/**
 * Computes on-demand the set of shortest disjoint risk groups path pairs
 * between source and destination devices.
 *
 * @param src         source device
 * @param dst         destination device
 * @param weigher     edge weight object
 * @param riskProfile map representing risk groups for each edge
 * @return set of shortest disjoint paths
 */
private Set<DisjointPath> disjointPaths(DeviceId src, DeviceId dst,
                                        LinkWeigher weigher,
                                        Map<TopologyEdge, Object> riskProfile) {
    DefaultTopologyVertex srcV = new DefaultTopologyVertex(src);
    DefaultTopologyVertex dstV = new DefaultTopologyVertex(dst);

    Set<TopologyVertex> vertices = graph.getVertexes();
    if (!vertices.contains(srcV) || !vertices.contains(dstV)) {
        // src or dst not part of the current graph
        return ImmutableSet.of();
    }

    SrlgGraphSearch<TopologyVertex, TopologyEdge> srlg =
            new SrlgGraphSearch<>(riskProfile);
    GraphPathSearch.Result<TopologyVertex, TopologyEdge> result =
            srlg.search(graph, srcV, dstV, weigher, ALL_PATHS);
    ImmutableSet.Builder<DisjointPath> builder = ImmutableSet.builder();
    for (org.onlab.graph.Path<TopologyVertex, TopologyEdge> path : result.paths()) {
        DisjointPath disjointPath =
                networkDisjointPath((DisjointPathPair<TopologyVertex, TopologyEdge>) path);
        if (disjointPath.backup() != null) {
            builder.add(disjointPath);
        }
    }
    return builder.build();
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:37,代码来源:DefaultTopology.java

示例5: createFreshProtectedPaths

import org.onosproject.net.DisjointPath; //导入方法依赖的package包/类
/**
 * Creates new protected paths.
 *
 * @param intent    original intention
 * @param did1      identifier of first device
 * @param did2      identifier of second device
 * @return compilation result
 * @throws IntentCompilationException when there's no satisfying path.
 */
private List<Intent> createFreshProtectedPaths(ProtectedTransportIntent intent,
                                               DeviceId did1,
                                               DeviceId did2) {
    DisjointPath disjointPath = getDisjointPath(intent, did1, did2);
    if (disjointPath == null || disjointPath.backup() == null) {
        log.error("Unable to find disjoint path between {}, {}", did1, did2);
        throw new IntentCompilationException("Unable to find disjoint paths.");
    }
    Path primary = disjointPath.primary();
    Path secondary = disjointPath.backup();

    String fingerprint = intent.key().toString();

    // pick and allocate Vlan to use as S-tag
    Pair<VlanId, VlanId> vlans = allocateEach(intent, primary, secondary, VlanId.class);

    VlanId primaryVlan = vlans.getLeft();
    VlanId secondaryVlan = vlans.getRight();

    // Build edge Intents for head/tail

    // resource for head/tail
    Collection<NetworkResource> oneResources = new ArrayList<>();
    Collection<NetworkResource> twoResources = new ArrayList<>();

    List<TransportEndpointDescription> onePaths = new ArrayList<>();
    onePaths.add(TransportEndpointDescription.builder()
                     .withOutput(vlanPort(primary.src(), primaryVlan))
                     .build());
    onePaths.add(TransportEndpointDescription.builder()
                     .withOutput(vlanPort(secondary.src(), secondaryVlan))
                     .build());

    List<TransportEndpointDescription> twoPaths = new ArrayList<>();
    twoPaths.add(TransportEndpointDescription.builder()
                 .withOutput(vlanPort(primary.dst(), primaryVlan))
                 .build());
    twoPaths.add(TransportEndpointDescription.builder()
                 .withOutput(vlanPort(secondary.dst(), secondaryVlan))
                 .build());

    ProtectionEndpointIntent oneIntent = ProtectionEndpointIntent.builder()
            .key(intent.key())
            .appId(intent.appId())
            .priority(intent.priority())
            .resources(oneResources)
            .deviceId(did1)
            .description(buildDescription(onePaths, did2, fingerprint))
            .build();
    ProtectionEndpointIntent twoIntent = ProtectionEndpointIntent.builder()
            .key(intent.key())
            .appId(intent.appId())
            .resources(twoResources)
            .deviceId(did2)
            .description(buildDescription(twoPaths, did1, fingerprint))
            .build();

    // Build transit intent for primary/secondary path

    Collection<NetworkResource> resources1 = ImmutableList.of(marker("protection1"));
    Collection<NetworkResource> resources2 = ImmutableList.of(marker("protection2"));

    ImmutableList<Intent> result = ImmutableList.<Intent>builder()
            // LinkCollection for primary and backup paths
            .addAll(createTransitIntent(intent, primary, primaryVlan, resources1))
            .addAll(createTransitIntent(intent, secondary, secondaryVlan, resources2))
            .add(oneIntent)
            .add(twoIntent)
            .build();
    log.trace("createFreshProtectedPaths result: {}", result);
    return result;
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:82,代码来源:ProtectedTransportIntentCompiler.java


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