gpt4 book ai didi

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

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

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

YangInstanceIdentifier.builder介绍

[英]Returns new builder for InstanceIdentifier with empty path arguments.
[中]返回带有空路径参数的InstanceIdentifier的新生成器。

代码示例

代码示例来源:origin: io.fd.honeycomb/data-impl

private static YangInstanceIdentifier childYangId(@Nonnull final YangInstanceIdentifier topLevelIdentifier,
                           @Nonnull final Map.Entry<YangInstanceIdentifier.PathArgument, DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?>> entry) {
    return YangInstanceIdentifier.builder(topLevelIdentifier)
        .node(entry.getKey()).build();
  }
}

代码示例来源:origin: io.fd.honeycomb/data-impl

@Override
  public Collection<NormalizedNodeUpdate> normalizedUpdates(@Nonnull final YangInstanceIdentifier topLevelIdentifier,
                               @Nonnull final Map.Entry<YangInstanceIdentifier.PathArgument, DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?>> entry) {
    // if leaf,just builds delete right away
    LOG.debug("Processing {} as leaf", topLevelIdentifier);
    return Collections.singletonList(new NormalizedNodeUpdate(YangInstanceIdentifier.builder(topLevelIdentifier)
        .node(entry.getKey()).build(), entry.getValue(), null));
  }
}

代码示例来源:origin: io.fd.honeycomb/data-impl

@Override
  public Collection<NormalizedNodeUpdate> normalizedUpdates(@Nonnull final YangInstanceIdentifier topLevelIdentifier,
                               @Nonnull final Map.Entry<YangInstanceIdentifier.PathArgument, DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?>> entry) {
    // if leaf-list,just builds delete right away
    LOG.debug("Processing {} as leaf-list", topLevelIdentifier);
    return Collections.singletonList(new NormalizedNodeUpdate(YangInstanceIdentifier.builder(topLevelIdentifier)
        .node(entry.getKey()).build(), entry.getValue(), null));
  }
}

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

YangInstanceIdentifier toInstanceIdentifier() {
    return YangInstanceIdentifier.builder(root).append(Arrays.asList(entries).subList(0, used)).build();
  }
}

代码示例来源:origin: org.opendaylight.controller/sal-common-api

/**
 * Construct an Entity with an with a name. The general-entity schema is used to construct the
 * YangInstanceIdentifier.
 *
 * @param type the type of the entity
 * @param entityName the name of the entity used to construct a general-entity YangInstanceIdentifier
 */
public Entity(@Nonnull String type, @Nonnull String entityName) {
  this.type = Preconditions.checkNotNull(type, "type should not be null");
  this.id = YangInstanceIdentifier.builder().node(ENTITY_QNAME).nodeWithKey(ENTITY_QNAME, ENTITY_NAME,
          Preconditions.checkNotNull(entityName, "entityName should not be null")).build();
}

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

public RouterSessionManager(final YangInstanceIdentifier yangMonitorId, final DOMDataBroker domDataBroker,
    final RIBExtensionConsumerContext extensions, final BindingCodecTree tree) {
  this.domDataBroker = domDataBroker;
  this.yangRoutersId = YangInstanceIdentifier.builder(yangMonitorId).node(Router.QNAME).build();
  this.extensions = extensions;
  this.tree = tree;
}

代码示例来源:origin: io.fd.honeycomb/data-impl

@Override
  public Collection<NormalizedNodeUpdate> normalizedUpdates(@Nonnull final YangInstanceIdentifier topLevelIdentifier,
                               @Nonnull final Map.Entry<YangInstanceIdentifier.PathArgument, DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?>> entry) {
    // identifier has different format : parent_node/list_node/list_node_with_key
    LOG.debug("Processing {} as list", topLevelIdentifier);
    return ((MapNode) entry.getValue()).getValue().stream()
        .map(mapEntryNode -> new NormalizedNodeUpdate(YangInstanceIdentifier.builder(topLevelIdentifier)
            .node(mapEntryNode.getNodeType())
            .node(mapEntryNode.getIdentifier()).build(), mapEntryNode, null))
        .collect(Collectors.toList());
  }
}

代码示例来源:origin: org.opendaylight.controller/sal-netconf-connector

private static org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier createBIPathForTopology(final String name) {
  final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.InstanceIdentifierBuilder builder =
      org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.builder();
  builder
      .node(NetworkTopology.QNAME)
      .node(Topology.QNAME)
      .nodeWithKey(Topology.QNAME, QName.create(Topology.QNAME, "topology-id"), TopologyNetconf.QNAME.getLocalName())
      .node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node.QNAME)
      .nodeWithKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node.QNAME,
          QName.create(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node.QNAME, "node-id"), name);
  return builder.build();
}

