BUG 4017: Notification publish service is not available from provider context 46/32346/5
authorTomas Cere <tcere@cisco.com>
Mon, 11 Jan 2016 16:08:11 +0000 (17:08 +0100)
committerTomas Cere <tcere@cisco.com>
Mon, 18 Jan 2016 12:31:00 +0000 (12:31 +0000)
Change-Id: I2cb2dd4e6e3c22b8db1d368bde2c914d53100661
Signed-off-by: Tomas Cere <tcere@cisco.com>
opendaylight/md-sal/md-sal-config/src/main/resources/initial/01-md-sal.xml
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RootBindingAwareBroker.java
opendaylight/md-sal/sal-binding-config/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingBrokerImplModule.java
opendaylight/md-sal/sal-binding-config/src/main/yang/opendaylight-binding-broker-impl.yang

index 0aab59ef4013ecf8e6bdd7f58fc35451a4fd6e52..4e2a4fb4d73dfebcbe039abd1a9f8ac806436bfd 100644 (file)
                             <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type>
                             <name>binding-data-broker</name>
                         </root-data-broker>
+                        <notification-publish-service>
+                            <type xmlns:binding-impl="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl">binding-impl:binding-new-notification-publish-service</type>
+                            <name>binding-notification-publish-adapter</name>
+                        </notification-publish-service>
                     </binding-broker-impl>
                 </module>
 
index 3fccb1d326c57f4afe91e5259e5c5062c77e85c1..640bc658f680105bf23a97059ce70f00114128ed 100644 (file)
@@ -12,6 +12,7 @@ import static com.google.common.base.Preconditions.checkState;
 import com.google.common.collect.ImmutableClassToInstanceMap;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.MountPointService;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
 import org.opendaylight.controller.md.sal.binding.util.AbstractBindingSalProviderInstance;
 import org.opendaylight.controller.md.sal.binding.util.BindingContextUtils;
 import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener;
@@ -50,6 +51,8 @@ public class RootBindingAwareBroker implements Mutable, Identifiable<String>, Bi
 
     private NotificationProviderService notificationBroker;
 
+    private NotificationPublishService notificationPublishService;
+
     @SuppressWarnings("deprecation")
     private DataProviderService legacyDataBroker;
 
@@ -88,6 +91,9 @@ public class RootBindingAwareBroker implements Mutable, Identifiable<String>, Bi
         return this.notificationBroker;
     }
 
+    public NotificationPublishService getNotificationPublishService() {
+        return this.notificationPublishService;
+    }
     public RpcProviderRegistry getRpcProviderRegistry() {
         return this.rpcBroker;
     }
@@ -120,6 +126,10 @@ public class RootBindingAwareBroker implements Mutable, Identifiable<String>, Bi
         this.notificationBroker = notificationBroker;
     }
 
+    public void setNotificationPublishService(final NotificationPublishService notificationPublishService) {
+        this.notificationPublishService = notificationPublishService;
+    }
+
     public void setLegacyDataBroker(final DataProviderService dataBroker) {
         this.legacyDataBroker = dataBroker;
     }
@@ -141,11 +151,18 @@ public class RootBindingAwareBroker implements Mutable, Identifiable<String>, Bi
         }
         consBuilder.put(MountPointService.class, mountService);
         consBuilder.put(MountService.class, legacyMount).build();
+
         supportedConsumerServices = consBuilder.build();
-        supportedProviderServices = ImmutableClassToInstanceMap.<BindingAwareService> builder()
-                .putAll(supportedConsumerServices).put(NotificationProviderService.class, getRoot())
+        final ImmutableClassToInstanceMap.Builder<BindingAwareService> provBuilder = ImmutableClassToInstanceMap
+                .builder();
+        provBuilder.putAll(supportedConsumerServices).put(NotificationProviderService.class, getRoot())
                 .put(DataProviderService.class, getRoot()).put(RpcProviderRegistry.class, getRoot())
-                .put(MountProviderService.class, legacyMount).build();
+                .put(MountProviderService.class, legacyMount);
+        if (notificationPublishService != null) {
+            provBuilder.put(NotificationPublishService.class, notificationPublishService);
+        }
+        supportedConsumerServices = consBuilder.build();
+        supportedProviderServices = provBuilder.build();
     }
 
     @Override
index f74faa3d223c2cdc19691e3535882ec2709a0cbc..bae95ffb7c39d479fc1ea2dd4a5da4854153c5b6 100644 (file)
@@ -67,8 +67,12 @@ public final class BindingBrokerImplModule extends
         final RpcProviderRegistry heliumRpcBroker = new HeliumRpcProviderRegistry(rpcConsumer, rpcProvider);
         final MountProviderService legacyMount = createLegacyMountPointService(mount);
 
+
         broker.setLegacyDataBroker(getDataBrokerDependency());
         broker.setNotificationBroker(getNotificationServiceDependency());
+        if (getNotificationPublishServiceDependency() != null) {
+            broker.setNotificationPublishService(getNotificationPublishServiceDependency());
+        }
         broker.setRpcBroker(heliumRpcBroker);
         broker.setDataBroker(getRootDataBrokerDependency());
         broker.setMountService(mount);
index 84cc5c7b99121e08e801b5af82777264712154eb..3244b5a4ee6f25e6653fb0258889b6ff1ecc4e79 100644 (file)
@@ -148,6 +148,18 @@ module opendaylight-sal-binding-broker-impl {
                         }
                     }
                 }
+
+                container notification-publish-service {
+                    uses config:service-ref {
+                        refine type {
+                            mandatory false;
+                            config:required-identity binding-new-notification-publish-service;
+                        }
+                        refine name {
+                            mandatory false;
+                        }
+                    }
+                }
             }
         }
     }