• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ChoiceNode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: createTable

import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode; //导入依赖的package包/类
void createTable(final DOMDataWriteTransaction tx) {
    final DataContainerNodeBuilder<NodeIdentifierWithPredicates, MapEntryNode> tb =
            ImmutableNodes.mapEntryBuilder();
    tb.withNodeIdentifier((NodeIdentifierWithPredicates) this.tableId.getLastPathArgument());
    tb.withChild(EMPTY_TABLE_ATTRIBUTES);

    // tableId is keyed, but that fact is not directly visible from YangInstanceIdentifier, see BUG-2796
    final NodeIdentifierWithPredicates tableKey =
            (NodeIdentifierWithPredicates) this.tableId.getLastPathArgument();
    for (final Map.Entry<QName, Object> e : tableKey.getKeyValues().entrySet()) {
        tb.withChild(ImmutableNodes.leafNode(e.getKey(), e.getValue()));
    }

    final ChoiceNode routes = this.tableSupport.emptyRoutes();
    Verify.verifyNotNull(routes, "Null empty routes in %s", this.tableSupport);

    tx.put(LogicalDatastoreType.OPERATIONAL, this.tableId,
            tb.withChild(ImmutableChoiceNodeBuilder.create(routes).withNodeIdentifier(
                    new NodeIdentifier(TablesUtil.BMP_ROUTES_QNAME)).build()).build());
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:21,代码来源:TableContext.java


示例2: extractFlowspec

import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode; //导入依赖的package包/类
public static void extractFlowspec(final ChoiceNode fsType, final FlowspecBuilder fsBuilder) {
    if (fsType.getChild(AbstractFlowspecNlriParser.DEST_PREFIX_NID).isPresent()) {
        fsBuilder.setFlowspecType(
            new DestinationPrefixCaseBuilder()
                .setDestinationPrefix(
                    new Ipv4Prefix((String) fsType.getChild(AbstractFlowspecNlriParser.DEST_PREFIX_NID).get().getValue())
                ).build()
        );
    } else if (fsType.getChild(AbstractFlowspecNlriParser.SOURCE_PREFIX_NID).isPresent()) {
        fsBuilder.setFlowspecType(
            new SourcePrefixCaseBuilder()
                .setSourcePrefix(
                    new Ipv4Prefix((String) fsType.getChild(AbstractFlowspecNlriParser.SOURCE_PREFIX_NID).get().getValue())
                ).build()
        );
    } else if (fsType.getChild(PROTOCOL_IP_NID).isPresent()) {
        fsBuilder.setFlowspecType(new ProtocolIpCaseBuilder().setProtocolIps(createProtocolsIps((UnkeyedListNode) fsType.getChild(PROTOCOL_IP_NID).get())).build());
    }
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:20,代码来源:FlowspecIpv4NlriParserHelper.java


示例3: extractFlowspec

import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode; //导入依赖的package包/类
public final List<Flowspec> extractFlowspec(final DataContainerNode<?> route) {
    requireNonNull(route, "Cannot extract flowspec from null route.");
    final List<Flowspec> fsList = new ArrayList<>();
    final Optional<DataContainerChild<? extends PathArgument, ?>> flowspecs = route.getChild(FLOWSPEC_NID);
    if (flowspecs.isPresent()) {
        for (final UnkeyedListEntryNode flowspec : ((UnkeyedListNode) flowspecs.get()).getValue()) {
            final FlowspecBuilder fsBuilder = new FlowspecBuilder();
            final Optional<DataContainerChild<?, ?>> flowspecType = flowspec.getChild(FLOWSPEC_TYPE_NID);
            if (flowspecType.isPresent()) {
                final ChoiceNode fsType = (ChoiceNode) flowspecType.get();
                processFlowspecType(fsType, fsBuilder);
            }
            fsList.add(fsBuilder.build());
        }
    }
    return fsList;
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:18,代码来源:AbstractFlowspecNlriParser.java


示例4: processFlowspecType

import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode; //导入依赖的package包/类
private void processFlowspecType(final ChoiceNode fsType, final FlowspecBuilder fsBuilder) {
    if (fsType.getChild(PORTS_NID).isPresent()) {
        fsBuilder.setFlowspecType(new PortCaseBuilder().setPorts(createPorts((UnkeyedListNode) fsType.getChild(PORTS_NID).get())).build());
    } else if (fsType.getChild(DEST_PORT_NID).isPresent()) {
        fsBuilder.setFlowspecType(new DestinationPortCaseBuilder().setDestinationPorts(createDestinationPorts((UnkeyedListNode) fsType.getChild(DEST_PORT_NID).get())).build());
    } else if (fsType.getChild(SOURCE_PORT_NID).isPresent()) {
        fsBuilder.setFlowspecType(new SourcePortCaseBuilder().setSourcePorts(createSourcePorts((UnkeyedListNode) fsType.getChild(SOURCE_PORT_NID).get())).build());
    } else if (fsType.getChild(ICMP_TYPE_NID).isPresent()) {
        fsBuilder.setFlowspecType(new IcmpTypeCaseBuilder().setTypes(createTypes((UnkeyedListNode) fsType.getChild(ICMP_TYPE_NID).get())).build());
    } else if (fsType.getChild(ICMP_CODE_NID).isPresent()) {
        fsBuilder.setFlowspecType(new IcmpCodeCaseBuilder().setCodes(createCodes((UnkeyedListNode) fsType.getChild(ICMP_CODE_NID).get())).build());
    } else if (fsType.getChild(TCP_FLAGS_NID).isPresent()) {
        fsBuilder.setFlowspecType(new TcpFlagsCaseBuilder().setTcpFlags(createTcpFlags((UnkeyedListNode) fsType.getChild(TCP_FLAGS_NID).get())).build());
    } else if (fsType.getChild(PACKET_LENGTHS_NID).isPresent()) {
        fsBuilder.setFlowspecType(new PacketLengthCaseBuilder().setPacketLengths(createPacketLengths((UnkeyedListNode) fsType.getChild(PACKET_LENGTHS_NID).get())).build());
    } else if (fsType.getChild(DSCP_NID).isPresent()) {
        fsBuilder.setFlowspecType(new DscpCaseBuilder().setDscps(createDscpsLengths((UnkeyedListNode) fsType.getChild(DSCP_NID).get())).build());
    } else if (fsType.getChild(FRAGMENT_NID).isPresent()) {
        fsBuilder.setFlowspecType(new FragmentCaseBuilder().setFragments(createFragments((UnkeyedListNode) fsType.getChild(FRAGMENT_NID).get())).build());
    } else {
        extractSpecificFlowspec(fsType, fsBuilder);
    }
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:24,代码来源:AbstractFlowspecNlriParser.java


示例5: extractFlowspec

import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode; //导入依赖的package包/类
public static void extractFlowspec(final ChoiceNode fsType, final FlowspecBuilder fsBuilder) {
    if (fsType.getChild(AbstractFlowspecNlriParser.DEST_PREFIX_NID).isPresent()) {
        fsBuilder.setFlowspecType(
            new DestinationIpv6PrefixCaseBuilder()
                .setDestinationPrefix(new Ipv6Prefix((String) fsType.getChild(AbstractFlowspecNlriParser.DEST_PREFIX_NID).get().getValue()))
                .build()
        );
    } else if (fsType.getChild(AbstractFlowspecNlriParser.SOURCE_PREFIX_NID).isPresent()) {
        fsBuilder.setFlowspecType(
            new SourceIpv6PrefixCaseBuilder()
                .setSourcePrefix(new Ipv6Prefix((String) fsType.getChild(AbstractFlowspecNlriParser.SOURCE_PREFIX_NID).get().getValue()))
                .build()
        );
    } else if (fsType.getChild(NEXT_HEADER_NID).isPresent()) {
        fsBuilder.setFlowspecType(new NextHeaderCaseBuilder().setNextHeaders(createNextHeaders((UnkeyedListNode) fsType.getChild(NEXT_HEADER_NID).get())).build());
    } else if (fsType.getChild(FLOW_LABEL_NID).isPresent()) {
        fsBuilder.setFlowspecType(new FlowLabelCaseBuilder().setFlowLabel(createFlowLabels((UnkeyedListNode) fsType.getChild(FLOW_LABEL_NID).get())).build());
    }
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:20,代码来源:FlowspecIpv6NlriParserHelper.java


示例6: extractLinkstateDestination

import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode; //导入依赖的package包/类
public static CLinkstateDestination extractLinkstateDestination(final DataContainerNode<? extends PathArgument> linkstate) {
    final CLinkstateDestinationBuilder builder = new CLinkstateDestinationBuilder();
    serializeCommonParts(builder, linkstate);

    final ChoiceNode objectType = (ChoiceNode) linkstate.getChild(OBJECT_TYPE_NID).get();
    if (objectType.getChild(ADVERTISING_NODE_DESCRIPTORS_NID).isPresent()) {
        serializeAdvertisedNodeDescriptor(builder, objectType);
    } else if (objectType.getChild(LOCAL_NODE_DESCRIPTORS_NID).isPresent()) {
        serializeLocalNodeDescriptor(builder, objectType);
    } else if (objectType.getChild(NODE_DESCRIPTORS_NID).isPresent()) {
        serializeNodeDescriptor(builder, objectType);
    } else if (AbstractTeLspNlriCodec.isTeLsp(objectType)) {
        builder.setObjectType(AbstractTeLspNlriCodec.serializeTeLsp(objectType));
    } else {
        LOG.warn("Unknown Object Type: {}.", objectType);
    }
    return builder.build();
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:19,代码来源:LinkstateNlriParser.java


示例7: serializeLocalNodeDescriptor

import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode; //导入依赖的package包/类
private static void serializeLocalNodeDescriptor(final CLinkstateDestinationBuilder builder, final ChoiceNode objectType) {
    // link local node descriptors
    final LinkCaseBuilder linkBuilder = new LinkCaseBuilder();

    linkBuilder.setLocalNodeDescriptors(NodeNlriParser.serializeLocalNodeDescriptors((ContainerNode) objectType.getChild(LOCAL_NODE_DESCRIPTORS_NID).get()));
    // link remote node descriptors
    if (objectType.getChild(REMOTE_NODE_DESCRIPTORS_NID).isPresent()) {
        linkBuilder.setRemoteNodeDescriptors(NodeNlriParser.serializeRemoteNodeDescriptors((ContainerNode) objectType.getChild(REMOTE_NODE_DESCRIPTORS_NID).get()));
    }
    // link descriptors
    final Optional<DataContainerChild<? extends PathArgument, ?>> linkDescriptors = objectType.getChild(LINK_DESCRIPTORS_NID);
    if (linkDescriptors.isPresent()) {
        linkBuilder.setLinkDescriptors(LinkNlriParser.serializeLinkDescriptors((ContainerNode) linkDescriptors.get()));
    }
    builder.setObjectType(linkBuilder.build());
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:17,代码来源:LinkstateNlriParser.java


示例8: serializeRouterId

import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode; //导入依赖的package包/类
private static CRouterIdentifier serializeRouterId(final ContainerNode descriptorsData) {
    CRouterIdentifier cRouterId = null;
    final Optional<DataContainerChild<? extends PathArgument, ?>> maybeRouterId = descriptorsData.getChild(ROUTER_NID);
    if (maybeRouterId.isPresent()) {
        final ChoiceNode routerId = (ChoiceNode) maybeRouterId.get();
        if (routerId.getChild(ISIS_NODE_NID).isPresent()) {
            cRouterId = serializeIsisNode((ContainerNode) routerId.getChild(ISIS_NODE_NID).get());
        } else if (routerId.getChild(ISIS_PSEUDONODE_NID).isPresent()) {
            cRouterId = serializeIsisPseudoNode((ContainerNode) routerId.getChild(ISIS_PSEUDONODE_NID).get());
        } else if (routerId.getChild(OSPF_NODE_NID).isPresent()) {
            cRouterId = serializeOspfNode((ContainerNode) routerId.getChild(OSPF_NODE_NID).get());
        } else if (routerId.getChild(OSPF_PSEUDONODE_NID).isPresent()) {
            cRouterId = serializeOspfPseudoNode((ContainerNode) routerId.getChild(OSPF_PSEUDONODE_NID).get());
        }
    }
    return cRouterId;
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:18,代码来源:NodeNlriParser.java


示例9: createEmptyTableStructure

import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode; //导入依赖的package包/类
@Override
public void createEmptyTableStructure(final DOMDataWriteTransaction tx, final YangInstanceIdentifier tableId) {
    final DataContainerNodeBuilder<NodeIdentifierWithPredicates, MapEntryNode> tb = ImmutableNodes.mapEntryBuilder();
    tb.withNodeIdentifier((NodeIdentifierWithPredicates)tableId.getLastPathArgument());
    tb.withChild(EMPTY_TABLE_ATTRIBUTES);

    // tableId is keyed, but that fact is not directly visible from YangInstanceIdentifier, see BUG-2796
    final NodeIdentifierWithPredicates tableKey = (NodeIdentifierWithPredicates) tableId.getLastPathArgument();
    for (final Entry<QName, Object> e : tableKey.getKeyValues().entrySet()) {
        tb.withChild(ImmutableNodes.leafNode(e.getKey(), e.getValue()));
    }

    final ChoiceNode routes = this.ribSupport.emptyRoutes();
    Verify.verifyNotNull(routes, "Null empty routes in %s", this.ribSupport);
    Verify.verify(Routes.QNAME.equals(routes.getNodeType()), "Empty routes have unexpected identifier %s, expected %s", routes.getNodeType(), Routes.QNAME);

    tx.put(LogicalDatastoreType.OPERATIONAL, tableId, tb.withChild(routes).build());
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:19,代码来源:RIBSupportContextImpl.java


示例10: setUp

import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode; //导入依赖的package包/类
@Override
@Before
public void setUp() throws Exception {
    super.setUp();

    Mockito.doReturn(mock(GeneratedClassLoadingStrategy.class)).when(this.extension).getClassLoadingStrategy();
    Mockito.doReturn(this.ribSupport).when(this.extension).getRIBSupport(any(TablesKey.class));
    final NodeIdentifier nii = new NodeIdentifier(QName.create("", "test").intern());
    Mockito.doReturn(nii).when(this.ribSupport).routeAttributesIdentifier();
    Mockito.doReturn(ImmutableSet.of()).when(this.ribSupport).cacheableAttributeObjects();
    final ChoiceNode choiceNode = mock(ChoiceNode.class);
    Mockito.doReturn(choiceNode).when(this.ribSupport).emptyRoutes();
    Mockito.doReturn(nii).when(choiceNode).getIdentifier();
    Mockito.doReturn(QName.create("", "test").intern()).when(choiceNode).getNodeType();
    Mockito.doReturn(this.domTx).when(this.domDataBroker).createTransactionChain(any());
    final DOMDataTreeChangeService dOMDataTreeChangeService = mock(DOMDataTreeChangeService.class);
    Mockito.doReturn(Collections.singletonMap(DOMDataTreeChangeService.class, dOMDataTreeChangeService))
            .when(this.domDataBroker).getSupportedExtensions();
    Mockito.doReturn(this.dataTreeRegistration).when(this.domSchemaService).registerSchemaContextListener(any());
    Mockito.doNothing().when(this.dataTreeRegistration).close();
    Mockito.doReturn(mock(ListenerRegistration.class)).when(dOMDataTreeChangeService)
            .registerDataTreeChangeListener(any(), any());
    Mockito.doNothing().when(this.serviceRegistration).unregister();
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:25,代码来源:RibImplTest.java


示例11: parserTest

import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode; //导入依赖的package包/类
@Test
public void parserTest() {
    final EsRouteCase expected = new EsRouteCaseBuilder().setEsRoute(new EsRouteBuilder()
            .setEsi(LAN_AUT_GEN_CASE).setOrigRouteIp(IP).build()).build();
    assertArrayEquals(RESULT, ByteArray.getAllBytes(this.parser.serializeEvpn(expected,
            Unpooled.wrappedBuffer(ROUDE_DISTIN))));

    final EvpnChoice result = this.parser.parseEvpn(Unpooled.wrappedBuffer(VALUE));
    assertEquals(expected, result);

    final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifier, ChoiceNode> choice = Builders
            .choiceBuilder();
    choice.withNodeIdentifier(EthSegRParser.ES_ROUTE_NID);
    final ContainerNode arbitraryC = createContBuilder(EthSegRParser.ES_ROUTE_NID)
            .addChild(LanParserTest.createLanChoice())
            .addChild(createValueBuilder(IP_MODEL, ORI_NID).build()).build();
    final EvpnChoice modelResult = this.parser.serializeEvpnModel(arbitraryC);
    assertEquals(expected, modelResult);

    final EvpnChoice keyResult = this.parser.createRouteKey(arbitraryC);
    assertEquals(expected, keyResult);
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:23,代码来源:EthSegRParserTest.java


示例12: parser2Test

import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode; //导入依赖的package包/类
@Test
public void parser2Test() {
    final EsRouteCase expected = new EsRouteCaseBuilder().setEsRoute(new EsRouteBuilder()
            .setEsi(LAN_AUT_GEN_CASE).setOrigRouteIp(IPV6).build()).build();
    assertArrayEquals(RESULT2, ByteArray.getAllBytes(this.parser.serializeEvpn(expected,
            Unpooled.wrappedBuffer(ROUDE_DISTIN))));

    final EvpnChoice result = this.parser.parseEvpn(Unpooled.wrappedBuffer(VALUE2));
    assertEquals(expected, result);

    final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifier, ChoiceNode> choice = Builders
            .choiceBuilder();
    choice.withNodeIdentifier(EthSegRParser.ES_ROUTE_NID);
    final ContainerNode arbitraryC = createContBuilder(EthSegRParser.ES_ROUTE_NID)
            .addChild(LanParserTest.createLanChoice())
            .addChild(createValueBuilder(IPV6_MODEL, ORI_NID).build()).build();
    final EvpnChoice modelResult = this.parser.serializeEvpnModel(arbitraryC);
    assertEquals(expected, modelResult);

    final EvpnChoice keyResult = this.parser.createRouteKey(arbitraryC);
    assertEquals(expected, keyResult);
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:23,代码来源:EthSegRParserTest.java


示例13: parserTest

import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode; //导入依赖的package包/类
@Test
public void parserTest() {

    final IncMultiEthernetTagResCase expected = IncMultEthTagRParserTest.createIncMultiCase();
    assertArrayEquals(RESULT, ByteArray.getAllBytes(this.parser.serializeEvpn(expected,
            Unpooled.wrappedBuffer(ROUDE_DISTIN))));

    final EvpnChoice result = this.parser.parseEvpn(Unpooled.wrappedBuffer(VALUE));
    assertEquals(expected, result);

    final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> choice = Builders.choiceBuilder();
    choice.withNodeIdentifier(IncMultEthTagRParser.INC_MULT_ROUTE_NID);
    final ContainerNode incMult = createContBuilder(IncMultEthTagRParser.INC_MULT_ROUTE_NID).addChild(createEti())
        .addChild(createValueBuilder(IP_MODEL, ORI_NID).build()).build();
    final EvpnChoice modelResult = this.parser.serializeEvpnModel(incMult);
    assertEquals(expected, modelResult);

    final EvpnChoice keyResult = this.parser.createRouteKey(incMult);
    assertEquals(expected, keyResult);
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:21,代码来源:IncMultEthTagRParserTest.java


示例14: parserCase2Test

import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode; //导入依赖的package包/类
@Test
public void parserCase2Test() {

    final MacIpAdvRouteCase expected = new MacIpAdvRouteCaseBuilder().setMacIpAdvRoute(new MacIpAdvRouteBuilder()
            .setEsi(LAN_AUT_GEN_CASE).setEthernetTagId(ETI).setMacAddress(MAC).setIpAddress(IPV6)
            .setMplsLabel1(MPLS_LABEL).build()).build();
    assertArrayEquals(RESULT2, ByteArray.getAllBytes(this.parser.serializeEvpn(expected,
            Unpooled.wrappedBuffer(ROUDE_DISTIN))));

    final EvpnChoice result = this.parser.parseEvpn(Unpooled.wrappedBuffer(VALUE2));
    assertEquals(expected, result);

    final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> choice = Builders.choiceBuilder();
    choice.withNodeIdentifier(MACIpAdvRParser.MAC_IP_ADV_ROUTE_NID);
    final ContainerNode macIp = createContBuilder(MACIpAdvRParser.MAC_IP_ADV_ROUTE_NID)
            .addChild(LanParserTest.createLanChoice()).addChild(createEti())
        .addChild(createValueBuilder(MAC_MODEL, MAC_NID).build())
            .addChild(createValueBuilder(IPV6_MODEL, IP_NID).build())
        .addChild(createValueBuilder(MPLS_LABEL_MODEL, MPLS1_NID).build()).build();
    final EvpnChoice modelResult = this.parser.serializeEvpnModel(macIp);

    assertEquals(expected, modelResult);
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:24,代码来源:MACIpAdvRParserTest.java


示例15: enforceCases

import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode; //导入依赖的package包/类
private void enforceCases(final NormalizedNode<?, ?> normalizedNode) {
    Verify.verify(normalizedNode instanceof ChoiceNode);
    final Collection<DataContainerChild<?, ?>> children = ((ChoiceNode) normalizedNode).getValue();
    if (!children.isEmpty()) {
        final DataContainerChild<?, ?> firstChild = children.iterator().next();
        final CaseEnforcer enforcer = Verify.verifyNotNull(caseEnforcers.get(firstChild.getIdentifier()),
            "Case enforcer cannot be null. Most probably, child node %s of choice node %s does not belong "
            + "in current tree type.", firstChild.getIdentifier(), normalizedNode.getIdentifier());

        // Make sure no leaves from other cases are present
        for (final CaseEnforcer other : exclusions.get(enforcer)) {
            for (final PathArgument id : other.getAllChildIdentifiers()) {
                final Optional<NormalizedNode<?, ?>> maybeChild = NormalizedNodes.getDirectChild(normalizedNode,
                    id);
                Preconditions.checkArgument(!maybeChild.isPresent(),
                    "Child %s (from case %s) implies non-presence of child %s (from case %s), which is %s",
                    firstChild.getIdentifier(), enforcer, id, other, maybeChild.orElse(null));
            }
        }

        // Make sure all mandatory children are present
        enforcer.enforceOnTreeNode(normalizedNode);
    }
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:25,代码来源:ChoiceModificationStrategy.java


示例16: createCon3Node

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

        final CollectionNodeBuilder<MapEntryNode, MapNode> mapBuilder = Builders
                .mapBuilder();
        mapBuilder.withNodeIdentifier(new NodeIdentifier(list3InChoice));

        mapBuilder.addChild(createList3Entry("k1", "val1", "valA", "valX"));
        mapBuilder.addChild(createList3Entry("k2", "val2", "valB", "valY"));

        final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> choiceBuilder = Builders
                .choiceBuilder();
        choiceBuilder.withNodeIdentifier(new NodeIdentifier(choiceInCon3));

        choiceBuilder.addChild(mapBuilder.build());

        final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> containerBuilder = Builders
                .containerBuilder();
        containerBuilder.withNodeIdentifier(new NodeIdentifier(con3));

        containerBuilder.addChild(choiceBuilder.build());

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


示例17: testOnDataCaseLeafFail

import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode; //导入依赖的package包/类
@Test(expected = VerifyException.class)
public void testOnDataCaseLeafFail() throws DataValidationFailedException {
    final DataTree inMemoryDataTree = new InMemoryDataTreeFactory().create(
        DataTreeConfiguration.DEFAULT_CONFIGURATION, schemaContext);
    final YangInstanceIdentifier.NodeIdentifier choice1Id = new YangInstanceIdentifier.NodeIdentifier(QName.create(
            TestModel.TEST_QNAME, "choice1"));
    final YangInstanceIdentifier ii = TestModel.TEST_PATH.node(choice1Id);
    final ChoiceNode choice1 = Builders.choiceBuilder().withNodeIdentifier(choice1Id)
            .withChild(leafNode(QName.create(TestModel.TEST_QNAME, "case1-leaf1"), "leaf-value")).build();

    final DataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
    modificationTree.write(ii, choice1);
    modificationTree.ready();
    inMemoryDataTree.validate(modificationTree);
    final DataTreeCandidate prepare = inMemoryDataTree.prepare(modificationTree);
    inMemoryDataTree.commit(prepare);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:18,代码来源:ConfigStatementValidationTest.java


示例18: testEmptyRoute

import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode; //导入依赖的package包/类
@Test
public void testEmptyRoute() throws Exception {
    final Routes empty = new FlowspecL3vpnIpv4RoutesCaseBuilder().setFlowspecL3vpnIpv4Routes(
        new FlowspecL3vpnIpv4RoutesBuilder().setFlowspecL3vpnRoute(Collections.emptyList()).build()).build();
    final ChoiceNode emptyRoutes = RIB_SUPPORT.emptyRoutes();
    assertEquals(createRoutes(empty), emptyRoutes);
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:8,代码来源:FlowspecL3vpnIpv4RIBSupportTest.java


示例19: testEmptyRoute

import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode; //导入依赖的package包/类
@Test
public void testEmptyRoute() throws Exception {
    final Routes empty = new FlowspecRoutesCaseBuilder().setFlowspecRoutes(
        new FlowspecRoutesBuilder().setFlowspecRoute(Collections.emptyList()).build()).build();
    final ChoiceNode emptyRoutes = RIB_SUPPORT.emptyRoutes();
    assertEquals(createRoutes(empty), emptyRoutes);
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:8,代码来源:FlowspecIpv4RIBSupportTest.java


示例20: testEmptyRoute

import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode; //导入依赖的package包/类
@Test
public void testEmptyRoute() throws Exception {
    final Routes empty = new FlowspecL3vpnIpv6RoutesCaseBuilder().setFlowspecL3vpnIpv6Routes(
        new FlowspecL3vpnIpv6RoutesBuilder().setFlowspecL3vpnRoute(Collections.emptyList()).build()).build();
    final ChoiceNode emptyRoutes = RIB_SUPPORT.emptyRoutes();
    assertEquals(createRoutes(empty), emptyRoutes);
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:8,代码来源:FlowspecL3vpnIpv6RIBSupportTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ArrowFactory类代码示例发布时间:2022-05-22
下一篇:
Java AnnotatedField类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap