Skip to content
Snippets Groups Projects
Commit f2642f01 authored by Tulio Ribeiro's avatar Tulio Ribeiro
Browse files

Minor bug corrections at startUp time.

NullPointerException verifications.

ant tests passed.
parent ab3da0f4
Branches v0.82
Tags v0.82
No related merge requests found
...@@ -2,7 +2,6 @@ package net.floodlightcontroller.simpleft; ...@@ -2,7 +2,6 @@ package net.floodlightcontroller.simpleft;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
...@@ -74,9 +73,6 @@ IRPCListener ...@@ -74,9 +73,6 @@ IRPCListener
@Override @Override
public Collection<Class<? extends IFloodlightService>> getModuleServices() { public Collection<Class<? extends IFloodlightService>> getModuleServices() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
/*Collection<Class<? extends IFloodlightService>> l =
new ArrayList<Class<? extends IFloodlightService>>();
return l;*/
return null; return null;
} }
...@@ -84,9 +80,6 @@ IRPCListener ...@@ -84,9 +80,6 @@ IRPCListener
@Override @Override
public Map<Class<? extends IFloodlightService>, IFloodlightService> getServiceImpls() { public Map<Class<? extends IFloodlightService>, IFloodlightService> getServiceImpls() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
/*Map<Class<? extends IFloodlightService>, IFloodlightService> m =
new HashMap<Class<? extends IFloodlightService>, IFloodlightService>();
return m;*/
return null; return null;
} }
...@@ -96,10 +89,8 @@ IRPCListener ...@@ -96,10 +89,8 @@ IRPCListener
// TODO Auto-generated method stub // TODO Auto-generated method stub
Collection<Class<? extends IFloodlightService>> l = Collection<Class<? extends IFloodlightService>> l =
new ArrayList<Class<? extends IFloodlightService>>(); new ArrayList<Class<? extends IFloodlightService>>();
//l.add(IFloodlightProviderService.class);
l.add(IStorageSourceService.class); l.add(IStorageSourceService.class);
l.add(ISyncService.class); l.add(ISyncService.class);
l.add(IThreadPoolService.class);
l.add(IOFSwitchService.class); l.add(IOFSwitchService.class);
return l; return l;
} }
...@@ -146,8 +137,6 @@ IRPCListener ...@@ -146,8 +137,6 @@ IRPCListener
return null; return null;
} }
@Override @Override
public void keysModified(Iterator<String> keys, public void keysModified(Iterator<String> keys,
org.sdnplatform.sync.IStoreListener.UpdateType type) { org.sdnplatform.sync.IStoreListener.UpdateType type) {
...@@ -163,7 +152,7 @@ IRPCListener ...@@ -163,7 +152,7 @@ IRPCListener
);*/ );*/
if(type.name().equals("REMOTE")){ if(type.name().equals("REMOTE")){
String swIds = storeFT.get(k).getValue(); String swIds = storeFT.get(k).getValue();
logger.debug("REMOTE: key:{}, Value:{}", k, swIds); logger.debug("REMOTE: NodeId:{}, Switches:{}", k, swIds);
} }
} catch (SyncException e) { } catch (SyncException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
...@@ -210,8 +199,10 @@ IRPCListener ...@@ -210,8 +199,10 @@ IRPCListener
@Override @Override
public void switchChanged(DatapathId switchId) { public void switchChanged(DatapathId switchId) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
String switches = getActiveSwitches();
if(switches==null)return;
try { try {
this.storeFT.put(controllerId, getActiveSwitches()); this.storeFT.put(controllerId, switches);
} catch (SyncException e) { } catch (SyncException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
...@@ -220,14 +211,20 @@ IRPCListener ...@@ -220,14 +211,20 @@ IRPCListener
public String getActiveSwitches(){ public String getActiveSwitches(){
if(switchService == null)return null;
String activeSwitches = ""; String activeSwitches = "";
Iterator<DatapathId> itDpid = switchService.getAllSwitchDpids().iterator(); Iterator<DatapathId> itDpid = switchService.getAllSwitchDpids().iterator();
while (itDpid.hasNext()) { while (itDpid.hasNext()) {
DatapathId dpid = itDpid.next(); DatapathId dpid = itDpid.next();
if(switchService.getActiveSwitch(dpid).isActive()){ try{
activeSwitches += dpid; if(switchService.getActiveSwitch(dpid).isActive()){
if(itDpid.hasNext()) activeSwitches += dpid;
activeSwitches += ","; if(itDpid.hasNext())
activeSwitches += ",";
}
}
catch(NullPointerException npe){
return null;
} }
} }
return activeSwitches; return activeSwitches;
...@@ -274,7 +271,7 @@ IRPCListener ...@@ -274,7 +271,7 @@ IRPCListener
public void connectedNode(Short nodeId) { public void connectedNode(Short nodeId) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
String activeSwicthes = getActiveSwitches(); String activeSwicthes = getActiveSwitches();
logger.debug("NodeID: {} connected, informing my switches: {}", nodeId, activeSwicthes); logger.debug("NodeID: {} connected, my switches: {}", nodeId, activeSwicthes);
try { try {
storeFT.put(controllerId, activeSwicthes); storeFT.put(controllerId, activeSwicthes);
} catch (SyncException e) { } catch (SyncException e) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment