org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology.getLink()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(13.0k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology.getLink()方法的一些代码示例,展示了Topology.getLink()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Topology.getLink()方法的具体详情如下:
包路径:org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology
类名称:Topology
方法名:getLink

Topology.getLink介绍

[英]A Network Link connects a by Local (Source) node anda Remote (Destination) Network Nodes via a set of thenodes' termination points.As it is possible to have several links between the samesource and destination nodes, and as a link could potentiallybe re-homed between termination points, to ensure that wewould always know to distinguish between links, every linkis identified by a dedicated link identifier.Note that a link models a point-to-point link, not a multipointlink.Layering dependencies on links in underlay topologies arenot represented as the layering information of nodes and oftermination points is sufficient.
[中]网络链路通过一组节点的终止点连接本地(源)节点和远程(目标)网络节点。由于同一资源和目标节点之间可能有多条链路,并且一条链路可能会在终止点之间重新建立,为了确保我们始终知道如何区分链路,每个链路都由一个专用的链路标识符标识。请注意,链路建模的是点到点链路,而不是多点链路。在参考底图拓扑中,对链接的分层依赖性不能表示为节点和端点的分层信息。

代码示例

代码示例来源: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.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.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.unimgr/unimgr-impl

/**
 * Retrieve the list of links in the Operational DataStore.
 * @param dataBroker The dataBroker instance to create transactions
 * @return A list of Links retrieved from the Operational DataStore
 */
public static List<Link> getEvcLinks(final DataBroker dataBroker) {
  final List<Link> evcLinks = new ArrayList<>();
  final InstanceIdentifier<Topology> evcTopology = UnimgrMapper.getEvcTopologyIid();
  final Topology topology = MdsalUtils.read(dataBroker,
                     LogicalDatastoreType.OPERATIONAL,
                     evcTopology);
  if ((topology != null) && (topology.getLink() != null)) {
    for (final Link link : topology.getLink()) {
      final EvcAugmentation evcAugmentation = link.getAugmentation(EvcAugmentation.class);
      if (evcAugmentation != null) {
        evcLinks.add(link);
      }
    }
  }
  return evcLinks;
}

代码示例来源:origin: org.opendaylight.openflowplugin.applications/topology-manager

static void removeAffectedLinks(final NodeId id, Optional<Topology> topologyOptional, ReadWriteTransaction transaction, final InstanceIdentifier<Topology> topology) {
  if (!topologyOptional.isPresent()) {
    return;
  }
  List<Link> linkList = topologyOptional.get().getLink() != null ?
      topologyOptional.get().getLink() : Collections.<Link> emptyList();
  for (Link link : linkList) {
    if (id.equals(link.getSource().getSourceNode()) ||
        id.equals(link.getDestination().getDestNode())) {
      transaction.delete(LogicalDatastoreType.OPERATIONAL, linkPath(link, topology));
    }
  }
}

代码示例来源:origin: org.opendaylight.openflowplugin.applications/topology-manager

static void removeAffectedLinks(final TpId id, Optional<Topology> topologyOptional, ReadWriteTransaction transaction, final InstanceIdentifier<Topology> topology) {
  if (!topologyOptional.isPresent()) {
    return;
  }
  List<Link> linkList = topologyOptional.get().getLink() != null
      ? topologyOptional.get().getLink() : Collections.<Link> emptyList();
  for (Link link : linkList) {
    if (id.equals(link.getSource().getSourceTp()) ||
        id.equals(link.getDestination().getDestTp())) {
      transaction.delete(LogicalDatastoreType.OPERATIONAL, linkPath(link, topology));
    }
  }
}

代码示例来源:origin: org.opendaylight.nic/intent-listeners

@Override
public void handleEvent(NicNotification event) {
  if (TopologyLinkUp.class.isInstance(event)) {
    LOG.trace("TOPOLOGY LINK ADDED");
    Topology topo = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL,
        IidFactory.getFlowTopologyII());
    if (graphService.getGraph() != null) {
      graphService.setLinks(topo.getLink());
    }
  }
  if (TopologyLinkDeleted.class.isInstance(event)) {
    LOG.trace("TOPOLOGY LINK REMOVED");
    Topology topo = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL,
        IidFactory.getFlowTopologyII());
    if (graphService.getGraph() != null) {
      graphService.updateLinks(topo.getLink());
      graphService.setLinks(topo.getLink());
    }
  }
}

代码示例来源: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-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.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.vtn/manager.it.ofmock

