Java Code Examples for org.opendaylight.yangtools.yang.model.api.Module#getUnknownSchemaNodes()
The following examples show how to use
org.opendaylight.yangtools.yang.model.api.Module#getUnknownSchemaNodes() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: YangDataExtensionTest.java From yangtools with Eclipse Public License 1.0 | 6 votes |
@Test public void testIfFeatureStatementBeingIgnoredInYangDataBody() throws Exception { final SchemaContext schemaContext = reactor.newBuild().setSupportedFeatures(ImmutableSet.of()) .addSources(FOOBAR_MODULE, IETF_RESTCONF_MODULE).buildEffective(); assertNotNull(schemaContext); final Module foobar = schemaContext.findModule("foobar", REVISION).get(); final Collection<? extends UnknownSchemaNode> unknownSchemaNodes = foobar.getUnknownSchemaNodes(); assertEquals(1, unknownSchemaNodes.size()); final UnknownSchemaNode unknownSchemaNode = unknownSchemaNodes.iterator().next(); assertTrue(unknownSchemaNode instanceof YangDataSchemaNode); final YangDataSchemaNode myYangDataNode = (YangDataSchemaNode) unknownSchemaNode; assertNotNull(myYangDataNode); final ContainerSchemaNode contInYangData = myYangDataNode.getContainerSchemaNode(); assertNotNull(contInYangData); final ContainerSchemaNode innerCont = (ContainerSchemaNode) contInYangData.findDataChildByName( QName.create(foobar.getQNameModule(), "inner-cont")).get(); assertNotNull(innerCont); final ContainerSchemaNode grpCont = (ContainerSchemaNode) contInYangData.findDataChildByName( QName.create(foobar.getQNameModule(), "grp-cont")).get(); assertNotNull(grpCont); }
Example 2
Source File: YangDataExtensionTest.java From yangtools with Eclipse Public License 1.0 | 5 votes |
@Test public void testYangData() throws Exception { final SchemaContext schemaContext = reactor.newBuild().addSources(FOO_MODULE, IETF_RESTCONF_MODULE) .buildEffective(); assertNotNull(schemaContext); final Collection<? extends ExtensionDefinition> extensions = schemaContext.getExtensions(); assertEquals(1, extensions.size()); final Module foo = schemaContext.findModule(FOO_QNAMEMODULE).get(); final Collection<? extends UnknownSchemaNode> unknownSchemaNodes = foo.getUnknownSchemaNodes(); assertEquals(2, unknownSchemaNodes.size()); YangDataSchemaNode myYangDataANode = null; YangDataSchemaNode myYangDataBNode = null; for (final UnknownSchemaNode unknownSchemaNode : unknownSchemaNodes) { assertTrue(unknownSchemaNode instanceof YangDataSchemaNode); final YangDataSchemaNode yangDataSchemaNode = (YangDataSchemaNode) unknownSchemaNode; if (MY_YANG_DATA_A.equals(yangDataSchemaNode.getQName())) { myYangDataANode = yangDataSchemaNode; } else if (MY_YANG_DATA_B.equals(yangDataSchemaNode.getQName())) { myYangDataBNode = yangDataSchemaNode; } } assertNotNull(myYangDataANode); assertNotNull(myYangDataBNode); assertNotNull(myYangDataANode.getContainerSchemaNode()); assertNotNull(myYangDataBNode.getContainerSchemaNode()); }
Example 3
Source File: YangDataExtensionTest.java From yangtools with Eclipse Public License 1.0 | 5 votes |
@Test public void testConfigStatementBeingIgnoredInYangDataBody() throws Exception { final SchemaContext schemaContext = reactor.newBuild().addSources(BAZ_MODULE, IETF_RESTCONF_MODULE) .buildEffective(); assertNotNull(schemaContext); final Module baz = schemaContext.findModule("baz", REVISION).get(); final Collection<? extends UnknownSchemaNode> unknownSchemaNodes = baz.getUnknownSchemaNodes(); assertEquals(1, unknownSchemaNodes.size()); final UnknownSchemaNode unknownSchemaNode = unknownSchemaNodes.iterator().next(); assertTrue(unknownSchemaNode instanceof YangDataSchemaNode); final YangDataSchemaNode myYangDataNode = (YangDataSchemaNode) unknownSchemaNode; assertNotNull(myYangDataNode); final ContainerSchemaNode contInYangData = myYangDataNode.getContainerSchemaNode(); assertNotNull(contInYangData); assertTrue(contInYangData.isConfiguration()); final ContainerSchemaNode innerCont = (ContainerSchemaNode) contInYangData.findDataChildByName( QName.create(baz.getQNameModule(), "inner-cont")).get(); assertNotNull(innerCont); assertTrue(innerCont.isConfiguration()); final ContainerSchemaNode grpCont = (ContainerSchemaNode) contInYangData.findDataChildByName( QName.create(baz.getQNameModule(), "grp-cont")).get(); assertNotNull(grpCont); assertTrue(grpCont.isConfiguration()); }
Example 4
Source File: AnnotationSchemaNode.java From yangtools with Eclipse Public License 1.0 | 5 votes |
/** * Find all annotations supported by a SchemaContext. * * @param context SchemaContext to search * @return {@link AnnotationSchemaNode}s supported by the SchemaContext.. * @throws NullPointerException if context is null */ static @NonNull Map<QName, AnnotationSchemaNode> findAll(final SchemaContext context) { final Builder<QName, AnnotationSchemaNode> builder = ImmutableMap.builder(); for (Module module : context.getModules()) { for (UnknownSchemaNode node : module.getUnknownSchemaNodes()) { if (node instanceof AnnotationSchemaNode) { builder.put(node.getQName(), (AnnotationSchemaNode) node); } } } return builder.build(); }