代码示例来源:origin: org.opendaylight.controller/mdsal-netconf-connector

@VisibleForTesting
protected YangInstanceIdentifier getInstanceIdentifierFromFilter(XmlElement filterElement) throws NetconfDocumentedException {
  if (filterElement.getChildElements().size() != 1) {
    throw new NetconfDocumentedException("Multiple filter roots not supported yet",
        ErrorType.application, ErrorTag.operation_not_supported, ErrorSeverity.error);
  }
  XmlElement element = filterElement.getOnlyChildElement();
  DataSchemaNode schemaNode = getSchemaNodeFromNamespace(element);
  return getReadPointFromNode(YangInstanceIdentifier.builder().build(), filterToNormalizedNode(element, schemaNode));
}

代码示例来源:origin: org.opendaylight.controller/sal-netconf-connector

private static org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier createBIPath(final String name) {
  final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.InstanceIdentifierBuilder builder =
      org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.builder();
  builder.node(Nodes.QNAME).node(Node.QNAME).nodeWithKey(Node.QNAME, QName.create(Node.QNAME.getNamespace(), Node.QNAME.getRevision(), "id"), name);
  return builder.build();
}

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

static YangInstanceIdentifier entityPath(String entityType, YangInstanceIdentifier entityId) {
  return YangInstanceIdentifier.builder(ENTITY_OWNERS_PATH).node(EntityType.QNAME).
      nodeWithKey(EntityType.QNAME, ENTITY_TYPE_QNAME, entityType).node(ENTITY_QNAME).
          nodeWithKey(ENTITY_QNAME, ENTITY_ID_QNAME, entityId).build();
}

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

static YangInstanceIdentifier candidatePath(String entityType, YangInstanceIdentifier entityId,
    String candidateName) {
  return YangInstanceIdentifier.builder(ENTITY_OWNERS_PATH).node(EntityType.QNAME).
      nodeWithKey(EntityType.QNAME, ENTITY_TYPE_QNAME, entityType).node(ENTITY_QNAME).
          nodeWithKey(ENTITY_QNAME, ENTITY_ID_QNAME, entityId).node(Candidate.QNAME).
              nodeWithKey(Candidate.QNAME, CANDIDATE_NAME_QNAME, candidateName).build();
}

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

@Override
public void instantiateServiceInstance() {
  if(this.configurationWriter != null) {
    this.configurationWriter.apply();
  }
  LOG.info("Application Peer Singleton Service {} instantiated", getIdentifier());
  final YangInstanceIdentifier yangIId = YangInstanceIdentifier.builder().node(ApplicationRib.QNAME)
    .nodeWithKey(ApplicationRib.QNAME, APP_ID_QNAME, this.appRibId.getValue()).node(Tables.QNAME).node(Tables.QNAME).build();
  this.applicationPeer.instantiateServiceInstance();
  this.registration = this.dataTreeChangeService
    .registerDataTreeChangeListener(new DOMDataTreeIdentifier(LogicalDatastoreType.CONFIGURATION, yangIId), this.applicationPeer);
}

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

private void installAdjRibInTables(final YangInstanceIdentifier newPeerPath, final TablesKey tableKey, final RIBSupportContext rs,
  final NodeIdentifierWithPredicates instanceIdentifierKey, final DOMDataWriteTransaction tx, final Builder<TablesKey, TableContext> tb) {
  // We will use table keys very often, make sure they are optimized
  final InstanceIdentifierBuilder idb = YangInstanceIdentifier.builder(newPeerPath.node(EMPTY_ADJRIBIN.getIdentifier()).node(TABLES));
  idb.nodeWithKey(instanceIdentifierKey.getNodeType(), instanceIdentifierKey.getKeyValues());
  final TableContext ctx = new TableContext(rs, idb.build());
  ctx.createEmptyTableStructure(tx);
  tx.merge(LogicalDatastoreType.OPERATIONAL, ctx.getTableId().node(Attributes.QNAME).node(ATTRIBUTES_UPTODATE_FALSE.getNodeType()), ATTRIBUTES_UPTODATE_FALSE);
  LOG.debug("Created table instance {}", ctx.getTableId());
  tb.put(tableKey, ctx);
}

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

void init(ShardDataTree shardDataTree) {
  shardDataTree.registerTreeChangeListener(YangInstanceIdentifier.builder(ENTITY_OWNERS_PATH).
      node(EntityType.QNAME).node(EntityType.QNAME).node(ENTITY_QNAME).node(ENTITY_QNAME).
          node(Candidate.QNAME).node(Candidate.QNAME).build(), this);
}

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

