use of org.opendaylight.mdsal.binding.generator.impl.DefaultBindingRuntimeGenerator 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);
}
use of org.opendaylight.mdsal.binding.generator.impl.DefaultBindingRuntimeGenerator 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);
}
Aggregations