[CONTROLLER-1282] controller cannot perform NETCONF operations on node after it is re-attached through RESTCONF Created: 28/Apr/15  Updated: 06/May/15  Resolved: 06/May/15

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

Type: Bug
Reporter: Ashwin Pankaj Assignee: Maros Marsalek
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


Attachments: File plugins.list    
External issue ID: 3076

 Description   

1. Detach a node using restconf (https://wiki.opendaylight.org/view/OpenDaylight_Controller:Config:Examples:Netconf#Reconfiguring_Netconf_Connector_While_the_Controller_is_Running)
2. REattach the node
3. Send config to / read operational data from node , using MountInstance API

You'll see the following error in opendaylight log and the operation fails.

2015-04-28 07:31:00.910 IST [pool-30-thread-1] ERROR o.o.c.m.s.c.i.s.TwoPhaseCommit - Transaction: BA-3 Request Commit failed
java.lang.RuntimeException: RemoteDevice

{dna-node}: Error while replacing /(urn:cisco:params:xml:ns:yang:dna:ldna?revision=2014-07-05)local-dna/telemetry-sources/telemetry/telemetry[{(urn:cisco:params:xml:ns:yang:dna:ldna?revision=2014-07-05)id=2}]
at org.opendaylight.controller.sal.connect.netconf.sal.tx.NetconfDeviceWriteOnlyTx.put(NetconfDeviceWriteOnlyTx.java:125) ~[na:na]
at org.opendaylight.controller.sal.connect.netconf.sal.tx.NetconfDeviceReadWriteTx.put(NetconfDeviceReadWriteTx.java:46) ~[na:na]
at org.opendaylight.controller.md.sal.dom.broker.impl.compat.BackwardsCompatibleTransaction$ReadWriteTransaction.putWithEnsuredParents(BackwardsCompatibleTransaction.java:253) ~[na:na]
at org.opendaylight.controller.md.sal.dom.broker.impl.compat.BackwardsCompatibleTransaction$ReadWriteTransaction.putConfigurationData(BackwardsCompatibleTransaction.java:216) ~[na:na]
at org.opendaylight.controller.md.sal.dom.broker.impl.compat.BackwardsCompatibleTransaction$ReadWriteTransaction.putConfigurationData(BackwardsCompatibleTransaction.java:191) ~[na:na]
at org.opendaylight.controller.sal.binding.impl.connect.dom.BindingToDomCommitHandler.createBindingToDomTransaction(BindingToDomCommitHandler.java:92) ~[na:na]
at org.opendaylight.controller.sal.binding.impl.connect.dom.BindingToDomCommitHandler.requestCommit(BindingToDomCommitHandler.java:57) ~[na:na]
at org.opendaylight.controller.md.sal.common.impl.service.TwoPhaseCommit.call(TwoPhaseCommit.java:87) [bundlefile:na]
at org.opendaylight.controller.md.sal.common.impl.service.TwoPhaseCommit.call(TwoPhaseCommit.java:36) [bundlefile:na]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_67]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_67]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_67]
at java.lang.Thread.run(Thread.java:745) [na:1.7.0_67]
Caused by: java.util.concurrent.ExecutionException: RemoteDevice{dna-node}

: Pre-commit rpc failed, request: Node[ImmutableCompositeNode], qName[edit-config], modify[n/a], children.size = 4, errors: [RpcError [message=The netconf session to dna-node is disconnected, severity=ERROR, errorType=TRANSPORT, tag=operation-failed, applicationTag=null, info=null, cause=null]]



 Comments   
Comment by Ashwin Pankaj [ 28/Apr/15 ]

Attachment plugins.list has been added with description: List of jars in the plugin directory

Comment by Maros Marsalek [ 29/Apr/15 ]

Tested multiple times on Helium-SR3 and Helium-SR1 and this works fine.

Does your code re-retrieve current MountPoint instance after reconnect ? Because it looks like your code is keeping a reference to the original MountPoint after reconnect, which is not correct, since after each reconnect a new MountPoint instance is built and the old instance just does not work.

If thats the case, you should listen to the changes of state for mounted node and react accordingly i.e. you cannot keep a reference to a MountPoint after a device is disconnected. Because if you do, you act as if there was no reconnect.

This approach is demonstrated in coretutorials for ODL in subproject ncmount (it is built using current Lithium code but the concept stays the same).

Decreasing priority by one level.

Maros

Comment by Ashwin Pankaj [ 29/Apr/15 ]

private MountInstance buildMountInstance(String node)

{ InstanceIdentifier<Node> nodeInstance = buildNodeInstance(node); MountInstance mountInstance = mountService.getMountPoint(nodeInstance); LOG.info(nodeInstance.toString()); return mountInstance; }

private InstanceIdentifier<Node> buildNodeInstance(String node)

{ NodeKey key = new NodeKey(new NodeId(node)); InstanceIdentifier<Node> nodeInstance = InstanceIdentifier .builder(Nodes.class).child(Node.class, key).toInstance(); return nodeInstance; }
Comment by Ashwin Pankaj [ 29/Apr/15 ]

(In reply to Ashwin Pankaj from comment #2)
>
> private MountInstance buildMountInstance(String node)

{ > InstanceIdentifier<Node> nodeInstance = buildNodeInstance(node); > MountInstance mountInstance = > mountService.getMountPoint(nodeInstance); > LOG.info(nodeInstance.toString()); > return mountInstance; > }

>
> private InstanceIdentifier<Node> buildNodeInstance(String node)

{ > NodeKey key = new NodeKey(new NodeId(node)); > InstanceIdentifier<Node> nodeInstance = InstanceIdentifier > .builder(Nodes.class).child(Node.class, key).toInstance(); > return nodeInstance; > }

Sorry - hit send button too soon.
I always rebuild the node instance as shown above. Is that not enough ?

Comment by Maros Marsalek [ 29/Apr/15 ]

Ok so this is a binding mount point issue.

Fix submitted, needs to be retested:
https://git.opendaylight.org/gerrit/#/c/19293/

Generated at Wed Feb 07 19:55:08 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.