Skip to content
Snippets Groups Projects
Commit 31b4aaeb authored by Banse, Christian's avatar Banse, Christian
Browse files

first attempt to re-enable message listeners to receive outgoing OF

messages
parent 973d0ed0
No related branches found
No related tags found
No related merge requests found
......@@ -14,3 +14,4 @@ findbugs-results
/thrift
*.idea/*
*.iml
/target/
......@@ -715,6 +715,7 @@ public class OFSwitch implements IOFSwitchBackend {
log.trace("Channel: {}, Connected: {}", connections.get(OFAuxId.MAIN).getRemoteInetAddress(), connections.get(OFAuxId.MAIN).isConnected());
if (isActive()) {
connections.get(OFAuxId.MAIN).write(m);
switchManager.handleOutgoingMessage(this, m);
} else {
log.warn("Attempted to write to switch {} that is SLAVE.", this.getId().toString());
}
......@@ -746,6 +747,7 @@ public class OFSwitch implements IOFSwitchBackend {
public void write(OFMessage m, LogicalOFMessageCategory category) {
if (isActive()) {
this.getConnection(category).write(m);
switchManager.handleOutgoingMessage(this, m);
} else {
log.warn("Attempted to write to switch {} that is SLAVE.", this.getId().toString());
}
......@@ -755,6 +757,10 @@ public class OFSwitch implements IOFSwitchBackend {
public void write(Iterable<OFMessage> msglist, LogicalOFMessageCategory category) {
if (isActive()) {
this.getConnection(category).write(msglist);
for(OFMessage m : msglist) {
switchManager.handleOutgoingMessage(this, m);
}
} else {
log.warn("Attempted to write to switch {} that is SLAVE.", this.getId().toString());
}
......@@ -785,6 +791,10 @@ public class OFSwitch implements IOFSwitchBackend {
public void write(Iterable<OFMessage> msglist) {
if (isActive()) {
connections.get(OFAuxId.MAIN).write(msglist);
for(OFMessage m : msglist) {
switchManager.handleOutgoingMessage(this, m);
}
} else {
log.warn("Attempted to write to switch {} that is SLAVE.", this.getId().toString());
}
......
......@@ -5,6 +5,7 @@ import java.util.List;
import net.floodlightcontroller.core.FloodlightContext;
import net.floodlightcontroller.core.IOFConnectionBackend;
import net.floodlightcontroller.core.IOFSwitch.SwitchStatus;
import net.floodlightcontroller.core.IOFSwitch;
import net.floodlightcontroller.core.IOFSwitchBackend;
import net.floodlightcontroller.core.IOFSwitchDriver;
import net.floodlightcontroller.core.LogicalOFMessageCategory;
......@@ -55,6 +56,14 @@ public interface IOFSwitchManager {
* @param bContext the Floodlight context of the message, normally null in this case.
*/
void handleMessage(IOFSwitchBackend sw, OFMessage m, FloodlightContext bContext);
/**
* Process written messages through the message listeners for the controller
* @param sw The switch being written to
* @param m the message
* @throws NullPointerException if switch or msg is null
*/
public void handleOutgoingMessage(IOFSwitch sw, OFMessage m);
/**
* Gets an unmodifiable collection of OFSwitchHandshakeHandlers
......
......@@ -503,6 +503,11 @@ public class OFSwitchManager implements IOFSwitchManager, INewOFConnectionListen
public void handleMessage(IOFSwitchBackend sw, OFMessage m, FloodlightContext bContext) {
floodlightProvider.handleMessage(sw, m, bContext);
}
@Override
public void handleOutgoingMessage(IOFSwitch sw, OFMessage m) {
floodlightProvider.handleOutgoingMessage(sw, m);
}
@Override
public void addOFSwitchDriver(String manufacturerDescriptionPrefix,
......
......@@ -90,6 +90,12 @@ public class MockSwitchManager implements IFloodlightModule, IOFSwitchManager, I
// do nothing
}
@Override
public void handleOutgoingMessage(IOFSwitch sw, OFMessage m) {
// do nothing
}
public void setSwitchHandshakeHandlers(Map<DatapathId, OFSwitchHandshakeHandler> handlers) {
this.switchHandlers = handlers;
......
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