gpt4 book ai didi

org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.getLastPathArgument()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 17:04:40 26 4
gpt4 key购买 nike

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

YangInstanceIdentifier.getLastPathArgument介绍

[英]Returns the last PathArgument. This is equivalent of iterating to the last element of the iterable returned by #getPathArguments().
[中]返回最后一个参数。这相当于迭代到#getPathArguments()返回的iterable的最后一个元素。

代码示例

代码示例来源:origin: io.fd.honeycomb.infra/test-tools

private static YangInstanceIdentifier.NodeIdentifierWithPredicates listNodeIdentifier(@Nonnull final YangInstanceIdentifier nodeIdentifier) {
    return java.util.Optional.ofNullable(nodeIdentifier.getLastPathArgument())
        .filter(pathArgument -> pathArgument instanceof YangInstanceIdentifier.NodeIdentifierWithPredicates)
        .map(YangInstanceIdentifier.NodeIdentifierWithPredicates.class::cast)
        .orElseThrow(() -> new IllegalArgumentException(
            String.format("Unable to create list node identifier from %s", nodeIdentifier)));
  }
}

代码示例来源:origin: io.fd.honeycomb.infra/test-tools

private static YangInstanceIdentifier.NodeIdentifier containerNodeIdentifier(@Nonnull final YangInstanceIdentifier nodeIdentifier) {
    return java.util.Optional.ofNullable(nodeIdentifier.getLastPathArgument())
        .filter(pathArgument -> pathArgument instanceof YangInstanceIdentifier.NodeIdentifier)
        .map(YangInstanceIdentifier.NodeIdentifier.class::cast)
        .orElseThrow(() -> new IllegalArgumentException(
            String.format("Unable to create container node identifier from %s", nodeIdentifier)));
  }
}

代码示例来源:origin: org.opendaylight.mdsal/mdsal-singleton-dom-impl

@Override
  protected String getServiceIdentifierFromEntity(final DOMEntity entity) {
    final YangInstanceIdentifier yii = entity.getIdentifier();
    final NodeIdentifierWithPredicates niiwp = (NodeIdentifierWithPredicates) yii.getLastPathArgument();
    return niiwp.getKeyValues().values().iterator().next().toString();
  }
}

代码示例来源:origin: org.opendaylight.mdsal/mdsal-binding2-dom-adapter

private YangInstanceIdentifier.PathArgument convertToNormalized(final TreeArgument<?> child) {
  stack.push(child);
  final InstanceIdentifier<?> iid = InstanceIdentifier.create(stack);
  final YangInstanceIdentifier ret = codec.toNormalized(iid);
  stack.pop();
  return ret.getLastPathArgument();
}

代码示例来源:origin: org.opendaylight.mdsal/mdsal-binding2-dom-adapter

@Override
public <P extends TreeNode> void write(final TreeArgument<P> child, final P data) {
  final Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> entry = convertToNormalized(child, data);
  delegate.write(entry.getKey().getLastPathArgument(), entry.getValue());
}

代码示例来源:origin: org.opendaylight.bgpcep/bgp-rib-impl

@Override
public void peerRoleChanged(final YangInstanceIdentifier peerPath, final PeerRole role) {
  final PeerId peer = IdentifierUtils.peerId((NodeIdentifierWithPredicates) peerPath.getLastPathArgument());
  if (role != null) {
    // Lookup policy based on role
    final AbstractImportPolicy policy = this.policyDatabase.importPolicyForRole(role);
    // Update lookup map
    this.policies.put(peer, policy);
    LOG.debug("Updating policy {} for peer {}", policy, peer);
  } else {
    this.policies.remove(peer);
  }
}

代码示例来源:origin: org.opendaylight.mdsal/mdsal-binding2-dom-adapter

@Override
public <U extends TreeNode> void merge(final TreeArgument<U> child, final U data) {
  final Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> entry = convertToNormalized(child, data);
  delegate.merge(entry.getKey().getLastPathArgument(), entry.getValue());
}

代码示例来源:origin: org.opendaylight.controller/sal-distributed-datastore

private static void checkInstanceIdentifierReferencesData(final YangInstanceIdentifier path,
    final NormalizedNode<?, ?> data) {
  final PathArgument lastArg = path.getLastPathArgument();
  Preconditions.checkArgument(
      (lastArg == data.getIdentifier()) || (lastArg != null && lastArg.equals(data.getIdentifier())),
      "Instance identifier references %s but data identifier is %s", lastArg, data);
}

代码示例来源:origin: org.opendaylight.mdsal/mdsal-dom-inmemory-datastore

@Override
public PathArgument getIdentifier() {
  return rootContext.getIdentifier().getRootIdentifier().getLastPathArgument();
}

代码示例来源:origin: org.opendaylight.mdsal/mdsal-binding-dom-adapter

private YangInstanceIdentifier.PathArgument convertToNormalized(final PathArgument child) {
  stack.push(child);
  final InstanceIdentifier<?> iid = InstanceIdentifier.create(stack);
  final YangInstanceIdentifier ret = getCodec().toNormalized(iid);
  stack.pop();
  return ret.getLastPathArgument();
}

代码示例来源:origin: org.opendaylight.mdsal/mdsal-binding-dom-adapter

