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


Java LeafSetNode类代码示例

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


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

示例1: testExportedAttributesSetFirst

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

    // make sure our AS is prepended to the list (as the AS-PATH starts with AS-SET)
    final LeafSetNode<?> list = checkFirstLeafList(exportedAttributes);
    assertEquals(ourAs, list.getValue().iterator().next().getValue());
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:19,代码来源:AttributeOperationsTest.java

示例2: testExportedAttributesListFirst

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; //导入依赖的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

示例3: testExportedAttributesEmptyWithTransitive

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; //导入依赖的package包/类
@Test
public void testExportedAttributesEmptyWithTransitive() {
    final Long ourAs = 72L;
    final ContainerNode attributesSetBefore = 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())
        .addChild(Builders.containerBuilder().withNodeIdentifier(AS_PATH_NID)
            .addChild(Builders.unkeyedListBuilder().withNodeIdentifier(SEGMENTS_NID).build())
        .build())
        .addChild(Builders.containerBuilder().withNodeIdentifier(ATOMIC_NID).build())
        .build();
    final AttributeOperations operations  = AttributeOperations.getInstance(attributesSetBefore);
    final ContainerNode exportedAttributes = operations.exportedAttributes(attributesSetBefore, ourAs);

    // Origin should be within exportedAttributes as it is Transitive
    assertTrue(exportedAttributes.getChild(ORIGIN_NID).isPresent());

    // AS-PATH should also be there with our AS
    final LeafSetNode<?> list = checkFirstLeafList(exportedAttributes);
    assertEquals(1, list.getValue().size());
    assertEquals(ourAs, list.getValue().iterator().next().getValue());

    // Atomic Aggregate should be filtered out
    assertFalse(exportedAttributes.getChild(ATOMIC_NID).isPresent());
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:27,代码来源:AttributeOperationsTest.java

