本文整理汇总了Java中org.onosproject.net.DisjointPath.primary方法的典型用法代码示例。如果您正苦于以下问题:Java DisjointPath.primary方法的具体用法?Java DisjointPath.primary怎么用?Java DisjointPath.primary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.onosproject.net.DisjointPath
的用法示例。
在下文中一共展示了DisjointPath.primary方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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));
}
示例3: 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;
}