Wired up a NotificationPopListner that will notify the MD-SAL 29/2829/2
authorEd Warnicke <eaw@cisco.com>
Mon, 18 Nov 2013 15:30:53 +0000 (09:30 -0600)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 18 Nov 2013 17:27:05 +0000 (17:27 +0000)
Any and all Notification messages get fired at the MD-SAL.

Change-Id: I646671f7f46a98362d916900ea2589e3f40f107e
Signed-off-by: Ed Warnicke <eaw@cisco.com>
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/NotificationPopListener.java [new file with mode: 0644]
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/SwitchConnectionHandlerImpl.java

diff --git a/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/NotificationPopListener.java b/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/NotificationPopListener.java
new file mode 100644 (file)
index 0000000..67dc838
--- /dev/null
@@ -0,0 +1,23 @@
+package org.opendaylight.openflowplugin.openflow.md.core;
+
+import java.util.List;
+
+import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
+import org.opendaylight.openflowplugin.openflow.md.queue.PopListener;
+import org.opendaylight.yangtools.yang.binding.Notification;
+
+public class NotificationPopListener<T> implements PopListener<T> {
+
+
+    @Override
+    public void onPop(List<T> processedMessage) {
+        OFSessionUtil.getSessionManager().getTranslatorMapping();
+        for ( T message : processedMessage ) {
+            if(message instanceof Notification) {
+                OFSessionUtil.getSessionManager().getNotificationProviderService().publish((Notification) message);
+            }
+        }
+
+    }
+
+}
index 400a009b62c345fe299d4c86f83246c61bcaf421..36fde031c7b6429b4815f2320d7c100c93bbd111 100644 (file)
@@ -13,6 +13,7 @@ import java.net.InetAddress;
 import org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter;
 import org.opendaylight.openflowjava.protocol.api.connection.SwitchConnectionHandler;
 import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
+import org.opendaylight.openflowplugin.openflow.md.queue.PopListener;
 import org.opendaylight.openflowplugin.openflow.md.queue.QueueKeeperLightImpl;
 
 /**
@@ -20,12 +21,12 @@ import org.opendaylight.openflowplugin.openflow.md.queue.QueueKeeperLightImpl;
  *
  */
 public class SwitchConnectionHandlerImpl implements SwitchConnectionHandler {
-    
+
     private QueueKeeperLightImpl queueKeeper;
     private ErrorHandler errorHandler;
 
     /**
-     * 
+     *
      */
     public SwitchConnectionHandlerImpl() {
         queueKeeper = new QueueKeeperLightImpl();
@@ -33,7 +34,8 @@ public class SwitchConnectionHandlerImpl implements SwitchConnectionHandler {
         queueKeeper.init();
         // TODO: add pop-listeners consuming object processed via queue
         //queueKeeper.addPopListener(listener);
-        
+        queueKeeper.addPopListener(new NotificationPopListener());
+
         errorHandler = new ErrorHandlerQueueImpl();
         new Thread(errorHandler).start();
     }