[YANGTOOLS-723] ODL fails to mount device - shows empty list of unsatisfied imports Created: 29/Nov/16  Updated: 10/Apr/22  Resolved: 08/Mar/17

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

Type: Bug
Reporter: Giles Heron Assignee: Robert Varga
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Linux
Platform: PC


Attachments: Text File karaf.log     File openconfig-interfaces@2015-11-20.yang     Text File short.log    
External issue ID: 7267

 Description   

when mounting some types of device I'm seeing the mount fail with "No more sources for schema context'.

I see this in the logs:

2016-11-29 17:39:00,580 | DEBUG | ssing-executor-9 | NetconfDevice | 315 - org.opendaylight.netconf.sal-netconf-connector - 1.4.1.Boron-SR1 | RemoteDevice

{3850}: Unable to map any source identifiers to a capability reported by device : []
2016-11-29 17:39:00,580 | WARN | ssing-executor-9 | NetconfDevice | 315 - org.opendaylight.netconf.sal-netconf-connector - 1.4.1.Boron-SR1 | RemoteDevice{3850}

: Unable to build schema context, unsatisfied imports {}, will reattempt with resolved only
2016-11-29 17:39:00,581 | DEBUG | ssing-executor-9 | NetconfDevice | 315 - org.opendaylight.netconf.sal-netconf-connector - 1.4.1.Boron-SR1 | {}: Unable to build schema context, unsatisfied imports {}, will reattempt with resolved only
SchemaResolutionException{unsatisfiedImports={}}
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)[:1.8.0_111]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)[:1.8.0_111]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)[:1.8.0_111]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)[:1.8.0_111]
at org.opendaylight.yangtools.util.concurrent.ReflectiveExceptionMapper.newWithCause(ReflectiveExceptionMapper.java:31)[47:org.opendaylight.yangtools.util:1.0.1.Boron-SR1]
at org.opendaylight.yangtools.util.concurrent.ExceptionMapper.apply(ExceptionMapper.java:87)[47:org.opendaylight.yangtools.util:1.0.1.Boron-SR1]
at org.opendaylight.yangtools.util.concurrent.ExceptionMapper.apply(ExceptionMapper.java:37)[47:org.opendaylight.yangtools.util:1.0.1.Boron-SR1]
at com.google.common.util.concurrent.Futures$MappingCheckedFuture.mapException(Futures.java:1809)[44:com.google.guava:18.0.0]
at com.google.common.util.concurrent.AbstractCheckedFuture.checkedGet(AbstractCheckedFuture.java:85)[44:com.google.guava:18.0.0]
at org.opendaylight.netconf.sal.connect.netconf.NetconfDevice$SchemaSetup.setUpSchema(NetconfDevice.java:452)[315:org.opendaylight.netconf.sal-netconf-connector:1.4.1.Boron-SR1]
at org.opendaylight.netconf.sal.connect.netconf.NetconfDevice$SchemaSetup.run(NetconfDevice.java:428)[315:org.opendaylight.netconf.sal-netconf-connector:1.4.1.Boron-SR1]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_111]
at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_111]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_111]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_111]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_111]
Caused by: java.lang.NullPointerException

So it seems that ODL thinks it has unsatisfied imports, but that the list of such imports is empty.

any idea what's going on here?



 Comments   
Comment by Giles Heron [ 29/Nov/16 ]

I checked, and I see the same behaviour with Beryllium-SR4 but Lithium-SR4 works ok. So I guess this is something to do with the stricter YANG checking in Beryllium?

Comment by Tomas Cere [ 30/Nov/16 ]

The full stack trace would be nice since it's cut off at the interesting part and you cant see the cause of the NPE.

Comment by Giles Heron [ 30/Nov/16 ]

I've deleted most of the log to leave the stuff potentially relevant to the error.

Comment by Giles Heron [ 30/Nov/16 ]

Attachment karaf.log has been added with description: last couple of hundred lines of the log

Comment by Jakub Morvay [ 06/Dec/16 ]

Hi Giles,

I've looked at the log and this behavior is indeed strange. Can you please also provide yang models, so I can reproduce this?

Comment by Giles Heron [ 06/Dec/16 ]

