Jonathan Hart | 23701d1 | 2014-04-03 10:45:48 -0700 | [diff] [blame] | 1 | package net.onrc.onos.core.flowprogrammer; |
Naoki Shiota | 75b7dd6 | 2013-12-03 18:09:21 -0800 | [diff] [blame] | 2 | |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 3 | |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 4 | import static org.easymock.EasyMock.anyInt; |
| 5 | import static org.easymock.EasyMock.anyLong; |
| 6 | import static org.easymock.EasyMock.anyObject; |
| 7 | import static org.easymock.EasyMock.anyShort; |
| 8 | import static org.easymock.EasyMock.createMock; |
| 9 | import static org.easymock.EasyMock.eq; |
| 10 | import static org.easymock.EasyMock.expect; |
| 11 | import static org.easymock.EasyMock.expectLastCall; |
| 12 | import static org.easymock.EasyMock.replay; |
| 13 | import static org.easymock.EasyMock.verify; |
Naoki Shiota | 4799310 | 2014-07-09 14:00:54 -0700 | [diff] [blame] | 14 | import static org.junit.Assert.assertNotNull; |
| 15 | import static org.junit.Assert.assertTrue; |
| 16 | import static org.junit.Assert.fail; |
| 17 | |
| 18 | import java.io.IOException; |
| 19 | import java.util.ArrayList; |
| 20 | import java.util.HashMap; |
| 21 | import java.util.List; |
| 22 | import java.util.Map; |
| 23 | import java.util.concurrent.ScheduledExecutorService; |
| 24 | import java.util.concurrent.TimeUnit; |
| 25 | |
Naoki Shiota | 75b7dd6 | 2013-12-03 18:09:21 -0800 | [diff] [blame] | 26 | import net.floodlightcontroller.core.FloodlightContext; |
| 27 | import net.floodlightcontroller.core.IFloodlightProviderService; |
| 28 | import net.floodlightcontroller.core.IOFSwitch; |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 29 | import net.floodlightcontroller.core.internal.OFMessageFuture; |
Naoki Shiota | 75b7dd6 | 2013-12-03 18:09:21 -0800 | [diff] [blame] | 30 | import net.floodlightcontroller.core.module.FloodlightModuleContext; |
| 31 | import net.floodlightcontroller.threadpool.IThreadPoolService; |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 32 | import net.onrc.onos.core.intent.FlowEntry; |
| 33 | import net.onrc.onos.core.intent.IntentOperation.Operator; |
Ray Milkey | 1064357 | 2014-06-10 15:17:39 -0700 | [diff] [blame] | 34 | import net.onrc.onos.core.util.IntegrationTest; |
Naoki Shiota | 4799310 | 2014-07-09 14:00:54 -0700 | [diff] [blame] | 35 | |
Naoki Shiota | 75b7dd6 | 2013-12-03 18:09:21 -0800 | [diff] [blame] | 36 | import org.junit.Test; |
Ray Milkey | 1064357 | 2014-06-10 15:17:39 -0700 | [diff] [blame] | 37 | import org.junit.experimental.categories.Category; |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 38 | import org.projectfloodlight.openflow.protocol.OFBarrierReply; |
| 39 | import org.projectfloodlight.openflow.protocol.OFBarrierRequest; |
| 40 | import org.projectfloodlight.openflow.protocol.OFFactories; |
| 41 | import org.projectfloodlight.openflow.protocol.OFFactory; |
| 42 | import org.projectfloodlight.openflow.protocol.OFFlowModify; |
| 43 | import org.projectfloodlight.openflow.protocol.OFMessage; |
| 44 | import org.projectfloodlight.openflow.protocol.OFType; |
| 45 | import org.projectfloodlight.openflow.protocol.OFVersion; |
| 46 | import org.projectfloodlight.openflow.protocol.action.OFAction; |
| 47 | import org.projectfloodlight.openflow.protocol.match.Match; |
| 48 | import org.projectfloodlight.openflow.types.OFBufferId; |
| 49 | import org.projectfloodlight.openflow.types.OFPort; |
| 50 | import org.projectfloodlight.openflow.types.U64; |
| 51 | |
Naoki Shiota | 75b7dd6 | 2013-12-03 18:09:21 -0800 | [diff] [blame] | 52 | |
Ray Milkey | 1064357 | 2014-06-10 15:17:39 -0700 | [diff] [blame] | 53 | @Category(IntegrationTest.class) |
Naoki Shiota | 75b7dd6 | 2013-12-03 18:09:21 -0800 | [diff] [blame] | 54 | public class FlowPusherTest { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 55 | private FlowPusher pusher; |
| 56 | private FloodlightContext context; |
| 57 | private FloodlightModuleContext modContext; |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 58 | private IFloodlightProviderService flProviderService; |
| 59 | private IThreadPoolService threadPoolService; |
Naoki Shiota | 75b7dd6 | 2013-12-03 18:09:21 -0800 | [diff] [blame] | 60 | |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 61 | private OFFactory factory10 = OFFactories.getFactory(OFVersion.OF_10); |
| 62 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 63 | /** |
Jonathan Hart | 51bb27c | 2014-08-11 16:00:31 -0700 | [diff] [blame] | 64 | * Test single OFMessage is correctly sent to single switch. |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 65 | */ |
| 66 | @Test |
| 67 | public void testAddMessage() { |
| 68 | beginInitMock(); |
Naoki Shiota | 75b7dd6 | 2013-12-03 18:09:21 -0800 | [diff] [blame] | 69 | |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 70 | OFMessage msg = createMock(OFMessage.class); |
| 71 | expect(msg.getXid()).andReturn((long) 1).anyTimes(); |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 72 | //EasyMock.expect(msg.()).andReturn((short) 100).anyTimes(); |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 73 | replay(msg); |
Naoki Shiota | 75b7dd6 | 2013-12-03 18:09:21 -0800 | [diff] [blame] | 74 | |
Naoki Shiota | 4799310 | 2014-07-09 14:00:54 -0700 | [diff] [blame] | 75 | IOFSwitch sw = createConnectedSwitchMock(1, false); |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 76 | |
| 77 | |
Naoki Shiota | d6ef3b3 | 2014-03-13 18:42:23 -0700 | [diff] [blame] | 78 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 79 | try { |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 80 | sw.write(eq(msg), eq((FloodlightContext) null)); |
| 81 | expectLastCall().once(); |
| 82 | replay(sw); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 83 | } catch (IOException e1) { |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 84 | fail("Failed in IOFSwitch#write()"); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 85 | } |
Naoki Shiota | 75b7dd6 | 2013-12-03 18:09:21 -0800 | [diff] [blame] | 86 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 87 | endInitMock(); |
| 88 | initPusher(1); |
Naoki Shiota | d6ef3b3 | 2014-03-13 18:42:23 -0700 | [diff] [blame] | 89 | |
Yuta HIGUCHI | 44a0b35 | 2014-05-14 21:32:48 -0700 | [diff] [blame] | 90 | boolean addResult = pusher.add(sw, msg); |
| 91 | assertTrue(addResult); |
Naoki Shiota | 75b7dd6 | 2013-12-03 18:09:21 -0800 | [diff] [blame] | 92 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 93 | try { |
| 94 | // wait until message is processed. |
| 95 | Thread.sleep(1000); |
| 96 | } catch (InterruptedException e) { |
| 97 | fail("Failed in Thread.sleep()"); |
| 98 | } |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 99 | verify(msg); |
| 100 | verify(sw); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 101 | verifyAll(); |
Naoki Shiota | 75b7dd6 | 2013-12-03 18:09:21 -0800 | [diff] [blame] | 102 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 103 | pusher.stop(); |
| 104 | } |
Naoki Shiota | 75b7dd6 | 2013-12-03 18:09:21 -0800 | [diff] [blame] | 105 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 106 | /** |
Jonathan Hart | 51bb27c | 2014-08-11 16:00:31 -0700 | [diff] [blame] | 107 | * Test bunch of OFMessages are correctly sent to single switch. |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 108 | */ |
| 109 | @Test |
| 110 | public void testMassiveAddMessage() { |
Yuta HIGUCHI | 7c39c84 | 2014-06-09 16:33:03 -0700 | [diff] [blame] | 111 | // Some number larger than FlowPusher.MAX_MESSAGE_SEND |
Yuta HIGUCHI | 91a8f50 | 2014-06-17 10:15:29 -0700 | [diff] [blame] | 112 | final int numMsg = FlowPusher.MAX_MESSAGE_SEND * 2; |
Naoki Shiota | d6ef3b3 | 2014-03-13 18:42:23 -0700 | [diff] [blame] | 113 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 114 | beginInitMock(); |
Naoki Shiota | 75b7dd6 | 2013-12-03 18:09:21 -0800 | [diff] [blame] | 115 | |
Naoki Shiota | 4799310 | 2014-07-09 14:00:54 -0700 | [diff] [blame] | 116 | IOFSwitch sw = createConnectedSwitchMock(1, false); |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 117 | |
Naoki Shiota | 75b7dd6 | 2013-12-03 18:09:21 -0800 | [diff] [blame] | 118 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 119 | List<OFMessage> messages = new ArrayList<OFMessage>(); |
Naoki Shiota | 75b7dd6 | 2013-12-03 18:09:21 -0800 | [diff] [blame] | 120 | |
Yuta HIGUCHI | 91a8f50 | 2014-06-17 10:15:29 -0700 | [diff] [blame] | 121 | for (int i = 0; i < numMsg; ++i) { |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 122 | OFMessage msg = createMock(OFMessage.class); |
| 123 | expect(msg.getXid()).andReturn((long) i).anyTimes(); |
| 124 | replay(msg); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 125 | messages.add(msg); |
Naoki Shiota | 75b7dd6 | 2013-12-03 18:09:21 -0800 | [diff] [blame] | 126 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 127 | try { |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 128 | sw.write(eq(msg), eq((FloodlightContext) null)); |
| 129 | expectLastCall().once(); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 130 | } catch (IOException e1) { |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 131 | fail("Failed in IOFSwitch#write()"); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 132 | } |
| 133 | } |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 134 | replay(sw); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 135 | endInitMock(); |
| 136 | initPusher(1); |
Naoki Shiota | 75b7dd6 | 2013-12-03 18:09:21 -0800 | [diff] [blame] | 137 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 138 | for (OFMessage msg : messages) { |
Yuta HIGUCHI | 44a0b35 | 2014-05-14 21:32:48 -0700 | [diff] [blame] | 139 | boolean addResult = pusher.add(sw, msg); |
| 140 | assertTrue(addResult); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 141 | } |
Naoki Shiota | 75b7dd6 | 2013-12-03 18:09:21 -0800 | [diff] [blame] | 142 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 143 | try { |
| 144 | // wait until message is processed. |
Yuta HIGUCHI | 7c39c84 | 2014-06-09 16:33:03 -0700 | [diff] [blame] | 145 | Thread.sleep(1000); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 146 | } catch (InterruptedException e) { |
| 147 | fail("Failed in Thread.sleep()"); |
| 148 | } |
Naoki Shiota | d6ef3b3 | 2014-03-13 18:42:23 -0700 | [diff] [blame] | 149 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 150 | for (OFMessage msg : messages) { |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 151 | verify(msg); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 152 | } |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 153 | verify(sw); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 154 | verifyAll(); |
| 155 | |
| 156 | pusher.stop(); |
| 157 | } |
| 158 | |
| 159 | /** |
| 160 | * Test bunch of OFMessages are correctly sent to multiple switches with single threads. |
| 161 | */ |
| 162 | @Test |
| 163 | public void testMultiSwitchAddMessage() { |
Yuta HIGUCHI | 91a8f50 | 2014-06-17 10:15:29 -0700 | [diff] [blame] | 164 | final int numSwitch = 10; |
| 165 | final int numMsg = 100; // messages per thread |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 166 | |
| 167 | beginInitMock(); |
| 168 | |
Yuta HIGUCHI | 44a0b35 | 2014-05-14 21:32:48 -0700 | [diff] [blame] | 169 | Map<IOFSwitch, List<OFMessage>> swMap = new HashMap<IOFSwitch, List<OFMessage>>(); |
Yuta HIGUCHI | 91a8f50 | 2014-06-17 10:15:29 -0700 | [diff] [blame] | 170 | for (int i = 0; i < numSwitch; ++i) { |
Naoki Shiota | 4799310 | 2014-07-09 14:00:54 -0700 | [diff] [blame] | 171 | IOFSwitch sw = createConnectedSwitchMock(i, false); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 172 | |
| 173 | List<OFMessage> messages = new ArrayList<OFMessage>(); |
| 174 | |
Yuta HIGUCHI | 91a8f50 | 2014-06-17 10:15:29 -0700 | [diff] [blame] | 175 | for (int j = 0; j < numMsg; ++j) { |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 176 | OFMessage msg = createMock(OFMessage.class); |
| 177 | expect(msg.getXid()).andReturn((long) j).anyTimes(); |
| 178 | replay(msg); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 179 | messages.add(msg); |
| 180 | |
| 181 | try { |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 182 | sw.write(eq(msg), eq((FloodlightContext) null)); |
| 183 | expectLastCall().once(); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 184 | } catch (IOException e1) { |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 185 | fail("Failed in IOFWrite#write()"); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 186 | } |
| 187 | } |
Yuta HIGUCHI | 44a0b35 | 2014-05-14 21:32:48 -0700 | [diff] [blame] | 188 | swMap.put(sw, messages); |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 189 | replay(sw); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 190 | } |
| 191 | |
| 192 | endInitMock(); |
| 193 | initPusher(1); |
| 194 | |
Yuta HIGUCHI | 44a0b35 | 2014-05-14 21:32:48 -0700 | [diff] [blame] | 195 | for (IOFSwitch sw : swMap.keySet()) { |
| 196 | for (OFMessage msg : swMap.get(sw)) { |
| 197 | boolean addResult = pusher.add(sw, msg); |
| 198 | assertTrue(addResult); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 199 | } |
| 200 | } |
| 201 | |
| 202 | try { |
| 203 | // wait until message is processed. |
| 204 | Thread.sleep(1000); |
| 205 | } catch (InterruptedException e) { |
| 206 | fail("Failed in Thread.sleep()"); |
| 207 | } |
| 208 | |
Yuta HIGUCHI | 44a0b35 | 2014-05-14 21:32:48 -0700 | [diff] [blame] | 209 | for (IOFSwitch sw : swMap.keySet()) { |
| 210 | for (OFMessage msg : swMap.get(sw)) { |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 211 | verify(msg); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 212 | } |
| 213 | |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 214 | verify(sw); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 215 | } |
| 216 | verifyAll(); |
| 217 | |
| 218 | pusher.stop(); |
| 219 | } |
| 220 | |
| 221 | /** |
| 222 | * Test bunch of OFMessages are correctly sent to multiple switches using multiple threads. |
| 223 | */ |
| 224 | @Test |
| 225 | public void testMultiThreadedAddMessage() { |
Yuta HIGUCHI | 91a8f50 | 2014-06-17 10:15:29 -0700 | [diff] [blame] | 226 | final int numThreads = 10; |
| 227 | final int numMsg = 100; // messages per thread |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 228 | |
| 229 | beginInitMock(); |
| 230 | |
Yuta HIGUCHI | 44a0b35 | 2014-05-14 21:32:48 -0700 | [diff] [blame] | 231 | Map<IOFSwitch, List<OFMessage>> swMap = new HashMap<IOFSwitch, List<OFMessage>>(); |
Yuta HIGUCHI | 91a8f50 | 2014-06-17 10:15:29 -0700 | [diff] [blame] | 232 | for (int i = 0; i < numThreads; ++i) { |
Naoki Shiota | 4799310 | 2014-07-09 14:00:54 -0700 | [diff] [blame] | 233 | IOFSwitch sw = createConnectedSwitchMock(i, false); |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 234 | //EasyMock.replay(sw); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 235 | |
| 236 | List<OFMessage> messages = new ArrayList<OFMessage>(); |
| 237 | |
Yuta HIGUCHI | 91a8f50 | 2014-06-17 10:15:29 -0700 | [diff] [blame] | 238 | for (int j = 0; j < numMsg; ++j) { |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 239 | OFMessage msg = createMock(OFMessage.class); |
| 240 | expect(msg.getXid()).andReturn((long) j).anyTimes(); |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 241 | |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 242 | replay(msg); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 243 | messages.add(msg); |
| 244 | |
| 245 | try { |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 246 | sw.write(eq(msg), eq((FloodlightContext) null)); |
| 247 | expectLastCall().once(); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 248 | } catch (IOException e1) { |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 249 | fail("Failed in IOFWrite#write()"); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 250 | } |
| 251 | } |
Yuta HIGUCHI | 44a0b35 | 2014-05-14 21:32:48 -0700 | [diff] [blame] | 252 | swMap.put(sw, messages); |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 253 | replay(sw); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 254 | } |
| 255 | |
| 256 | endInitMock(); |
Yuta HIGUCHI | 91a8f50 | 2014-06-17 10:15:29 -0700 | [diff] [blame] | 257 | initPusher(numThreads); |
Yuta HIGUCHI | 44a0b35 | 2014-05-14 21:32:48 -0700 | [diff] [blame] | 258 | for (IOFSwitch sw : swMap.keySet()) { |
| 259 | for (OFMessage msg : swMap.get(sw)) { |
| 260 | boolean addResult = pusher.add(sw, msg); |
| 261 | assertTrue(addResult); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 262 | } |
| 263 | } |
| 264 | |
| 265 | try { |
| 266 | // wait until message is processed. |
| 267 | Thread.sleep(1000); |
| 268 | } catch (InterruptedException e) { |
| 269 | fail("Failed in Thread.sleep()"); |
| 270 | } |
| 271 | |
Yuta HIGUCHI | 44a0b35 | 2014-05-14 21:32:48 -0700 | [diff] [blame] | 272 | for (IOFSwitch sw : swMap.keySet()) { |
| 273 | for (OFMessage msg : swMap.get(sw)) { |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 274 | verify(msg); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 275 | } |
| 276 | |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 277 | verify(sw); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 278 | } |
| 279 | verifyAll(); |
| 280 | |
| 281 | pusher.stop(); |
| 282 | } |
| 283 | |
| 284 | private long barrierTime = 0; |
| 285 | |
| 286 | /** |
| 287 | * Test rate limitation of messages works correctly. |
| 288 | */ |
| 289 | @Test |
| 290 | public void testRateLimitedAddMessage() { |
Yuta HIGUCHI | 91a8f50 | 2014-06-17 10:15:29 -0700 | [diff] [blame] | 291 | final long limitRate = 100; // [bytes/ms] |
| 292 | final int numMsg = 1000; |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 293 | |
| 294 | // Accuracy of FlowPusher's rate calculation can't be measured by unit test |
| 295 | // because switch doesn't return BARRIER_REPLY. |
| 296 | // In unit test we use approximate way to measure rate. This value is |
| 297 | // acceptable margin of measured rate. |
Yuta HIGUCHI | 91a8f50 | 2014-06-17 10:15:29 -0700 | [diff] [blame] | 298 | final double acceptableRate = limitRate * 1.2; |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 299 | |
| 300 | beginInitMock(); |
| 301 | |
Naoki Shiota | 4799310 | 2014-07-09 14:00:54 -0700 | [diff] [blame] | 302 | IOFSwitch sw = createConnectedSwitchMock(1, true); |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 303 | expect(sw.getOFVersion()).andReturn(OFVersion.OF_10).once(); |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 304 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 305 | |
| 306 | List<OFMessage> messages = new ArrayList<OFMessage>(); |
| 307 | |
Yuta HIGUCHI | 91a8f50 | 2014-06-17 10:15:29 -0700 | [diff] [blame] | 308 | for (int i = 0; i < numMsg; ++i) { |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 309 | OFMessage msg = createMock(OFMessage.class); |
| 310 | expect(msg.getXid()).andReturn((long) 1).anyTimes(); |
| 311 | replay(msg); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 312 | messages.add(msg); |
| 313 | |
| 314 | try { |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 315 | sw.write(eq(msg), eq((FloodlightContext) null)); |
| 316 | expectLastCall().once(); |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 317 | } catch (IOException e1) { |
| 318 | fail("Failed in IOFWrite#write()"); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 319 | } |
| 320 | } |
| 321 | |
| 322 | try { |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 323 | sw.write(anyObject(OFBarrierRequest.class), eq((FloodlightContext) null)); |
| 324 | expectLastCall().once(); |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 325 | barrierTime = System.currentTimeMillis(); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 326 | } catch (IOException e1) { |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 327 | fail("Failed in IOFWrite#write()"); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 328 | } |
| 329 | |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 330 | replay(sw); |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 331 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 332 | endInitMock(); |
| 333 | initPusher(1); |
| 334 | |
| 335 | pusher.createQueue(sw); |
Yuta HIGUCHI | 91a8f50 | 2014-06-17 10:15:29 -0700 | [diff] [blame] | 336 | pusher.setRate(sw, limitRate); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 337 | |
| 338 | long beginTime = System.currentTimeMillis(); |
| 339 | for (OFMessage msg : messages) { |
Yuta HIGUCHI | 44a0b35 | 2014-05-14 21:32:48 -0700 | [diff] [blame] | 340 | boolean addResult = pusher.add(sw, msg); |
| 341 | assertTrue(addResult); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 342 | } |
| 343 | |
| 344 | pusher.barrierAsync(sw); |
| 345 | |
| 346 | try { |
| 347 | do { |
| 348 | Thread.sleep(1000); |
| 349 | } while (barrierTime == 0); |
| 350 | } catch (InterruptedException e) { |
| 351 | fail("Failed to sleep"); |
| 352 | } |
| 353 | |
Yuta HIGUCHI | 91a8f50 | 2014-06-17 10:15:29 -0700 | [diff] [blame] | 354 | double measuredRate = numMsg * 100 / (barrierTime - beginTime); |
| 355 | assertTrue(measuredRate < acceptableRate); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 356 | |
| 357 | for (OFMessage msg : messages) { |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 358 | verify(msg); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 359 | } |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 360 | verify(sw); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 361 | verifyAll(); |
| 362 | |
| 363 | pusher.stop(); |
| 364 | } |
| 365 | |
| 366 | /** |
| 367 | * Test barrier message is correctly sent to a switch. |
| 368 | */ |
| 369 | @Test |
| 370 | public void testBarrierMessage() { |
| 371 | beginInitMock(); |
| 372 | |
Naoki Shiota | 4799310 | 2014-07-09 14:00:54 -0700 | [diff] [blame] | 373 | IOFSwitch sw = createConnectedSwitchMock(1, true); |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 374 | expect(sw.getOFVersion()).andReturn(OFVersion.OF_10).once(); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 375 | |
| 376 | try { |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 377 | sw.write((OFMessage) anyObject(), eq((FloodlightContext) null)); |
| 378 | expectLastCall().once(); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 379 | } catch (IOException e1) { |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 380 | fail("Failed in IOFWrite#write()"); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 381 | } |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 382 | replay(sw); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 383 | endInitMock(); |
| 384 | initPusher(1); |
| 385 | |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 386 | OFMessageFuture<OFBarrierReply> future = pusher.barrierAsync(sw); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 387 | |
| 388 | assertNotNull(future); |
| 389 | |
| 390 | try { |
| 391 | Thread.sleep(1000); |
| 392 | } catch (InterruptedException e) { |
| 393 | fail("Failed to sleep"); |
| 394 | } |
| 395 | |
| 396 | verifyAll(); |
| 397 | |
| 398 | pusher.stop(); |
| 399 | } |
| 400 | |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 401 | static final long XID_TO_VERIFY = 100; |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 402 | static final long DPID_TO_VERIFY = 10; |
| 403 | |
| 404 | /** |
| 405 | * Test FlowObject is correctly converted to message and is sent to a switch. |
| 406 | */ |
| 407 | @SuppressWarnings("unchecked") |
| 408 | @Test |
| 409 | public void testAddFlow() { |
| 410 | // instantiate required objects |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 411 | FlowEntry flowEntry1 = new FlowEntry(DPID_TO_VERIFY, 1, 11, null, null, 0, 0, Operator.ADD); |
| 412 | /* |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 413 | flowEntry1.setDpid(new Dpid(DPID_TO_VERIFY)); |
| 414 | flowEntry1.setFlowId(new FlowId(1)); |
Yuta HIGUCHI | fb56450 | 2014-06-16 21:29:00 -0700 | [diff] [blame] | 415 | flowEntry1.setInPort(new PortNumber((short) 1)); |
| 416 | flowEntry1.setOutPort(new PortNumber((short) 11)); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 417 | flowEntry1.setFlowEntryId(new FlowEntryId(1)); |
| 418 | flowEntry1.setFlowEntryMatch(new FlowEntryMatch()); |
| 419 | flowEntry1.setFlowEntryActions(new FlowEntryActions()); |
| 420 | flowEntry1.setFlowEntryErrorState(new FlowEntryErrorState()); |
| 421 | flowEntry1.setFlowEntryUserState(FlowEntryUserState.FE_USER_ADD); |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 422 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 423 | |
| 424 | beginInitMock(); |
| 425 | |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 426 | OFFlowModify fm = createMock(OFFlowModify.class); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 427 | |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 428 | OFFlowModify.Builder bld = createMock(OFFlowModify.Builder.class); |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 429 | |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 430 | expect(bld.setIdleTimeout(anyInt())).andReturn(bld); |
| 431 | expect(bld.setHardTimeout(anyInt())).andReturn(bld); |
| 432 | expect(bld.setPriority(anyShort())).andReturn(bld); |
| 433 | expect(bld.setBufferId(OFBufferId.NO_BUFFER)).andReturn(bld); |
| 434 | expect(bld.setCookie(U64.of(anyLong()))).andReturn(bld); |
| 435 | expect(bld.setMatch(anyObject(Match.class))).andReturn(bld); |
| 436 | expect(bld.setActions((List<OFAction>) anyObject())).andReturn(bld); |
| 437 | expect(bld.setOutPort(OFPort.of(anyInt()))).andReturn(bld).atLeastOnce(); |
| 438 | expect(bld.build()).andReturn(fm); |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 439 | |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 440 | expect(fm.getXid()).andReturn(XID_TO_VERIFY).anyTimes(); |
| 441 | expect(fm.getType()).andReturn(OFType.FLOW_MOD).anyTimes(); |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 442 | |
| 443 | |
| 444 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 445 | |
Naoki Shiota | 4799310 | 2014-07-09 14:00:54 -0700 | [diff] [blame] | 446 | IOFSwitch sw = createConnectedSwitchMock(DPID_TO_VERIFY, false); |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 447 | expect(sw.getStringId()).andReturn("1").anyTimes(); |
| 448 | expect(sw.getOFVersion()).andReturn(OFVersion.OF_10).once(); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 449 | |
| 450 | try { |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 451 | sw.write(anyObject(OFMessage.class), eq((FloodlightContext) null)); |
| 452 | expectLastCall().once(); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 453 | } catch (IOException e1) { |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 454 | fail("Failed in IOFWrite#write()"); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 455 | } |
| 456 | |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 457 | replay(bld, fm); |
| 458 | replay(sw); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 459 | |
| 460 | endInitMock(); |
| 461 | initPusher(1); |
| 462 | |
| 463 | pusher.pushFlowEntry(sw, flowEntry1); |
| 464 | |
| 465 | try { |
| 466 | Thread.sleep(1000); |
| 467 | } catch (InterruptedException e) { |
| 468 | fail("Failed to sleep"); |
| 469 | } |
| 470 | |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 471 | verify(sw); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 472 | verifyAll(); |
| 473 | |
| 474 | pusher.stop(); |
| 475 | } |
| 476 | |
| 477 | private void beginInitMock() { |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 478 | context = createMock(FloodlightContext.class); |
| 479 | modContext = createMock(FloodlightModuleContext.class); |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 480 | // AAS: I don't think we should mock factories... the rabbit whole is too deep. |
| 481 | //factory10 = EasyMock.createMock(OFFactories.getFactory(OFVersion.OF_10).getClass()); |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 482 | flProviderService = createMock(IFloodlightProviderService.class); |
| 483 | threadPoolService = createMock(IThreadPoolService.class); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 484 | |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 485 | expect(modContext.getServiceImpl(eq(IThreadPoolService.class))) |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 486 | .andReturn(threadPoolService).once(); |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 487 | expect(modContext.getServiceImpl(eq(IFloodlightProviderService.class))) |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 488 | .andReturn(flProviderService).once(); |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 489 | // AAS: FlowPusher doesn't call the following anymore. |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 490 | flProviderService.addOFMessageListener(eq(OFType.BARRIER_REPLY), |
| 491 | anyObject(FlowPusher.class)); |
| 492 | expectLastCall().once(); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 493 | |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 494 | ScheduledExecutorService executor = createMock(ScheduledExecutorService.class); |
| 495 | expect(executor.schedule((Runnable) anyObject(), anyLong(), |
| 496 | (TimeUnit) anyObject())).andReturn(null).once(); |
| 497 | replay(executor); |
| 498 | expect(threadPoolService.getScheduledExecutor()).andReturn(executor).anyTimes(); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 499 | } |
| 500 | |
| 501 | private void endInitMock() { |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 502 | replay(threadPoolService); |
| 503 | replay(flProviderService); |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 504 | //EasyMock.replay(factory10); |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 505 | replay(modContext); |
| 506 | replay(context); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 507 | } |
| 508 | |
| 509 | private void verifyAll() { |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 510 | verify(threadPoolService); |
| 511 | verify(flProviderService); |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 512 | //EasyMock.verify(factory10); |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 513 | verify(modContext); |
| 514 | verify(context); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 515 | } |
| 516 | |
Yuta HIGUCHI | 44a0b35 | 2014-05-14 21:32:48 -0700 | [diff] [blame] | 517 | private void initPusher(int numThread) { |
| 518 | pusher = new FlowPusher(numThread); |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 519 | pusher.init(modContext); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 520 | pusher.start(); |
| 521 | } |
| 522 | |
Naoki Shiota | 4799310 | 2014-07-09 14:00:54 -0700 | [diff] [blame] | 523 | private IOFSwitch createConnectedSwitchMock(long dpid, boolean useBarrier) { |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 524 | IOFSwitch sw = createMock(IOFSwitch.class); |
| 525 | expect(sw.isConnected()).andReturn(true).anyTimes(); |
| 526 | expect(sw.getId()).andReturn(dpid).anyTimes(); |
Naoki Shiota | 4799310 | 2014-07-09 14:00:54 -0700 | [diff] [blame] | 527 | sw.flush(); |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 528 | expectLastCall().anyTimes(); |
Naoki Shiota | 4799310 | 2014-07-09 14:00:54 -0700 | [diff] [blame] | 529 | if (useBarrier) { |
| 530 | prepareBarrier(sw); |
| 531 | } |
| 532 | |
| 533 | return sw; |
| 534 | } |
| 535 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 536 | private void prepareBarrier(IOFSwitch sw) { |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 537 | OFBarrierRequest.Builder bld = createMock(factory10.buildBarrierRequest().getClass()); |
| 538 | expect(bld.setXid(anyInt())).andReturn(bld); |
| 539 | expect(bld.getXid()).andReturn((long) 1).anyTimes(); |
| 540 | expect(bld.getType()).andReturn(OFType.BARRIER_REQUEST).anyTimes(); |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 541 | |
Sho SHIMIZU | 107344e | 2014-08-13 16:11:53 -0700 | [diff] [blame] | 542 | OFBarrierRequest req = createMock(OFBarrierRequest.class); |
| 543 | expect(bld.build()).andReturn(req).anyTimes(); |
| 544 | replay(bld); |
| 545 | expect(sw.getNextTransactionId()).andReturn(1); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 546 | } |
| 547 | |
Naoki Shiota | 75b7dd6 | 2013-12-03 18:09:21 -0800 | [diff] [blame] | 548 | } |