示例4: getNodeReferencedByLeafref

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; //导入依赖的package包/类
private static NormalizedNode<?, ?> getNodeReferencedByLeafref(final RevisionAwareXPath xpath,
        final NormalizedNodeContext currentNodeContext, final SchemaContext schemaContext,
        final TypedDataSchemaNode correspondingSchemaNode, final Object nodeValue) {
    final NormalizedNode<?, ?> referencedNode = xpath.isAbsolute() ? getNodeReferencedByAbsoluteLeafref(xpath,
            currentNodeContext, schemaContext, correspondingSchemaNode) : getNodeReferencedByRelativeLeafref(xpath,
            currentNodeContext, schemaContext, correspondingSchemaNode);

    if (referencedNode instanceof LeafSetNode) {
        return getReferencedLeafSetEntryNode((LeafSetNode<?>) referencedNode, nodeValue);
    }

    if (referencedNode instanceof LeafNode && referencedNode.getValue().equals(nodeValue)) {
        return referencedNode;
    }

    return null;
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:18,代码来源:YangFunctionContext.java

示例5: resolveWrittenShard

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void resolveWrittenShard(final DataTreeCandidateNode childNode) {
    final MapEntryNode entryNode = (MapEntryNode) childNode.getDataAfter().get();
    final LeafNode<YangInstanceIdentifier> prefix =
            (LeafNode<YangInstanceIdentifier>) entryNode.getChild(new NodeIdentifier(SHARD_PREFIX_QNAME)).get();

    final YangInstanceIdentifier identifier = prefix.getValue();

    LOG.debug("{}: Deserialized {} from datastore", logName, identifier);

    final ContainerNode replicas =
            (ContainerNode) entryNode.getChild(new NodeIdentifier(SHARD_REPLICAS_QNAME)).get();

    final LeafSetNode<String> replicaList =
            (LeafSetNode<String>) replicas.getChild(new NodeIdentifier(SHARD_REPLICA_QNAME)).get();

    final List<MemberName> retReplicas = replicaList.getValue().stream()
            .map(child -> MemberName.forName(child.getValue()))
            .collect(Collectors.toList());

    LOG.debug("{}: Replicas read from ds {}", logName, retReplicas.toString());

    final PrefixShardConfiguration newConfig =
            new PrefixShardConfiguration(new DOMDataTreeIdentifier(type, identifier),
                    PrefixShardStrategy.NAME, retReplicas);

    LOG.debug("{}: Resulting config {} - sending PrefixShardCreated to {}", logName, newConfig, handlingActor);

    handlingActor.tell(new PrefixShardCreated(newConfig), noSender());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:31,代码来源:PrefixedShardConfigUpdateHandler.java

示例6: createTestContainer

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; //导入依赖的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

示例7: extractAsList

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; //导入依赖的package包/类
private static List<AsNumber> extractAsList(final UnkeyedListEntryNode segment, final NodeIdentifier nid) {
    final List<AsNumber> ases = new ArrayList<>();
    final Optional<NormalizedNode<?, ?>> maybeAsList = NormalizedNodes.findNode(segment, nid);
    if (maybeAsList.isPresent()) {
        final LeafSetNode<?> list = (LeafSetNode<?>)maybeAsList.get();
        for (final LeafSetEntryNode<?> as : list.getValue())  {
            ases.add(new AsNumber((Long)as.getValue()));
        }
        return ases;
    }
    return null;
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:13,代码来源:BestPathStateImpl.java

示例8: effectiveAttributes

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; //导入依赖的package包/类
@Override
public ContainerNode effectiveAttributes(final ContainerNode attributes) {
    final AttributeOperations oper = AttributeOperations.getInstance(attributes);

    /*
     * This is an implementation of https://tools.ietf.org/html/rfc4456#section-8
     *
     * We first check the ORIGINATOR_ID, if present. If it matches our BGP identifier,
     * we filter the route.
     */
    final Object originatorId = oper.getOriginatorId(attributes);
    if (this.bgpIdentifier.getValue().equals(originatorId)) {
        LOG.debug("Filtering route with our ORIGINATOR_ID {}", this.bgpIdentifier);
        return null;
    }

    /*
     * Second we check CLUSTER_LIST, if present. If it contains our CLUSTER_ID, we issue
     * a warning and ignore the route.
     */
    final LeafSetNode<?> clusterList = oper.getClusterList(attributes);
    if (clusterList != null) {
        for (final LeafSetEntryNode<?> node : clusterList.getValue()) {
            if (this.clusterIdentifier.getValue().equals(node.getValue())) {
                LOG.info("Received a route with our CLUSTER_ID {} in CLUSTER_LIST {}, filtering it", this.clusterIdentifier.getValue(), clusterList);
                return null;
            }
        }
    }

    return attributes;
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:33,代码来源:FromInternalImportPolicy.java

示例9: reusableSegment

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; //导入依赖的package包/类
private LeafSetNode<?> reusableSegment(final UnkeyedListEntryNode segment) {
    final Optional<NormalizedNode<?, ?>> maybeAsSequence = NormalizedNodes.findNode(segment, this.asPathSequence);
    if (maybeAsSequence.isPresent()) {
        final LeafSetNode<?> asList = (LeafSetNode<?>) maybeAsSequence.get();
        if (asList.getValue().size() < Values.UNSIGNED_BYTE_MAX_VALUE) {
            return asList;
        }
    }
    return null;
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:11,代码来源:AttributeOperations.java

示例10: addOtherClusterEntries

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; //导入依赖的package包/类
private static void addOtherClusterEntries(final Optional<NormalizedNode<?, ?>> maybeClusterList, final ListNodeBuilder<Object,
    LeafSetEntryNode<Object>> clb) {
    final NormalizedNode<?, ?> clusterList = maybeClusterList.get();
    if (clusterList instanceof LeafSetNode) {
        for (final LeafSetEntryNode<?> n : ((LeafSetNode<?>) clusterList).getValue()) {
            // There's no way we can safely avoid this cast
            @SuppressWarnings("unchecked")
            final LeafSetEntryNode<Object> child = (LeafSetEntryNode<Object>) n;
            clb.addChild(child);
        }
    } else {
        LOG.warn("Ignoring malformed CLUSTER_LIST {}", clusterList);
    }
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:15,代码来源:AttributeOperations.java

示例11: getClusterList

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; //导入依赖的package包/类
LeafSetNode<?> getClusterList(final ContainerNode attributes) {
    final Optional<NormalizedNode<?, ?>> maybeClusterList = NormalizedNodes.findNode(attributes, this.clusterListPath);
    if (maybeClusterList.isPresent()) {
        final NormalizedNode<?, ?> clusterList = maybeClusterList.get();
        if (clusterList instanceof LeafSetNode) {
            return (LeafSetNode<?>) clusterList;
        }

        LOG.warn("Unexpected CLUSTER_LIST node {}, ignoring it", clusterList);
    }

    return null;
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:14,代码来源:AttributeOperations.java

示例12: checkFirstLeafList

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; //导入依赖的package包/类
private static LeafSetNode<?> checkFirstLeafList(final ContainerNode exportedAttributes) {
    assertTrue(NormalizedNodes.findNode(exportedAttributes, AS_PATH_NID, SEGMENTS_NID).isPresent());
    final UnkeyedListNode segments = (UnkeyedListNode) NormalizedNodes.findNode(exportedAttributes, AS_PATH_NID, SEGMENTS_NID).get();
    final UnkeyedListEntryNode seg = segments.getValue().iterator().next();
    final DataContainerChild<? extends PathArgument, ?> firstLeafList = seg.getValue().iterator().next();
    return (LeafSetNode<?>) firstLeafList;
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:8,代码来源:AttributeOperationsTest.java

示例13: create

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; //导入依赖的package包/类
public static <T> ListNodeBuilder<T, LeafSetEntryNode<T>> create(final LeafSetNode<T> node) {
    if (!(node instanceof ImmutableOrderedLeafSetNode<?>)) {
        throw new UnsupportedOperationException(String.format("Cannot initialize from class %s", node.getClass()));
    }

    return new ImmutableOrderedLeafSetNodeBuilder<>((ImmutableOrderedLeafSetNode<T>) node);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:8,代码来源:ImmutableOrderedLeafSetNodeBuilder.java

示例14: create

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; //导入依赖的package包/类
public static <T> ListNodeBuilder<T, LeafSetEntryNode<T>> create(final LeafListSchemaNode schema,
        final LeafSetNode<T> node) {
    if (!(node instanceof ImmutableOrderedLeafSetNode<?>)) {
        throw new UnsupportedOperationException(String.format("Cannot initialize from class %s", node.getClass()));
    }

    return new ImmutableOrderedLeafSetNodeSchemaAwareBuilder<>(schema, (ImmutableOrderedLeafSetNode<T>) node);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:9,代码来源:ImmutableOrderedLeafSetNodeSchemaAwareBuilder.java

示例15: create

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; //导入依赖的package包/类
public static <T> ListNodeBuilder<T, LeafSetEntryNode<T>> create(final LeafListSchemaNode schema,
        final LeafSetNode<T> node) {
    if (!(node instanceof ImmutableLeafSetNode<?>)) {
        throw new UnsupportedOperationException(String.format("Cannot initialize from class %s", node.getClass()));
    }

    return new ImmutableLeafSetNodeSchemaAwareBuilder<>(schema, (ImmutableLeafSetNode<T>) node);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:9,代码来源:ImmutableLeafSetNodeSchemaAwareBuilder.java


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