本文整理了Java中org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology.getNode()
方法的一些代码示例,展示了Topology.getNode()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Topology.getNode()
方法的具体详情如下:
包路径:org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology
类名称:Topology
方法名:getNode
[英]The list of network nodes defined for the topology.
[中]为拓扑定义的网络节点列表。
代码示例来源: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.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.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;
}
代码示例来源:origin: org.opendaylight.netvirt/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;
}
代码示例来源:origin: org.opendaylight.netvirt/openstack.net-virt
public List<Node> readOvsdbTopologyNodes() {
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()) {
OvsdbNodeAugmentation ovsdbNodeAugmentation = node.getAugmentation(OvsdbNodeAugmentation.class);
if (ovsdbNodeAugmentation != null) {
ovsdbNodes.add(node);
}
}
}
return ovsdbNodes;
}
代码示例来源:origin: org.opendaylight.ovsdb/openstack.net-virt
public List<Node> readOvsdbTopologyNodes() {
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()) {
OvsdbNodeAugmentation ovsdbNodeAugmentation = node.getAugmentation(OvsdbNodeAugmentation.class);
if (ovsdbNodeAugmentation != null) {
ovsdbNodes.add(node);
}
}
}
return ovsdbNodes;
}
代码示例来源:origin: org.opendaylight.unimgr/unimgr-impl
/**
* Retrieve a list of Uni Nodes from the Configuration DataStore.
* @param dataBroker The dataBroker instance to create transactions
* @return A list of Uni Nodes from the Config dataStore
*/
public static List<Node> getUniNodes(DataBroker dataBroker) {
final List<Node> uniNodes = new ArrayList<>();
final InstanceIdentifier<Topology> topologyInstanceIdentifier = UnimgrMapper.getUniTopologyIid();
final Topology topology = MdsalUtils.read(dataBroker,
LogicalDatastoreType.CONFIGURATION,
topologyInstanceIdentifier);
if ((topology != null) && (topology.getNode() != null)) {
for (final Node node : topology.getNode()) {
final UniAugmentation uniAugmentation = node.getAugmentation(UniAugmentation.class);
if (uniAugmentation != null) {
uniNodes.add(node);
}
}
}
return uniNodes;
}
代码示例来源:origin: org.opendaylight.mdsal.model/ietf-topology
/**
* @return <code>java.util.List</code> <code>node</code>, or an empty list if it is not present
*/
default @NonNull List<Node> nonnullNode() {
return CodeHelpers.nonnull(getNode());
}
代码示例来源:origin: org.opendaylight.unimgr/unimgr-impl
/**
* Retrieve a list of Unis on a specific DataStore
* @param dataBroker instance to create transactions
* @param store to which send the read request
* @return A List of Unis.
*/
public static List<UniAugmentation> getUnis(DataBroker dataBroker,
LogicalDatastoreType store) {
final List<UniAugmentation> unis = new ArrayList<>();
final InstanceIdentifier<Topology> topologyInstanceIdentifier = UnimgrMapper.getUniTopologyIid();
final Topology topology = MdsalUtils.read(dataBroker,
store,
topologyInstanceIdentifier);
if ((topology != null) && (topology.getNode() != null)) {
for (final Node node : topology.getNode()) {
final UniAugmentation uniAugmentation = node.getAugmentation(UniAugmentation.class);
if (uniAugmentation != null) {
unis.add(uniAugmentation);
}
}
}
return unis;
}
代码示例来源:origin: org.opendaylight.unimgr/unimgr-impl
/**
* Retrieve a list of Uni Nodes on a specific DataStore
* @param dataBroker The dataBroker instance to create transactions
* @param store The store to which to send the read request
* @return A List of UNI Nodes.
*/
public static List<Node> getUniNodes(DataBroker dataBroker,
LogicalDatastoreType store) {
final List<Node> uniNodes = new ArrayList<>();
final InstanceIdentifier<Topology> topologyInstanceIdentifier = UnimgrMapper.getUniTopologyIid();
final Topology topology = MdsalUtils.read(dataBroker,
store,
topologyInstanceIdentifier);
if ((topology != null) && (topology.getNode() != null)) {
for (final Node node : topology.getNode()) {
final UniAugmentation uniAugmentation = node.getAugmentation(UniAugmentation.class);
if (uniAugmentation != null) {
uniNodes.add(node);
}
}
}
return uniNodes;
}
代码示例来源:origin: opendaylight/controller
@Override
public void onSuccess(@Nonnull final Optional<Topology> data) {
if (data.isPresent()) {
final List<Node> nodes = data.get().getNode();
if (nodes != null) {
for (final Node node : nodes) {
if (nodeRegex.matcher(node.getNodeId().getValue()).matches()) {
notifyNode(EventSourceTopology.EVENT_SOURCE_TOPOLOGY_PATH.child(Node.class,
node.key()));
}
}
}
}
tx.close();
}
代码示例来源:origin: org.opendaylight.controller/messagebus-impl
@Override
public void onSuccess(final Optional<Topology> data) {
if(data.isPresent()) {
final List<Node> nodes = data.get().getNode();
if(nodes != null){
for (final Node node : nodes) {
if (nodeRegex.matcher(node.getNodeId().getValue()).matches()) {
notifyNode(EventSourceTopology.EVENT_SOURCE_TOPOLOGY_PATH.child(Node.class, node.getKey()));
}
}
}
}
tx.close();
}
代码示例来源:origin: org.opendaylight.alto.basic/alto-auto-maps-impl
private void createDefaultAutoNetworkMap(Topology topology, final WriteTransaction wx) {
for (Node node : topology.getNode()) {
HostNode hostNode = node.getAugmentation(HostNode.class);
if (hostNode != null) {
List<Addresses> addressesList = hostNode.getAddresses();
mergeAddressesListToDefaultNetworkMap(addressesList, wx);
}
}
}
代码示例来源: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.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.faas/fabric
@Override
public void onSuccess(Optional<Topology> result) {
if (result.isPresent()) {
List<Node> nodes = result.get().getNode();
List<FabricId> fabricIds = new ArrayList<FabricId>();
if (nodes != null) {
for (Node node : nodes) {
FabricNode fnode = node.getAugmentation(FabricNode.class);
if (fnode != null) {
fabricIds.add(new FabricId(node.getNodeId()));
}
}
outputBuilder.setFabricId(fabricIds);
}
}
futureResult.set(resultBuilder.withResult(outputBuilder.build()).build());
}
代码示例来源:origin: org.opendaylight.ovsdb/utils.southbound-utils
/**
* Get all OVSDB nodes from topology.
* @return a list of nodes or null if the topology could not found
*/
public List<Node> getOvsdbNodes() {
InstanceIdentifier<Topology> inst = InstanceIdentifier.create(NetworkTopology.class).child(Topology.class,
new TopologyKey(OVSDB_TOPOLOGY_ID));
Topology topology = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, inst);
return topology != null ? topology.getNode() : null;
}
代码示例来源:origin: org.opendaylight.sfc/sfc-ovs
private Node readOvsdbNodeByIp(String ipAddress) {
Preconditions.checkNotNull(ipAddress,
"Cannot READ Node for given ipAddress from OVS operational store, ipAddress is null.");
Topology topology = SfcDataStoreAPI.readTransactionAPI(SfcOvsUtil.buildOvsdbTopologyIID(),
LogicalDatastoreType.OPERATIONAL);
if (topology.getNode() != null) {
for (Node node : topology.getNode()) {
OvsdbNodeAugmentation ovsdbNodeAug = node.getAugmentation(OvsdbNodeAugmentation.class);
if (ovsdbNodeAug != null && ovsdbNodeAug.getConnectionInfo() != null) {
IpAddress connectionIp = ovsdbNodeAug.getConnectionInfo().getRemoteIp();
if (connectionIp == null) {
return null;
}
if (connectionIp.getIpv4Address() != null
&& connectionIp.getIpv4Address().getValue().equals(ipAddress)) {
return node;
} else if (connectionIp.getIpv6Address() != null
&& connectionIp.getIpv6Address().getValue().equals(ipAddress)) {
return node;
}
}
}
} else {
LOG.warn(
"Cannot READ Node for given ipAddress from OVS operational store, Topology does not contain any Node.");
}
return null;
}
代码示例来源: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.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);
}
内容来源于网络,如有侵权,请联系作者删除!