use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev190104.yang.library.parameters.ModuleSetBuilder in project mdsal by opendaylight.
the class YangLibraryContentBuilderImpl method formatYangLibrary.
@NonNull
ContainerNode formatYangLibrary() {
// Two-step process: we first build the content and then use hashCode() to generate module-set-id
final YangLibraryBuilder builder = new YangLibraryBuilder().setContentId("");
final ModuleSetBuilder moduleSetBuilder = new ModuleSetBuilder().setModule(modelContext.getModules().stream().map(YangLibraryContentBuilderImpl::buildModule).collect(BindingMap.toMap())).setName(MODULE_SET_NAME);
final ModuleSet moduleSet = moduleSetBuilder.build();
builder.setModuleSet(Map.of(new ModuleSetKey(moduleSet.getName()), moduleSet));
return (ContainerNode) codec.serialize(builder.setContentId(String.valueOf(builder.build().hashCode())).build());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev190104.yang.library.parameters.ModuleSetBuilder in project netconf by opendaylight.
the class YangLibraryTest method createTestModuleSet.
private static YangLibrary createTestModuleSet() {
Submodule sub = new SubmoduleBuilder().setName(new YangIdentifier("test-submodule")).setRevision(ImportOnlyModuleRevisionBuilder.emptyRevision().getRevisionIdentifier()).build();
Module modules = new ModuleBuilder().setName(new YangIdentifier("test-module_2013-07-22")).setNamespace(new Uri("test:namespace")).setRevision(new RevisionIdentifier("2013-07-22")).setSubmodule(ImmutableMap.of(sub.key(), sub)).build();
Module yangLibrary = new ModuleBuilder().setName(new YangIdentifier("ietf-yang-library_2019-01-04")).setNamespace(new Uri("urn:ietf:params:xml:ns:yang:ietf-yang-library")).setRevision(new RevisionIdentifier("2019-01-04")).build();
ModuleSet modulesSet = new ModuleSetBuilder().setName("state-modules").setModule(ImmutableMap.of(modules.key(), modules, yangLibrary.key(), yangLibrary)).build();
Schema schema = new SchemaBuilder().setName("state-schema").setModuleSet(Collections.singletonList(modulesSet.getName())).build();
Datastore datastore = new DatastoreBuilder().setName(Operational.class).setSchema(schema.getName()).build();
return new YangLibraryBuilder().setModuleSet(BindingMap.of(modulesSet)).setSchema(BindingMap.of(schema)).setDatastore(BindingMap.of(datastore)).setContentId("0").build();
}
Aggregations