use of org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode in project controller by opendaylight.
the class SchemaContextTest method findIdentityByQName.
IdentitySchemaNode findIdentityByQName(final Module module, final QName qName) {
Map<QName, IdentitySchemaNode> mapIdentitiesByQNames = mapIdentitiesByQNames(module);
IdentitySchemaNode found = mapIdentitiesByQNames.get(qName);
assertNotNull(found);
return found;
}
use of org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode in project controller by opendaylight.
the class ModuleMXBeanEntryBuilder method build.
public Map<String, ModuleMXBeanEntry> build() {
LOG.debug("Generating ModuleMXBeans of {} to package {}", currentModule.getNamespace(), packageName);
String configModulePrefix;
try {
configModulePrefix = getConfigModulePrefixFromImport(currentModule);
} catch (IllegalArgumentException e) {
// this currentModule does not import config currentModule
return Collections.emptyMap();
}
// get identities of base config:currentModule-type
Map<String, IdentitySchemaNode> moduleIdentities = getIdentityMap();
Map<String, QName> uniqueGeneratedClassesNames = new HashMap<>();
// each currentModule name should have an augmentation defined
Map<String, IdentitySchemaNode> unaugmentedModuleIdentities = new HashMap<>(moduleIdentities);
Map<String, ModuleMXBeanEntry> result = new HashMap<>();
for (AugmentationSchemaNode augmentation : currentModule.getAugmentations()) {
Collection<DataSchemaNode> childNodes = augmentation.getChildNodes();
if (areAllChildrenCaseSchemaNodes(childNodes)) {
for (CaseSchemaNode childCase : castChildNodesToChoiceCases(childNodes)) {
// TODO refactor, extract to standalone builder class
processCaseSchemaNode(result, uniqueGeneratedClassesNames, configModulePrefix, moduleIdentities, unaugmentedModuleIdentities, augmentation, childCase);
}
}
// skip if child nodes are not all cases
}
// clean up nulls
cleanUpNulls(result);
// check attributes name uniqueness
checkAttributeNamesUniqueness(uniqueGeneratedClassesNames, result);
checkUnaugumentedIdentities(unaugmentedModuleIdentities);
LOG.debug("Number of ModuleMXBeans to be generated: {}", result.size());
return result;
}
Aggregations