From d863f45455b746bfea350bb4a76f22d374d5a40f Mon Sep 17 00:00:00 2001
From: Ryan Izard <rizard@g.clemson.edu>
Date: Fri, 7 Nov 2014 10:19:27 -0500
Subject: [PATCH] Forgot to fix Hub after playing with it initially. Now
 defaults to FLOOD OFPacketOuts at the controller, which means no flows are
 inserted. The option still exists to insert flows instead.

---
 src/main/java/net/floodlightcontroller/hub/Hub.java     | 2 +-
 src/test/java/net/floodlightcontroller/hub/HubTest.java | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/main/java/net/floodlightcontroller/hub/Hub.java b/src/main/java/net/floodlightcontroller/hub/Hub.java
index 4d3ccf513..0e8b8bc09 100644
--- a/src/main/java/net/floodlightcontroller/hub/Hub.java
+++ b/src/main/java/net/floodlightcontroller/hub/Hub.java
@@ -66,7 +66,7 @@ public class Hub implements IFloodlightModule, IOFMessageListener {
 
     public Command receive(IOFSwitch sw, OFMessage msg, FloodlightContext cntx) {
     	OFMessage outMessage;
-    	HubType ht = HubType.USE_FLOW_MOD;
+    	HubType ht = HubType.USE_PACKET_OUT;
     	switch (ht) {
     	case USE_FLOW_MOD:
             outMessage = createHubFlowMod(sw, msg);
diff --git a/src/test/java/net/floodlightcontroller/hub/HubTest.java b/src/test/java/net/floodlightcontroller/hub/HubTest.java
index ecef81215..4a2921df5 100644
--- a/src/test/java/net/floodlightcontroller/hub/HubTest.java
+++ b/src/test/java/net/floodlightcontroller/hub/HubTest.java
@@ -38,6 +38,7 @@ import net.floodlightcontroller.test.FloodlightTestCase;
 
 import org.easymock.Capture;
 import org.easymock.CaptureType;
+import org.easymock.EasyMock;
 import org.junit.Before;
 import org.junit.Test;
 import org.projectfloodlight.openflow.protocol.OFFactories;
@@ -105,6 +106,7 @@ public class HubTest extends FloodlightTestCase {
     public void testFloodNoBufferId() throws Exception {
         // Mock up our expected behavior
         IOFSwitch mockSwitch = createMock(IOFSwitch.class);
+        EasyMock.expect(mockSwitch.getOFFactory()).andReturn(OFFactories.getFactory(OFVersion.OF_13)).anyTimes();
         
         // build our expected flooded packetOut
     	OFActionOutput ao = OFFactories.getFactory(OFVersion.OF_13).actions().buildOutput().setPort(OFPort.FLOOD).build();
@@ -160,6 +162,7 @@ public class HubTest extends FloodlightTestCase {
 
         // Mock up our expected behavior
         IOFSwitch mockSwitch = createMock(IOFSwitch.class);
+        EasyMock.expect(mockSwitch.getOFFactory()).andReturn(OFFactories.getFactory(OFVersion.OF_13)).anyTimes();
         Capture<OFPacketOut> wc1 = new Capture<OFPacketOut>(CaptureType.ALL);
         mockSwitch.write(capture(wc1));
 
-- 
GitLab