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 0aab59e..4e2a4fb 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 3fccb1d..640bc65 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 f74faa3..bae95ff 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 84cc5c7..3244b5a 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;
+                        }
+                    }
+                }
             }
         }
     }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.