[CONTROLLER-1238] Clustering : Unable to read from datastore root with clustering enabled Created: 07/Apr/15  Updated: 25/Jul/23  Resolved: 10/Apr/15

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

Type: Bug
Reporter: Tomas Cere Assignee: Moiz Raja
Resolution: Done 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: 2953
Priority: Highest

 Description   

When reading from the datastore root(YangInstanceIdentifier.builder().build()) we get java.util.NoSuchElementException the offending line is rwTx.read(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.builder().build()).checkedGet();

This is possible with just pure IMDS but with clustering enabled by default we get this exception.

Steps to reproduce with netconf-mdsal-northbound:

1) feature:install odl-restconf odl-netconf-connector-all odl-netconf-mdsal

2) send a POST request to:

http://127.0.0.1:8181/restconf/config/opendaylight-inventory:nodes/node/controller-config/yang-ext:mount/config:modules

with payload:

<module xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">prefix:sal-netconf-connector</type>
<name>mdsal-config</name>
<address xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">127.0.0.1</address>
<port xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">2830</port>
<username xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">admin</username>
<password xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">admin</password>
<tcp-only xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">false</tcp-only>
<event-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netty">prefix:netty-event-executor</type>
<name>global-event-executor</name>
</event-executor>
<binding-registry xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">prefix:binding-broker-osgi-registry</type>
<name>binding-osgi-broker</name>
</binding-registry>
<dom-registry xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">prefix:dom-broker-osgi-registry</type>
<name>dom-broker</name>
</dom-registry>
<client-dispatcher xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf">prefix:netconf-client-dispatcher</type>
<name>global-netconf-dispatcher</name>
</client-dispatcher>
<processing-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:threadpool">prefix:threadpool</type>
<name>global-netconf-processing-executor</name>
</processing-executor>
</module>

3) try to read data from mdsal-loopback connection:
http://127.0.0.1:8181/restconf/operational/network-topology:network-topology/topology/topology-netconf/node/mdsal-config/yang-ext:mount

it fails with applicationoperation-failedProblem to get data from transaction.
and this exception in karaf log :

2015-04-07 13:30:35,379 | ERROR | oupCloseable-6-4 | NetconfOperationRouterImpl | 220 - org.opendaylight.controller.netconf-impl - 0.3.0.SNAPSHOT | Unexpected exception during netconf operation execution
java.util.NoSuchElementException
at com.google.common.collect.Iterators$1.next(Iterators.java:80)[78:com.google.guava:18.0.0]
at org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategyFactory.getModuleName(ShardStrategyFactory.java:47)[254:org.opendaylight.controller.sal-distributed-datastore:1.2.0.SNAPSHOT]
at org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategyFactory.getStrategy(ShardStrategyFactory.java:36)[254:org.opendaylight.controller.sal-distributed-datastore:1.2.0.SNAPSHOT]
at org.opendaylight.controller.cluster.datastore.TransactionProxy.shardNameFromIdentifier(TransactionProxy.java:462)[254:org.opendaylight.controller.sal-distributed-datastore:1.2.0.SNAPSHOT]
at org.opendaylight.controller.cluster.datastore.TransactionProxy.getOrCreateTxFutureCallback(TransactionProxy.java:470)[254:org.opendaylight.controller.sal-distributed-datastore:1.2.0.SNAPSHOT]
at org.opendaylight.controller.cluster.datastore.TransactionProxy.read(TransactionProxy.java:259)[254:org.opendaylight.controller.sal-distributed-datastore:1.2.0.SNAPSHOT]
at org.opendaylight.controller.md.sal.dom.broker.impl.DOMForwardedReadWriteTransaction.read(DOMForwardedReadWriteTransaction.java:47)[229:org.opendaylight.controller.sal-broker-impl:1.2.0.SNAPSHOT]
at org.opendaylight.controller.netconf.mdsal.connector.ops.get.Get.handleWithNoSubsequentOperations(Get.java:56)[266:org.opendaylight.controller.mdsal-netconf-connector:0.3.0.SNAPSHOT]



 Comments   
Comment by Moiz Raja [ 09/Apr/15 ]

I tried reproducing this problem with restconf. When I tried adding the md-sal-config mount I got an exception.

1. This is what I tried - https://www.getpostman.com/collections/839d3f72912811354cc0
2. This is the error I got - https://gist.github.com/moizr/5c602cbf3289f5467c7f

Because of this I am not able to get to step 3 to see the problem with the datastore.

Comment by Tomas Cere [ 09/Apr/15 ]

Currently this is affected by https://bugs.opendaylight.org/show_bug.cgi?id=2964

Until that is fixed workaround is to post config in json and reading with xml.

Comment by Moiz Raja [ 09/Apr/15 ]

Tomas, is there an easy way for me to create the corresponding json payload or does it need to be done the hard way?

Comment by Tomas Cere [ 09/Apr/15 ]

(In reply to Moiz Raja from comment #3)
> Tomas, is there an easy way for me to create the corresponding json payload
> or does it need to be done the hard way?

Here you go:

{
"config:module":
{
"type": "odl-sal-netconf-connector-cfg:sal-netconf-connector",
"name": "mdsal-config",
"odl-sal-netconf-connector-cfg:password": "admin",
"odl-sal-netconf-connector-cfg:tcp-only": false,
"odl-sal-netconf-connector-cfg:binding-registry":

{ "type": "opendaylight-md-sal-binding:binding-broker-osgi-registry", "name": "binding-osgi-broker" }

,
"odl-sal-netconf-connector-cfg:between-attempts-timeout-millis": 2000,
"odl-sal-netconf-connector-cfg:processing-executor":

{ "type": "threadpool:threadpool", "name": "global-netconf-processing-executor" }

,
"odl-sal-netconf-connector-cfg:max-connection-attempts": 0,
"odl-sal-netconf-connector-cfg:sleep-factor": 1.5,
"odl-sal-netconf-connector-cfg:client-dispatcher":

{ "type": "odl-netconf-cfg:netconf-client-dispatcher", "name": "global-netconf-dispatcher" }

,
"odl-sal-netconf-connector-cfg:username": "admin",
"odl-sal-netconf-connector-cfg:address": "127.0.0.1",
"odl-sal-netconf-connector-cfg:dom-registry":

{ "type": "opendaylight-md-sal-dom:dom-broker-osgi-registry", "name": "dom-broker" }

,
"odl-sal-netconf-connector-cfg:port": 2830,
"odl-sal-netconf-connector-cfg:event-executor":

{ "type": "netty:netty-event-executor", "name": "global-event-executor" }

,
"odl-sal-netconf-connector-cfg:connection-timeout-millis": 20000
}
}

Comment by Moiz Raja [ 09/Apr/15 ]

Thanks Tomas! That worked.

Comment by Moiz Raja [ 09/Apr/15 ]

https://git.opendaylight.org/gerrit/18050

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