Details
-
Bug
-
Status: Resolved
-
Resolution: Done
-
None
-
None
-
None
-
Operating System: All
Platform: All
-
8697
Description
ODL Boron release introduced schemaless netconf mount points [1] to deal with devices that do not offer YANG models. This feature can also be used as a workaround for devices whose YANG model cannot be parsed by ODL.
I developed a proof-of-concept ODL application in order to figure out how to work with schemaless netconf mount points. Its code can be found on github [2], and it can be used to reproduce the problem.
Getting or editing the configuration of a schemaless-mounted netconf device from the code of an ODL application results in a NullPointerException. Example while trying to read the configuration of a Juniper device:
2017-06-02 11:05:06,955 | ERROR | tp1288045576-189 | ContainerResponse | 232 - com.sun.jersey.jersey-server - 1.17.0 | The RuntimeException could not be mapped to a response, re-throwing to the HTTP container
java.lang.NullPointerException: Cannot find (http://xml.juniper.net/xnm/1.1/xnm)configuration node in schema context. Instance identifier has to start from root
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:250)[65:com.google.guava:18.0.0]
at org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.fromInstanceId(ImmutableNodes.java:134)[81:org.opendaylight.yangtools.yang-data-impl:1.1.0.Carbon]
at org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.fromInstanceId(ImmutableNodes.java:105)[81:org.opendaylight.yangtools.yang-data-impl:1.1.0.Carbon]
at org.opendaylight.netconf.sal.connect.netconf.util.NetconfMessageTransformUtil.toFilterStructure(NetconfMessageTransformUtil.java:170)
at org.opendaylight.netconf.sal.connect.netconf.util.NetconfRpcStructureTransformer.toFilterStructure(NetconfRpcStructureTransformer.java:44)
at org.opendaylight.netconf.sal.connect.netconf.util.NetconfBaseOps.getConfig(NetconfBaseOps.java:170)
at org.opendaylight.netconf.sal.connect.netconf.util.NetconfBaseOps.getConfigRunning(NetconfBaseOps.java:205)
at org.opendaylight.netconf.sal.connect.netconf.util.NetconfBaseOps.getConfigRunningData(NetconfBaseOps.java:184)
at org.opendaylight.netconf.sal.connect.netconf.sal.tx.ReadOnlyTx.readConfigurationData(ReadOnlyTx.java:42)
at org.opendaylight.netconf.sal.connect.netconf.sal.tx.ReadOnlyTx.read(ReadOnlyTx.java:66)
at com.bcom.pocnetconfschemaless.impl.Hostname.getHostname(Hostname.java:89)
This is quite unexpected because we're working in schemaless mode. So ODL should not look for a schema, and there should not be an exception.
The traceback shows that ODL uses a NetconfRpcStructureTransformer, while it should use a SchemalessRpcStructureTransformer.
Looking for ODL behaviour at mount time with a debugger, we can see that the NetconfBaseOps object is created with the wrong transformer. As a matter of fact, in the NetconfBaseOps constructor, the "rpc instanceof SchemalessNetconfDeviceRpc" test fails. Investigation shows that rpc is a KeepAliveSalFacade.KeepAliveDomRpcService object, while rpc.deviceRpc is a SchemalessNetconfDeviceRpc object.
I will submit a patch that fixes the issue.