/**
 * Delete all the inter-switch links affected by the specified resource.
 *
 * @param tx  A read-write MD-SAL datastore transaction.
 */
public final void delete(ReadWriteTransaction tx) {
  // Read the current network topology.
  InstanceIdentifier<Topology> tpath = TopologyUtils.
    getTopologyPathBuilder().
    build();
  LogicalDatastoreType oper = LogicalDatastoreType.OPERATIONAL;
  Optional<Topology> opt = DataStoreUtils.read(tx, oper, tpath);
  if (opt.isPresent()) {
    List<Link> links = opt.get().getLink();
    if (links != null) {
      for (Link link: links) {
        if (match(link)) {
          InstanceIdentifier<Link> path = tpath.
            child(Link.class, link.getKey());
          tx.delete(oper, path);
        }
      }
    }
  }
}

代码示例来源:origin: org.opendaylight.faas/fabric-mgr-impl

/**
 * To get the border Fabric and its port connects to the External network
 * for now we only only return the first one.
 * @return
 */
private Entry<FabricId, TpId> getBorderInfo()
{
  Topology fabricTopo = this.getFabricTopology();
  if (fabricTopo == null) {
    LOG.error("Fabric Topology is NULL!");
    return null;
  }
  for (Link l : fabricTopo.getLink()) {
    if ("external".equalsIgnoreCase(l.getSource().getSourceNode().getValue())) {
      return new AbstractMap.SimpleEntry(l.getDestination().getDestNode(), l.getDestination().getDestTp());
    }
    if ("external".equalsIgnoreCase(l.getDestination().getDestNode().getValue())) {
      return new AbstractMap.SimpleEntry(l.getSource().getSourceNode(), l.getSource().getSourceTp());
    }
  }
  LOG.error("No Fabric Topology found!");
  return null;
}

代码示例来源:origin: org.opendaylight.lacp.main/lacp.main.impl

return;
List<Link> links = topology.getLink();
if (links == null || links.isEmpty())

代码示例来源:origin: org.opendaylight.vtn/manager.implementation

/**
 * Initialize VTN network topology.
 *
 * @param luctx     A {@link LinkUpdateContext} instance.
 * @param topology  MD-SAL network topology.
 * @throws VTNException
 *    An error occurred.
 */
private void initLinks(LinkUpdateContext luctx, Topology topology)
  throws VTNException {
  if (topology == null) {
    return;
  }
  List<Link> links = topology.getLink();
  if (links == null) {
    return;
  }
  for (Link link: links) {
    SalPort src = SalPort.create(link.getSource());
    SalPort dst = SalPort.create(link.getDestination());
    if (src == null || dst == null) {
      LOG.debug("Ignore unsupported inter-switch link: {}",
           link);
    } else {
      luctx.addVtnLink(link.getLinkId(), src, dst);
    }
  }
}

代码示例来源:origin: org.opendaylight.nic/of-renderer

NetworkTopology networkTopo = oNT.get();
for (Topology t : networkTopo.getTopology()) {
  if (t.getLink() != null) {
    for (Link l : t.getLink()) {
      if ((l.getSource().getSourceTp().equals(tpId)
          && !l.getDestination().getDestTp().getValue().startsWith("host:"))

代码示例来源:origin: org.opendaylight.atrium/hostservice-impl

NetworkTopology networkTopo = oNT.get();
for (Topology t : networkTopo.getTopology()) {
  if (t.getLink() != null) {
    for (Link l : t.getLink()) {
      if ((l.getSource().getSourceTp().equals(tpId)
          && !l.getDestination().getDestTp().getValue().startsWith(Host.NODE_PREFIX))

代码示例来源:origin: org.opendaylight.l2switch.hosttracker/hosttracker-impl

NetworkTopology networkTopo = oNT.get();
for (Topology t : networkTopo.getTopology()) {
  if (t.getLink() != null) {
    for (Link l : t.getLink()) {
      if ((l.getSource().getSourceTp().equals(tpId)
          && !l.getDestination().getDestTp().getValue().startsWith(Host.NODE_PREFIX))

代码示例来源: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.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.faas/fabric-mgr-impl

= new org.opendaylight.yang.gen.v1.urn.opendaylight.faas.logical.faas.common.rev151013.Uuid(lsw.getValue());
List<RenderReadySwitchLink> tasks = new ArrayList<>();
for (Link l : topo.getLink()) {
  RenderedSwitch sswitch  = maps.get(l.getSource().getSourceNode().getValue());
  if (sswitch == null) {

相关文章