Skip to content
Snippets Groups Projects
Commit a8ff90bb authored by Ryan Izard's avatar Ryan Izard
Browse files

Merge pull request #646 from tulioalberton/master

Fired when receive a ROLE_STATUS message, at Master to Slave transiti…
parents b1c4465b 7c6604ec
No related branches found
No related tags found
No related merge requests found
Showing
with 100 additions and 58 deletions
......@@ -51,7 +51,7 @@ public interface IOFSwitchListener {
public void switchAdded(DatapathId switchId);
/**
* Fired when a switch disconnects from the cluster ,
* Fired when a switch disconnects from the cluster,
* @param switchId the datapath Id of the switch
*/
public void switchRemoved(DatapathId switchId);
......@@ -88,4 +88,14 @@ public interface IOFSwitchListener {
* @param switchId
*/
public void switchChanged(DatapathId switchId);
/**
* Fired when receive a ROLE_STATUS message,
* TODO: At Master to Slave transitions, switch become deactivated.
* @param switchId
*/
public void switchDeactivated(DatapathId switchId);
}
......@@ -235,6 +235,12 @@ public class Controller implements IFloodlightProviderService, IStorageSourceLis
@Override
public void switchChanged(DatapathId switchId) {
}
@Override
public void switchDeactivated(DatapathId switchId) {
// TODO Auto-generated method stub
}
}
/**
......
......@@ -1453,12 +1453,8 @@ public class OFSwitchHandshakeHandler implements IOFConnectionListener {
*/
//log.info("Processing roleStatus from MasterState...");
long role = m.getRole();
if(role==3){
if(role==3)
sendRoleRequest(OFControllerRole.ROLE_SLAVE);
/*OFSwitchManager.switchInitialRole.remove(mainConnection.getDatapathId());
OFSwitchManager.switchInitialRole.put(mainConnection.getDatapathId(),
OFControllerRole.ROLE_SLAVE);*/
}
else if (role==2)
sendRoleRequest(OFControllerRole.ROLE_MASTER);
else if (role==1)
......
......@@ -392,7 +392,8 @@ IHAListener, IFloodlightModule, IOFSwitchService, IStoreListener<DatapathId> {
listener.switchActivated(swId);
break;
case DEACTIVATED:
// ignore
// Called on master to slave transitions, ROLE_STATUS message.
listener.switchDeactivated(swId);
break;
case OTHERCHANGE:
counters.switchOtherChange
......
......@@ -121,4 +121,10 @@ public class DHCPSwitchFlowSetter implements IFloodlightModule, IOFSwitchListene
@Override
public void switchChanged(DatapathId switchId) {
}
@Override
public void switchDeactivated(DatapathId switchId) {
// TODO Auto-generated method stub
}
}
\ No newline at end of file
......@@ -573,4 +573,10 @@ public class Forwarding extends ForwardingBase implements IFloodlightModule, IOF
@Override
public void switchChanged(DatapathId switchId) {
}
@Override
public void switchDeactivated(DatapathId switchId) {
// TODO Auto-generated method stub
}
}
......@@ -2287,4 +2287,10 @@ IFloodlightModule, IInfoProvider {
//no-op
}
}
@Override
public void switchDeactivated(DatapathId switchId) {
// TODO Auto-generated method stub
}
}
\ No newline at end of file
......@@ -33,7 +33,6 @@ import net.floodlightcontroller.core.module.FloodlightModuleException;
import net.floodlightcontroller.core.module.IFloodlightModule;
import net.floodlightcontroller.core.module.IFloodlightService;
import net.floodlightcontroller.storage.IStorageSourceService;
import net.floodlightcontroller.threadpool.IThreadPoolService;
import org.projectfloodlight.openflow.protocol.OFControllerRole;
import org.projectfloodlight.openflow.protocol.OFMessage;
......@@ -60,12 +59,8 @@ IRPCListener
private ISyncService syncService;
private IStoreClient<String, String> storeFT;
protected static Logger logger = LoggerFactory.getLogger(FT.class);
protected static IOFSwitchService switchService;
private static UtilDurable utilDurable;
private String controllerId;
@Override
......@@ -90,14 +85,12 @@ IRPCListener
public Collection<Class<? extends IFloodlightService>> getModuleServices() {
// TODO Auto-generated method stub
return null;
}
@Override
public Map<Class<? extends IFloodlightService>, IFloodlightService> getServiceImpls() {
// TODO Auto-generated method stub
return null;
}
@Override
......@@ -118,7 +111,6 @@ IRPCListener
this.syncService = context.getServiceImpl(ISyncService.class);
switchService = context.getServiceImpl(IOFSwitchService.class);
utilDurable = new UtilDurable();
Map<String, String> configParams = context.getConfigParams(FloodlightProvider.class);
controllerId = configParams.get("controllerId");
......@@ -141,7 +133,6 @@ IRPCListener
} catch (SyncException e) {
throw new FloodlightModuleException("Error while setting up sync service", e);
}
}
@Override
......@@ -184,51 +175,46 @@ IRPCListener
@Override
public void switchRemoved(DatapathId switchId) {
// TODO Auto-generated method stub
try {
this.storeFT.put(controllerId, getActiveSwitches());
} catch (SyncException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String activeSwitches = getActiveSwitchesAndUpdateSyncInfo();
logger.debug("Switch REMOVED: {}, Syncing: {}", switchId, activeSwitches);
}
@Override
public void switchActivated(DatapathId switchId) {
// TODO Auto-generated method stub
String switches = getActiveSwitches();
if(switches==null)return;
try {
this.storeFT.put(controllerId, switches);
} catch (SyncException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String activeSwitches = getActiveSwitchesAndUpdateSyncInfo();
logger.debug("Switch ACTIVATED: {}, Syncing: {}", switchId, activeSwitches);
}
@Override
public void switchPortChanged(DatapathId switchId, OFPortDesc port,
PortChangeType type) {
// TODO Auto-generated method stub
logger.debug("Switch Port CHANGED: {}", switchId);
}
@Override
public void switchChanged(DatapathId switchId) {
// TODO Auto-generated method stub
String switches = getActiveSwitches();
if(switches==null)return;
try {
this.storeFT.put(controllerId, switches);
} catch (SyncException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String activeSwitches = getActiveSwitchesAndUpdateSyncInfo();
logger.debug("Switch CHANGED: {}, Syncing: {}", switchId, activeSwitches);
}
@Override
public void switchDeactivated(DatapathId switchId) {
// TODO Auto-generated method stub
String activeSwitches = getActiveSwitchesAndUpdateSyncInfo();
logger.debug("Switch DEACTIVATED: {}, Syncing: {}", switchId, activeSwitches);
}
public String getActiveSwitches(){
if(switchService == null)return null;
public String getActiveSwitchesAndUpdateSyncInfo(){
String activeSwitches = "";
if(switchService == null)
return "";
Iterator<DatapathId> itDpid = switchService.getAllSwitchDpids().iterator();
while (itDpid.hasNext()) {
DatapathId dpid = itDpid.next();
......@@ -240,14 +226,24 @@ IRPCListener
}
}
catch(NullPointerException npe){
return null;
return "";
}
}
return activeSwitches;
if(activeSwitches.equals(""))
return "";
try {
this.storeFT.put(controllerId, activeSwitches);
return activeSwitches;
} catch (SyncException e) {
e.printStackTrace();
return "";
}
}
public void setSwitchRole(OFControllerRole role, String swId){
IOFSwitch sw = switchService.getActiveSwitch(DatapathId.of(swId));
OFRoleReply reply=null;
UtilDurable utilDurable = new UtilDurable();
......@@ -275,7 +271,7 @@ IRPCListener
e.printStackTrace();
}
if(!swIds.equals("")){
if(swIds != null){
String swId[] = swIds.split(",");
for (int i = 0; i < swId.length; i++) {
setSwitchRole(OFControllerRole.ROLE_MASTER, swId[i]);
......@@ -286,14 +282,8 @@ IRPCListener
@Override
public void connectedNode(Short nodeId) {
// TODO Auto-generated method stub
String activeSwicthes = getActiveSwitches();
logger.debug("NodeID: {} connected, my switches: {}", nodeId, activeSwicthes);
try {
storeFT.put(controllerId, activeSwicthes);
} catch (SyncException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String activeSwicthes = getActiveSwitchesAndUpdateSyncInfo();
logger.debug("NodeID:{} connected, sending my Switches: {}", nodeId, activeSwicthes);
}
}
......@@ -998,4 +998,10 @@ implements IOFSwitchListener, IFloodlightModule, IStaticFlowEntryPusherService,
deleteAllFlows();
}
}
@Override
public void switchDeactivated(DatapathId switchId) {
// TODO Auto-generated method stub
}
}
......@@ -280,4 +280,10 @@ public class TestModule implements IFloodlightModule, IOFSwitchListener {
// TODO Auto-generated method stub
}
@Override
public void switchDeactivated(DatapathId switchId) {
// TODO Auto-generated method stub
}
}
......@@ -11,6 +11,7 @@ net.floodlightcontroller.forwarding.Forwarding,\
net.floodlightcontroller.linkdiscovery.internal.LinkDiscoveryManager,\
net.floodlightcontroller.ui.web.StaticWebRoutable,\
net.floodlightcontroller.loadbalancer.LoadBalancer,\
net.floodlightcontroller.loadbalancer.LoadBalancer,\
net.floodlightcontroller.firewall.Firewall,\
net.floodlightcontroller.simpleft.FT,\
net.floodlightcontroller.devicemanager.internal.DeviceManagerImpl,\
......@@ -29,6 +30,8 @@ org.sdnplatform.sync.internal.SyncManager.nodes=[\
]
net.floodlightcontroller.forwarding.Forwarding.match=vlan, mac, ip, transport
net.floodlightcontroller.forwarding.Forwarding.flood-arp=NO
net.floodlightcontroller.forwarding.Forwarding.idle-timeout=5
net.floodlightcontroller.forwarding.Forwarding.set-send-flow-rem-flag=FALSE
net.floodlightcontroller.core.internal.FloodlightProvider.openFlowPort=7753
net.floodlightcontroller.core.internal.FloodlightProvider.role=ACTIVE
net.floodlightcontroller.core.internal.FloodlightProvider.workerThreads=8
......
......@@ -31,6 +31,8 @@ org.sdnplatform.sync.internal.SyncManager.nodes=[\
]
net.floodlightcontroller.forwarding.Forwarding.match=vlan, mac, ip, transport
net.floodlightcontroller.forwarding.Forwarding.flood-arp=NO
net.floodlightcontroller.forwarding.Forwarding.idle-timeout=5
net.floodlightcontroller.forwarding.Forwarding.set-send-flow-rem-flag=FALSE
net.floodlightcontroller.core.internal.FloodlightProvider.openFlowPort=6653
net.floodlightcontroller.core.internal.FloodlightProvider.role=ACTIVE
net.floodlightcontroller.core.internal.FloodlightProvider.workerThreads=8
......
......@@ -19,16 +19,20 @@
<logger name="org.sdnplatform.sync.internal.config.StorageCCProvider" level="INFO"></logger>
<logger name="org.sdnplatform.sync.internal.config.PropertyCCProvider" level="INFO"></logger>
<logger name="org.sdnplatform.sync.internal.rpc.RPCService" level="INFO"></logger>
<logger name="net.floodlightcontroller.devicemanager" level="INFO"></logger>
<logger name="net.floodlightcontroller.devicemanager.DeviceManagerImpl" level="INFO"></logger>
<logger name="net.floodlightcontroller.linkdiscovery" level="INFO"></logger>
<logger name="net.floodlightcontroller.forwarding" level="INFO"></logger>
<logger name="net.floodlightcontroller.simpleft.FT" level="INFO"></logger>
<logger name="net.floodlightcontroller.forwarding.Forwarding" level="INFO"></logger>
<logger name="net.floodlightcontroller.forwarding.ForwardingBase" level="INFO"></logger>
<logger name="net.floodlightcontroller.core" level="INFO"></logger>
<logger name="net.floodlightcontroller.topology" level="INFO" ></logger>
<logger name="org.projectfloodlight.openflow" level="INFO" ></logger>
<logger name="net.floodlightcontroller.core.internal.OFSwitchManager" level="INFO"></logger>
<logger name="net.floodlightcontroller.core.internal.OFSwitchHandshakeHandler" level="INFO"></logger>
<logger name="net.floodlightcontroller.core.internal.OFChannelHandler" level="INFO"></logger>
<logger name="net.floodlightcontroller.core.internal.OFSwitchManager" level="INFO"></logger>
<logger name="net.floodlightcontroller.staticflowentry.StaticFlowEntries" level="INFO"></logger>
<logger name="net.floodlightcontroller.staticflowentry.StaticFlowEntryPusher" level="INFO"></logger>
<logger name="net.floodlightcontroller.simpleft.FT" level="INFO"></logger>
</configuration>
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