BUG 3566 : Get remote-rpc working again
authorMoiz Raja <moraja@cisco.com>
Thu, 4 Jun 2015 17:18:30 +0000 (10:18 -0700)
committerTom Pantelis <tpanteli@brocade.com>
Sat, 6 Jun 2015 00:34:14 +0000 (00:34 +0000)
Some changes to moving from CompositeNode to NormalizedNode had broken
remote rpc. This patch attempts to get it working again.

Verified everything works in a 3 node cluster with the clustering-test-app

Change-Id: I2ec714f1d21d95812bd5b486260be3575df252a2
Signed-off-by: Moiz Raja <moraja@cisco.com>
(cherry picked from commit 40217346551e20a809df37cd92955cd63c61944f)

opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/RoutedDOMRpcRoutingTableEntry.java

index e6df966f369a55e391d686646804e91891b584cb..3d2eb974c03ae8244da33794f5b21c02b2bc4ca6 100644 (file)
@@ -52,11 +52,23 @@ final class RoutedDOMRpcRoutingTableEntry extends AbstractDOMRpcRoutingTableEntr
             final Object value = key.getValue();
             if (value instanceof YangInstanceIdentifier) {
                 final YangInstanceIdentifier iid = (YangInstanceIdentifier) value;
-                final List<DOMRpcImplementation> impls = getImplementations(iid);
-                if (impls != null) {
-                    return impls.get(0).invokeRpc(DOMRpcIdentifier.create(getSchemaPath(), iid), input);
+
+                // Find a DOMRpcImplementation for a specific iid
+                final List<DOMRpcImplementation> specificImpls = getImplementations(iid);
+                if (specificImpls != null) {
+                    return specificImpls.get(0).invokeRpc(DOMRpcIdentifier.create(getSchemaPath(), iid), input);
+                }
+
+                LOG.debug("No implementation for context {} found will now look for wildcard id", iid);
+
+                // Find a DOMRpcImplementation for a wild card. Usually remote-rpc-connector would register an
+                // implementation this way
+                final List<DOMRpcImplementation> mayBeRemoteImpls = getImplementations(YangInstanceIdentifier.EMPTY);
+
+                if(mayBeRemoteImpls != null){
+                    return mayBeRemoteImpls.get(0).invokeRpc(DOMRpcIdentifier.create(getSchemaPath(), iid), input);
                 }
-                LOG.debug("No implementation for context {} found", iid);
+
             } else {
                 LOG.warn("Ignoring wrong context value {}", value);
             }