[NETCONF-231] 'odl-netconf-topology' feature throws NullPointerException while mounting device[1.1.0-SNAPSHOT] Created: 20/Jul/16  Updated: 15/Mar/19  Resolved: 21/Jul/16

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

Type: Bug
Reporter: Zhaoxing Li Assignee: Jakub Morvay
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Mac OS
Platform: Macintosh


External issue ID: 6239
Priority: High

 Description   

Karaf log:
2016-07-19 17:46:30,159 | INFO | on-dispatcher-53 | AbstractNetconfTopology | 287 - org.opendaylight.netconf.topology - 1.1.0.SNAPSHOT | Connecting RemoteDevice

{Uri [_value=hcmount]}

, with config Node{getNodeId=Uri [_value=hcmount], augmentations={interface org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode=NetconfNode{getBetweenAttemptsTimeoutMillis=10000, getConcurrentRpcLimit=0, getConnectionTimeoutMillis=10000, getCredentials=LoginPassword{getPassword=admin, getUsername=admin, augmentations={}}, getDefaultRequestTimeoutMillis=10000, getHost=Host [_domainName=DomainName [_value=172.23.29.126]], getKeepaliveDelay=0, getMaxConnectionAttempts=10, getPort=PortNumber [_value=7777], getSchemaCacheDirectory=schema, getSleepFactor=1.5, isReconnectOnChangedSchema=false, isSchemaless=false, isTcpOnly=true}}}
2016-07-19 17:46:30,168 | ERROR | on-dispatcher-53 | DataTreeChangeListenerActor | 214 - org.opendaylight.controller.sal-distributed-datastore - 1.4.0.SNAPSHOT | Error notifying listener org.opendaylight.controller.md.sal.binding.impl.BindingDOMDataTreeChangeListenerAdapter@54d13ad3
java.lang.NullPointerException
at org.opendaylight.netconf.topology.AbstractNetconfTopology.createDeviceCommunicator(AbstractNetconfTopology.java:275)[287:org.opendaylight.netconf.topology:1.1.0.SNAPSHOT]
at org.opendaylight.netconf.topology.AbstractNetconfTopology.setupConnection(AbstractNetconfTopology.java:243)[287:org.opendaylight.netconf.topology:1.1.0.SNAPSHOT]
at org.opendaylight.netconf.topology.AbstractNetconfTopology.connectNode(AbstractNetconfTopology.java:218)[287:org.opendaylight.netconf.topology:1.1.0.SNAPSHOT]
at org.opendaylight.netconf.topology.impl.NetconfTopologyImpl.onDataTreeChanged(NetconfTopologyImpl.java:151)[287:org.opendaylight.netconf.topology:1.1.0.SNAPSHOT]
at org.opendaylight.controller.md.sal.binding.impl.BindingDOMDataTreeChangeListenerAdapter.onDataTreeChanged(BindingDOMDataTreeChangeListenerAdapter.java:41)[185:org.opendaylight.controller.sal-binding-broker-impl:1.4.0.SNAPSHOT]
at org.opendaylight.controller.cluster.datastore.DataTreeChangeListenerActor.dataChanged(DataTreeChangeListenerActor.java:55)[214:org.opendaylight.controller.sal-distributed-datastore:1.4.0.SNAPSHOT]
at org.opendaylight.controller.cluster.datastore.DataTreeChangeListenerActor.handleReceive(DataTreeChangeListenerActor.java:37)[214:org.opendaylight.controller.sal-distributed-datastore:1.4.0.SNAPSHOT]
at org.opendaylight.controller.cluster.common.actor.AbstractUntypedActor.onReceive(AbstractUntypedActor.java:26)[209:org.opendaylight.controller.sal-clustering-commons:1.4.0.SNAPSHOT]
at akka.actor.UntypedActor$$anonfun$receive$1.applyOrElse(UntypedActor.scala:165)[197:com.typesafe.akka.actor:2.4.7]
at akka.actor.Actor$class.aroundReceive(Actor.scala:484)[197:com.typesafe.akka.actor:2.4.7]
at akka.actor.UntypedActor.aroundReceive(UntypedActor.scala:95)[197:com.typesafe.akka.actor:2.4.7]
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:526)[197:com.typesafe.akka.actor:2.4.7]
at akka.actor.ActorCell.invoke(ActorCell.scala:495)[197:com.typesafe.akka.actor:2.4.7]
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257)[197:com.typesafe.akka.actor:2.4.7]
at akka.dispatch.Mailbox.run(Mailbox.scala:224)[197:com.typesafe.akka.actor:2.4.7]
at akka.dispatch.Mailbox.exec(Mailbox.scala:234)[197:com.typesafe.akka.actor:2.4.7]
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)[193:org.scala-lang.scala-library:2.11.8.v20160304-115712-1706a37eb8]
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)[193:org.scala-lang.scala-library:2.11.8.v20160304-115712-1706a37eb8]
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)[193:org.scala-lang.scala-library:2.11.8.v20160304-115712-1706a37eb8]
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)[193:org.scala-lang.scala-library:2.11.8.v20160304-115712-1706a37eb8]

PUT operation:
http://172.23.29.120:8181/restconf/config/network-topology:network-topology/network-topology:topology/topology-netconf/node/hcmount

{
"node" :
[

{ "node-id":"hcmount", "netconf-node-topology:host":"172.23.29.126", "netconf-node-topology:port":"7777", "netconf-node-topology:tcp-only":true, "netconf-node-topology:keepalive-delay":0, "netconf-node-topology:username":"admin", "netconf-node-topology:password":"admin", "netconf-node-topology:connection-timeout-millis":10000, "netconf-node-topology:default-request-timeout-millis":10000, "netconf-node-topology:max-connection-attempts":10, "netconf-node-topology:between-attempts-timeout-millis":10000 }

]
}

After the NPE, there's nothing showing in the operational datastore, nor does the mount point exist.



 Comments   
Comment by Jakub Morvay [ 20/Jul/16 ]

The problem seems to be in wrong type of host node, when we are getting the configuration for node from datastore. As you can see from your INFO log from AbstractNetconfTopology, we get the host node as domainName type. But we are expecting this node to be of ipAddress type. Not sure why is this happening, if this is problem in MD-SAL or Yangtools or where.

Also, this bug is not always present, sometimes we get the host in ipAdress type, sometimes in domainName type.

We should add support also for addressing devices via domain name in netconf-topology, but I don't think this will solve this bug. If we get IP address as
domainName type, I think we wouldn't be able to resolve such domain name.

Next thing, we can do in NETCONF is to somehow explicitly check host value and if it is valid IP address cast it to IP address, even if we get it as domain name. Do not know if we want such fixes in NETCONF project though..

Comment by Zhaoxing Li [ 20/Jul/16 ]

Just rebuilt everything and tried again.
I’ve been adding the same node that had the bug yesterday for 10 times. None of them has triggered the bug again. So it looks like something has been changed and this problem seems to not be occurring to me anymore.
But yesterday it was a 100% chance to trigger this bug for me(I still have the old build which still breaks). So let’s just leave it like this for now, until it comes back(hopefully not).

Comment by Robert Varga [ 21/Jul/16 ]

This regression was caused by https://git.opendaylight.org/gerrit/#/c/40056/. The problem was that UnionTypeCodec.create() used a temporary HashSet, which meant the order on constituent types was not retained. That in turn lead to the less-restrictive domain-name being tried first and succeeding.

https://git.opendaylight.org/gerrit/#/c/42072/ fixed that.

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