Jonathan Hart

Fixes to allow CPqD switch to connect (eventually)

Change-Id: I5fff883d8458de4c9924051480caa6e3268ffef7
...@@ -41,7 +41,6 @@ import org.projectfloodlight.openflow.protocol.OFHello; ...@@ -41,7 +41,6 @@ import org.projectfloodlight.openflow.protocol.OFHello;
41 import org.projectfloodlight.openflow.protocol.OFHelloElem; 41 import org.projectfloodlight.openflow.protocol.OFHelloElem;
42 import org.projectfloodlight.openflow.protocol.OFMessage; 42 import org.projectfloodlight.openflow.protocol.OFMessage;
43 import org.projectfloodlight.openflow.protocol.OFPacketIn; 43 import org.projectfloodlight.openflow.protocol.OFPacketIn;
44 -import org.projectfloodlight.openflow.protocol.OFPacketOut;
45 import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply; 44 import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply;
46 import org.projectfloodlight.openflow.protocol.OFPortDescStatsRequest; 45 import org.projectfloodlight.openflow.protocol.OFPortDescStatsRequest;
47 import org.projectfloodlight.openflow.protocol.OFPortStatus; 46 import org.projectfloodlight.openflow.protocol.OFPortStatus;
...@@ -661,10 +660,9 @@ class OFChannelHandler extends IdleStateAwareChannelHandler { ...@@ -661,10 +660,9 @@ class OFChannelHandler extends IdleStateAwareChannelHandler {
661 * However, we could be more forgiving 660 * However, we could be more forgiving
662 * @param h the channel handler that received the message 661 * @param h the channel handler that received the message
663 * @param m the message 662 * @param m the message
664 - * @throws SwitchStateException 663 + * @throws SwitchStateException we always throw the exception
665 - * @throws SwitchStateExeption we always through the execption
666 */ 664 */
667 - // needs to be protected because enum members are acutally subclasses 665 + // needs to be protected because enum members are actually subclasses
668 protected void illegalMessageReceived(OFChannelHandler h, OFMessage m) 666 protected void illegalMessageReceived(OFChannelHandler h, OFMessage m)
669 throws SwitchStateException { 667 throws SwitchStateException {
670 String msg = getSwitchStateMessage(h, m, 668 String msg = getSwitchStateMessage(h, m,
...@@ -1025,7 +1023,9 @@ class OFChannelHandler extends IdleStateAwareChannelHandler { ...@@ -1025,7 +1023,9 @@ class OFChannelHandler extends IdleStateAwareChannelHandler {
1025 // all state for the original switch (with the same dpid), 1023 // all state for the original switch (with the same dpid),
1026 // which we obviously don't want. 1024 // which we obviously don't want.
1027 log.info("{}:removal called", getSwitchInfoString()); 1025 log.info("{}:removal called", getSwitchInfoString());
1028 - sw.removeConnectedSwitch(); 1026 + if (sw != null) {
1027 + sw.removeConnectedSwitch();
1028 + }
1029 } else { 1029 } else {
1030 // A duplicate was disconnected on this ChannelHandler, 1030 // A duplicate was disconnected on this ChannelHandler,
1031 // this is the same switch reconnecting, but the original state was 1031 // this is the same switch reconnecting, but the original state was
......
...@@ -1188,7 +1188,8 @@ public class OFSwitchImplCPqD13 extends AbstractOpenFlowSwitch { ...@@ -1188,7 +1188,8 @@ public class OFSwitchImplCPqD13 extends AbstractOpenFlowSwitch {
1188 .setHardTimeout(0) 1188 .setHardTimeout(0)
1189 .setXid(getNextTransactionId()) 1189 .setXid(getNextTransactionId())
1190 .build(); 1190 .build();
1191 - sendMsg(tableMissEntry); 1191 +
1192 + write(tableMissEntry);
1192 } 1193 }
1193 1194
1194 private void sendBarrier(boolean finalBarrier) { 1195 private void sendBarrier(boolean finalBarrier) {
...@@ -1200,7 +1201,8 @@ public class OFSwitchImplCPqD13 extends AbstractOpenFlowSwitch { ...@@ -1200,7 +1201,8 @@ public class OFSwitchImplCPqD13 extends AbstractOpenFlowSwitch {
1200 .buildBarrierRequest() 1201 .buildBarrierRequest()
1201 .setXid(xid) 1202 .setXid(xid)
1202 .build(); 1203 .build();
1203 - sendMsg(br); 1204 +
1205 + write(br);
1204 } 1206 }
1205 1207
1206 @Override 1208 @Override
...@@ -1210,7 +1212,7 @@ public class OFSwitchImplCPqD13 extends AbstractOpenFlowSwitch { ...@@ -1210,7 +1212,7 @@ public class OFSwitchImplCPqD13 extends AbstractOpenFlowSwitch {
1210 1212
1211 @Override 1213 @Override
1212 public void write(OFMessage msg) { 1214 public void write(OFMessage msg) {
1213 - this.channel.write(msg); 1215 + this.channel.write(Collections.singletonList(msg));
1214 1216
1215 } 1217 }
1216 1218
......