Merge "BUG-648: include yangtools.util package"
authorTony Tkacik <ttkacik@cisco.com>
Thu, 29 May 2014 10:37:59 +0000 (10:37 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 29 May 2014 10:37:59 +0000 (10:37 +0000)
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/ComponentActivator.java
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/DataPacketAdapter.java
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/topology/TopologyAdapter.java

index b3a89a4..ba68d52 100644 (file)
@@ -107,6 +107,7 @@ public class ComponentActivator extends ComponentActivatorAbstractBase {
                 nodeConnectorFactory,
                 topology,
                 tpProvider,
+                this // Used for setBroker callback
         };
     }
 
index f95f978..4d26a3a 100644 (file)
@@ -17,13 +17,19 @@ import org.slf4j.LoggerFactory;
 
 class DataPacketAdapter implements PacketProcessingListener {
     private static final Logger LOG = LoggerFactory.getLogger(DataPacketAdapter.class);
+
+    // These are injected via Apache DM (see ComponentActivator)
     private IPluginOutDataPacketService dataPacketPublisher;
 
     @Override
     public void onPacketReceived(final PacketReceived packet) {
         try {
             RawPacket inPacket = toRawPacket(packet);
-            dataPacketPublisher.receiveDataPacket(inPacket);
+            if (dataPacketPublisher != null) {
+                dataPacketPublisher.receiveDataPacket(inPacket);
+            } else {
+                LOG.warn("IPluginOutDataPacketService is not available. Not forwarding packet to AD-SAL.");
+            }
         } catch (ConstructionException e) {
             LOG.warn("Failed to construct raw packet from {}, dropping it", packet, e);
         }
@@ -34,4 +40,13 @@ class DataPacketAdapter implements PacketProcessingListener {
         ret.setIncomingNodeConnector(NodeMapping.toADNodeConnector(received.getIngress()));
         return ret;
     }
+
+    public IPluginOutDataPacketService getDataPacketPublisher() {
+        return dataPacketPublisher;
+    }
+
+    // These are injected via Apache DM (see ComponentActivator)
+    public void setDataPacketPublisher(final IPluginOutDataPacketService dataPacketPublisher) {
+        this.dataPacketPublisher = dataPacketPublisher;
+    }
 }
index b609add..4e3cf69 100644 (file)
@@ -23,8 +23,10 @@ public class TopologyAdapter implements IPluginInTopologyService {
     private final InstanceIdentifier<Topology> topology = InstanceIdentifier.builder(NetworkTopology.class)
             .child(Topology.class, new TopologyKey(new TopologyId("flow:1"))).toInstance();
 
-    // FIXME: seems to be unused
+    // Injected via Apache DM
     private IPluginOutTopologyService topologyPublisher;
+
+
     private DataProviderService dataService;
 
     public void setDataService(final DataProviderService dataService) {
@@ -37,4 +39,12 @@ public class TopologyAdapter implements IPluginInTopologyService {
         final Topology t = reader.readOperationalData(topology);
         topologyPublisher.edgeUpdate(TopologyMapping.toADEdgeUpdates(t, reader));
     }
+
+    public IPluginOutTopologyService getTopologyPublisher() {
+        return topologyPublisher;
+    }
+
+    public void setTopologyPublisher(final IPluginOutTopologyService topologyPublisher) {
+        this.topologyPublisher = topologyPublisher;
+    }
 }