Creating node in the inventory is error under clustering mode, while fine under single mode

asked 2014-10-21 06:30:51 -0800

Xin Chang gravatar image

updated 2014-10-21 06:37:46 -0800

Following is the main code snippet to create node in the inventory:

        final InstanceIdentifier<Node> nodeIdentifier = createPath(nodeIdStr);
        Node node = createDeviceNode(ipAddrStr, nodeIdStr);
        final ReadWriteTransaction writeTx = dataBroker.newReadWriteTransaction();
        writeTx.merge(LogicalDatastoreType.OPERATIONAL, nodeIdentifier, node, true);
        CheckedFuture<Void, TransactionCommitFailedException> submitFuture = writeTx.submit();
        Futures.addCallback(submitFuture, new FutureCallback<Void>() {
            public void onSuccess(Void result) {

            public void onFailure(Throwable t) {
                logger.error("when creating device node, catching exception.", t);

It is fine under single mode. But under clustering mode, it is error caused by null key in CacheLoader.

In the karaf.log, the complete error message is as following:

org.opendaylight.controller.sal-broker-impl - 1.1.1.SNAPSHOT Tx: DOM-13 Error during phase CAN_COMMIT, starting About$InvalidCacheLoadException: CacheLoader return null for key (urn:opendaylight:inventory?revision=2013-08-19)nodes.

Clustering mode is started via karaf:

feature:install odl-mdsal-clustering

feature:install odl-restconf

feature:install odl-netconf-connector

bundle:install mvn:...

Via jconsole, akka.conf and module-shards.conf are fine and raft state is ok.

curl -v -i -H "Content-Type: application/json" -X POST -d '{ "input" : {...} }' -u admin:admin http://localhost:8181/restconf/operations/icmp-discovery:discover

invoke creating device node

curl -v -i -X GET -u admin:admin http://localhost:8181/restconf/config/opendaylight-inventory:nodes


curl -v -i -X GET -u admin:admin http://localhost:8181/restconf/operational/opendaylight-inventory:nodes return 404

How to solve this problem? Is there some bundles missed to initialize inventory?

edit retag flag offensive close merge delete


Is DataBroker the correct way to do something like this, are nodes added this way automatically pushed into the SwitchManager/TopologyManager services? I was trying to do somethign similar by using the IPluginOutTopologyService.edgeUpdate method.

scurtis ( 2014-11-13 08:40:25 -0800 )edit