[SEBA-593] Register listener to optional services

Change-Id: Iea408beb46b7a027518d52a93be94624c430f77b
diff --git a/src/main/java/org/opencord/kafka/integrations/AaaKafkaIntegration.java b/src/main/java/org/opencord/kafka/integrations/AaaKafkaIntegration.java
index a09cb41..316032e 100644
--- a/src/main/java/org/opencord/kafka/integrations/AaaKafkaIntegration.java
+++ b/src/main/java/org/opencord/kafka/integrations/AaaKafkaIntegration.java
@@ -24,6 +24,7 @@
 import org.apache.felix.scr.annotations.Deactivate;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.ReferencePolicy;
 import org.onosproject.net.AnnotationKeys;
 import org.onosproject.net.device.DeviceService;
 import org.opencord.aaa.AuthenticationEvent;
@@ -50,6 +51,7 @@
     protected DeviceService deviceService;
 
     @Reference(cardinality = ReferenceCardinality.OPTIONAL_UNARY,
+            policy = ReferencePolicy.DYNAMIC,
             bind = "bindAuthenticationService",
             unbind = "unbindAuthenticationService")
     protected AuthenticationService authenticationService;
@@ -65,6 +67,7 @@
     private static final String AUTHENTICATION_STATE = "authenticationState";
 
     protected void bindAuthenticationService(AuthenticationService authenticationService) {
+        log.info("bindAuthenticationService");
         if (this.authenticationService == null) {
             log.info("Binding AuthenticationService");
             this.authenticationService = authenticationService;
@@ -76,6 +79,7 @@
     }
 
     protected void unbindAuthenticationService(AuthenticationService authenticationService) {
+        log.info("unbindAuthenticationService");
         if (this.authenticationService == authenticationService) {
             log.info("Unbinding AuthenticationService");
             this.authenticationService = null;
@@ -88,12 +92,12 @@
 
     @Activate
     public void activate() {
-        log.info("Started");
+        log.info("Started AaaKafkaIntegration");
     }
 
     @Deactivate
     public void deactivate() {
-        log.info("Stopped");
+        log.info("Stopped AaaKafkaIntegration");
     }
 
     private void handle(AuthenticationEvent event) {
diff --git a/src/main/java/org/opencord/kafka/integrations/AccessDeviceKafkaIntegration.java b/src/main/java/org/opencord/kafka/integrations/AccessDeviceKafkaIntegration.java
index 8dddb78..36954ad 100644
--- a/src/main/java/org/opencord/kafka/integrations/AccessDeviceKafkaIntegration.java
+++ b/src/main/java/org/opencord/kafka/integrations/AccessDeviceKafkaIntegration.java
@@ -24,6 +24,7 @@
 import org.apache.felix.scr.annotations.Deactivate;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.ReferencePolicy;
 import org.onosproject.net.AnnotationKeys;
 import org.onosproject.net.Port;
 import org.opencord.kafka.EventBusService;
@@ -46,6 +47,7 @@
     protected EventBusService eventBusService;
 
     @Reference(cardinality = ReferenceCardinality.OPTIONAL_UNARY,
+            policy = ReferencePolicy.DYNAMIC,
             bind = "bindAccessDeviceService",
             unbind = "unbindAccessDeviceService")
     protected AccessDeviceService accessDeviceService;
@@ -89,12 +91,12 @@
 
     @Activate
     public void activate() {
-        log.info("Started");
+        log.info("Started AccessDeviceKafkaIntegration");
     }
 
     @Deactivate
     public void deactivate() {
-        log.info("Stopped");
+        log.info("Stopped AccessDeviceKafkaIntegration");
     }
 
     private void handle(AccessDeviceEvent event, String status) {
diff --git a/src/main/java/org/opencord/kafka/integrations/DhcpL2RelayKafkaIntegration.java b/src/main/java/org/opencord/kafka/integrations/DhcpL2RelayKafkaIntegration.java
index 867bcfe..e1ca65a 100644
--- a/src/main/java/org/opencord/kafka/integrations/DhcpL2RelayKafkaIntegration.java
+++ b/src/main/java/org/opencord/kafka/integrations/DhcpL2RelayKafkaIntegration.java
@@ -24,6 +24,7 @@
 import org.apache.felix.scr.annotations.Deactivate;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.ReferencePolicy;
 import org.onosproject.net.AnnotationKeys;
 import org.onosproject.net.device.DeviceService;
 import org.opencord.dhcpl2relay.DhcpAllocationInfo;
@@ -51,6 +52,7 @@
     protected DeviceService deviceService;
 
     @Reference(cardinality = ReferenceCardinality.OPTIONAL_UNARY,
+            policy = ReferencePolicy.DYNAMIC,
             bind = "bindDhcpL2RelayService",
             unbind = "unbindDhcpL2RelayService")
     protected DhcpL2RelayService dhcpL2RelayService;
@@ -92,12 +94,12 @@
 
     @Activate
     public void activate() {
-        log.info("Started");
+        log.info("Started DhcpL2RelayKafkaIntegration");
     }
 
     @Deactivate
     public void deactivate() {
-        log.info("Stopped");
+        log.info("Stopped DhcpL2RelayKafkaIntegration");
     }
 
     private void handle(DhcpL2RelayEvent event) {