Added initial pieces for topology related notifications.
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
index 012f333..44607a9 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
@@ -31,6 +31,7 @@
import net.onrc.onos.ofcontroller.flowmanager.web.FlowWebRoutable;
import net.onrc.onos.ofcontroller.topology.ITopologyNetService;
import net.onrc.onos.ofcontroller.topology.Topology;
+import net.onrc.onos.ofcontroller.topology.TopologyElement;
import net.onrc.onos.ofcontroller.util.*;
import org.openflow.protocol.OFType;
@@ -76,6 +77,10 @@
protected BlockingQueue<EventEntry<FlowPath>> flowPathEvents =
new LinkedBlockingQueue<EventEntry<FlowPath>>();
+ // The queue with Topology Element updates
+ protected BlockingQueue<EventEntry<TopologyElement>> topologyEvents =
+ new LinkedBlockingQueue<EventEntry<TopologyElement>>();
+
/**
* Periodic task for reading the Flow Entries and pushing changes
* into the switches.
@@ -494,8 +499,19 @@
// Initialize the Flow Entry ID generator
nextFlowEntryIdPrefix = randomGenerator.nextInt();
- // Register with the Datagrid Service and obtain the initial state
+ // Register with the Datagrid Service
datagridService.registerFlowService(this);
+
+ // Obtain the initial Topology state
+ Collection<TopologyElement> topologyElements =
+ datagridService.getAllTopologyElements();
+ for (TopologyElement topologyElement : topologyElements) {
+ EventEntry<TopologyElement> eventEntry =
+ new EventEntry<TopologyElement>(EventEntry.Type.ENTRY_ADD, topologyElement);
+ topologyEvents.add(eventEntry);
+ }
+
+ // Obtain the initial Flow state
Collection<FlowPath> flowPaths = datagridService.getAllFlows();
for (FlowPath flowPath : flowPaths) {
EventEntry<FlowPath> eventEntry =
@@ -864,4 +880,34 @@
public void notificationRecvFlowUpdated(FlowPath flowPath) {
// TODO
}
+
+ /**
+ * Receive a notification that a Topology Element is added.
+ *
+ * @param topologyElement the Topology Element that is added.
+ */
+ @Override
+ public void notificationRecvTopologyElementAdded(TopologyElement topologyElement) {
+ // TODO
+ }
+
+ /**
+ * Receive a notification that a Topology Element is removed.
+ *
+ * @param topologyElement the Topology Element that is removed.
+ */
+ @Override
+ public void notificationRecvTopologyElementRemoved(TopologyElement topologyElement) {
+ // TODO
+ }
+
+ /**
+ * Receive a notification that a Topology Element is updated.
+ *
+ * @param topologyElement the Topology Element that is updated.
+ */
+ @Override
+ public void notificationRecvTopologyElementUpdated(TopologyElement topologyElement) {
+ // TODO
+ }
}