From: Moiz Raja Date: Thu, 4 Jun 2015 17:18:30 +0000 (-0700) Subject: BUG 3566 : Get remote-rpc working again X-Git-Tag: release/beryllium~149^2~27 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=385c9ef9b899b35b4d1a58a8f59bae921402c697;p=mdsal.git BUG 3566 : Get remote-rpc working again 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 (cherry picked from commit 40217346551e20a809df37cd92955cd63c61944f) --- diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/RoutedDOMRpcRoutingTableEntry.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/RoutedDOMRpcRoutingTableEntry.java index e6df966f36..3d2eb974c0 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/RoutedDOMRpcRoutingTableEntry.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/RoutedDOMRpcRoutingTableEntry.java @@ -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 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 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 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); }