@Override
public <P extends DataObject> void merge(final PathArgument child, final P data) {
  final Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> entry = convertToNormalized(child, data);
  getDelegate().merge(entry.getKey().getLastPathArgument(), entry.getValue());
}

代码示例来源:origin: org.opendaylight.mdsal/mdsal-binding-dom-adapter

@Override
public <P extends DataObject> void write(final PathArgument child, final P data) {
  final Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> entry = convertToNormalized(child, data);
  getDelegate().write(entry.getKey().getLastPathArgument(), entry.getValue());
}

代码示例来源:origin: org.opendaylight.mdsal/mdsal-dom-spi

@Override
public PathArgument getIdentifier() {
  return boundary.getIdentifier().getRootIdentifier().getLastPathArgument();
}

代码示例来源:origin: org.opendaylight.yangtools/yang-data-impl

private void checkIdentifierReferencesData(final YangInstanceIdentifier path,
    final NormalizedNode<?, ?> data) {
  final PathArgument arg;
  if (!path.isEmpty()) {
    arg = path.getLastPathArgument();
    checkArgument(arg != null, "Instance identifier %s has invalid null path argument", path);
  } else {
    arg = rootNode.getIdentifier();
  }
  checkIdentifierReferencesData(arg, data);
}

代码示例来源:origin: org.opendaylight.controller/sal-distributed-datastore

public static String entityTypeFromEntityPath(YangInstanceIdentifier entityPath){
  YangInstanceIdentifier parent = entityPath;
  while(!parent.isEmpty()) {
    if (EntityType.QNAME.equals(parent.getLastPathArgument().getNodeType())) {
      YangInstanceIdentifier.NodeIdentifierWithPredicates entityTypeLastPathArgument = (YangInstanceIdentifier.NodeIdentifierWithPredicates) parent.getLastPathArgument();
      return (String) entityTypeLastPathArgument.getKeyValues().get(ENTITY_TYPE_QNAME);
    }
    parent = parent.getParent();
  }
  return null;
}

代码示例来源:origin: opendaylight/yangtools

private void checkIdentifierReferencesData(final YangInstanceIdentifier path,
    final NormalizedNode<?, ?> data) {
  final PathArgument arg;
  if (!path.isEmpty()) {
    arg = path.getLastPathArgument();
    checkArgument(arg != null, "Instance identifier %s has invalid null path argument", path);
  } else {
    arg = rootNode.getIdentifier();
  }
  checkIdentifierReferencesData(arg, data);
}

代码示例来源:origin: org.opendaylight.bgpcep/bgp-rib-impl

private EffectiveRibInWriter(final DOMDataTreeChangeService service, final DOMTransactionChain chain, final YangInstanceIdentifier peerIId,
    final ImportPolicyPeerTracker importPolicyPeerTracker, final RIBSupportContextRegistry registry, final PeerRole peerRole,
    @Nonnull final PerTableTypeRouteCounter effectiveRouteCounters, @Nonnull final PerTableTypeRouteCounter adjRibInRouteCounters) {
  importPolicyPeerTracker.peerRoleChanged(peerIId, peerRole);
  this.importPolicy = importPolicyPeerTracker.policyFor(IdentifierUtils.peerId((NodeIdentifierWithPredicates) peerIId.getLastPathArgument()));
  this.adjInTracker = new AdjInTracker(service, registry, chain, peerIId, effectiveRouteCounters, adjRibInRouteCounters);
}

代码示例来源:origin: org.opendaylight.bgpcep/bgp-rib-impl

@Deprecated
private EffectiveRibInWriter(final DOMDataTreeChangeService service, final DOMTransactionChain chain, final YangInstanceIdentifier peerIId,
    final ImportPolicyPeerTracker importPolicyPeerTracker, final RIBSupportContextRegistry registry, final PeerRole peerRole) {
  importPolicyPeerTracker.peerRoleChanged(peerIId, peerRole);
  this.importPolicy = importPolicyPeerTracker.policyFor(IdentifierUtils.peerId((NodeIdentifierWithPredicates) peerIId.getLastPathArgument()));
  this.adjInTracker = new AdjInTracker(service, registry, chain, peerIId);
}

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

private InstanceIdentifier<Node> obtainNodeIdFromEntity(Entity entity) {
  LOG.debug ("in obtainNodeIdFromEntity for entity {}", entity.getId());
  NodeIdentifierWithPredicates node = (NodeIdentifierWithPredicates)entity.getId().getLastPathArgument();
  String nodeValue = (String)node.getKeyValues().values().iterator().next();
  InstanceIdentifier<Node> nodeId = InstanceIdentifier.builder(Nodes.class)
    .child(Node.class, new NodeKey(new NodeId(nodeValue))).toInstance();
  LOG.debug("nodeid returned for entity {}", nodeId);
  return nodeId;
}

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

@Override
public void ownershipChanged(EntityOwnershipChange ownershipChange) {
  YangInstanceIdentifier yId = ownershipChange.getEntity().getId();
  NodeIdentifierWithPredicates niWPredicates = (NodeIdentifierWithPredicates)yId.getLastPathArgument();
  Map<QName, Object> keyValMap = niWPredicates.getKeyValues();
  String nodeIdStr = (String)(keyValMap.get(ENTITY_NAME));
  NodeId nodeId = new NodeId(nodeIdStr);
  setNodeOwnership(nodeId, ownershipChange.isOwner());
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com