Remove unused test cases
diff --git a/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java b/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java
index 3dfe5fe..05e01a3 100644
--- a/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java
+++ b/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java
@@ -17,36 +17,43 @@
package net.floodlightcontroller.core.internal;
-import static org.easymock.EasyMock.*;
+import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.capture;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.createNiceMock;
+import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.isA;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.reset;
+import static org.easymock.EasyMock.same;
+import static org.easymock.EasyMock.verify;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
-import net.floodlightcontroller.core.FloodlightProvider;
import net.floodlightcontroller.core.FloodlightContext;
+import net.floodlightcontroller.core.FloodlightProvider;
import net.floodlightcontroller.core.IFloodlightProviderService;
-import net.floodlightcontroller.core.IHAListener;
import net.floodlightcontroller.core.IFloodlightProviderService.Role;
-import net.floodlightcontroller.core.IOFMessageFilterManagerService;
-import net.floodlightcontroller.core.IOFMessageListener;
+import net.floodlightcontroller.core.IHAListener;
import net.floodlightcontroller.core.IListener.Command;
+import net.floodlightcontroller.core.IOFMessageListener;
import net.floodlightcontroller.core.IOFSwitch;
import net.floodlightcontroller.core.IOFSwitchListener;
-import net.floodlightcontroller.core.OFMessageFilterManager;
import net.floodlightcontroller.core.internal.Controller.IUpdate;
import net.floodlightcontroller.core.internal.Controller.SwitchUpdate;
import net.floodlightcontroller.core.internal.Controller.SwitchUpdateType;
import net.floodlightcontroller.core.internal.OFChannelState.HandshakeState;
import net.floodlightcontroller.core.module.FloodlightModuleContext;
-import net.floodlightcontroller.core.test.MockFloodlightProvider;
import net.floodlightcontroller.core.test.MockThreadPoolService;
import net.floodlightcontroller.counter.CounterStore;
import net.floodlightcontroller.counter.ICounterStoreService;
@@ -72,17 +79,13 @@
import org.openflow.protocol.OFError.OFErrorType;
import org.openflow.protocol.OFFeaturesReply;
import org.openflow.protocol.OFPacketIn;
-import org.openflow.protocol.OFPacketOut;
+import org.openflow.protocol.OFPacketIn.OFPacketInReason;
import org.openflow.protocol.OFPhysicalPort;
-import org.openflow.protocol.OFPort;
import org.openflow.protocol.OFPortStatus;
+import org.openflow.protocol.OFPortStatus.OFPortReason;
import org.openflow.protocol.OFStatisticsReply;
import org.openflow.protocol.OFType;
-import org.openflow.protocol.OFPacketIn.OFPacketInReason;
-import org.openflow.protocol.OFPortStatus.OFPortReason;
import org.openflow.protocol.OFVendor;
-import org.openflow.protocol.action.OFAction;
-import org.openflow.protocol.action.OFActionOutput;
import org.openflow.protocol.factory.BasicFactory;
import org.openflow.protocol.statistics.OFFlowStatisticsReply;
import org.openflow.protocol.statistics.OFStatistics;
@@ -359,125 +362,6 @@
}
@Test
- public void testMessageFilterManager() throws Exception {
- class MyOFMessageFilterManager extends OFMessageFilterManager {
- public MyOFMessageFilterManager(int timer_interval) {
- super();
- TIMER_INTERVAL = timer_interval;
- }
- }
- FloodlightModuleContext fmCntx = new FloodlightModuleContext();
- MockFloodlightProvider mfp = new MockFloodlightProvider();
- OFMessageFilterManager mfm = new MyOFMessageFilterManager(100);
- MockThreadPoolService mtp = new MockThreadPoolService();
- fmCntx.addService(IOFMessageFilterManagerService.class, mfm);
- fmCntx.addService(IFloodlightProviderService.class, mfp);
- fmCntx.addService(IThreadPoolService.class, mtp);
- String sid = null;
-
- mfm.init(fmCntx);
- mfm.startUp(fmCntx);
-
- ConcurrentHashMap <String, String> filter;
- int i;
-
- //Adding the filter works -- adds up to the maximum filter size.
- for(i=mfm.getMaxFilterSize(); i > 0; --i) {
- filter = new ConcurrentHashMap<String,String>();
- filter.put("mac", String.format("00:11:22:33:44:%d%d", i,i));
- sid = mfm.setupFilter(null, filter, 60);
- assertTrue(mfm.getNumberOfFilters() == mfm.getMaxFilterSize() - i +1);
- }
-
- // Add one more to see if you can't
- filter = new ConcurrentHashMap<String,String>();
- filter.put("mac", "mac2");
- mfm.setupFilter(null, filter, 10*1000);
-
- assertTrue(mfm.getNumberOfFilters() == mfm.getMaxFilterSize());
-
- // Deleting the filter works.
- mfm.setupFilter(sid, null, -1);
- assertTrue(mfm.getNumberOfFilters() == mfm.getMaxFilterSize()-1);
-
- // Creating mock switch to which we will send packet out and
- IOFSwitch sw = createMock(IOFSwitch.class);
- expect(sw.getId()).andReturn(new Long(0));
-
- // Mock Packet-in
- IPacket testPacket = new Ethernet()
- .setSourceMACAddress("00:44:33:22:11:00")
- .setDestinationMACAddress("00:11:22:33:44:55")
- .setEtherType(Ethernet.TYPE_ARP)
- .setPayload(
- new ARP()
- .setHardwareType(ARP.HW_TYPE_ETHERNET)
- .setProtocolType(ARP.PROTO_TYPE_IP)
- .setHardwareAddressLength((byte) 6)
- .setProtocolAddressLength((byte) 4)
- .setOpCode(ARP.OP_REPLY)
- .setSenderHardwareAddress(Ethernet.toMACAddress("00:44:33:22:11:00"))
- .setSenderProtocolAddress(IPv4.toIPv4AddressBytes("192.168.1.1"))
- .setTargetHardwareAddress(Ethernet.toMACAddress("00:11:22:33:44:55"))
- .setTargetProtocolAddress(IPv4.toIPv4AddressBytes("192.168.1.2")));
- byte[] testPacketSerialized = testPacket.serialize();
-
- // Build the PacketIn
- OFPacketIn pi = ((OFPacketIn) new BasicFactory().getMessage(OFType.PACKET_IN))
- .setBufferId(-1)
- .setInPort((short) 1)
- .setPacketData(testPacketSerialized)
- .setReason(OFPacketInReason.NO_MATCH)
- .setTotalLength((short) testPacketSerialized.length);
-
- // Mock Packet-out
- OFPacketOut packetOut =
- (OFPacketOut) mockFloodlightProvider.getOFMessageFactory().getMessage(OFType.PACKET_OUT);
- packetOut.setBufferId(pi.getBufferId())
- .setInPort(pi.getInPort());
- List<OFAction> poactions = new ArrayList<OFAction>();
- poactions.add(new OFActionOutput(OFPort.OFPP_TABLE.getValue(), (short) 0));
- packetOut.setActions(poactions)
- .setActionsLength((short) OFActionOutput.MINIMUM_LENGTH)
- .setPacketData(testPacketSerialized)
- .setLengthU(OFPacketOut.MINIMUM_LENGTH+packetOut.getActionsLength()+testPacketSerialized.length);
-
- FloodlightContext cntx = new FloodlightContext();
- IFloodlightProviderService.bcStore.put(cntx, IFloodlightProviderService.CONTEXT_PI_PAYLOAD, (Ethernet) testPacket);
-
-
- // Let's check the listeners.
- List <IOFMessageListener> lm;
-
- // Check to see if all the listeners are active.
- lm = mfp.getListeners().get(OFType.PACKET_OUT);
- assertTrue(lm.size() == 1);
- assertTrue(lm.get(0).equals(mfm));
-
- lm = mfp.getListeners().get(OFType.FLOW_MOD);
- assertTrue(lm.size() == 1);
- assertTrue(lm.get(0).equals(mfm));
-
- lm = mfp.getListeners().get(OFType.PACKET_IN);
- assertTrue(lm.size() == 1);
- assertTrue(lm.get(0).equals(mfm));
-
- HashSet<String> matchedFilters;
-
- // Send a packet in and check if it matches a filter.
- matchedFilters = mfm.getMatchedFilters(pi, cntx);
- assertTrue(matchedFilters.size() == 1);
-
- // Send a packet out and check if it matches a filter
- matchedFilters = mfm.getMatchedFilters(packetOut, cntx);
- assertTrue(matchedFilters.size() == 1);
-
- // Wait for all filters to be timed out.
- Thread.sleep(150);
- assertEquals(0, mfm.getNumberOfFilters());
- }
-
- @Test
public void testAddSwitch() throws Exception {
controller.activeSwitches = new ConcurrentHashMap<Long, IOFSwitch>();