Do not use SchemaContext.findModule(URI),
which looks for a module instance with specified namespace
and no revision.
Such lookup fails for modules with revision defined.
Instead (as already done in AbstractEdit)
use SchemaContext.findModules and take the newest module
if more than one module with the same namespace is found.
Change-Id: I7b6bdcb9156669645e19a6395e1b74995328154d
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
(cherry picked from commit
69c92b2bee54681ebb5c0bfaf89d269877e0b747)
//this returns module with the newest revision if more then 1 module with same namespace is found
private Optional<Module> getModule(final URI namespaceURI) {
//this returns module with the newest revision if more then 1 module with same namespace is found
private Optional<Module> getModule(final URI namespaceURI) {
- return Optional.fromJavaUtil(schemaContext.getCurrentContext().findModule(namespaceURI));
+ return Optional.fromJavaUtil(schemaContext.getCurrentContext().findModules(namespaceURI).stream().findFirst());
}
private static Optional<RpcDefinition> getRpcDefinitionFromModule(final Module module, final URI namespaceURI,
}
private static Optional<RpcDefinition> getRpcDefinitionFromModule(final Module module, final URI namespaceURI,
@Nonnull final SchemaPath type, @Nullable final NormalizedNode<?, ?> input) {
final Collection<DataContainerChild<? extends PathArgument, ?>> children =
(Collection<DataContainerChild<? extends PathArgument, ?>>) input.getValue();
@Nonnull final SchemaPath type, @Nullable final NormalizedNode<?, ?> input) {
final Collection<DataContainerChild<? extends PathArgument, ?>> children =
(Collection<DataContainerChild<? extends PathArgument, ?>>) input.getValue();
- final Module module = schemaContext.findModule(type.getLastComponent().getNamespace()).orElse(null);
+ final Module module = schemaContext.findModules(type.getLastComponent().getNamespace()).stream()
+ .findFirst().orElse(null);
final RpcDefinition rpcDefinition = getRpcDefinitionFromModule(
module, module.getNamespace(), type.getLastComponent().getLocalName());
final ContainerSchemaNode outputSchemaNode = rpcDefinition.getOutput();
final RpcDefinition rpcDefinition = getRpcDefinitionFromModule(
module, module.getNamespace(), type.getLastComponent().getLocalName());
final ContainerSchemaNode outputSchemaNode = rpcDefinition.getOutput();
namespace "urn:opendaylight:mdsal:mapping:rpc:test";
prefix "rpc";
namespace "urn:opendaylight:mdsal:mapping:rpc:test";
prefix "rpc";
+ revision "2015-04-08";
+
rpc void-input-output-rpc {
}
rpc void-input-output-rpc {
}