本文整理汇总了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));
}
示例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();
}
示例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));
}
示例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();
}
示例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;
}