Skip to content
Snippets Groups Projects
Commit b3e05d08 authored by Shudong Zhou's avatar Shudong Zhou
Browse files

BSC-3397 fix floodlight unit tests

parent 62656fe2
No related branches found
No related tags found
No related merge requests found
...@@ -357,9 +357,9 @@ public class ForwardingTest extends FloodlightTestCase { ...@@ -357,9 +357,9 @@ public class ForwardingTest extends FloodlightTestCase {
OFFlowMod fm2 = fm1.clone(); OFFlowMod fm2 = fm1.clone();
((OFActionOutput)fm2.getActions().get(0)).setPort((short) 3); ((OFActionOutput)fm2.getActions().get(0)).setPort((short) 3);
sw1.write(capture(wc1), capture(bc1)); sw1.writeThrottled(capture(wc1), capture(bc1));
expectLastCall().anyTimes(); expectLastCall().anyTimes();
sw2.write(capture(wc2), capture(bc2)); sw2.writeThrottled(capture(wc2), capture(bc2));
expectLastCall().anyTimes(); expectLastCall().anyTimes();
reset(topology); reset(topology);
...@@ -420,8 +420,8 @@ public class ForwardingTest extends FloodlightTestCase { ...@@ -420,8 +420,8 @@ public class ForwardingTest extends FloodlightTestCase {
OFActionOutput.MINIMUM_LENGTH); OFActionOutput.MINIMUM_LENGTH);
// Record expected packet-outs/flow-mods // Record expected packet-outs/flow-mods
sw1.write(fm1, cntx); sw1.writeThrottled(fm1, cntx);
sw1.write(packetOut, cntx); sw1.writeThrottled(packetOut, cntx);
reset(topology); reset(topology);
expect(topology.isIncomingBroadcastAllowed(anyLong(), anyShort())).andReturn(true).anyTimes(); expect(topology.isIncomingBroadcastAllowed(anyLong(), anyShort())).andReturn(true).anyTimes();
...@@ -473,9 +473,9 @@ public class ForwardingTest extends FloodlightTestCase { ...@@ -473,9 +473,9 @@ public class ForwardingTest extends FloodlightTestCase {
// Record expected packet-outs/flow-mods // Record expected packet-outs/flow-mods
// We will inject the packet_in 3 times and expect 1 flow mod and // We will inject the packet_in 3 times and expect 1 flow mod and
// 3 packet outs due to flow mod dampening // 3 packet outs due to flow mod dampening
sw1.write(fm1, cntx); sw1.writeThrottled(fm1, cntx);
expectLastCall().once(); expectLastCall().once();
sw1.write(packetOut, cntx); sw1.writeThrottled(packetOut, cntx);
expectLastCall().times(3); expectLastCall().times(3);
reset(topology); reset(topology);
...@@ -508,7 +508,7 @@ public class ForwardingTest extends FloodlightTestCase { ...@@ -508,7 +508,7 @@ public class ForwardingTest extends FloodlightTestCase {
.anyTimes(); .anyTimes();
expect(sw1.hasAttribute(IOFSwitch.PROP_SUPPORTS_OFPP_FLOOD)) expect(sw1.hasAttribute(IOFSwitch.PROP_SUPPORTS_OFPP_FLOOD))
.andReturn(true).anyTimes(); .andReturn(true).anyTimes();
sw1.write(packetOutFlooded, cntx); sw1.writeThrottled(packetOutFlooded, cntx);
expectLastCall().once(); expectLastCall().once();
replay(sw1, sw2, routingEngine, topology); replay(sw1, sw2, routingEngine, topology);
forwarding.receive(sw1, this.packetIn, cntx); forwarding.receive(sw1, this.packetIn, cntx);
......
...@@ -433,7 +433,7 @@ public class LoadBalancerTest extends FloodlightTestCase { ...@@ -433,7 +433,7 @@ public class LoadBalancerTest extends FloodlightTestCase {
expect(sw1.getStringId()).andReturn("00:00:00:00:00:01").anyTimes(); expect(sw1.getStringId()).andReturn("00:00:00:00:00:01").anyTimes();
expect(sw1.getAttribute(IOFSwitch.PROP_FASTWILDCARDS)).andReturn((Integer)fastWildcards).anyTimes(); expect(sw1.getAttribute(IOFSwitch.PROP_FASTWILDCARDS)).andReturn((Integer)fastWildcards).anyTimes();
expect(sw1.hasAttribute(IOFSwitch.PROP_SUPPORTS_OFPP_TABLE)).andReturn(true).anyTimes(); expect(sw1.hasAttribute(IOFSwitch.PROP_SUPPORTS_OFPP_TABLE)).andReturn(true).anyTimes();
sw1.write(capture(wc1), capture(bc1)); sw1.writeThrottled(capture(wc1), capture(bc1));
expectLastCall().anyTimes(); expectLastCall().anyTimes();
sw1.flush(); sw1.flush();
expectLastCall().anyTimes(); expectLastCall().anyTimes();
......
...@@ -102,6 +102,12 @@ public class OFMessageDamperMockSwitch implements IOFSwitch { ...@@ -102,6 +102,12 @@ public class OFMessageDamperMockSwitch implements IOFSwitch {
writtenContext = bc; writtenContext = bc;
writtenMessage = m; writtenMessage = m;
} }
@Override
public void writeThrottled(OFMessage msg, FloodlightContext cntx)
throws IOException {
write(msg, cntx);
}
//------------------------------------------------------- //-------------------------------------------------------
// IOFSwitch: not-implemented methods // IOFSwitch: not-implemented methods
...@@ -420,4 +426,4 @@ public class OFMessageDamperMockSwitch implements IOFSwitch { ...@@ -420,4 +426,4 @@ public class OFMessageDamperMockSwitch implements IOFSwitch {
return false; return false;
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment