- Fixed DOM Broker and BI Connector code
- The refactoring was done so that DOM Broker does not get exposed to
- BA Broker directly but rather through a proxy. This also fixes the
issue where DOM Broker would not be initialized in BI Connector, therefore
any messages from BA Broker would not flow to DOM Broker via BI Connector.
Change-Id: Ia25a71787857c8d052a5dbd40e8237015d8c4d63
Signed-off-by: Abhishek Kumar <abhishk2@cisco.com>
private RpcProviderRegistryImpl baRpcRegistryImpl;
private RpcProviderRegistryImpl baRpcRegistryImpl;
- private org.opendaylight.controller.sal.dom.broker.spi.RpcRouter biRouter;
-
private NotificationProviderService baNotifyService;
private NotificationPublishService domNotificationService;
private NotificationProviderService baNotifyService;
private NotificationPublishService domNotificationService;
baRpcRegistryImpl.registerRouterInstantiationListener(domToBindingRpcManager.getInstance());
baRpcRegistryImpl.registerGlobalRpcRegistrationListener(domToBindingRpcManager.getInstance());
}
baRpcRegistryImpl.registerRouterInstantiationListener(domToBindingRpcManager.getInstance());
baRpcRegistryImpl.registerGlobalRpcRegistrationListener(domToBindingRpcManager.getInstance());
}
- if (biRpcRegistry instanceof org.opendaylight.controller.sal.dom.broker.spi.RpcRouter) {
- biRouter = (org.opendaylight.controller.sal.dom.broker.spi.RpcRouter) biRpcRegistry;
- }
rpcForwarding = true;
}
}
rpcForwarding = true;
}
}
@Override
public Future<RpcResult<?>> forwardToDomBroker(DataObject input) {
@Override
public Future<RpcResult<?>> forwardToDomBroker(DataObject input) {
+ if(biRpcRegistry != null) {
CompositeNode xml = mappingService.toDataDom(input);
CompositeNode wrappedXml = ImmutableCompositeNode.create(rpc, ImmutableList.<Node<?>> of(xml));
CompositeNode xml = mappingService.toDataDom(input);
CompositeNode wrappedXml = ImmutableCompositeNode.create(rpc, ImmutableList.<Node<?>> of(xml));
- RpcResult<CompositeNode> result = biRouter.invokeRpc(rpc, wrappedXml);
+ RpcResult<CompositeNode> result = biRpcRegistry.invokeRpc(rpc, wrappedXml);
Object baResultValue = null;
if (result.getResult() != null) {
baResultValue = mappingService.dataObjectFromDataDom(outputClass.get(), result.getResult());
Object baResultValue = null;
if (result.getResult() != null) {
baResultValue = mappingService.dataObjectFromDataDom(outputClass.get(), result.getResult());
@Override
public Future<RpcResult<?>> forwardToDomBroker(DataObject input) {
@Override
public Future<RpcResult<?>> forwardToDomBroker(DataObject input) {
+ if(biRpcRegistry != null) {
CompositeNode xml = mappingService.toDataDom(input);
CompositeNode wrappedXml = ImmutableCompositeNode.create(rpc,ImmutableList.<Node<?>>of(xml));
CompositeNode xml = mappingService.toDataDom(input);
CompositeNode wrappedXml = ImmutableCompositeNode.create(rpc,ImmutableList.<Node<?>>of(xml));
- RpcResult<CompositeNode> result = biRouter.invokeRpc(rpc, wrappedXml);
+ RpcResult<CompositeNode> result = biRpcRegistry.invokeRpc(rpc, wrappedXml);
Object baResultValue = null;
RpcResult<?> baResult = Rpcs.<Void>getRpcResult(result.isSuccessful(), null, result.getErrors());
return Futures.<RpcResult<?>>immediateFuture(baResult);
Object baResultValue = null;
RpcResult<?> baResult = Rpcs.<Void>getRpcResult(result.isSuccessful(), null, result.getErrors());
return Futures.<RpcResult<?>>immediateFuture(baResult);
private final Map<C, Set<P>> removal;
private final Map<C, Set<P>> announcement;
private final Map<C, Set<P>> removal;
private final Map<C, Set<P>> announcement;
- public RouteChangeImpl(ImmutableMap<C, Set<P>> removal, ImmutableMap<C, Set<P>> announcement) {
+ public RouteChangeImpl(ImmutableMap<C, Set<P>> announcement, ImmutableMap<C, Set<P>> removal) {
super();
this.removal = removal;
this.announcement = announcement;
super();
this.removal = removal;
this.announcement = announcement;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-public interface RpcProvisionRegistry extends BrokerService, RouteChangePublisher<RpcRoutingContext, InstanceIdentifier> {
+public interface RpcProvisionRegistry extends RpcImplementation, BrokerService, RouteChangePublisher<RpcRoutingContext, InstanceIdentifier> {
/**
* Registers an implementation of the rpc.
/**
* Registers an implementation of the rpc.
- protected def Future<RpcResult<CompositeNode>> invokeRpc(QName rpc, CompositeNode input) {
+ protected def Future<RpcResult<CompositeNode>> invokeRpcAsync(QName rpc, CompositeNode input) {
val result = executor.submit([|router.invokeRpc(rpc, input)] as Callable<RpcResult<CompositeNode>>);
return result;
}
val result = executor.submit([|router.invokeRpc(rpc, input)] as Callable<RpcResult<CompositeNode>>);
return result;
}
override <L extends RouteChangeListener<RpcRoutingContext, InstanceIdentifier>> registerRouteChangeListener(L listener) {
return router.registerRouteChangeListener(listener);
}
override <L extends RouteChangeListener<RpcRoutingContext, InstanceIdentifier>> registerRouteChangeListener(L listener) {
return router.registerRouteChangeListener(listener);
}
+
+ override invokeRpc(QName rpc,CompositeNode input){
+ return router.invokeRpc(rpc,input)
+ }
+
+ override getSupportedRpcs() {
+ return router.getSupportedRpcs();
+ }
}
override rpc(QName rpc, CompositeNode input) {
}
override rpc(QName rpc, CompositeNode input) {
- return broker.invokeRpc(rpc, input);
+ return broker.invokeRpcAsync(rpc, input);
}
override <T extends BrokerService> T getService(Class<T> service) {
}
override <T extends BrokerService> T getService(Class<T> service) {
L listener) {
return rpcs.registerRouteChangeListener(listener);
}
L listener) {
return rpcs.registerRouteChangeListener(listener);
}
import org.opendaylight.controller.sal.core.api.RpcRoutingContext;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.controller.sal.core.api.RpcRoutingContext;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
import org.osgi.framework.ServiceReference;
import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
import org.osgi.framework.ServiceReference;
public class RpcProvisionRegistryProxy extends AbstractBrokerServiceProxy<RpcProvisionRegistry>
implements RpcProvisionRegistry {
public class RpcProvisionRegistryProxy extends AbstractBrokerServiceProxy<RpcProvisionRegistry>
implements RpcProvisionRegistry {
public <L extends RouteChangeListener<RpcRoutingContext, InstanceIdentifier>> ListenerRegistration<L> registerRouteChangeListener(L listener) {
return getDelegate().registerRouteChangeListener(listener);
}
public <L extends RouteChangeListener<RpcRoutingContext, InstanceIdentifier>> ListenerRegistration<L> registerRouteChangeListener(L listener) {
return getDelegate().registerRouteChangeListener(listener);
}
+
+
+ @Override
+ public Set<QName> getSupportedRpcs() {
+ return getDelegate().getSupportedRpcs();
+ }
+
+ @Override
+ public RpcResult<CompositeNode> invokeRpc(QName rpc, CompositeNode input) {
+ return getDelegate().invokeRpc(rpc,input);
+ }