本文整理汇总了Java中org.opendaylight.yangtools.yang.model.api.Module.getAugmentations方法的典型用法代码示例。如果您正苦于以下问题:Java Module.getAugmentations方法的具体用法?Java Module.getAugmentations怎么用?Java Module.getAugmentations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opendaylight.yangtools.yang.model.api.Module
的用法示例。
在下文中一共展示了Module.getAugmentations方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: emitBodyNodes
import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
private void emitBodyNodes(final Module input) {
for (final ExtensionDefinition extension : input.getExtensionSchemaNodes()) {
emitExtension(extension);
}
for (final FeatureDefinition definition : input.getFeatures()) {
emitFeature(definition);
}
for (final IdentitySchemaNode identity : input.getIdentities()) {
emitIdentity(identity);
}
for (final Deviation deviation : input.getDeviations()) {
emitDeviation(deviation);
}
emitDataNodeContainer(input);
for (final AugmentationSchemaNode augmentation : input.getAugmentations()) {
emitAugment(augmentation);
}
for (final RpcDefinition rpc : input.getRpcs()) {
emitRpc(rpc);
}
emitNotifications(input.getNotifications());
}
示例2: testActionStatementInDataContainers
import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
@Test
public void testActionStatementInDataContainers() throws Exception {
final SchemaContext schemaContext = StmtTestUtils.parseYangSource("/rfc7950/action-stmt/foo.yang");
assertNotNull(schemaContext);
assertContainsActions(schemaContext, "root", "grp-action", "aug-action");
assertContainsActions(schemaContext, "top-list", "top-list-action");
assertContainsActions(schemaContext, "top", "top-action");
final Set<GroupingDefinition> groupings = schemaContext.getGroupings();
assertEquals(1, groupings.size());
assertContainsActions(groupings.iterator().next(), "grp-action");
final Set<Module> modules = schemaContext.getModules();
assertEquals(1, modules.size());
final Module foo = modules.iterator().next();
final Set<AugmentationSchemaNode> augmentations = foo.getAugmentations();
assertEquals(1, augmentations.size());
assertContainsActions(augmentations.iterator().next(), "aug-action", "grp-action");
}
示例3: notificationsInDataContainersTest
import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
@Test
public void notificationsInDataContainersTest() throws Exception {
final SchemaContext schemaContext = StmtTestUtils
.parseYangSource("/rfc7950/notifications-in-data-nodes/foo.yang");
assertNotNull(schemaContext);
assertContainsNotifications(schemaContext, "root", "grp-notification", "aug-notification");
assertContainsNotifications(schemaContext, "top-list", "top-list-notification");
assertContainsNotifications(schemaContext, "top", "top-notification");
final Set<GroupingDefinition> groupings = schemaContext.getGroupings();
assertEquals(1, groupings.size());
assertContainsNotifications(groupings.iterator().next(), "grp-notification");
final Set<Module> modules = schemaContext.getModules();
assertEquals(1, modules.size());
final Module foo = modules.iterator().next();
final Set<AugmentationSchemaNode> augmentations = foo.getAugmentations();
assertEquals(1, augmentations.size());
assertContainsNotifications(augmentations.iterator().next(), "aug-notification", "grp-notification");
}
示例4: testDeclaredAugment
import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
@Test
public void testDeclaredAugment() throws ReactorException {
final StatementStreamSource augmentStmtModule =
sourceForResource("/declared-statements-test/augment-declared-test.yang");
final SchemaContext schemaContext = StmtTestUtils.parseYangSources(augmentStmtModule);
assertNotNull(schemaContext);
final Module testModule = schemaContext.findModules("augment-declared-test").iterator().next();
assertNotNull(testModule);
final Set<AugmentationSchemaNode> augmentationSchemas = testModule.getAugmentations();
assertNotNull(augmentationSchemas);
assertEquals(1, augmentationSchemas.size());
final AugmentationSchemaNode augmentationSchema = augmentationSchemas.iterator().next();
final AugmentStatement augmentStatement = ((AugmentEffectiveStatement) augmentationSchema).getDeclared();
final SchemaNodeIdentifier targetNode = augmentStatement.getTargetNode();
assertNotNull(targetNode);
final Collection<? extends DataDefinitionStatement> augmentStatementDataDefinitions =
augmentStatement.getDataDefinitions();
assertNotNull(augmentStatementDataDefinitions);
assertEquals(1, augmentStatementDataDefinitions.size());
}
示例5: testAugment
import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
@Test
public void testAugment() {
final Module testModule = TestUtils.findModule(context, "main-impl").get();
assertNotNull(testModule);
final Set<AugmentationSchemaNode> augmentations = testModule.getAugmentations();
assertEquals(1, augmentations.size());
final Iterator<AugmentationSchemaNode> augmentIterator = augmentations.iterator();
final AugmentationSchemaNode augment = augmentIterator.next();
assertNotNull(augment);
assertTrue(augment.getTargetPath().toString().contains(
"(urn:opendaylight:params:xml:ns:yang:controller:config?revision=2013-04-05)modules, "
+ "(urn:opendaylight:params:xml:ns:yang:controller:config?revision=2013-04-05)module, "
+ "(urn:opendaylight:params:xml:ns:yang:controller:config?revision=2013-04-05)configuration"));
assertEquals(1, augment.getChildNodes().size());
final CaseSchemaNode caseNode = (CaseSchemaNode) augment.getDataChildByName(QName.create(
testModule.getQNameModule(), "main-impl"));
assertNotNull(caseNode);
}
示例6: testUses
import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
@Test
public void testUses() {
final Module testModule = TestUtils.findModule(context, "main-impl").get();
assertNotNull(testModule);
final Set<AugmentationSchemaNode> augmentations = testModule.getAugmentations();
assertEquals(1, augmentations.size());
final Iterator<AugmentationSchemaNode> augmentIterator = augmentations.iterator();
final AugmentationSchemaNode augment = augmentIterator.next();
final CaseSchemaNode caseNode = (CaseSchemaNode) augment.getDataChildByName(
QName.create(testModule.getQNameModule(), "main-impl"));
assertNotNull(caseNode);
final ContainerSchemaNode container = (ContainerSchemaNode) caseNode.getDataChildByName(QName.create(
testModule.getQNameModule(), "notification-service"));
assertNotNull(container);
assertEquals(1, container.getUses().size());
final UsesNode usesNode = container.getUses().iterator().next();
assertNotNull(usesNode);
assertTrue(usesNode.getGroupingPath().toString()
.contains("[(urn:opendaylight:params:xml:ns:yang:controller:config?revision=2013-04-05)service-ref]"));
assertEquals(1, usesNode.getRefines().size());
}
示例7: testBug5884
import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
@Test
public void testBug5884() throws Exception {
final SchemaContext context = StmtTestUtils.parseYangSources("/bugs/bug5884");
assertNotNull(context);
final QName root = QName.create(NS, REV, "main-container");
final QName choice = QName.create(NS, REV, "test-choice");
final QName testContainerQname = QName.create(NS, REV, "test");
final Module foo = context.findModule("foo", Revision.of("2016-01-01")).get();
final ContainerSchemaNode rootContainer = (ContainerSchemaNode) context.getDataChildByName(root);
final ContainerSchemaNode testContainer = (ContainerSchemaNode) rootContainer.getDataChildByName(
testContainerQname);
final ChoiceSchemaNode dataChildByName = (ChoiceSchemaNode) testContainer.getDataChildByName(choice);
final Set<AugmentationSchemaNode> augmentations = foo.getAugmentations();
final Set<AugmentationSchemaNode> availableAugmentations = dataChildByName.getAvailableAugmentations();
final Iterator<AugmentationSchemaNode> iterator = augmentations.iterator();
final Iterator<AugmentationSchemaNode> availableIterator = availableAugmentations.iterator();
testIterator(iterator);
testIterator(availableIterator);
}
示例8: salDomBrokerImplModuleTest
import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
private static void salDomBrokerImplModuleTest(final SchemaContext context) {
final Module module = context.findModule("opendaylight-sal-dom-broker-impl", Revision.of("2013-10-28")).get();
final Set<AugmentationSchemaNode> augmentations = module.getAugmentations();
boolean checked = false;
for (final AugmentationSchemaNode augmentationSchema : augmentations) {
final DataSchemaNode dataNode = augmentationSchema
.getDataChildByName(QName.create(module.getQNameModule(), "dom-broker-impl"));
if (dataNode instanceof CaseSchemaNode) {
final CaseSchemaNode caseNode = (CaseSchemaNode) dataNode;
final DataSchemaNode dataNode2 = caseNode
.getDataChildByName(QName.create(module.getQNameModule(), "async-data-broker"));
if (dataNode2 instanceof ContainerSchemaNode) {
final ContainerSchemaNode containerNode = (ContainerSchemaNode) dataNode2;
final DataSchemaNode leaf = containerNode
.getDataChildByName(QName.create(module.getQNameModule(), "type"));
final List<UnknownSchemaNode> unknownSchemaNodes = leaf.getUnknownSchemaNodes();
assertEquals(1, unknownSchemaNodes.size());
final UnknownSchemaNode unknownSchemaNode = unknownSchemaNodes.get(0);
assertEquals("dom-async-data-broker", unknownSchemaNode.getQName().getLocalName());
assertEquals(unknownSchemaNode.getQName(), unknownSchemaNode.getPath().getLastComponent());
checked = true;
}
}
}
assertTrue(checked);
}
示例9: effectiveBuildTest
import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
@Test
public void effectiveBuildTest() throws SourceException, ReactorException {
SchemaContext result = RFC7950Reactors.defaultReactor().newBuild()
.addSources(ROOT_MODULE, IMPORTED_MODULE, SUBMODULE)
.buildEffective();
assertNotNull(result);
Module rootModule = result.findModules("root").iterator().next();
assertNotNull(rootModule);
assertEquals("root-pref", rootModule.getPrefix());
assertEquals(YangVersion.VERSION_1, rootModule.getYangVersion());
assertEquals(Optional.of("cisco"), rootModule.getOrganization());
assertEquals(Optional.of("cisco email"), rootModule.getContact());
final ContainerSchemaNode contSchemaNode = (ContainerSchemaNode) rootModule.getDataChildByName(CONT);
assertNotNull(contSchemaNode);
final Set<AugmentationSchemaNode> augmentations = rootModule.getAugmentations();
assertEquals(1, augmentations.size());
assertEquals(CONT_SCHEMA_PATH, augmentations.iterator().next().getTargetPath());
final Set<ModuleImport> imports = rootModule.getImports();
assertEquals(1, imports.size());
final ModuleImport importStmt = imports.iterator().next();
assertNotNull(importStmt);
assertEquals("imported", importStmt.getModuleName());
assertEquals(Optional.of(REVISION), importStmt.getRevision());
assertEquals("imp-pref", importStmt.getPrefix());
final Set<Module> submodules = rootModule.getSubmodules();
assertEquals(1, submodules.size());
assertEquals("submod", submodules.iterator().next().getName());
final Set<NotificationDefinition> notifications = rootModule.getNotifications();
assertEquals(1, notifications.size());
assertEquals("notif1", notifications.iterator().next().getQName().getLocalName());
final Set<RpcDefinition> rpcs = rootModule.getRpcs();
assertEquals(1, rpcs.size());
assertEquals("rpc1", rpcs.iterator().next().getQName().getLocalName());
final Set<Deviation> deviations = rootModule.getDeviations();
assertEquals(1, deviations.size());
final Deviation deviationStmt = deviations.iterator().next();
assertNotNull(deviationStmt);
final QNameModule importedModuleQName = QNameModule.create(URI.create("imported"), REVISION);
final QName importedContQName = QName.create(importedModuleQName, "cont");
final SchemaPath importedContSchemaPath = SchemaPath.create(true, importedContQName);
assertEquals(importedContSchemaPath, deviationStmt.getTargetPath());
assertEquals(DeviateKind.ADD, deviationStmt.getDeviates().iterator().next().getDeviateType());
assertEquals(Optional.of("deviate reference"), deviationStmt.getReference());
final Set<IdentitySchemaNode> identities = rootModule.getIdentities();
assertEquals(1, identities.size());
assertEquals("identity1", identities.iterator().next().getQName().getLocalName());
final Set<FeatureDefinition> features = rootModule.getFeatures();
assertEquals(1, features.size());
final FeatureDefinition featureStmt = features.iterator().next();
assertNotNull(featureStmt);
assertEquals(FEATURE1, featureStmt.getQName());
assertEquals(FEATURE1_SCHEMA_PATH, featureStmt.getPath());
assertEquals(Optional.of("feature1 description"), featureStmt.getDescription());
assertEquals(Optional.of("feature1 reference"), featureStmt.getReference());
assertEquals(Status.CURRENT, featureStmt.getStatus());
final List<ExtensionDefinition> extensionSchemaNodes = rootModule.getExtensionSchemaNodes();
assertEquals(1, extensionSchemaNodes.size());
assertEquals("ext1", extensionSchemaNodes.iterator().next().getQName().getLocalName());
}