From f32ac2f1452eaef97f9cb98db1f6da27d96abd03 Mon Sep 17 00:00:00 2001 From: Ryan Izard <rizard@g.clemson.edu> Date: Wed, 30 Jul 2014 17:34:54 -0400 Subject: [PATCH] Initial OF1.3 handshake working. Still trouble write()ing to OFSwitch instance after handshake complete. The Connection is reported as down, yet the switch is echoed repeatedly w/o a problem... --- floodlight.sh | 8 +++---- logback.xml | 12 +++++------ .../floodlightcontroller/core/OFSwitch.java | 2 +- .../core/internal/Controller.java | 2 +- .../internal/OFSwitchHandshakeHandler.java | 21 +++++++++++++++---- .../core/internal/OFSwitchManager.java | 13 +++++------- .../core/module/FloodlightModuleLoader.java | 4 +++- .../sync/internal/SyncManager.java | 1 + ...htcontroller.core.module.IFloodlightModule | 3 ++- .../resources/floodlightdefault.properties | 3 ++- 10 files changed, 42 insertions(+), 27 deletions(-) diff --git a/floodlight.sh b/floodlight.sh index 5bc8564af..9bdf26411 100755 --- a/floodlight.sh +++ b/floodlight.sh @@ -25,10 +25,10 @@ JVM_OPTS="$JVM_OPTS -Dpython.security.respectJavaAccessibility=false" <root level="INFO"> <appender-ref ref="STDOUT" /> </root> - <logger name="org" level="WARN"/> - <logger name="LogService" level="WARN"/> <!-- Restlet access logging --> - <logger name="net.floodlightcontroller" level="INFO"/> - <logger name="net.floodlightcontroller.logging" level="ERROR"/> + <logger name="org" level=“ALLâ€/> + <logger name="LogService" level=“DEBUGâ€/> <!-- Restlet access logging --> + <logger name="net.floodlightcontroller" level=“ALLâ€/> + <logger name="net.floodlightcontroller.logging" level=“ALLâ€/> </configuration> EOF_LOGBACK diff --git a/logback.xml b/logback.xml index 29427f88c..a25cc7f63 100644 --- a/logback.xml +++ b/logback.xml @@ -4,12 +4,12 @@ <pattern>%date{yyyy-MM-dd HH:mm:ss.S} %-5level [%logger{15}] %msg%n</pattern> </encoder> </appender> - <root level="INFO"> + <root level="DEBUG"> <appender-ref ref="STDOUT" /> </root> - <logger name="org" level="WARN"/> - <logger name="LogService" level="WARN"/> <!-- Restlet access logging --> - <logger name="net.floodlightcontroller" level="INFO"/> - <logger name="net.floodlightcontroller.logging" level="WARN"/> - <logger name="org.sdnplatform" level="INFO"/> + <logger name="org" level="DEBUG"/> + <logger name="LogService" level="DEBUG"/> <!-- Restlet access logging --> + <logger name="net.floodlightcontroller" level="DEBUG"/> + <logger name="net.floodlightcontroller.logging" level="DEBUG"/> + <logger name="org.sdnplatform" level="DEBUG"/> </configuration> diff --git a/src/main/java/net/floodlightcontroller/core/OFSwitch.java b/src/main/java/net/floodlightcontroller/core/OFSwitch.java index 4a09ac480..410b1fea7 100644 --- a/src/main/java/net/floodlightcontroller/core/OFSwitch.java +++ b/src/main/java/net/floodlightcontroller/core/OFSwitch.java @@ -774,7 +774,7 @@ public class OFSwitch implements IOFSwitchBackend { entry.getValue().disconnect(); this.connections.remove(entry.getKey()); } - + log.debug("~~~~~~~SWITCH DISCONNECTED~~~~~~"); connected = false; } diff --git a/src/main/java/net/floodlightcontroller/core/internal/Controller.java b/src/main/java/net/floodlightcontroller/core/internal/Controller.java index a28eebfd7..7d20f436a 100644 --- a/src/main/java/net/floodlightcontroller/core/internal/Controller.java +++ b/src/main/java/net/floodlightcontroller/core/internal/Controller.java @@ -476,7 +476,7 @@ public class Controller implements IFloodlightProviderService, IStorageSourceLis public void handleMessage(IOFSwitch sw, OFMessage m, FloodlightContext bContext) { Ethernet eth = null; - + log.debug("~~~~~~~~GOT PACKET IN MESSAGE FROM SWITCH~~~~~~~~~"); if (this.notifiedRole == HARole.STANDBY) { counters.dispatchMessageWhileStandby.increment(); // We are SLAVE. Do not dispatch messages to listeners. diff --git a/src/main/java/net/floodlightcontroller/core/internal/OFSwitchHandshakeHandler.java b/src/main/java/net/floodlightcontroller/core/internal/OFSwitchHandshakeHandler.java index 90c7d4654..5f15a1e23 100644 --- a/src/main/java/net/floodlightcontroller/core/internal/OFSwitchHandshakeHandler.java +++ b/src/main/java/net/floodlightcontroller/core/internal/OFSwitchHandshakeHandler.java @@ -1023,6 +1023,9 @@ public class OFSwitchHandshakeHandler implements IOFConnectionListener { for (IOFConnectionBackend conn : auxConnections.values()) { sw.registerConnection(conn); } + //TODO @Ryan but we should still add the main connection as one, right? + //sw.registerConnection(mainConnection); // don't think so bc the connection is already associated + // with the ofswitch setState(new WaitGentableDescStatsReplyState()); } @@ -1276,6 +1279,12 @@ public class OFSwitchHandshakeHandler implements IOFConnectionListener { unhandledMessageReceived(m); } } + + @Override + void processOFError(OFErrorMsg m) { + // @Ryan Need to handle case where the switch is not a BSN switch + setState(new WaitInitialRoleState()); + } @Override void processOFPortStatus(OFPortStatus m) { @@ -1565,14 +1574,15 @@ public class OFSwitchHandshakeHandler implements IOFConnectionListener { Preconditions.checkState(state instanceof InitState, "must be in InitState"); if (this.featuresReply.getNTables() > 1) { - log.debug("Have {} table for switch {}", this.featuresReply.getNTables(), + log.debug("Have {} table(s) for switch {}", this.featuresReply.getNTables(), getSwitchInfoString()); // likely supports L2 table extensions. Send set + //TODO @Ryan is this needed? sendHandshakeL2TableSet(); // TODO: no L2 SET reply yet, so fire and forget the set } - if(this.featuresReply.getVersion().compareTo(OFVersion.OF_13) < 0) { + if (this.featuresReply.getVersion().compareTo(OFVersion.OF_13) < 0) { setState(new WaitConfigReplyState()); } else { // OF 1.3. Ask for Port Descriptions @@ -1718,6 +1728,7 @@ public class OFSwitchHandshakeHandler implements IOFConnectionListener { mainConnection.write(descStatsRequest); } + //TODO @Ryan can we nuke this as well? /** send a BSN GenTable DescStats Request, querying for the tables * available at the switch. * @return @@ -1871,15 +1882,17 @@ public class OFSwitchHandshakeHandler implements IOFConnectionListener { if(sw != null) { SwitchStatus oldStatus = sw.getStatus(); if(oldStatus != status) { + log.debug("[{}] SwitchStatus change to {} requested, switch is in status " + oldStatus, + mainConnection.getDatapathId(), status); sw.setStatus(status); switchManager.switchStatusChanged(sw, oldStatus, status); } else { log.warn("[{}] SwitchStatus change to {} requested, switch is already in status", - mainConnection.getDatapathId()); + mainConnection.getDatapathId(), status); } } else { log.warn("[{}] SwitchStatus change to {} requested, but switch is not allocated yet", - mainConnection.getDatapathId()); + mainConnection.getDatapathId(), status); } } diff --git a/src/main/java/net/floodlightcontroller/core/internal/OFSwitchManager.java b/src/main/java/net/floodlightcontroller/core/internal/OFSwitchManager.java index dd1cc86b7..6e46b1cca 100644 --- a/src/main/java/net/floodlightcontroller/core/internal/OFSwitchManager.java +++ b/src/main/java/net/floodlightcontroller/core/internal/OFSwitchManager.java @@ -128,16 +128,14 @@ public class OFSwitchManager implements IOFSwitchManager, INewOFConnectionListen if (oldSw == sw) { // Note == for object equality, not .equals for value - counters.errorActivatedSwitchNotPresent - .increment(); + counters.errorActivatedSwitchNotPresent.increment(); log.error("Switch {} added twice?", sw); return; } else if (oldSw != null) { // This happens either when we have switches with duplicate // DPIDs or when a switch reconnects before we saw the // disconnect - counters.switchWithSameDpidActivated - .increment(); + counters.switchWithSameDpidActivated.increment(); log.warn("New switch added {} for already-added switch {}", sw, oldSw); // We need to disconnect and remove the old switch // TODO: we notify switch listeners that the switch has been @@ -181,7 +179,7 @@ public class OFSwitchManager implements IOFSwitchManager, INewOFConnectionListen // Note == for object equality, not .equals for value counters.errorActivatedSwitchNotPresent .increment(); - log.warn("Switch {} status change but not present in sync manager", sw); + log.debug("Switch {} status change but not present in sync manager", sw); return; } evSwitch.newEventWithFlush(new SwitchEvent(dpid, @@ -401,8 +399,7 @@ public class OFSwitchManager implements IOFSwitchManager, INewOFConnectionListen // Disconnect all the handler's connections if(oldHandler != null){ - log.debug("{} is a new main connection, killing old handler connections", - connection); + log.debug("{} is a new main connection, killing old handler connections", connection); oldHandler.cleanup(); } @@ -458,7 +455,7 @@ public class OFSwitchManager implements IOFSwitchManager, INewOFConnectionListen } @Override - public IOFSwitchBackend getOFSwitchInstance(IOFConnectionBackend connection, + public IOFSwitchBackend getOFSwitchInstance(IOFConnectionBackend connection, SwitchDescription description, OFFactory factory, DatapathId datapathId) { return this.driverRegistry.getOFSwitchInstance(connection, description, factory, datapathId); diff --git a/src/main/java/net/floodlightcontroller/core/module/FloodlightModuleLoader.java b/src/main/java/net/floodlightcontroller/core/module/FloodlightModuleLoader.java index 720db3dcf..ded7b6d34 100644 --- a/src/main/java/net/floodlightcontroller/core/module/FloodlightModuleLoader.java +++ b/src/main/java/net/floodlightcontroller/core/module/FloodlightModuleLoader.java @@ -584,10 +584,12 @@ public class FloodlightModuleLoader { IFloodlightModule mod = moduleNameMap.get(moduleName); if (mod == null) { - logger.warn("Module {} not found or loaded. " + + logger.debug("Module {} not found or loaded. " + "Not adding configuration option {} = {}", new Object[]{moduleName, configKey, configValue}); } else { + logger.debug("Adding configuration option {} = {} for module {}", + new Object[]{configKey, configValue, moduleName}); floodlightModuleContext.addConfigParam(mod, configKey, configValue); } } diff --git a/src/main/java/org/sdnplatform/sync/internal/SyncManager.java b/src/main/java/org/sdnplatform/sync/internal/SyncManager.java index 86d126050..cfe27e00e 100644 --- a/src/main/java/org/sdnplatform/sync/internal/SyncManager.java +++ b/src/main/java/org/sdnplatform/sync/internal/SyncManager.java @@ -512,6 +512,7 @@ public class SyncManager extends AbstractSyncManager { private void registerDebugCounters(FloodlightModuleContext context) throws FloodlightModuleException { if (context != null) { + debugCounter.registerModule(PACKAGE); counterHints = debugCounter.registerCounter(PACKAGE, "hints", "Queued sync events processed"); counterSentValues = debugCounter.registerCounter(PACKAGE, "sent-values", diff --git a/src/main/resources/META-INF/services/net.floodlightcontroller.core.module.IFloodlightModule b/src/main/resources/META-INF/services/net.floodlightcontroller.core.module.IFloodlightModule index a3251672a..dd3bbfd31 100644 --- a/src/main/resources/META-INF/services/net.floodlightcontroller.core.module.IFloodlightModule +++ b/src/main/resources/META-INF/services/net.floodlightcontroller.core.module.IFloodlightModule @@ -15,4 +15,5 @@ net.floodlightcontroller.core.internal.OFSwitchManager net.floodlightcontroller.threadpool.ThreadPool net.floodlightcontroller.core.internal.ShutdownServiceImpl org.sdnplatform.sync.internal.SyncManager -org.sdnplatform.sync.internal.SyncTorture \ No newline at end of file +org.sdnplatform.sync.internal.SyncTorture +net.floodlightcontroller.hub.Hub \ No newline at end of file diff --git a/src/main/resources/floodlightdefault.properties b/src/main/resources/floodlightdefault.properties index 402e48338..1f4417232 100644 --- a/src/main/resources/floodlightdefault.properties +++ b/src/main/resources/floodlightdefault.properties @@ -6,8 +6,9 @@ net.floodlightcontroller.threadpool.ThreadPool,\ net.floodlightcontroller.debugcounter.DebugCounterServiceImpl,\ net.floodlightcontroller.restserver.RestApiServer,\ net.floodlightcontroller.perfmon.PktInProcessingTime,\ -net.floodligthcontroller.hub.Hub,\ +net.floodlightcontroller.hub.Hub,\ net.floodlightcontroller.debugevent.DebugEventService org.sdnplatform.sync.internal.SyncManager.authScheme=CHALLENGE_RESPONSE org.sdnplatform.sync.internal.SyncManager.keyStorePath=/etc/floodlight/auth_credentials.jceks org.sdnplatform.sync.internal.SyncManager.dbPath=/var/lib/floodlight/ +net.floodlightcontroller.core.internal.FloodlightProvider.role=MASTER -- GitLab