本文整理了Java中org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology
类的一些代码示例,展示了Topology
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Topology
类的具体详情如下:
包路径:org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology
类名称:Topology
[英]This is the model of an abstract topology.A topology contains nodes and links.Each topology MUST be identified byunique topology-id for reason that a network could contain manytopologies.
This class represents the following YANG schema fragment defined in module network-topology
list topology {
key topology-id;
leaf topology-id {
type topology-id;
}
leaf server-provided {
type boolean;
config false;
}
container topology-types {
}
list underlay-topology {
key topology-ref;
leaf topology-ref {
type topology-ref;
}
}
list node {
key node-id;
uses node-attributes;
must boolean(../underlay-topology[*]/node[./supporting-nodes/node-ref]);
list termination-point {
key tp-id;
uses tp-attributes;
}
}
list link {
key link-id;
uses link-attributes;
must boolean(../underlay-topology/link[./supporting-link]);
must boolean(../node[./source/source-node]);
must boolean(../node[./destination/dest-node]);
must boolean(../node/termination-point[./source/source-tp]);
must boolean(../node/termination-point[./destination/dest-tp]);
}
}
The schema path to identify an instance is network-topology/network-topology/topology
To create instances of this class use TopologyBuilder.
[中]这是一个抽象拓扑的模型。拓扑包含节点和链接。每个拓扑必须由唯一的拓扑id标识,因为网络可能包含许多拓扑。
此类代表模块网络拓扑中定义的以下模式片段
list topology {
key topology-id;
leaf topology-id {
type topology-id;
}
leaf server-provided {
type boolean;
config false;
}
container topology-types {
}
list underlay-topology {
key topology-ref;
leaf topology-ref {
type topology-ref;
}
}
list node {
key node-id;
uses node-attributes;
must boolean(../underlay-topology[*]/node[./supporting-nodes/node-ref]);
list termination-point {
key tp-id;
uses tp-attributes;
}
}
list link {
key link-id;
uses link-attributes;
must boolean(../underlay-topology/link[./supporting-link]);
must boolean(../node[./source/source-node]);
must boolean(../node[./destination/dest-node]);
must boolean(../node/termination-point[./source/source-tp]);
must boolean(../node/termination-point[./destination/dest-tp]);
}
}
标识实例的模式路径是网络拓扑/网络拓扑/拓扑
要创建此类的实例,请使用TopologyBuilder。
代码示例来源:origin: org.opendaylight.alto.basic/alto-simple-ecs-impl
private void addExistingHostNodes(Topology topology) {
log.info("Topology Null Check: " + (topology == null));
List<Node> nodeList = topology.getNode();
log.info("Node List Null Check: " + (nodeList == null));
if (topology != null && nodeList != null) {
for (int i = 0; i < nodeList.size(); ++i) {
Node node = nodeList.get(i);
HostNode hostNode = node.getAugmentation(HostNode.class);
log.info("Processing node " + i + ", " + hostNode);
hostNodeService.addHostNode(hostNode);
}
}
}
代码示例来源:origin: org.opendaylight.yangtools.model/ietf-topology
public TopologyBuilder(Topology base) {
if (base.getKey() == null) {
this._key = new TopologyKey(
base.getTopologyId()
);
this._topologyId = base.getTopologyId();
} else {
this._key = base.getKey();
this._topologyId = _key.getTopologyId();
}
this._link = base.getLink();
this._node = base.getNode();
this._topologyTypes = base.getTopologyTypes();
this._underlayTopology = base.getUnderlayTopology();
this._serverProvided = base.isServerProvided();
if (base instanceof TopologyImpl) {
TopologyImpl impl = (TopologyImpl) base;
if (!impl.augmentation.isEmpty()) {
this.augmentation = new HashMap<>(impl.augmentation);
}
} else if (base instanceof AugmentationHolder) {
@SuppressWarnings("unchecked")
AugmentationHolder<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology>) base;
if (!casted.augmentations().isEmpty()) {
this.augmentation = new HashMap<>(casted.augmentations());
}
}
}
代码示例来源:origin: org.opendaylight.yangtools/bug1196-test-model
if (other.getKey() != null) {
return false;
} else if(!_key.equals(other.getKey())) {
return false;
if (other.getNode() != null) {
return false;
} else if(!_node.equals(other.getNode())) {
return false;
if (other.getTopologyId() != null) {
return false;
} else if(!_topologyId.equals(other.getTopologyId())) {
return false;
if (!e.getValue().equals(other.getAugmentation(e.getKey()))) {
return false;
代码示例来源:origin: org.opendaylight.mdsal.model/ietf-topology
public TopologyBuilder(Topology base) {
this.key = base.key();
this._topologyId = base.getTopologyId();
this._link = base.getLink();
this._node = base.getNode();
this._topologyTypes = base.getTopologyTypes();
this._underlayTopology = base.getUnderlayTopology();
this._serverProvided = base.isServerProvided();
if (base instanceof TopologyImpl) {
TopologyImpl impl = (TopologyImpl) base;
if (!impl.augmentation.isEmpty()) {
this.augmentation = new HashMap<>(impl.augmentation);
}
} else if (base instanceof AugmentationHolder) {
@SuppressWarnings("unchecked")
Map<Class<? extends Augmentation<Topology>>, Augmentation<Topology>> aug =((AugmentationHolder<Topology>) base).augmentations();
if (!aug.isEmpty()) {
this.augmentation = new HashMap<>(aug);
}
}
}
代码示例来源:origin: org.opendaylight.yangtools/bug1196-test-model
public TopologyBuilder(Topology base) {
if (base.getKey() == null) {
this._key = new TopologyKey(
base.getTopologyId()
);
this._topologyId = base.getTopologyId();
} else {
this._key = base.getKey();
this._topologyId = _key.getTopologyId();
}
this._node = base.getNode();
if (base instanceof TopologyImpl) {
TopologyImpl impl = (TopologyImpl) base;
if (!impl.augmentation.isEmpty()) {
this.augmentation = new HashMap<>(impl.augmentation);
}
} else if (base instanceof AugmentationHolder) {
@SuppressWarnings("unchecked")
AugmentationHolder<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology>) base;
if (!casted.augmentations().isEmpty()) {
this.augmentation = new HashMap<>(casted.augmentations());
}
}
}
代码示例来源:origin: org.opendaylight.faas/fabric-mgr-impl
private List<Link> calcShortestPathOnFabricTopo(NodeId fabrics, NodeId fabricd)
{
UndirectedSparseGraph<NodeId, Link> g = new UndirectedSparseGraph<>();
Topology topo = this.getFabricTopology();
if (topo == null) {
LOG.error("Failed to get fabric topology!");
return Collections.emptyList();
}
for (Node node : topo.getNode()) {
g.addVertex(node.getNodeId());
}
if (topo.getLink() != null)
for (Link link : topo.getLink())
{
g.addEdge(link, link.getSource().getSourceNode(), link.getDestination().getDestNode());
}
return calcShortestPath(fabrics, fabricd, g);
}
代码示例来源:origin: org.opendaylight.openflowplugin.legacy/sal-compatibility
public static List<TopoEdgeUpdate> toADEdgeUpdates(final Topology topology,final TypeSafeDataReader reader) {
final List<TopoEdgeUpdate> result = new CopyOnWriteArrayList<>();
return FluentIterable.from(topology.getLink()).transform(
new Function<Link, TopoEdgeUpdate>() {
@Override
public TopoEdgeUpdate apply(final Link input) {
try {
return toTopoEdgeUpdate(toAdEdge(input, topology), reader);
} catch (ConstructionException e) {
throw new IllegalArgumentException(String.format("Failed to construct edge update for {}", input), e);
}
}}
).copyInto(result);
}
代码示例来源:origin: org.opendaylight.mdsal.model/ietf-topology
if (!Objects.equals(_link, other.getLink())) {
return false;
if (!Objects.equals(_node, other.getNode())) {
return false;
if (!Objects.equals(_topologyId, other.getTopologyId())) {
return false;
if (!Objects.equals(_topologyTypes, other.getTopologyTypes())) {
return false;
if (!Objects.equals(_underlayTopology, other.getUnderlayTopology())) {
return false;
if (!Objects.equals(_serverProvided, other.isServerProvided())) {
return false;
if (!e.getValue().equals(other.augmentation(e.getKey()))) {
return false;
代码示例来源:origin: org.opendaylight.bgpcep/bgp-topology-provider
private TopologyReferenceSingletonService createInstance(final Topology topology, final Function<Topology, Void> writeFunction) {
final RibReference ribReference = new DefaultRibReference(InstanceIdentifier.create(BgpRib.class).child(Rib.class, new RibKey(topology.getAugmentation(Topology1.class).getRibId())));
final AbstractTopologyBuilder<?> topologyBuilder = createTopologyBuilder(this.dataBroker, ribReference, topology.getTopologyId());
return new TopologyReferenceSingletonServiceImpl(topologyBuilder, this.deployer, topology, writeFunction);
}
代码示例来源:origin: org.opendaylight.bgpcep/bgp-topology-provider
@Override
public final void onTopologyBuilderCreated(final Topology topology, final Function<Topology, Void> writeFunction) {
LOG.debug("Cretaing topology builder instance {}", topology);
final TopologyReferenceSingletonService currentInstance = this.topologyBuilders.get(topology.getTopologyId());
if (currentInstance == null || !currentInstance.getConfiguration().equals(topology)) {
final TopologyReferenceSingletonService topologyBuilder = createInstance(topology, writeFunction);
this.topologyBuilders.put(topology.getTopologyId(), topologyBuilder);
LOG.debug("Topology builder instance created {}", topologyBuilder);
}
}
代码示例来源:origin: org.opendaylight.bgpcep/bgp-topology-provider
private static void writeConfiguration(final DataBroker dataBroker, final Topology topology) {
final KeyedInstanceIdentifier<Topology, TopologyKey> topologyIId = InstanceIdentifier.create(NetworkTopology.class).child(Topology.class,
topology.getKey());
final WriteTransaction wTx = dataBroker.newWriteOnlyTransaction();
wTx.put(LogicalDatastoreType.CONFIGURATION, topologyIId, topology, true);
wTx.submit();
}
代码示例来源:origin: org.opendaylight.faas/fabric-mgr-impl
/**
* Calculate and return the minimum spanning free of the Graph top.
* @param topo - the graph.
* @return the "pruned" minimal spanning tree.
*/
private Graph<String, Link> calcMinimumSpanningTree(List<String> fabrics)
{
Topology topo = this.getFabricTopology();
if (topo == null) {
LOG.error("Failed to read Fabric Topology!");
return null;
}
UndirectedSparseGraph<String, Link> graph = new UndirectedSparseGraph<>();
for (Node node : topo.getNode()) {
graph.addVertex(node.getNodeId().getValue());
}
if (topo.getLink() != null)
for (Link link : topo.getLink())
{
graph.addEdge(link, link.getSource().getSourceNode().getValue(), link.getDestination().getDestNode().getValue());
}
PrimMinimumSpanningTree<String, Link> alg =
new PrimMinimumSpanningTree<>(UndirectedSparseGraph.<String, Link>getFactory());
Graph<String, Link> miniTree = alg.transform(graph);
return pruneTree(miniTree, fabrics);
}
代码示例来源:origin: org.opendaylight.alto.basic/alto-simple-ecs-impl
private void addExistingLinks(Topology topology) {
log.info("Topology Null Check: " + (topology == null));
List<Link> linkList = topology.getLink();
log.info("Link List Null Check: " + (linkList == null));
if (topology != null && linkList != null) {
for (int i = 0; i < linkList.size(); i++) {
Link link = linkList.get(i);
log.info("Processing link " + i + ", " + link.getLinkId().getValue());
linkService.addLink(link);
}
}
}
@Override
代码示例来源:origin: org.opendaylight.bgpcep/bgp-topology-provider
@Override
public final void onTopologyBuilderRemoved(final Topology topology) {
LOG.debug("Removing topology builder instance {}", topology);
final TopologyReferenceSingletonService topologyBuilder = this.topologyBuilders.remove(topology.getTopologyId());
if (topologyBuilder != null) {
topologyBuilder.close();
LOG.debug("Topology builder instance removed {}", topologyBuilder);
}
}
代码示例来源:origin: org.opendaylight.netconf/abstract-topology
@Override
public void onSuccess(Optional<Topology> result) {
if (result.isPresent() && result.get().getNode() != null) {
for (final Node node : result.get().getNode()) {
final Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> entry = codecRegistry.toNormalizedNode(TopologyUtil.createTopologyNodePath(topologyId), node);
peer.onRemoteNodeCreated(new NormalizedNodeMessage(entry.getKey(), entry.getValue()));
// we dont care about the future from now on since we will be notified by the onConnected event
}
}
}
代码示例来源:origin: org.opendaylight.yangtools.model/ietf-topology
if (other.getKey() != null) {
return false;
} else if(!_key.equals(other.getKey())) {
return false;
if (other.getLink() != null) {
return false;
} else if(!_link.equals(other.getLink())) {
return false;
if (other.getNode() != null) {
return false;
} else if(!_node.equals(other.getNode())) {
return false;
if (other.getTopologyId() != null) {
return false;
} else if(!_topologyId.equals(other.getTopologyId())) {
return false;
if (other.getTopologyTypes() != null) {
return false;
} else if(!_topologyTypes.equals(other.getTopologyTypes())) {
return false;
代码示例来源:origin: org.opendaylight.alto.ext/alto-spce-impl
private Graph<String, RouteViewer.Path> getGraphFromTopology(Topology topology, Long minBw) {
Graph<String, RouteViewer.Path> networkGraph = new SparseMultigraph();
if (minBw == null) {
minBw = (long) 0;
}
for (Node eachNode : topology.getNode()) {
networkGraph.addVertex(eachNode.getNodeId().getValue());
}
for (Link eachLink : topology.getLink()) {
String linkSrcNode = extractNodeId(eachLink.getSource().getSourceNode().getValue());
String linkDstNode = extractNodeId(eachLink.getDestination().getDestNode().getValue());
if (linkSrcNode.contains("host") || linkDstNode.contains("host")) {
continue;
}
TpId linkSrcTp = eachLink.getSource().getSourceTp();
TpId linkDstTp = eachLink.getDestination().getDestTp();
RouteViewer.Path srcPath = new RouteViewer.Path();
srcPath.src = linkSrcTp;
srcPath.dst = linkDstTp;
srcPath.bandwidth = getBandwidthByTp(srcPath.src.getValue()).longValue();
if (srcPath.bandwidth < minBw) {
continue;
}
networkGraph.addEdge(srcPath, linkSrcNode, linkDstNode, EdgeType.DIRECTED);
}
return networkGraph;
}
代码示例来源:origin: org.opendaylight.mdsal.model/ietf-topology
/**
* @return <code>java.util.List</code> <code>link</code>, or an empty list if it is not present
*/
default @NonNull List<Link> nonnullLink() {
return CodeHelpers.nonnull(getLink());
}
代码示例来源:origin: org.opendaylight.bgpcep/bgp-topology-provider
bundleContext, "(" + "topology-id" + "=" + topology.getTopologyId().getValue() + ")");
final TopologyReference topologyService = topologyTracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
return Reflection.newProxy(TopologyReferenceSingletonService.class, new AbstractInvocationHandler() {
代码示例来源:origin: org.opendaylight.ovsdb/openstack.net-virt
public List<Node> readOvsdbTopologyBridgeNodes() {
List<Node> ovsdbNodes = new ArrayList<>();
InstanceIdentifier<Topology> topologyInstanceIdentifier = MdsalHelper.createInstanceIdentifier();
Topology topology = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, topologyInstanceIdentifier);
if (topology != null && topology.getNode() != null) {
for (Node node : topology.getNode()) {
OvsdbBridgeAugmentation ovsdbBridgeAugmentation = node.getAugmentation(OvsdbBridgeAugmentation.class);
if (ovsdbBridgeAugmentation != null) {
ovsdbNodes.add(node);
}
}
}
return ovsdbNodes;
}
内容来源于网络,如有侵权,请联系作者删除!