[YANGTOOLS-613] SchemaResolutionException caused by multiple revisions of model and its dependent models in the runtime Created: 18/May/16  Updated: 10/Apr/22  Resolved: 10/Apr/17

Status: Resolved
Project: yangtools
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Srini Seetharaman Assignee: Unassigned
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


External issue ID: 5906

 Description   

I have an application that has a dependency on the IETF standard model shown below. So, I have ietf-network@2015-12-08.yang and ietf-network-topology@2015-12-08.yang in my controller system.

module ietf-network-topology {
namespace "urn:ietf:params:xml:ns:yang:ietf-network-topology";
prefix nt;
...
import ietf-network

{ prefix nd; }

revision 2015-12-08 { }
...
}

Although the IETF model doesn't specify the revision of ietf-network that it depends on, it actually depends on the ietf-network@2015-12-08.yang (There was a model change in Nov 2015 that makes this dependency important).

In my controller, I also have odl-mdsal-models feature installed with ietf-network bundle of version 1.0.1-Beryllium-SR1. This bundle includes ietf-network-topology@2015-06-08.yang and ietf-network@2015-06-08.yang.

Since yangtools picks the latest version, the ietf-network@2015-06-08.yang is not visible to other modules. However, ietf-network-topology@2015-06-08.yang is not suppressed from the runtime. This causes dependency issues because yangtools offers ietf-network@2015-12-08 to ietf-network-topology@2015-06-08's import. This throws the following error:

2016-05-17 21:14:45,632 | ERROR | Event Dispatcher | BuildGlobalContext | 79 - org.opendaylight.yangtools.yang-parser-impl - 0.8.1.Beryl
lium-SR1 | Error 1: Augment target 'Absolute

{path=[(urn:ietf:params:xml:ns:yang:ietf-network?revision=2015-12-08)network, (urn:ietf:params:xml:ns:yang :ietf-network?revision=2015-12-08)node]}

' not found [at ietf-network-topology:186:2]

SchemaResolutionException{unsatisfiedImports={}}
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)[:1.8.0_72]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)[:1.8.0_72]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)[:1.8.0_72]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)[:1.8.0_72]
at org.opendaylight.yangtools.util.concurrent.ReflectiveExceptionMapper.newWithCause(ReflectiveExceptionMapper.java:31)[64:org.opendaylight.yangtools.util:0.8.1.Beryllium-SR1]
at org.opendaylight.yangtools.util.concurrent.ExceptionMapper.apply(ExceptionMapper.java:80)[64:org.opendaylight.yangtools.util:0.8.1.Beryllium-SR1]
at org.opendaylight.yangtools.util.concurrent.ExceptionMapper.apply(ExceptionMapper.java:31)[64:org.opendaylight.yangtools.util:0.8.1.Beryllium-SR1]
at com.google.common.util.concurrent.Futures$MappingCheckedFuture.mapException(Futures.java:1809)[61:com.google.guava:18.0.0]
at com.google.common.util.concurrent.AbstractCheckedFuture.checkedGet(AbstractCheckedFuture.java:85)[61:com.google.guava:18.0.0]
at org.opendaylight.yangtools.yang.parser.repo.YangTextSchemaContextResolver.getSchemaContext(YangTextSchemaContextResolver.java:206)[79:org.opendaylight.yangtools.yang-parser-impl:0.8.1.Beryllium-SR1]
at org.opendaylight.yangtools.sal.binding.generator.impl.ModuleInfoBackedContext.tryToCreateSchemaContext(ModuleInfoBackedContext.java:86)[88:org.opendaylight.mdsal.binding-generator-impl:0.8.1.Beryllium-SR1]
at org.opendaylight.yangtools.sal.binding.generator.impl.ModuleInfoBackedContext.getSchemaContext(ModuleInfoBackedContext.java:192)[88:org.opendaylight.mdsal.binding-generator-impl:0.8.1.Beryllium-SR1]
at org.opendaylight.controller.config.manager.impl.osgi.mapping.BindingContextProvider.update(BindingContextProvider.java:25)
at org.opendaylight.controller.config.manager.impl.osgi.mapping.RefreshingSCPModuleInfoRegistry.updateService(RefreshingSCPModuleInfoRegistry.java:57)
at org.opendaylight.controller.config.manager.impl.osgi.mapping.ModuleInfoBundleTracker.open(ModuleInfoBundleTracker.java:57)
at org.opendaylight.controller.config.manager.impl.osgi.ConfigManagerActivator.start(ConfigManagerActivator.java:83)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
at java.security.AccessController.doPrivileged(Native Method)[:1.8.0_72]
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)[org.eclipse.osgi-3.8.2.v20130124-134944.jar:]
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683)[org.eclipse.osgi-3.8.2.v20130124-134944.jar:]
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)[org.eclipse.osgi-3.8.2.v20130124-134944.jar:]
at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:390)[org.eclipse.osgi-3.8.2.v20130124-134944.jar:]
at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1176)[org.eclipse.osgi-3.8.2.v20130124-134944.jar:]
at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:559)[org.eclipse.osgi-3.8.2.v20130124-134944.jar:]
at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:544)[org.eclipse.osgi-3.8.2.v20130124-134944.jar:]
at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:457)[org.eclipse.osgi-3.8.2.v20130124-134944.jar:]
at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243)[org.eclipse.osgi-3.8.2.v20130124-134944.jar:]
at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:438)[org.eclipse.osgi-3.8.2.v20130124-134944.jar:]
at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:1)[org.eclipse.osgi-3.8.2.v20130124-134944.jar:]
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)[org.eclipse.osgi-3.8.2.v20130124-134944.jar:]
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)[org.eclipse.osgi-3.8.2.v20130124-134944.jar:]
Caused by: org.opendaylight.yangtools.yang.parser.spi.meta.SomeModifiersUnresolvedException: Some of EFFECTIVE_MODEL modifiers for statements were not resolved.
at org.opendaylight.yangtools.yang.parser.stmt.reactor.BuildGlobalContext.completePhaseActions(BuildGlobalContext.java:282)[79:org.opendaylight.yangtools.yang-parser-impl:0.8.1.Beryllium-SR1]
at org.opendaylight.yangtools.yang.parser.stmt.reactor.BuildGlobalContext.buildEffective(BuildGlobalContext.java:175)[79:org.opendaylight.yangtools.yang-parser-impl:0.8.1.Beryllium-SR1]
at org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor$BuildAction.buildEffective(CrossSourceStatementReactor.java:102)[79:org.opendaylight.yangtools.yang-parser-impl:0.8.1.Beryllium-SR1]
at org.opendaylight.yangtools.yang.parser.repo.SharedSchemaContextFactory$2.apply(SharedSchemaContextFactory.java:91)[79:org.opendaylight.yangtools.yang-parser-impl:0.8.1.Beryllium-SR1]
at org.opendaylight.yangtools.yang.parser.repo.SharedSchemaContextFactory$2.apply(SharedSchemaContextFactory.java:63)[79:org.opendaylight.yangtools.yang-parser-impl:0.8.1.Beryllium-SR1]
at com.google.common.util.concurrent.Futures$ChainingListenableFuture.run(Futures.java:906)[61:com.google.guava:18.0.0]
at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:457)[61:com.google.guava:18.0.0]
at com.google.common.util.concurrent.ExecutionList.executeListener(ExecutionList.java:156)[61:com.google.guava:18.0.0]
at com.google.common.util.concurrent.ExecutionList.add(ExecutionList.java:101)[61:com.google.guava:18.0.0]
at com.google.common.util.concurrent.AbstractFuture.addListener(AbstractFuture.java:170)[61:com.google.guava:18.0.0]
at com.google.common.util.concurrent.Futures.transform(Futures.java:567)[61:com.google.guava:18.0.0]
at org.opendaylight.yangtools.yang.parser.repo.SharedSchemaContextFactory.createSchemaContext(SharedSchemaContextFactory.java:127)[79:org.opendaylight.yangtools.yang-parser-impl:0.8.1.Beryllium-SR1]
at org.opendaylight.yangtools.yang.parser.repo.YangTextSchemaContextResolver.getSchemaContext(YangTextSchemaContextResolver.java:204)[79:org.opendaylight.yangtools.yang-parser-impl:0.8.1.Beryllium-SR1]
... 21 more
Caused by: org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException: Yang model processing phase EFFECTIVE_MODEL failed [at ietf-network-topology:1:0]
at org.opendaylight.yangtools.yang.parser.stmt.reactor.SourceSpecificContext.failModifiers(SourceSpecificContext.java:301)
at org.opendaylight.yangtools.yang.parser.stmt.reactor.BuildGlobalContext.addSourceExceptions(BuildGlobalContext.java:214)[79:org.opendaylight.yangtools.yang-parser-impl:0.8.1.Beryllium-SR1]
at org.opendaylight.yangtools.yang.parser.stmt.reactor.BuildGlobalContext.completePhaseActions(BuildGlobalContext.java:283)[79:org.opendaylight.yangtools.yang-parser-impl:0.8.1.Beryllium-SR1]
... 33 more
Caused by: org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException: Augment target 'Absolute

