Cosmetic changes, annotations
diff --git a/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/NetworkGraphPublisher.java b/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/NetworkGraphPublisher.java
index 187465f..742985e 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/NetworkGraphPublisher.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/NetworkGraphPublisher.java
@@ -56,7 +56,7 @@
ILinkDiscoveryListener,
IFloodlightModule,
INetworkGraphService {
-
+
protected IDeviceStorage devStore;
protected ISwitchStorage swStore;
protected ILinkStorage linkStore;
@@ -64,19 +64,19 @@
//protected IDeviceService deviceService;
protected IControllerRegistryService registryService;
protected GraphDBOperation op;
-
+
protected static final String DBConfigFile = "dbconf";
protected static final String CleanupEnabled = "EnableCleanup";
protected IThreadPoolService threadPool;
protected IFloodlightProviderService floodlightProvider;
-
+
protected final int CLEANUP_TASK_INTERVAL = 60; // 1 min
protected SingletonTask cleanupTask;
protected ILinkDiscoveryService linkDiscovery;
protected IDatagridService datagridService;
-
- /**
+
+ /**
* Cleanup and synch switch state from registry
*/
protected class SwitchCleanup implements ControlChangeCallback, Runnable {
@@ -114,7 +114,7 @@
//if (swStore.updateSwitch(HexString.toHexString(dpid), SwitchState.INACTIVE, DM_OPERATION.UPDATE)) {
if (swStore.deactivateSwitch(HexString.toHexString(dpid))) {
registryService.releaseControl(dpid);
-
+
// TODO publish UPDATE_SWITCH event here
//
// NOTE: Here we explicitly send
@@ -144,14 +144,14 @@
} catch (Exception e) {
log.error("Error in SwitchCleanup:controlChanged ", e);
}
- }
+ }
}
}
protected void switchCleanup() {
op.close();
Iterable<ISwitchObject> switches = op.getActiveSwitches();
-
+
log.debug("Checking for inactive switches");
// For each switch check if a controller exists in controller registry
for (ISwitchObject sw: switches) {
@@ -180,11 +180,11 @@
public void linkDiscoveryUpdate(LDUpdate update) {
Link lt = new Link(update.getSrc(),update.getSrcPort(),update.getDst(),update.getDstPort());
//log.debug("{}:LinkDicoveryUpdate(): Updating Link {}",this.getClass(), lt);
-
+
switch (update.getOperation()) {
case LINK_REMOVED:
log.debug("LinkDiscoveryUpdate(): Removing link {}", lt);
-
+
if (linkStore.deleteLink(lt)) {
// TODO publish DELETE_LINK event here
TopologyElement topologyElement =
@@ -197,7 +197,7 @@
break;
case LINK_UPDATED:
log.debug("LinkDiscoveryUpdate(): Updating link {}", lt);
-
+
LinkInfo linfo = linkStore.getLinkInfo(lt);
// TODO update "linfo" using portState derived using "update"
if (linkStore.update(lt, linfo, DM_OPERATION.UPDATE)) {
@@ -216,7 +216,7 @@
break;
case LINK_ADDED:
log.debug("LinkDiscoveryUpdate(): Adding link {}", lt);
-
+
if (linkStore.addLink(lt)) {
// TODO publish ADD_LINK event here
TopologyElement topologyElement =
@@ -248,7 +248,7 @@
TopologyElement topologyElementPort =
new TopologyElement(sw.getId(), port.getPortNumber());
datagridService.notificationSendTopologyElementAdded(topologyElementPort);
-
+
// Allow links to be discovered on this port now that it's
// in the database
linkDiscovery.RemoveFromSuppressLLDPs(sw.getId(), port.getPortNumber());
@@ -323,7 +323,7 @@
// Allow links to be discovered on this port now that it's
// in the database
linkDiscovery.RemoveFromSuppressLLDPs(switchId, port.getPortNumber());
-
+
// TODO publish ADD_PORT event here
TopologyElement topologyElement =
new TopologyElement(switchId, port.getPortNumber());
@@ -408,7 +408,7 @@
public void deviceVlanChanged(IDevice device) {
// TODO Auto-generated method stub
}
-
+
@Override
public Collection<Class<? extends IFloodlightService>> getModuleServices() {
@@ -445,7 +445,7 @@
Map<String, String> configMap = context.getConfigParams(this);
String conf = configMap.get(DBConfigFile);
op = new GraphDBOperation(conf);
-
+
floodlightProvider =
context.getServiceImpl(IFloodlightProviderService.class);
//deviceService = context.getServiceImpl(IDeviceService.class);
@@ -453,18 +453,18 @@
threadPool = context.getServiceImpl(IThreadPoolService.class);
registryService = context.getServiceImpl(IControllerRegistryService.class);
datagridService = context.getServiceImpl(IDatagridService.class);
-
+
devStore = new DeviceStorageImpl();
devStore.init(conf);
-
+
swStore = new SwitchStorageImpl();
swStore.init(conf);
-
+
linkStore = new LinkStorageImpl();
linkStore.init(conf);
-
+
log.debug("Initializing NetworkGraphPublisher module with {}", conf);
-
+
}
@Override
@@ -475,11 +475,11 @@
//deviceService.addListener(this);
floodlightProvider.addOFSwitchListener(this);
linkDiscovery.addListener(this);
-
+
log.debug("Adding EventListener");
IDBConnection conn = op.getDBConnection();
conn.addEventListener(new LocalTopologyEventListener((GraphDBConnection) conn));
- // Setup the Cleanup task.
+ // Setup the Cleanup task.
if (cleanupNeeded == null || !cleanupNeeded.equals("False")) {
ScheduledExecutorService ses = threadPool.getScheduledExecutor();
cleanupTask = new SingletonTask(ses, new SwitchCleanup());