will mail you a zip of the YANG models (comes to 1.4MB even as a ZIP so can't send it here).

Comment by Robert Varga [ 08/Dec/16 ]

This part has been omitted from original report:

Caused by: java.lang.NullPointerException
at org.opendaylight.yangtools.yang.common.QName.create(QName.java:211)
at org.opendaylight.yangtools.yang.parser.stmt.rfc6020.TypeUtils.typeEffectiveSchemaPath(TypeUtils.java:209)
at org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.type.UnsignedIntegerTypeEffectiveStatementImpl.<init>(UnsignedIntegerTypeEffectiveStatementImpl.java:33)
at org.opendaylight.yangtools.yang.parser.stmt.rfc6020.TypeStatementImpl$Definition.createEffective(TypeStatementImpl.java:188)
at org.opendaylight.yangtools.yang.parser.stmt.rfc6020.TypeStatementImpl$Definition.createEffective(TypeStatementImpl.java:82)
at org.opendaylight.yangtools.yang.parser.stmt.reactor.StatementContextBase.buildEffective(StatementContextBase.java:445

NPE is caused by QName.create() being called with a null base, which in turn points to TypeUtils doing:

final SchemaPath path = stmtCtx.getSchemaPath().get();
final QName qname = stmtCtx.getFromNamespace(QNameCacheNamespace.class,
QName.create(path.getParent().getLastComponent()

In this path.getParent() is YangInstanceIdentifier.EMPTY, which is the only case where getLastComponent() returns null.

The stack classes involved are pointing at an uint typedef or leaf. Models need to be analyzed.

boron: https://git.opendaylight.org/gerrit/49143

will report more information so we can track it down.

Comment by Robert Varga [ 08/Dec/16 ]

Thinking about this a bit more, the probable cause for this is a free-standing 'type' statement – which would constitute invalid yang.

Comment by Viera Zelcamova [ 08/Dec/16 ]

(In reply to Giles Heron from comment #5)
> will mail you a zip of the YANG models (comes to 1.4MB even as a ZIP so
> can't send it here).

Hi Giles, send the models to Peter Kajsa or Igor Foltin (Yang team). Thanks.

Comment by Giles Heron [ 08/Dec/16 ]

will do once I have the models. For this one I need access to a real cisco switch that has the issue (7267 doesn't occur with CSR1Kv but only with a real switch). Kevin/Jason have the switches so I need to get hold of them once they're in today.

Comment by Robert Varga [ 08/Dec/16 ]

Furthermore, this is a side-effect of when and how we validate sub-statements – which happens only after the parent has been fully declared.

Hence I can do

container foo {
type uint8;
}

and while it will blow up, it will do so very late in processing, at which point someone may have asked for the effective statement.

That leads to TypeEffectiveStatementImpl being invoked in a context, which the implementation does not expect (hey, 'type' can occur only nested in a different statement, hence it's parent path is non-empty... kaboom).

BUG-7037 tracks an improvement to lookups, which means that the fact that 'type' statement has no place under container the very first time we attempt to start to define it, throwing a SourceException pinpointing the offender – allowing NETCONF to properly exclude it (and hence fix this particular issue).

Comment by Robert Varga [ 14/Dec/16 ]

Workaround patch for parser to add the offender identification – that should be sufficient for NETCONF to prune the offender. The root cause needs to be still investigated.

master: https://git.opendaylight.org/gerrit/49351

Comment by Robert Varga [ 15/Dec/16 ]

boron: https://git.opendaylight.org/gerrit/49433

Comment by Igor Foltin [ 19/Dec/16 ]

Hi Giles, I tested the models you provided and the only problem came up with the model ned-switching-devs@2016-04-20.

deviation /ned:native/ned:class-map/ned:match/ned:access-group/ned:index {
deviate replace {
type uint32

{ range "1..2799"; tailf:info "<1-2799>;;Access list index"; }

}
}

The issue was that the type uint32 statement had an empty parent.
It is a problem in yang parser code, so I will open a new bug for that.

Comment by Giles Heron [ 08/Mar/17 ]

Attachment short.log has been added with description: ODL log (starting with the instance data)

Comment by Giles Heron [ 08/Mar/17 ]

Attachment openconfig-interfaces@2015-11-20.yang has been added with description: YANG model with missing instance data

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