当前位置: 首页>>代码示例>>Java>>正文


Java LeafSetEntryNode类代码示例

本文整理汇总了Java中org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode的典型用法代码示例。如果您正苦于以下问题:Java LeafSetEntryNode类的具体用法?Java LeafSetEntryNode怎么用?Java LeafSetEntryNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


LeafSetEntryNode类属于org.opendaylight.yangtools.yang.data.api.schema包,在下文中一共展示了LeafSetEntryNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addLeafSetChildren

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private ListNodeBuilder<Object, LeafSetEntryNode<Object>> addLeafSetChildren(final QName nodeType,
        final ListNodeBuilder<Object, LeafSetEntryNode<Object>> builder) throws IOException {

    LOG.trace("Reading children of leaf set");

    lastLeafSetQName = nodeType;

    LeafSetEntryNode<Object> child = (LeafSetEntryNode<Object>)readNormalizedNodeInternal();

    while (child != null) {
        builder.withChild(child);
        child = (LeafSetEntryNode<Object>)readNormalizedNodeInternal();
    }
    return builder;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:17,代码来源:NormalizedNodeInputStreamReader.java

示例2: createTestContainer

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode; //导入依赖的package包/类
private static NormalizedNode<?, ?> createTestContainer() {
    byte[] bytes1 = {1,2,3};
    LeafSetEntryNode<Object> entry1 = ImmutableLeafSetEntryNodeBuilder.create().withNodeIdentifier(
            new NodeWithValue<>(TestModel.BINARY_LEAF_LIST_QNAME, bytes1)).withValue(bytes1).build();

    byte[] bytes2 = {};
    LeafSetEntryNode<Object> entry2 = ImmutableLeafSetEntryNodeBuilder.create().withNodeIdentifier(
            new NodeWithValue<>(TestModel.BINARY_LEAF_LIST_QNAME, bytes2)).withValue(bytes2).build();

    LeafSetEntryNode<Object> entry3 = ImmutableLeafSetEntryNodeBuilder.create().withNodeIdentifier(
            new NodeWithValue<>(TestModel.BINARY_LEAF_LIST_QNAME, null)).withValue(null).build();

    return TestModel.createBaseTestContainerBuilder()
            .withChild(ImmutableLeafSetNodeBuilder.create().withNodeIdentifier(
                    new NodeIdentifier(TestModel.BINARY_LEAF_LIST_QNAME))
                    .withChild(entry1).withChild(entry2).withChild(entry3).build())
            .withChild(ImmutableNodes.leafNode(TestModel.SOME_BINARY_DATA_QNAME, new byte[]{1,2,3,4}))
            .withChild(Builders.orderedMapBuilder()
                  .withNodeIdentifier(new NodeIdentifier(TestModel.ORDERED_LIST_QNAME))
                  .withChild(ImmutableNodes.mapEntry(TestModel.ORDERED_LIST_ENTRY_QNAME,
                          TestModel.ID_QNAME, 11)).build()).build();
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:23,代码来源:NormalizedNodeStreamReaderWriterTest.java

示例3: createTestContainer

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode; //导入依赖的package包/类
private static NormalizedNode<?, ?> createTestContainer() {
    byte[] bytes1 = {1,2,3};
    LeafSetEntryNode<Object> entry1 = ImmutableLeafSetEntryNodeBuilder.create().withNodeIdentifier(
            new NodeWithValue<>(TestModel.BINARY_LEAF_LIST_QNAME, bytes1)).withValue(bytes1).build();

    byte[] bytes2 = {};
    LeafSetEntryNode<Object> entry2 = ImmutableLeafSetEntryNodeBuilder.create().withNodeIdentifier(
            new NodeWithValue<>(TestModel.BINARY_LEAF_LIST_QNAME, bytes2)).withValue(bytes2).build();

    LeafSetEntryNode<Object> entry3 = ImmutableLeafSetEntryNodeBuilder.create().withNodeIdentifier(
            new NodeWithValue<>(TestModel.BINARY_LEAF_LIST_QNAME, null)).withValue(null).build();


    return TestModel.createBaseTestContainerBuilder()
            .withChild(ImmutableLeafSetNodeBuilder.create().withNodeIdentifier(
                    new NodeIdentifier(TestModel.BINARY_LEAF_LIST_QNAME))
                    .withChild(entry1).withChild(entry2).withChild(entry3).build())
            .withChild(ImmutableNodes.leafNode(TestModel.SOME_BINARY_DATA_QNAME, new byte[]{1, 2, 3, 4}))
            .build();
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:21,代码来源:NormalizedNodePrunerTest.java

示例4: reflectedAttributes

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode; //导入依赖的package包/类
/**
 * Attributes when reflecting a route from Internal iBGP (Application Peer)
 * @param attributes
 * @return
 */
ContainerNode reflectedAttributes(final ContainerNode attributes) {
    final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> attributesContainer = Builders.containerBuilder(attributes);

    // if there was a CLUSTER_LIST attribute, add it
    final Optional<NormalizedNode<?, ?>> maybeClusterList = NormalizedNodes.findNode(attributes, this.clusterListPath);
    if (maybeClusterList.isPresent()) {
        // Create a new CLUSTER_LIST builder
        final ListNodeBuilder<Object, LeafSetEntryNode<Object>> clusterBuilder = Builders.orderedLeafSetBuilder();
        clusterBuilder.withNodeIdentifier(this.clusterListLeaf);
        AttributeOperations.addOtherClusterEntries(maybeClusterList, clusterBuilder);
        // Now wrap it in a container and add it to attributes
        final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> clusterListCont= Builders.containerBuilder();
        clusterListCont.withNodeIdentifier(this.clusterListContainer);
        clusterListCont.withChild(clusterBuilder.build());
        attributesContainer.withChild(clusterListCont.build());
    }

    return attributesContainer.build();
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:25,代码来源:AttributeOperations.java

示例5: testExportedAttributesListFirst

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode; //导入依赖的package包/类
@Test
public void testExportedAttributesListFirst() {
    final Long ourAs = 72L;
    final ContainerNode attributesListBefore = Builders.containerBuilder().withNodeIdentifier(new NodeIdentifier(ATTRS_EXTENSION_Q))
        .addChild(Builders.containerBuilder().withNodeIdentifier(AS_PATH_NID)
            .addChild(Builders.unkeyedListBuilder().withNodeIdentifier(SEGMENTS_NID)
                .addChild(SEQ_SEGMENT)
                .addChild(SET_SEGMENT)
                .build())
        .build())
        .build();
    final AttributeOperations operations  = AttributeOperations.getInstance(attributesListBefore);
    final ContainerNode exportedAttributes = operations.exportedAttributes(attributesListBefore, ourAs);

    // make sure our AS is appended to the a-list (as the AS-PATH starts with A-LIST)
    final LeafSetNode<?> list = checkFirstLeafList(exportedAttributes);
    final Iterator<?> iter = list.getValue().iterator();
    assertEquals(ourAs, ((LeafSetEntryNode<?>)iter.next()).getValue());
    assertEquals(1L, ((LeafSetEntryNode<?>)iter.next()).getValue());
    assertEquals(2L, ((LeafSetEntryNode<?>)iter.next()).getValue());
    assertEquals(3L, ((LeafSetEntryNode<?>)iter.next()).getValue());
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:23,代码来源:AttributeOperationsTest.java

示例6: testReflectedAttributesOriginatorAndClusterNotPresent

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode; //导入依赖的package包/类
@Test
public void testReflectedAttributesOriginatorAndClusterNotPresent() {
    final Ipv4Address originatorId = new Ipv4Address("127.0.0.2");
    final ClusterIdentifier clusterId = new ClusterIdentifier("10.10.10.10");
    final ContainerNode attributes = Builders.containerBuilder().withNodeIdentifier(new NodeIdentifier(ATTRS_EXTENSION_Q))
        .addChild(Builders.containerBuilder().withNodeIdentifier(ORIGIN_NID)
            .addChild(Builders.leafBuilder().withNodeIdentifier(ORIGIN_VALUE_NID).withValue(BgpOrigin.Egp).build())
        .build())
        .build();
    final AttributeOperations operations  = AttributeOperations.getInstance(attributes);
    final ContainerNode reflectedAttributes = operations.reflectedAttributes(attributes, originatorId, clusterId);

    // Origin should be within reflectedAttributes as part of original attributes
    assertTrue(reflectedAttributes.getChild(ORIGIN_NID).isPresent());

    // ClusterIdentifier should be prepended
    final Collection<?> clusters = checkCluster(reflectedAttributes).getValue();
    assertEquals(1, clusters.size());
    assertEquals(clusterId.getValue(), ((LeafSetEntryNode<?>)clusters.iterator().next()).getValue());

    // OriginatorId should be added
    assertTrue(reflectedAttributes.getChild(ORIGINATOR_C_NID).isPresent());
    assertEquals(originatorId.getValue(), ((ContainerNode)reflectedAttributes.getChild(ORIGINATOR_C_NID).get()).getChild(ORIGINATOR_NID).get().getValue());
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:25,代码来源:AttributeOperationsTest.java

示例7: createList3Entry

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode; //导入依赖的package包/类
private static MapEntryNode createList3Entry(final String keyVal,
        final String l3Val1, final String l3Val2, final String l3Val3) {
    final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> mapEntryBuilder = Builders
            .mapEntryBuilder();
    mapEntryBuilder.withNodeIdentifier(new NodeIdentifierWithPredicates(
            list3InChoice, k, keyVal));

    final ListNodeBuilder<Object, LeafSetEntryNode<Object>> leafSetBuilder = Builders
            .leafSetBuilder();
    leafSetBuilder.withNodeIdentifier(new NodeIdentifier(l3));

    leafSetBuilder.addChild(createLeafSetEntry(l3, l3Val1));
    leafSetBuilder.addChild(createLeafSetEntry(l3, l3Val2));
    leafSetBuilder.addChild(createLeafSetEntry(l3, l3Val3));

    mapEntryBuilder.addChild(ImmutableNodes.leafNode(k, keyVal));
    mapEntryBuilder.addChild(leafSetBuilder.build());

    return mapEntryBuilder.build();
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:21,代码来源:DataTreeCandidateValidatorTest.java

示例8: getElementStringValue

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode; //导入依赖的package包/类
@Override
public String getElementStringValue(final Object element) {
    final NormalizedNode<?, ?> node = contextNode(element);
    if (node instanceof LeafNode || node instanceof LeafSetEntryNode) {
        final Object value = node.getValue();

        // TODO: This is a rather poor approximation of what the codec infrastructure, but it should be sufficient
        //       to work for now. Tracking SchemaPath will mean we will need to wrap each NormalizedNode with a
        //       corresponding SchemaPath. That in turn would complicate this class and result in a lot of object
        //       allocations.
        if (value instanceof byte[]) {
            // Binary
            return BaseEncoding.base64().encode((byte[]) value);
        }
        if (value instanceof Set) {
            // Bits
            return JOINER.join((Set<?>)value);
        }
        if (value != null) {
            // Everything else...
            return String.valueOf(value);
        }
    }

    return "";
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:27,代码来源:NormalizedNodeNavigator.java

示例9: intern

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode; //导入依赖的package包/类
@SuppressWarnings("static-method")
public <T extends LeafSetEntryNode<?>> T intern(@Nonnull final T sample) {
    if (!sample.getAttributes().isEmpty()) {
        // Non-empty attributes, do not intern
        return sample;
    }

    /*
     * We do not perform type checks here as they are implied by #forSchema(LeafListSchemaNode). Any misuse can
     * result in inappropriate candidates being interned, but the alternative would be quite a bit slower.
     */
    @SuppressWarnings("unchecked")
    final T ret = (T) INTERNER.intern(sample);
    LOG.trace("Interned object {} to {}", sample, ret);
    return ret;
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:17,代码来源:LeafsetEntryInterner.java

示例10: doWrite

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode; //导入依赖的package包/类
private DOMStoreThreePhaseCommitCohort doWrite(final YangInstanceIdentifier path,
                                               final Collection<MemberName> replicas) {

    final ListNodeBuilder<Object, LeafSetEntryNode<Object>> replicaListBuilder =
            ImmutableLeafSetNodeBuilder.create().withNodeIdentifier(
                    new NodeIdentifier(ClusterUtils.SHARD_REPLICA_QNAME));

    replicas.forEach(name -> replicaListBuilder.withChild(
            ImmutableLeafSetEntryNodeBuilder.create()
                    .withNodeIdentifier(new NodeWithValue<>(ClusterUtils.SHARD_REPLICA_QNAME, name.getName()))
                    .withValue(name.getName())
                    .build()));

    final MapEntryNode newEntry = ImmutableMapEntryNodeBuilder.create()
            .withNodeIdentifier(
                    new NodeIdentifierWithPredicates(ClusterUtils.SHARD_LIST_QNAME, ClusterUtils.SHARD_PREFIX_QNAME,
                            path))
            .withChild(ImmutableLeafNodeBuilder.create()
                    .withNodeIdentifier(new NodeIdentifier(ClusterUtils.SHARD_PREFIX_QNAME))
                    .withValue(path)
                    .build())
            .withChild(ImmutableContainerNodeBuilder.create()
                    .withNodeIdentifier(new NodeIdentifier(ClusterUtils.SHARD_REPLICAS_QNAME))
                    .withChild(replicaListBuilder.build())
                    .build())
            .build();

    final ClientTransaction tx = history.createTransaction();
    final DOMDataTreeWriteCursor cursor = tx.openCursor();

    ClusterUtils.SHARD_LIST_PATH.getPathArguments().forEach(cursor::enter);

    cursor.write(newEntry.getIdentifier(), newEntry);
    cursor.close();

    return tx.ready();
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:38,代码来源:PrefixedShardConfigWriter.java

示例11: createTestContainer

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode; //导入依赖的package包/类
public static ContainerNode createTestContainer() {

        final LeafSetEntryNode<Object> nike = ImmutableLeafSetEntryNodeBuilder.create()
                .withNodeIdentifier(
                        new YangInstanceIdentifier.NodeWithValue<>(QName.create(TEST_QNAME, "shoe"), "nike"))
                .withValue("nike").build();
        final LeafSetEntryNode<Object> puma = ImmutableLeafSetEntryNodeBuilder.create()
                .withNodeIdentifier(
                        new YangInstanceIdentifier.NodeWithValue<>(QName.create(TEST_QNAME, "shoe"), "puma"))
                .withValue("puma").build();
        final LeafSetNode<Object> shoes = ImmutableLeafSetNodeBuilder.create()
                .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(QName.create(TEST_QNAME, "shoe")))
                .withChild(nike).withChild(puma).build();

        final LeafSetEntryNode<Object> five = ImmutableLeafSetEntryNodeBuilder.create()
                .withNodeIdentifier(new YangInstanceIdentifier.NodeWithValue<>(QName.create(TEST_QNAME, "number"), 5))
                .withValue(5).build();
        final LeafSetEntryNode<Object> fifteen = ImmutableLeafSetEntryNodeBuilder.create()
                .withNodeIdentifier(
                        new YangInstanceIdentifier.NodeWithValue<>(QName.create(TEST_QNAME, "number"), 15))
                .withValue(15).build();
        final LeafSetNode<Object> numbers = ImmutableLeafSetNodeBuilder.create()
                .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(QName.create(TEST_QNAME, "number")))
                .withChild(five).withChild(fifteen).build();

        Set<QName> childAugmentations = new HashSet<>();
        childAugmentations.add(AUG_QNAME);
        final YangInstanceIdentifier.AugmentationIdentifier augmentationIdentifier =
                new YangInstanceIdentifier.AugmentationIdentifier(childAugmentations);
        final AugmentationNode augmentationNode = Builders.augmentationBuilder()
                .withNodeIdentifier(augmentationIdentifier).withChild(ImmutableNodes.leafNode(AUG_QNAME, "First Test"))
                .build();
        return ImmutableContainerNodeBuilder.create()
                .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME))
                .withChild(ImmutableNodes.leafNode(DESC_QNAME, DESC)).withChild(augmentationNode).withChild(shoes)
                .withChild(numbers).withChild(mapNodeBuilder(OUTER_LIST_QNAME)
                        .withChild(mapEntry(OUTER_LIST_QNAME, ID_QNAME, ONE_ID)).withChild(BAR_NODE).build())
                .build();

    }
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:41,代码来源:CompositeModel.java

示例12: testLeafSetNodeCandidate

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testLeafSetNodeCandidate() throws Exception {
    YangInstanceIdentifier.NodeWithValue entryPathArg = new YangInstanceIdentifier.NodeWithValue(LEAF_SET, "one");
    YangInstanceIdentifier leafSetPath = YangInstanceIdentifier.builder(TestModel.TEST_PATH).node(LEAF_SET).build();

    LeafSetEntryNode leafSetEntryNode = Builders.leafSetEntryBuilder().withNodeIdentifier(entryPathArg)
            .withValue("one").build();
    NormalizedNode<?, ?> leafSetNode = Builders.leafSetBuilder().withNodeIdentifier(
            new YangInstanceIdentifier.NodeIdentifier(LEAF_SET)).withChild(leafSetEntryNode).build();

    candidate = DataTreeCandidates.fromNormalizedNode(leafSetPath, leafSetNode);
    CommitTransactionPayload payload = CommitTransactionPayload.create(nextTransactionId(), candidate);
    assertCandidateEquals(candidate, payload.getCandidate().getValue());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:16,代码来源:CommitTransactionPayloadTest.java

示例13: testOrderedLeafSetNodeCandidate

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testOrderedLeafSetNodeCandidate() throws Exception {
    YangInstanceIdentifier.NodeWithValue entryPathArg = new YangInstanceIdentifier.NodeWithValue(LEAF_SET, "one");
    YangInstanceIdentifier leafSetPath = YangInstanceIdentifier.builder(TestModel.TEST_PATH).node(LEAF_SET).build();

    LeafSetEntryNode leafSetEntryNode = Builders.leafSetEntryBuilder().withNodeIdentifier(entryPathArg)
            .withValue("one").build();
    NormalizedNode<?, ?> leafSetNode = Builders.orderedLeafSetBuilder().withNodeIdentifier(
            new YangInstanceIdentifier.NodeIdentifier(LEAF_SET)).withChild(leafSetEntryNode).build();

    candidate = DataTreeCandidates.fromNormalizedNode(leafSetPath, leafSetNode);
    CommitTransactionPayload payload = CommitTransactionPayload.create(nextTransactionId(), candidate);
    assertCandidateEquals(candidate, payload.getCandidate().getValue());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:16,代码来源:CommitTransactionPayloadTest.java

示例14: leafSetEntryBuilder

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
private NormalizedNodeAttrBuilder<NodeWithValue, Object,
                                  LeafSetEntryNode<Object>> leafSetEntryBuilder() {
    if (leafSetEntryBuilder == null) {
        leafSetEntryBuilder = Builders.leafSetEntryBuilder();
    }

    return leafSetEntryBuilder;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:10,代码来源:NormalizedNodeInputStreamReader.java

示例15: testLeafSetEntryNodeNotPrunedWhenHasParent

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode; //导入依赖的package包/类
@Test
public void testLeafSetEntryNodeNotPrunedWhenHasParent() throws IOException {
    NormalizedNodePruner pruner = prunerFullSchema(TestModel.TEST_PATH.node(TestModel.SHOE_QNAME));
    LeafSetEntryNode<Object> child = Builders.leafSetEntryBuilder().withValue("puma").withNodeIdentifier(
            new NodeWithValue<>(TestModel.SHOE_QNAME, "puma")).build();
    NormalizedNode<?, ?> input = Builders.leafSetBuilder().withNodeIdentifier(
            new NodeIdentifier(TestModel.SHOE_QNAME)).withChild(child).build();
    NormalizedNodeWriter.forStreamWriter(pruner).write(input);

    NormalizedNode<?, ?> actual = pruner.normalizedNode();
    assertEquals("normalizedNode", input, actual);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:13,代码来源:NormalizedNodePrunerTest.java


注:本文中的org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。