possible fix for link discovery
Change-Id: Id52dce21e93f0ca4665b15d3b169dc6a8dba76b4
diff --git a/openflow/ctl/src/main/java/org/onlab/onos/openflow/controller/impl/Controller.java b/openflow/ctl/src/main/java/org/onlab/onos/openflow/controller/impl/Controller.java
index 168c06d..5d8fd12 100644
--- a/openflow/ctl/src/main/java/org/onlab/onos/openflow/controller/impl/Controller.java
+++ b/openflow/ctl/src/main/java/org/onlab/onos/openflow/controller/impl/Controller.java
@@ -48,13 +48,10 @@
public class Controller {
protected static final Logger log = LoggerFactory.getLogger(Controller.class);
- static final String ERROR_DATABASE =
- "The controller could not communicate with the system database.";
+
protected static final OFFactory FACTORY13 = OFFactories.getFactory(OFVersion.OF_13);
protected static final OFFactory FACTORY10 = OFFactories.getFactory(OFVersion.OF_10);
- // The controllerNodeIPsCache maps Controller IDs to their IP address.
- // It's only used by handleControllerNodeIPsChanged
protected HashMap<String, String> controllerNodeIPsCache;
private ChannelGroup cg;
diff --git a/openflow/ctl/src/main/java/org/onlab/onos/openflow/controller/impl/OFChannelHandler.java b/openflow/ctl/src/main/java/org/onlab/onos/openflow/controller/impl/OFChannelHandler.java
index 8b4d444..009cd3f 100644
--- a/openflow/ctl/src/main/java/org/onlab/onos/openflow/controller/impl/OFChannelHandler.java
+++ b/openflow/ctl/src/main/java/org/onlab/onos/openflow/controller/impl/OFChannelHandler.java
@@ -41,6 +41,7 @@
import org.projectfloodlight.openflow.protocol.OFHelloElem;
import org.projectfloodlight.openflow.protocol.OFMessage;
import org.projectfloodlight.openflow.protocol.OFPacketIn;
+import org.projectfloodlight.openflow.protocol.OFPacketOut;
import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply;
import org.projectfloodlight.openflow.protocol.OFPortDescStatsRequest;
import org.projectfloodlight.openflow.protocol.OFPortStatus;
@@ -418,7 +419,14 @@
//h.setSwitchRole(RoleState.EQUAL);
h.sw.startDriverHandshake();
- h.setState(WAIT_SWITCH_DRIVER_SUB_HANDSHAKE);
+ if (h.sw.isDriverHandshakeComplete()) {
+ if (!h.sw.connectSwitch()) {
+ disconnectDuplicate(h);
+ }
+ h.setState(ACTIVE);
+ } else {
+ h.setState(WAIT_SWITCH_DRIVER_SUB_HANDSHAKE);
+ }
}
@@ -465,6 +473,8 @@
if (h.sw.isDriverHandshakeComplete()) {
moveToActive(h);
+ h.state.processOFMessage(h, m);
+ return;
}
@@ -479,7 +489,6 @@
h.sw.processDriverHandshakeMessage(m);
if (h.sw.isDriverHandshakeComplete()) {
moveToActive(h);
- h.setState(ACTIVE);
}
}
} else {
@@ -507,7 +516,6 @@
h.setState(ACTIVE);
if (!success) {
disconnectDuplicate(h);
- return;
}
}
@@ -581,6 +589,11 @@
@Override
void processOFPacketIn(OFChannelHandler h, OFPacketIn m) {
+// OFPacketOut out =
+// h.sw.factory().buildPacketOut()
+// .setXid(m.getXid())
+// .setBufferId(m.getBufferId()).build();
+// h.sw.sendMsg(out);
h.dispatchMessage(m);
}
diff --git a/openflow/ctl/src/main/java/org/onlab/onos/openflow/controller/impl/OpenFlowControllerImpl.java b/openflow/ctl/src/main/java/org/onlab/onos/openflow/controller/impl/OpenFlowControllerImpl.java
index 685ee9c..565ccb9 100644
--- a/openflow/ctl/src/main/java/org/onlab/onos/openflow/controller/impl/OpenFlowControllerImpl.java
+++ b/openflow/ctl/src/main/java/org/onlab/onos/openflow/controller/impl/OpenFlowControllerImpl.java
@@ -188,6 +188,7 @@
@Override
public boolean addConnectedSwitch(Dpid dpid, OpenFlowSwitch sw) {
+
if (connectedSwitches.get(dpid) != null) {
log.error("Trying to add connectedSwitch but found a previous "
+ "value for dpid: {}", dpid);