@Test
public void testYangInstanceIdentifierStreaming() throws IOException  {
  YangInstanceIdentifier path = YangInstanceIdentifier.builder(TestModel.TEST_PATH)
      .node(TestModel.OUTER_LIST_QNAME).nodeWithKey(
          TestModel.INNER_LIST_QNAME, TestModel.ID_QNAME, 10).build();
  ByteArrayOutputStream bos = new ByteArrayOutputStream();
  NormalizedNodeDataOutput nnout = NormalizedNodeInputOutput.newDataOutput(ByteStreams.newDataOutput(bos));
  nnout.writeYangInstanceIdentifier(path);
  NormalizedNodeDataInput nnin = NormalizedNodeInputOutput.newDataInput(ByteStreams.newDataInput(
    bos.toByteArray()));
  YangInstanceIdentifier newPath = nnin.readYangInstanceIdentifier();
  Assert.assertEquals(path, newPath);
}

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

@Test
public void testInnerContainerNodeWithFullPathPathNotPruned() throws IOException {
  YangInstanceIdentifier path = YangInstanceIdentifier.builder().node(TestModel.TEST_QNAME)
      .node(TestModel.OUTER_LIST_QNAME).nodeWithKey(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, 1)
      .node(TestModel.INNER_LIST_QNAME).nodeWithKey(TestModel.INNER_LIST_QNAME, TestModel.NAME_QNAME, "one")
      .node(TestModel.INNER_CONTAINER_QNAME).build();
  NormalizedNodePruner pruner = prunerFullSchema(path);
  NormalizedNode<?, ?> input = ImmutableNodes.containerNode(TestModel.INNER_CONTAINER_QNAME);
  NormalizedNodeWriter.forStreamWriter(pruner).write(input);
  NormalizedNode<?, ?> actual = pruner.normalizedNode();
  assertEquals("normalizedNode", input, actual);
}

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

@Test
public void testInnerContainerNodeWithFullPathPrunedWhenSchemaMissing() throws IOException {
  YangInstanceIdentifier path = YangInstanceIdentifier.builder().node(TestModel.TEST_QNAME)
      .node(TestModel.OUTER_LIST_QNAME).nodeWithKey(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, 1)
      .node(TestModel.INNER_LIST_QNAME).nodeWithKey(TestModel.INNER_LIST_QNAME, TestModel.NAME_QNAME, "one")
      .node(TestModel.INVALID_QNAME).build();
  NormalizedNodePruner pruner = prunerFullSchema(path);
  NormalizedNode<?, ?> input = ImmutableNodes.containerNode(TestModel.INVALID_QNAME);
  NormalizedNodeWriter.forStreamWriter(pruner).write(input);
  NormalizedNode<?, ?> actual = pruner.normalizedNode();
  assertNull(actual);
}

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

@Test
public void testLeafNodePrunedWhenHasAugmentationParentAndSchemaMissing() throws IOException {
  AugmentationIdentifier augId = new AugmentationIdentifier(Sets.newHashSet(TestModel.AUG_CONT_QNAME));
  NormalizedNodePruner pruner = prunerFullSchema(YangInstanceIdentifier.builder()
      .node(TestModel.TEST_QNAME).node(TestModel.AUGMENTED_LIST_QNAME)
          .node(TestModel.AUGMENTED_LIST_QNAME).node(augId).build());
  LeafNode<Object> child = Builders.leafBuilder().withNodeIdentifier(
      new NodeIdentifier(TestModel.INVALID_QNAME)).withValue("test").build();
  NormalizedNode<?, ?> input = Builders.augmentationBuilder().withNodeIdentifier(augId).withChild(child).build();
  NormalizedNodeWriter.forStreamWriter(pruner).write(input);
  NormalizedNode<?, ?> actual = pruner.normalizedNode();
  assertEquals("normalizedNode", Builders.augmentationBuilder().withNodeIdentifier(augId).build(), actual);
}

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

@Test
public void testInnerListNodeWithFullPathPrunedWhenSchemaMissing() throws IOException {
  YangInstanceIdentifier path = YangInstanceIdentifier.builder().node(TestModel.TEST_QNAME)
      .node(TestModel.OUTER_LIST_QNAME).nodeWithKey(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, 1)
      .node(TestModel.INVALID_QNAME).build();
  NormalizedNodePruner pruner = prunerFullSchema(path);
  MapNode input = mapNodeBuilder(TestModel.INVALID_QNAME).withChild(mapEntryBuilder(
      TestModel.INVALID_QNAME, TestModel.NAME_QNAME, "one").withChild(
          ImmutableNodes.containerNode(TestModel.INNER_CONTAINER_QNAME)).build()).build();
  NormalizedNodeWriter.forStreamWriter(pruner).write(input);
  NormalizedNode<?, ?> actual = pruner.normalizedNode();
  assertNull(actual);
}

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