Search in sources :

Example 1 with DefaultBindingRuntimeContext

use of org.opendaylight.mdsal.binding.runtime.api.DefaultBindingRuntimeContext in project mdsal by opendaylight.

the class CurrentAdapterSerializerTest method fromNormalizedNode.

private static Entry<InstanceIdentifier<?>, DataObject> fromNormalizedNode(final NormalizedNode data, final EffectiveModelContext schemaCtx) {
    final CurrentAdapterSerializer codec = new CurrentAdapterSerializer(new BindingCodecContext(new DefaultBindingRuntimeContext(new DefaultBindingRuntimeGenerator().generateTypeMapping(schemaCtx), TestingModuleInfoSnapshot.INSTANCE)));
    final YangInstanceIdentifier path = YangInstanceIdentifier.create(NodeIdentifier.create(QName.create("urn:test", "2017-01-01", "cont")));
    return codec.fromNormalizedNode(path, data);
}
Also used : BindingCodecContext(org.opendaylight.mdsal.binding.dom.codec.impl.BindingCodecContext) DefaultBindingRuntimeGenerator(org.opendaylight.mdsal.binding.generator.impl.DefaultBindingRuntimeGenerator) DefaultBindingRuntimeContext(org.opendaylight.mdsal.binding.runtime.api.DefaultBindingRuntimeContext) YangInstanceIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier)

Example 2 with DefaultBindingRuntimeContext

use of org.opendaylight.mdsal.binding.runtime.api.DefaultBindingRuntimeContext in project lighty-netconf-simulator by PANTHEONtech.

the class NetconfDeviceServicesImpl method createAdapterContext.

private AdapterContext createAdapterContext(Collection<YangModuleInfo> moduleInfos) {
    final YangParserFactory yangParserFactory = new DefaultYangParserFactory();
    ModuleInfoSnapshotResolver snapshotResolver = new ModuleInfoSnapshotResolver("netconf-simulator", yangParserFactory);
    snapshotResolver.registerModuleInfos(moduleInfos);
    ModuleInfoSnapshot moduleInfoSnapshot = snapshotResolver.takeSnapshot();
    final BindingRuntimeGenerator bindingRuntimeGenerator = new DefaultBindingRuntimeGenerator();
    final BindingRuntimeTypes bindingRuntimeTypes = bindingRuntimeGenerator.generateTypeMapping(moduleInfoSnapshot.getEffectiveModelContext());
    final DefaultBindingRuntimeContext bindingRuntimeContext = new DefaultBindingRuntimeContext(bindingRuntimeTypes, moduleInfoSnapshot);
    final BindingCodecContext bindingCodecContext = new BindingCodecContext(bindingRuntimeContext);
    return new ConstantAdapterContext(bindingCodecContext);
}
Also used : ModuleInfoSnapshot(org.opendaylight.mdsal.binding.runtime.api.ModuleInfoSnapshot) ConstantAdapterContext(org.opendaylight.mdsal.binding.dom.adapter.ConstantAdapterContext) DefaultBindingRuntimeGenerator(org.opendaylight.mdsal.binding.generator.impl.DefaultBindingRuntimeGenerator) BindingCodecContext(org.opendaylight.mdsal.binding.dom.codec.impl.BindingCodecContext) BindingRuntimeTypes(org.opendaylight.mdsal.binding.runtime.api.BindingRuntimeTypes) DefaultYangParserFactory(org.opendaylight.yangtools.yang.parser.impl.DefaultYangParserFactory) ModuleInfoSnapshotResolver(org.opendaylight.mdsal.binding.runtime.spi.ModuleInfoSnapshotResolver) DefaultBindingRuntimeContext(org.opendaylight.mdsal.binding.runtime.api.DefaultBindingRuntimeContext) YangParserFactory(org.opendaylight.yangtools.yang.parser.api.YangParserFactory) DefaultYangParserFactory(org.opendaylight.yangtools.yang.parser.impl.DefaultYangParserFactory) DefaultBindingRuntimeGenerator(org.opendaylight.mdsal.binding.generator.impl.DefaultBindingRuntimeGenerator) BindingRuntimeGenerator(org.opendaylight.mdsal.binding.runtime.api.BindingRuntimeGenerator)

Aggregations

BindingCodecContext (org.opendaylight.mdsal.binding.dom.codec.impl.BindingCodecContext)2 DefaultBindingRuntimeGenerator (org.opendaylight.mdsal.binding.generator.impl.DefaultBindingRuntimeGenerator)2 DefaultBindingRuntimeContext (org.opendaylight.mdsal.binding.runtime.api.DefaultBindingRuntimeContext)2 ConstantAdapterContext (org.opendaylight.mdsal.binding.dom.adapter.ConstantAdapterContext)1 BindingRuntimeGenerator (org.opendaylight.mdsal.binding.runtime.api.BindingRuntimeGenerator)1 BindingRuntimeTypes (org.opendaylight.mdsal.binding.runtime.api.BindingRuntimeTypes)1 ModuleInfoSnapshot (org.opendaylight.mdsal.binding.runtime.api.ModuleInfoSnapshot)1 ModuleInfoSnapshotResolver (org.opendaylight.mdsal.binding.runtime.spi.ModuleInfoSnapshotResolver)1 YangInstanceIdentifier (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier)1 YangParserFactory (org.opendaylight.yangtools.yang.parser.api.YangParserFactory)1 DefaultYangParserFactory (org.opendaylight.yangtools.yang.parser.impl.DefaultYangParserFactory)1