{path=[(urn:ietf:params:xml:ns:yang:ietf-network?revision=2015-12-08)network]}

' not found [at ietf-network-topology:88:2]
at org.opendaylight.yangtools.yang.parser.stmt.rfc6020.AugmentStatementImpl$Definition$1.prerequisiteFailed(AugmentStatementImpl.java:144)
at org.opendaylight.yangtools.yang.parser.stmt.reactor.ModifierImpl.failModifier(ModifierImpl.java:91)[79:org.opendaylight.yangtools.yang-parser-impl:0.8.1.Beryllium-SR1]
at org.opendaylight.yangtools.yang.parser.stmt.reactor.SourceSpecificContext.failModifiers(SourceSpecificContext.java:290)[79:org.opendaylight.yangtools.yang-parser-impl:0.8.1.Beryllium-SR1]



 Comments   
Comment by Peter Kajsa [ 07/Jun/16 ]

I investigate the issue a little bit, but I am not sure, what we can do as for the YangTools in order to solve the issue now, because the yang parser have to pick one from offered revisions and the rule is that it picks the latest revision, if the revision is not specified.

Maybe upcoming semantic version import resolution will help you to solve this issue (please see YANGTOOLS-557 for more info).

For more information about module updating, I refer you to RFC6020 section 10. Updating a Module. Among other things the section says that obsolete definitions MUST NOT be removed from modules since their identifiers may still be referenced by other modules.

Anyway, workaround of the issue is using of revision dates in import statements everywhere it is possible.

Comment by Robert Varga [ 19/Oct/16 ]

This is a problem of evolution of draft models, which are allowed to make incompatible changes.

https://tools.ietf.org/html/rfc6020#section-7.1.5 clearly states that:

If no "revision-date"
substatement is present, it is undefined from which revision of the
module they are taken.

Our implementation always takes the latest version.

Comment by Srini Seetharaman [ 10/Apr/17 ]

> Anyway, workaround of the issue is using of revision dates in import
> statements everywhere it is possible.

To resolve this issue, can we commit the revision-date to the imports within the standard models that mdsal repo is hosting?

Here is a patch that will help us: https://git.opendaylight.org/gerrit/#/c/54623/

Generated at Wed Feb 07 20:53:47 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.