blob: e34bde9395443f32b9f873d42309e02e76d595f9 [file] [log] [blame]
TeruU8b2d1672014-04-25 17:02:56 -07001package net.onrc.onos.apps.proxyarp;
2
3import static org.junit.Assert.assertEquals;
4import static org.junit.Assert.assertTrue;
Yuta HIGUCHI238fa2a2014-05-01 09:56:46 -07005import static org.junit.Assert.fail;
TeruU8b2d1672014-04-25 17:02:56 -07006
7import java.net.InetAddress;
8import java.net.UnknownHostException;
9import java.nio.ByteBuffer;
10import java.util.ArrayList;
11import java.util.HashMap;
12import java.util.List;
13import java.util.Map;
14
TeruU8b2d1672014-04-25 17:02:56 -070015import net.floodlightcontroller.core.IFloodlightProviderService;
16import net.floodlightcontroller.core.module.FloodlightModuleContext;
17import net.floodlightcontroller.restserver.IRestApiService;
18import net.floodlightcontroller.util.MACAddress;
19import net.onrc.onos.api.packet.IPacketService;
Yuta HIGUCHI238fa2a2014-05-01 09:56:46 -070020import net.onrc.onos.apps.proxyarp.web.ArpWebRoutable;
TeruU8b2d1672014-04-25 17:02:56 -070021import net.onrc.onos.core.datagrid.IDatagridService;
22import net.onrc.onos.core.datagrid.IEventChannel;
23import net.onrc.onos.core.datagrid.IEventChannelListener;
24import net.onrc.onos.core.devicemanager.IOnosDeviceService;
25import net.onrc.onos.core.flowprogrammer.IFlowPusherService;
26import net.onrc.onos.core.main.config.IConfigInfoService;
27import net.onrc.onos.core.packet.ARP;
28import net.onrc.onos.core.packet.Ethernet;
29import net.onrc.onos.core.packet.IPv4;
TeruU8b2d1672014-04-25 17:02:56 -070030import net.onrc.onos.core.topology.Device;
Jonathan Harte37e4e22014-05-13 19:12:02 -070031import net.onrc.onos.core.topology.ITopologyService;
32import net.onrc.onos.core.topology.Topology;
TeruU8b2d1672014-04-25 17:02:56 -070033import net.onrc.onos.core.topology.Port;
34import net.onrc.onos.core.topology.Switch;
35
36import org.easymock.EasyMock;
37import org.junit.After;
38import org.junit.Before;
39import org.junit.Test;
40import org.junit.runner.RunWith;
41import org.powermock.api.easymock.PowerMock;
42import org.powermock.core.classloader.annotations.PrepareForTest;
43import org.powermock.modules.junit4.PowerMockRunner;
44
45@RunWith(PowerMockRunner.class)
Yuta HIGUCHI44a0b352014-05-14 21:32:48 -070046@PrepareForTest({ ProxyArpManager.class, ArpCache.class })
TeruU8b2d1672014-04-25 17:02:56 -070047public class ProxyArpManagerTest {
48 String defaultStrAgingMsec = "60000";
49 String defaultStrCleanupMsec = "60000";
50
51 ProxyArpManager arpManager;
52 FloodlightModuleContext context;
53 IFloodlightProviderService floodligthProviderService;
54 IConfigInfoService configInfoService;
55 IRestApiService restApiService;
56 IDatagridService datagridService;
57 IFlowPusherService flowPusherService;
Jonathan Harte37e4e22014-05-13 19:12:02 -070058 ITopologyService topologyService;
TeruU8b2d1672014-04-25 17:02:56 -070059 IOnosDeviceService onosDeviceService;
60 IPacketService packetService;
Yuta HIGUCHI44a0b352014-05-14 21:32:48 -070061 Map<String, String> configMap;
TeruU8b2d1672014-04-25 17:02:56 -070062
63 String srcStrMac, dstStrMac, cachedStrMac1, cachedStrMac2, srcStrIp, dstStrIp, cachedStrIp1, cachedStrIp2;
64 byte[] srcByteMac, dstByteMac;
65 MACAddress dstMac, srcMac, cachedMac1, cachedMac2;
66 InetAddress srcIp, dstIp, cachedIp1, cachedIp2;
67 Long sw1Dpid;
68 Short sw1Inport, sw1Outport;
69 Short vlanId;
70 ARP arpRequest, arpReply, rarpRequest;
71 Ethernet ethArpRequest, ethArpReply, ethRarpRequest, ethArpOtherOp;
72
Jonathan Harte37e4e22014-05-13 19:12:02 -070073 Topology topology;
TeruU8b2d1672014-04-25 17:02:56 -070074 IEventChannel eg;
75 IEventChannelListener el;
76 Device dev1;
77 Port inPort1, outPort1;
78 Switch sw1;
79 ArpCache arpCache;
80 List<String> arpCacheComparisonList;
81
82 @Before
83 public void setUp() throws Exception {
84 makeTestedObject();
85 makeMock();
86 prepareExpectForInit();
87 prepareExpectForStartUp();
88 prepareExpectForGeneral();
89 }
90
91 private void makeTestedObject() {
92 //Made tested values
93 srcStrMac = "00:00:00:00:00:01";
94 dstStrMac = "00:00:00:00:00:02";
95 cachedStrMac1 = "00:00:00:00:00:03";
96 cachedStrMac2 = "00:00:00:00:00:04";
97 srcStrIp = "192.168.0.1";
98 dstStrIp = "192.168.0.2";
99 cachedStrIp1 = "192.168.0.3";
100 cachedStrIp2 = "192.168.0.4";
101 srcByteMac = Ethernet.toMACAddress(srcStrMac);
102 dstByteMac = Ethernet.toMACAddress(dstStrMac);
103 dstMac = new MACAddress(dstByteMac);
104 srcMac = new MACAddress(srcByteMac);
105 cachedMac1 = new MACAddress(Ethernet.toMACAddress(cachedStrMac1));
106 cachedMac2 = new MACAddress(Ethernet.toMACAddress(cachedStrMac2));
107 srcIp = null;
108 dstIp = null;
109 cachedIp1 = null;
110 cachedIp2 = null;
111 try {
112 srcIp = InetAddress.getByAddress(IPv4.toIPv4AddressBytes(srcStrIp));
113 dstIp = InetAddress.getByAddress(IPv4.toIPv4AddressBytes(dstStrIp));
114 cachedIp1 = InetAddress.getByAddress(IPv4.toIPv4AddressBytes(cachedStrIp1));
115 cachedIp2 = InetAddress.getByAddress(IPv4.toIPv4AddressBytes(cachedStrIp2));
116 } catch (UnknownHostException e) {
117 e.printStackTrace();
118 }
Yuta HIGUCHI44a0b352014-05-14 21:32:48 -0700119 sw1Dpid = 1L;
TeruU8b2d1672014-04-25 17:02:56 -0700120 sw1Inport = 1;
121 sw1Outport = 2;
122 vlanId = 1;
123
124 //Made tested packets
125 arpRequest = new ARP()
126 .setHardwareType(ARP.HW_TYPE_ETHERNET)
127 .setProtocolType(ARP.PROTO_TYPE_IP)
128 .setHardwareAddressLength((byte) 6)
129 .setProtocolAddressLength((byte) 4)
130 .setOpCode(ARP.OP_REQUEST)
131 .setSenderHardwareAddress(srcByteMac)
132 .setSenderProtocolAddress(srcIp.getAddress())
133 .setTargetProtocolAddress(dstIp.getAddress())
134 .setTargetHardwareAddress(dstByteMac);
135
136 ethArpRequest = (Ethernet) new Ethernet()
137 .setSourceMACAddress(srcStrMac)
138 .setDestinationMACAddress(dstStrMac)
139 .setEtherType(Ethernet.TYPE_ARP)
140 .setVlanID((short) 0)
141 .setPayload(arpRequest);
142
143 arpReply = new ARP()
144 .setHardwareType(ARP.HW_TYPE_ETHERNET)
145 .setProtocolType(ARP.PROTO_TYPE_IP)
146 .setHardwareAddressLength((byte) 6)
147 .setProtocolAddressLength((byte) 4)
148 .setOpCode(ARP.OP_RARP_REPLY)
149 .setSenderHardwareAddress(srcByteMac)
150 .setSenderProtocolAddress(srcIp.getAddress())
151 .setTargetProtocolAddress(dstIp.getAddress())
152 .setTargetHardwareAddress(dstByteMac);
153
154 ethArpReply = (Ethernet) new Ethernet()
155 .setSourceMACAddress(srcStrMac)
156 .setDestinationMACAddress(dstStrMac)
157 .setEtherType(Ethernet.TYPE_ARP)
158 .setVlanID((short) 0)
159 .setPayload(arpReply);
160
161 rarpRequest = new ARP()
162 .setHardwareType(ARP.HW_TYPE_ETHERNET)
163 .setProtocolType(ARP.PROTO_TYPE_IP)
164 .setHardwareAddressLength((byte) 6)
165 .setProtocolAddressLength((byte) 4)
166 .setOpCode(ARP.OP_RARP_REQUEST)
167 .setSenderHardwareAddress(srcByteMac)
168 .setSenderProtocolAddress(srcIp.getAddress())
169 .setTargetProtocolAddress(dstIp.getAddress())
170 .setTargetHardwareAddress(dstByteMac);
171
172 ethRarpRequest = (Ethernet) new Ethernet()
173 .setSourceMACAddress(srcStrMac)
174 .setDestinationMACAddress(dstStrMac)
175 .setEtherType(Ethernet.TYPE_RARP)
176 .setVlanID((short) 0)
177 .setPayload(rarpRequest);
178
179 ethArpOtherOp = (Ethernet) new Ethernet()
180 .setSourceMACAddress(srcStrMac)
181 .setDestinationMACAddress(dstStrMac)
182 .setEtherType(Ethernet.TYPE_ARP)
183 .setVlanID((short) 0)
184 .setPayload(rarpRequest);
185
186 //Made tested objects
187 arpCache = new ArpCache();
Yuta HIGUCHI238fa2a2014-05-01 09:56:46 -0700188 arpCache.setArpEntryTimeoutConfig(Long.parseLong(defaultStrCleanupMsec));
TeruU8b2d1672014-04-25 17:02:56 -0700189 arpCache.update(cachedIp1, cachedMac1);
Yuta HIGUCHI238fa2a2014-05-01 09:56:46 -0700190 arpCache.update(cachedIp2, cachedMac2);
191
192 arpCacheComparisonList = new ArrayList<String>();
TeruU8b2d1672014-04-25 17:02:56 -0700193 arpCacheComparisonList.add(cachedStrIp1
194 + " => "
195 + cachedStrMac1
196 + " : VALID");
TeruU8b2d1672014-04-25 17:02:56 -0700197 arpCacheComparisonList.add(cachedStrIp2
198 + " => "
199 + cachedStrMac2
200 + " : VALID");
201
202 arpManager = new ProxyArpManager();
Yuta HIGUCHI44a0b352014-05-14 21:32:48 -0700203 configMap = new HashMap<String, String>();
TeruU8b2d1672014-04-25 17:02:56 -0700204 }
205
206 private void makeMock() {
207 //Mock floodlight modules
208 context = EasyMock.createMock(FloodlightModuleContext.class);
209 floodligthProviderService = EasyMock.createMock(IFloodlightProviderService.class);
210 configInfoService = EasyMock.createMock(IConfigInfoService.class);
211 restApiService = EasyMock.createMock(IRestApiService.class);
212 datagridService = EasyMock.createMock(IDatagridService.class);
213 flowPusherService = EasyMock.createMock(IFlowPusherService.class);
Jonathan Harte37e4e22014-05-13 19:12:02 -0700214 topologyService = EasyMock.createMock(ITopologyService.class);
TeruU8b2d1672014-04-25 17:02:56 -0700215 onosDeviceService = EasyMock.createMock(IOnosDeviceService.class);
216 packetService = EasyMock.createMock(IPacketService.class);
217 eg = EasyMock.createMock(IEventChannel.class);
218 el = EasyMock.createMock(IEventChannelListener.class);
219
Jonathan Harte37e4e22014-05-13 19:12:02 -0700220 //Mock Topology related data
221 topology = EasyMock.createMock(Topology.class);
TeruU8b2d1672014-04-25 17:02:56 -0700222 dev1 = EasyMock.createMock(Device.class);
223 inPort1 = EasyMock.createMock(Port.class);
224 outPort1 = EasyMock.createMock(Port.class);
225 sw1 = EasyMock.createMock(Switch.class);
226 }
227
228 private void prepareExpectForGeneral() {
Yuta HIGUCHI44a0b352014-05-14 21:32:48 -0700229 EasyMock.expect(inPort1.getNumber()).andReturn((long) sw1Inport).anyTimes();
230 EasyMock.expect(outPort1.getNumber()).andReturn((long) sw1Outport).anyTimes();
TeruU8b2d1672014-04-25 17:02:56 -0700231 EasyMock.expect(outPort1.getOutgoingLink()).andReturn(null).anyTimes();
232 EasyMock.expect(outPort1.getIncomingLink()).andReturn(null).anyTimes();
233 EasyMock.expect(outPort1.getSwitch()).andReturn(sw1).anyTimes();
234 EasyMock.expect(sw1.getDpid()).andReturn(sw1Dpid).anyTimes();
235 }
236
237 private void prepareExpectForInit() {
238 EasyMock.expect(context.getServiceImpl(IFloodlightProviderService.class)).andReturn(floodligthProviderService);
239 EasyMock.expect(context.getServiceImpl(IConfigInfoService.class)).andReturn(configInfoService);
240 EasyMock.expect(context.getServiceImpl(IRestApiService.class)).andReturn(restApiService);
241 EasyMock.expect(context.getServiceImpl(IDatagridService.class)).andReturn(datagridService);
242 EasyMock.expect(context.getServiceImpl(IFlowPusherService.class)).andReturn(flowPusherService);
Jonathan Harte37e4e22014-05-13 19:12:02 -0700243 EasyMock.expect(context.getServiceImpl(ITopologyService.class)).andReturn(topologyService);
TeruU8b2d1672014-04-25 17:02:56 -0700244 EasyMock.expect(context.getServiceImpl(IOnosDeviceService.class)).andReturn(onosDeviceService);
245 EasyMock.expect(context.getServiceImpl(IPacketService.class)).andReturn(packetService);
246 }
247
248 private void prepareExpectForStartUp() {
249 try {
250 PowerMock.expectNew(ArpCache.class).andReturn(arpCache);
251 } catch (Exception e) {
Yuta HIGUCHI238fa2a2014-05-01 09:56:46 -0700252 fail("Exception:" + e.getMessage());
TeruU8b2d1672014-04-25 17:02:56 -0700253 }
254 PowerMock.replayAll();
255 EasyMock.expect(configInfoService.getVlan()).andReturn(vlanId);
256 restApiService.addRestletRoutable(EasyMock.isA(ArpWebRoutable.class));
257 EasyMock.expectLastCall();
258 packetService.registerPacketListener(arpManager);
259 EasyMock.expectLastCall();
Jonathan Harte37e4e22014-05-13 19:12:02 -0700260 EasyMock.expect(topologyService.getTopology()).andReturn(topology);
Yuta HIGUCHI44a0b352014-05-14 21:32:48 -0700261 EasyMock.expect(datagridService.addListener((String) EasyMock.anyObject(), EasyMock.isA(IEventChannelListener.class),
262 (Class) EasyMock.anyObject(), (Class) EasyMock.anyObject())).andReturn(eg).anyTimes();
TeruU8b2d1672014-04-25 17:02:56 -0700263 List<ArpCacheNotification> list = new ArrayList<ArpCacheNotification>();
264 EasyMock.expect(eg.getAllEntries()).andReturn(list);
265 }
266
267 private void prepareExpectForLearnArp() {
268 eg.addEntry(EasyMock.eq(srcIp.toString()), EasyMock.isA(ArpCacheNotification.class));
269 EasyMock.expectLastCall();
270 }
271
272 @After
273 public void tearDown() throws Exception {
Yuta HIGUCHI238fa2a2014-05-01 09:56:46 -0700274 arpCache = null;
TeruU8b2d1672014-04-25 17:02:56 -0700275 }
276
277 @Test
278 public void testConfigTimeWithNoConfig() {
279 Map<String, String> config = new HashMap<String, String>();
280 EasyMock.expect(context.getConfigParams(arpManager)).andReturn(config);
281
282 EasyMock.replay(context, floodligthProviderService, configInfoService, restApiService, datagridService, flowPusherService,
Jonathan Harte37e4e22014-05-13 19:12:02 -0700283 topologyService, onosDeviceService, packetService, topology, eg, el, dev1, inPort1, sw1);
TeruU8b2d1672014-04-25 17:02:56 -0700284 arpManager.init(context);
285 arpManager.startUp(context);
286 assertEquals(defaultStrAgingMsec, String.valueOf(arpManager.getArpEntryTimeout()));
287 assertEquals(defaultStrCleanupMsec, String.valueOf(arpManager.getArpCleaningTimerPeriod()));
288 }
289
290 @Test
291 public void testConfigTimeWithWrongParameter() {
292 Map<String, String> config = new HashMap<String, String>();
293 String strAgingMsec = "aaaaa";
294 String strCleanupMsec = "bbbbb";
295 config.put("agingmsec", strAgingMsec);
296 config.put("cleanupmsec", strCleanupMsec);
297 EasyMock.expect(context.getConfigParams(arpManager)).andReturn(config);
298
299 EasyMock.replay(context, floodligthProviderService, configInfoService, restApiService, datagridService, flowPusherService,
Jonathan Harte37e4e22014-05-13 19:12:02 -0700300 topologyService, onosDeviceService, packetService, topology, eg, el, dev1, inPort1, sw1);
TeruU8b2d1672014-04-25 17:02:56 -0700301 arpManager.init(context);
302 arpManager.startUp(context);
303 assertEquals(defaultStrAgingMsec, String.valueOf(arpManager.getArpEntryTimeout()));
304 assertEquals(defaultStrCleanupMsec, String.valueOf(arpManager.getArpCleaningTimerPeriod()));
305 }
306
307 @Test
308 public void testConfigTime() {
309 String strAgingMsec = "10000";
310 String strCleanupMsec = "10000";
Yuta HIGUCHI44a0b352014-05-14 21:32:48 -0700311 configMap.put("agingmsec", strAgingMsec);
312 configMap.put("cleanupmsec", strCleanupMsec);
313 EasyMock.expect(context.getConfigParams(arpManager)).andReturn(configMap);
TeruU8b2d1672014-04-25 17:02:56 -0700314
315 EasyMock.replay(context, floodligthProviderService, configInfoService, restApiService, datagridService, flowPusherService,
Jonathan Harte37e4e22014-05-13 19:12:02 -0700316 topologyService, onosDeviceService, packetService, topology, eg, el, dev1, inPort1, sw1);
TeruU8b2d1672014-04-25 17:02:56 -0700317 arpManager.init(context);
318 arpManager.startUp(context);
319 assertEquals(strAgingMsec, String.valueOf(arpManager.getArpEntryTimeout()));
320 assertEquals(strCleanupMsec, String.valueOf(arpManager.getArpCleaningTimerPeriod()));
321 }
322
323 @Test
324 public void testGetMacAddress() {
325 Map<String, String> config = new HashMap<String, String>();
326 EasyMock.expect(context.getConfigParams(arpManager)).andReturn(config);
327
328 EasyMock.replay(context, floodligthProviderService, configInfoService, restApiService, datagridService, flowPusherService,
Jonathan Harte37e4e22014-05-13 19:12:02 -0700329 topologyService, onosDeviceService, packetService, topology, eg, el, dev1, inPort1, sw1);
TeruU8b2d1672014-04-25 17:02:56 -0700330 arpManager.init(context);
331 arpManager.startUp(context);
332 MACAddress mac = arpManager.getMacAddress(cachedIp1);
333 assertEquals(cachedMac1, mac);
334 }
335
336 @Test
337 public void testGetMappings() {
338 Map<String, String> config = new HashMap<String, String>();
339 EasyMock.expect(context.getConfigParams(arpManager)).andReturn(config);
340
341 EasyMock.replay(context, floodligthProviderService, configInfoService, restApiService, datagridService, flowPusherService,
Jonathan Harte37e4e22014-05-13 19:12:02 -0700342 topologyService, onosDeviceService, packetService, topology, eg, el, dev1, inPort1, sw1);
TeruU8b2d1672014-04-25 17:02:56 -0700343 arpManager.init(context);
344 arpManager.startUp(context);
345 List<String> list = arpManager.getMappings();
Yuta HIGUCHI44a0b352014-05-14 21:32:48 -0700346 for (String str : list) {
TeruU8b2d1672014-04-25 17:02:56 -0700347 assertTrue(arpCacheComparisonList.contains(str));
348 }
349 }
350
351 @Test
352 public void testReceivePacketWithNoArpPacket() {
353 Map<String, String> config = new HashMap<String, String>();
354 EasyMock.expect(context.getConfigParams(arpManager)).andReturn(config);
355
356 EasyMock.replay(context, floodligthProviderService, configInfoService, restApiService, datagridService, flowPusherService,
Jonathan Harte37e4e22014-05-13 19:12:02 -0700357 topologyService, onosDeviceService, packetService, topology, eg, el, dev1, inPort1, sw1);
TeruU8b2d1672014-04-25 17:02:56 -0700358 arpManager.init(context);
359 arpManager.startUp(context);
360 arpManager.receive(sw1, inPort1, ethRarpRequest);
361 }
362
363 @Test
364 public void testReceivePacketWithOtherOpCode() {
365 Map<String, String> config = new HashMap<String, String>();
366 EasyMock.expect(context.getConfigParams(arpManager)).andReturn(config);
367
368 prepareExpectForLearnArp();
369
370 EasyMock.replay(context, floodligthProviderService, configInfoService, restApiService, datagridService, flowPusherService,
Jonathan Harte37e4e22014-05-13 19:12:02 -0700371 topologyService, onosDeviceService, packetService, topology, eg, el, dev1, inPort1, sw1);
TeruU8b2d1672014-04-25 17:02:56 -0700372 arpManager.init(context);
373 arpManager.startUp(context);
374 arpManager.receive(sw1, inPort1, ethArpOtherOp);
375 }
376
377 @Test
378 public void testClassifyPacketToSendArpReplyNotification() {
379 Map<String, String> config = new HashMap<String, String>();
380 EasyMock.expect(context.getConfigParams(arpManager)).andReturn(config);
381
382 prepareExpectForLearnArp();
383
384 ArpReplyNotification value =
385 new ArpReplyNotification(ByteBuffer.wrap(dstIp.getAddress()).getInt(), dstMac);
386 eg.addTransientEntry(srcMac.toLong(), value);
387 EasyMock.expectLastCall();
388 EasyMock.expect(context.getServiceImpl(IDatagridService.class)).andReturn(datagridService);
389
390 EasyMock.replay(context, floodligthProviderService, configInfoService, restApiService, datagridService, flowPusherService,
Jonathan Harte37e4e22014-05-13 19:12:02 -0700391 topologyService, onosDeviceService, packetService, topology, eg, el, dev1, inPort1, sw1);
TeruU8b2d1672014-04-25 17:02:56 -0700392 arpManager.init(context);
393 arpManager.startUp(context);
394 arpManager.receive(sw1, inPort1, ethArpReply);
395 }
396
397 @Test
398 public void testClassifyPacketToHandleArpRequest() {
399 Map<String, String> config = new HashMap<String, String>();
400 EasyMock.expect(context.getConfigParams(arpManager)).andReturn(config);
401
402 prepareExpectForLearnArp();
403
404 EasyMock.expect(configInfoService.fromExternalNetwork(EasyMock.anyLong(), EasyMock.anyShort())).andReturn(true);
405 EasyMock.expect(configInfoService.isInterfaceAddress(dstIp)).andReturn(false);
406
407 EasyMock.replay(context, floodligthProviderService, configInfoService, restApiService, datagridService, flowPusherService,
Jonathan Harte37e4e22014-05-13 19:12:02 -0700408 topologyService, onosDeviceService, packetService, topology, eg, el, dev1, inPort1, sw1);
TeruU8b2d1672014-04-25 17:02:56 -0700409 arpManager.init(context);
410 arpManager.startUp(context);
411 arpManager.receive(sw1, inPort1, ethArpRequest);
412 }
413
414 @Test
415 public void testClassifyPacketToHandleArpRequest2() {
416 List<Port> portList = new ArrayList<Port>();
417 portList.add(outPort1);
418
419 Map<String, String> config = new HashMap<String, String>();
420 EasyMock.expect(context.getConfigParams(arpManager)).andReturn(config);
421
422 prepareExpectForLearnArp();
423
424 EasyMock.expect(configInfoService.fromExternalNetwork(EasyMock.anyLong(), EasyMock.anyShort())).andReturn(false);
Jonathan Harte37e4e22014-05-13 19:12:02 -0700425 topology.acquireReadLock();
TeruU8b2d1672014-04-25 17:02:56 -0700426 EasyMock.expectLastCall();
Jonathan Harte37e4e22014-05-13 19:12:02 -0700427 EasyMock.expect(topology.getDeviceByMac(dstMac)).andReturn(dev1);
428 topology.releaseReadLock();
TeruU8b2d1672014-04-25 17:02:56 -0700429 EasyMock.expectLastCall();
430 EasyMock.expect(dev1.getAttachmentPoints()).andReturn(portList);
Yuta HIGUCHI44a0b352014-05-14 21:32:48 -0700431 eg.addTransientEntry(EasyMock.anyLong(), EasyMock.anyObject());
TeruU8b2d1672014-04-25 17:02:56 -0700432 EasyMock.expectLastCall();
433
434 EasyMock.replay(context, configInfoService, restApiService, floodligthProviderService,
Jonathan Harte37e4e22014-05-13 19:12:02 -0700435 topologyService, datagridService, eg, topology, dev1, inPort1, outPort1, sw1);
TeruU8b2d1672014-04-25 17:02:56 -0700436 arpManager.init(context);
437 arpManager.startUp(context);
438 arpManager.receive(sw1, inPort1, ethArpRequest);
439 }
440}