blob: 22ec42e450cdd9b710006773585a85a49de68f2f [file] [log] [blame]
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -08001/**
Ray Milkey269ffb92014-04-03 14:43:30 -07002 * Copyright 2011, Big Switch Networks, Inc.
3 * Originally created by David Erickson, Stanford University
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may
6 * not use this file except in compliance with the License. You may obtain
7 * a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations
15 * under the License.
16 **/
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080017
Jonathan Hart23701d12014-04-03 10:45:48 -070018package net.onrc.onos.core.linkdiscovery.internal;
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080019
Jonathan Hart2fa28062013-11-25 20:16:28 -080020import static org.easymock.EasyMock.createNiceMock;
21import static org.easymock.EasyMock.expect;
22import static org.easymock.EasyMock.replay;
23import static org.easymock.EasyMock.verify;
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080024
srikanth9f383342014-06-12 11:49:00 -070025import java.io.IOException;
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080026import java.util.ArrayList;
Jonathan Hart2fa28062013-11-25 20:16:28 -080027import java.util.Collections;
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080028import java.util.HashMap;
29import java.util.Map;
30
srikanth9f383342014-06-12 11:49:00 -070031import net.floodlightcontroller.core.FloodlightContext;
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080032import net.floodlightcontroller.core.IFloodlightProviderService;
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080033import net.floodlightcontroller.core.IOFSwitch;
34import net.floodlightcontroller.core.module.FloodlightModuleContext;
35import net.floodlightcontroller.core.test.MockThreadPoolService;
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080036import net.floodlightcontroller.restserver.IRestApiService;
37import net.floodlightcontroller.restserver.RestApiServer;
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080038import net.floodlightcontroller.test.FloodlightTestCase;
39import net.floodlightcontroller.threadpool.IThreadPoolService;
Jonathan Hart23701d12014-04-03 10:45:48 -070040import net.onrc.onos.core.linkdiscovery.ILinkDiscoveryListener;
41import net.onrc.onos.core.linkdiscovery.ILinkDiscoveryService;
42import net.onrc.onos.core.linkdiscovery.Link;
43import net.onrc.onos.core.linkdiscovery.LinkInfo;
44import net.onrc.onos.core.linkdiscovery.NodePortTuple;
Jonathan Hartcd1ab172014-07-03 14:59:48 -070045import net.onrc.onos.core.registry.IControllerRegistryService;
Jonathan Hart2fa28062013-11-25 20:16:28 -080046
srikanth9f383342014-06-12 11:49:00 -070047import org.easymock.EasyMock;
Jonathan Hart2fa28062013-11-25 20:16:28 -080048import org.junit.Before;
49import org.junit.Test;
srikanth9f383342014-06-12 11:49:00 -070050import org.openflow.protocol.OFMessage;
51import org.openflow.protocol.OFPhysicalPort;
Jonathan Hartcd1ab172014-07-03 14:59:48 -070052import org.openflow.protocol.OFPortStatus;
53import org.openflow.protocol.OFPortStatus.OFPortReason;
Jonathan Hart2fa28062013-11-25 20:16:28 -080054import org.slf4j.Logger;
55import org.slf4j.LoggerFactory;
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080056
Yuta HIGUCHIaa132f52014-06-26 10:18:39 -070057// CHECKSTYLE IGNORE WriteTag FOR NEXT 2 LINES
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080058/**
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080059 * @author David Erickson (daviderickson@cs.stanford.edu)
60 */
61public class LinkDiscoveryManagerTest extends FloodlightTestCase {
62
63 private TestLinkDiscoveryManager ldm;
Yuta HIGUCHI44a0b352014-05-14 21:32:48 -070064 protected static final Logger log = LoggerFactory.getLogger(LinkDiscoveryManagerTest.class);
Ray Milkey269ffb92014-04-03 14:43:30 -070065
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080066 public class TestLinkDiscoveryManager extends LinkDiscoveryManager {
67 public boolean isSendLLDPsCalled = false;
68 public boolean isClearLinksCalled = false;
69
70 @Override
71 protected void discoverOnAllPorts() {
72 isSendLLDPsCalled = true;
73 super.discoverOnAllPorts();
74 }
75
76 public void reset() {
77 isSendLLDPsCalled = false;
78 isClearLinksCalled = false;
79 }
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080080 }
Ray Milkey269ffb92014-04-03 14:43:30 -070081
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080082 public LinkDiscoveryManager getTopology() {
83 return ldm;
84 }
85
86 public IOFSwitch createMockSwitch(Long id) {
87 IOFSwitch mockSwitch = createNiceMock(IOFSwitch.class);
88 expect(mockSwitch.getId()).andReturn(id).anyTimes();
89 return mockSwitch;
90 }
91
Yuta HIGUCHI44a0b352014-05-14 21:32:48 -070092 @Override
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080093 @Before
94 public void setUp() throws Exception {
95 super.setUp();
96 FloodlightModuleContext cntx = new FloodlightModuleContext();
97 ldm = new TestLinkDiscoveryManager();
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080098 ldm.linkDiscoveryAware = new ArrayList<ILinkDiscoveryListener>();
99 MockThreadPoolService tp = new MockThreadPoolService();
100 RestApiServer restApi = new RestApiServer();
Jonathan Hartcd1ab172014-07-03 14:59:48 -0700101 IControllerRegistryService registry =
102 EasyMock.createMock(IControllerRegistryService.class);
103 expect(registry.hasControl(EasyMock.anyLong())).andReturn(true).anyTimes();
104 replay(registry);
105 cntx.addService(IControllerRegistryService.class, registry);
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800106 cntx.addService(IRestApiService.class, restApi);
107 cntx.addService(IThreadPoolService.class, tp);
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800108 cntx.addService(ILinkDiscoveryService.class, ldm);
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800109 cntx.addService(IFloodlightProviderService.class, getMockFloodlightProvider());
110 restApi.init(cntx);
111 tp.init(cntx);
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800112 ldm.init(cntx);
113 restApi.startUp(cntx);
114 tp.startUp(cntx);
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800115 ldm.startUp(cntx);
116
117 IOFSwitch sw1 = createMockSwitch(1L);
118 IOFSwitch sw2 = createMockSwitch(2L);
119 Map<Long, IOFSwitch> switches = new HashMap<Long, IOFSwitch>();
120 switches.put(1L, sw1);
121 switches.put(2L, sw2);
122 getMockFloodlightProvider().setSwitches(switches);
123 replay(sw1, sw2);
124 }
125
126 @Test
127 public void testAddOrUpdateLink() throws Exception {
128 LinkDiscoveryManager topology = getTopology();
129
130 Link lt = new Link(1L, 2, 2L, 1);
Jonathan Hartcd1ab172014-07-03 14:59:48 -0700131 long firstSeenTime = System.currentTimeMillis();
132 LinkInfo info = new LinkInfo(firstSeenTime,
Jonathan Hartba354e02014-06-30 19:18:16 -0700133 System.currentTimeMillis(), 0, 0);
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800134 topology.addOrUpdateLink(lt, info);
135
136
137 NodePortTuple srcNpt = new NodePortTuple(1L, 2);
138 NodePortTuple dstNpt = new NodePortTuple(2L, 1);
139
140 // check invariants hold
141 assertNotNull(topology.switchLinks.get(lt.getSrc()));
142 assertTrue(topology.switchLinks.get(lt.getSrc()).contains(lt));
143 assertNotNull(topology.portLinks.get(srcNpt));
144 assertTrue(topology.portLinks.get(srcNpt).contains(lt));
145 assertNotNull(topology.portLinks.get(dstNpt));
146 assertTrue(topology.portLinks.get(dstNpt).contains(lt));
147 assertTrue(topology.links.containsKey(lt));
Jonathan Hartcd1ab172014-07-03 14:59:48 -0700148
149 LinkInfo infoToVerify = topology.links.get(lt);
150 assertEquals(firstSeenTime, infoToVerify.getFirstSeenTime());
151 assertEquals(0, infoToVerify.getSrcPortState());
152 assertEquals(0, infoToVerify.getDstPortState());
153
154 // Arbitrary new port states to verify that the port state is updated
155 final int newSrcPortState = 1;
156 final int newDstPortState = 2;
157
158 // Update the last received probe timestamp and the port states
159 LinkInfo infoWithStateChange = new LinkInfo(System.currentTimeMillis(),
160 System.currentTimeMillis(), newSrcPortState, newDstPortState);
161
162 topology.addOrUpdateLink(lt, infoWithStateChange);
163
164 assertNotNull(topology.links.get(lt));
165 infoToVerify = topology.links.get(lt);
166 // First seen time should be the original time, not the second update time
167 assertEquals(firstSeenTime, infoToVerify.getFirstSeenTime());
168 // Both port states should have been updated
169 assertEquals(newSrcPortState, infoToVerify.getSrcPortState());
170 assertEquals(newDstPortState, infoToVerify.getDstPortState());
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800171 }
172
173 @Test
174 public void testDeleteLink() throws Exception {
175 LinkDiscoveryManager topology = getTopology();
176
177 Link lt = new Link(1L, 2, 2L, 1);
178 LinkInfo info = new LinkInfo(System.currentTimeMillis(),
Jonathan Hartba354e02014-06-30 19:18:16 -0700179 System.currentTimeMillis(), 0, 0);
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800180 topology.addOrUpdateLink(lt, info);
181 topology.deleteLinks(Collections.singletonList(lt), "Test");
182
183 // check invariants hold
184 assertNull(topology.switchLinks.get(lt.getSrc()));
185 assertNull(topology.switchLinks.get(lt.getDst()));
186 assertNull(topology.portLinks.get(lt.getSrc()));
187 assertNull(topology.portLinks.get(lt.getDst()));
188 assertTrue(topology.links.isEmpty());
189 }
190
191 @Test
192 public void testAddOrUpdateLinkToSelf() throws Exception {
193 LinkDiscoveryManager topology = getTopology();
194
195 Link lt = new Link(1L, 2, 2L, 3);
196 NodePortTuple srcNpt = new NodePortTuple(1L, 2);
197 NodePortTuple dstNpt = new NodePortTuple(2L, 3);
198
199 LinkInfo info = new LinkInfo(System.currentTimeMillis(),
Jonathan Hartba354e02014-06-30 19:18:16 -0700200 System.currentTimeMillis(), 0, 0);
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800201 topology.addOrUpdateLink(lt, info);
202
203 // check invariants hold
204 assertNotNull(topology.switchLinks.get(lt.getSrc()));
205 assertTrue(topology.switchLinks.get(lt.getSrc()).contains(lt));
206 assertNotNull(topology.portLinks.get(srcNpt));
207 assertTrue(topology.portLinks.get(srcNpt).contains(lt));
208 assertNotNull(topology.portLinks.get(dstNpt));
209 assertTrue(topology.portLinks.get(dstNpt).contains(lt));
210 assertTrue(topology.links.containsKey(lt));
211 }
212
213 @Test
214 public void testDeleteLinkToSelf() throws Exception {
215 LinkDiscoveryManager topology = getTopology();
216
217 Link lt = new Link(1L, 2, 1L, 3);
218 NodePortTuple srcNpt = new NodePortTuple(1L, 2);
219 NodePortTuple dstNpt = new NodePortTuple(2L, 3);
220
221 LinkInfo info = new LinkInfo(System.currentTimeMillis(),
Jonathan Hartba354e02014-06-30 19:18:16 -0700222 System.currentTimeMillis(), 0, 0);
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800223 topology.addOrUpdateLink(lt, info);
224 topology.deleteLinks(Collections.singletonList(lt), "Test to self");
225
226 // check invariants hold
227 assertNull(topology.switchLinks.get(lt.getSrc()));
228 assertNull(topology.switchLinks.get(lt.getDst()));
229 assertNull(topology.portLinks.get(srcNpt));
230 assertNull(topology.portLinks.get(dstNpt));
231 assertTrue(topology.links.isEmpty());
232 }
233
234 @Test
235 public void testRemovedSwitch() {
236 LinkDiscoveryManager topology = getTopology();
237
238 Link lt = new Link(1L, 2, 2L, 1);
239 NodePortTuple srcNpt = new NodePortTuple(1L, 2);
240 NodePortTuple dstNpt = new NodePortTuple(2L, 1);
241 LinkInfo info = new LinkInfo(System.currentTimeMillis(),
Jonathan Hartba354e02014-06-30 19:18:16 -0700242 System.currentTimeMillis(), 0, 0);
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800243 topology.addOrUpdateLink(lt, info);
244
245 IOFSwitch sw1 = getMockFloodlightProvider().getSwitches().get(1L);
246 IOFSwitch sw2 = getMockFloodlightProvider().getSwitches().get(2L);
247 // Mock up our expected behavior
248 topology.removedSwitch(sw1);
249 verify(sw1, sw2);
250
251 // check invariants hold
252 assertNull(topology.switchLinks.get(lt.getSrc()));
253 assertNull(topology.switchLinks.get(lt.getDst()));
254 assertNull(topology.portLinks.get(srcNpt));
255 assertNull(topology.portLinks.get(dstNpt));
256 assertTrue(topology.links.isEmpty());
257 }
258
259 @Test
260 public void testRemovedSwitchSelf() {
261 LinkDiscoveryManager topology = getTopology();
262 IOFSwitch sw1 = createMockSwitch(1L);
263 replay(sw1);
264 Link lt = new Link(1L, 2, 1L, 3);
265 LinkInfo info = new LinkInfo(System.currentTimeMillis(),
Jonathan Hartba354e02014-06-30 19:18:16 -0700266 System.currentTimeMillis(), 0, 0);
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800267 topology.addOrUpdateLink(lt, info);
268
269 // Mock up our expected behavior
270 topology.removedSwitch(sw1);
271
272 verify(sw1);
273 // check invariants hold
274 assertNull(topology.switchLinks.get(lt.getSrc()));
275 assertNull(topology.portLinks.get(lt.getSrc()));
276 assertNull(topology.portLinks.get(lt.getDst()));
277 assertTrue(topology.links.isEmpty());
278 }
279
280 @Test
281 public void testAddUpdateLinks() throws Exception {
282 LinkDiscoveryManager topology = getTopology();
283
284 Link lt = new Link(1L, 1, 2L, 1);
285 NodePortTuple srcNpt = new NodePortTuple(1L, 1);
286 NodePortTuple dstNpt = new NodePortTuple(2L, 1);
Ray Milkey269ffb92014-04-03 14:43:30 -0700287
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800288 LinkInfo info;
289
290 info = new LinkInfo(System.currentTimeMillis() - 40000,
Jonathan Hartba354e02014-06-30 19:18:16 -0700291 System.currentTimeMillis() - 40000, 0, 0);
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800292 topology.addOrUpdateLink(lt, info);
293
294 // check invariants hold
295 assertNotNull(topology.switchLinks.get(lt.getSrc()));
296 assertTrue(topology.switchLinks.get(lt.getSrc()).contains(lt));
297 assertNotNull(topology.portLinks.get(srcNpt));
298 assertTrue(topology.portLinks.get(srcNpt).contains(lt));
299 assertNotNull(topology.portLinks.get(dstNpt));
300 assertTrue(topology.portLinks.get(dstNpt).contains(lt));
301 assertTrue(topology.links.containsKey(lt));
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800302
303 topology.timeoutLinks();
304
Jonathan Hartba354e02014-06-30 19:18:16 -0700305 // Add a link info based on info that would be obtained from unicast LLDP
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800306 // Setting the unicast LLDP reception time to be 40 seconds old, so we can use
Jonathan Hartcd1ab172014-07-03 14:59:48 -0700307 // this to test timeout after this test.
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800308 info = new LinkInfo(System.currentTimeMillis() - 40000,
Jonathan Hartba354e02014-06-30 19:18:16 -0700309 System.currentTimeMillis() - 40000, 0, 0);
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800310 topology.addOrUpdateLink(lt, info);
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800311
Jonathan Hartcd1ab172014-07-03 14:59:48 -0700312 // Expect to timeout the unicast Valid Time, so the link should disappear
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800313 topology.timeoutLinks();
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800314 assertTrue(topology.links.get(lt) == null);
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800315 }
srikanth9f383342014-06-12 11:49:00 -0700316
317 /**
318 * This test case verifies that LinkDiscoveryManager.sendDiscoveryMessage()
Yuta HIGUCHI91a8f502014-06-17 10:15:29 -0700319 * performs "write" operation on the specified IOFSwitch object
320 * with a LLDP packet.
321 *
srikanth9f383342014-06-12 11:49:00 -0700322 * @throws IOException
323 */
324 @Test
Yuta HIGUCHI91a8f502014-06-17 10:15:29 -0700325 public void testSendDiscoveryMessage() throws IOException {
Jonathan Hart299d1132014-06-27 09:25:28 -0700326 byte[] macAddress = new byte[] {0x0, 0x0, 0x0, 0x0, 0x0, 0x1};
327
srikanth9f383342014-06-12 11:49:00 -0700328 LinkDiscoveryManager topology = getTopology();
329
330 // Mock up our expected behavior
331 IOFSwitch swTest = createMockSwitch(3L);
332 getMockFloodlightProvider().getSwitches().put(3L, swTest);
Yuta HIGUCHI91a8f502014-06-17 10:15:29 -0700333
srikanth9f383342014-06-12 11:49:00 -0700334 short portNum = 1;
335 OFPhysicalPort ofpPort = new OFPhysicalPort();
336 ofpPort.setPortNumber(portNum);
Jonathan Hart299d1132014-06-27 09:25:28 -0700337 ofpPort.setHardwareAddress(macAddress);
Yuta HIGUCHI91a8f502014-06-17 10:15:29 -0700338
339 /* sendDiscoverMessage() should perform the following actions on
srikanth9f383342014-06-12 11:49:00 -0700340 * IOFSwitch object
Yuta HIGUCHI91a8f502014-06-17 10:15:29 -0700341 * - getPort() with argument as "1"
342 * - write() with OFPacketOut
343 * - flush()
srikanth9f383342014-06-12 11:49:00 -0700344 */
345 expect(swTest.getPort(portNum)).andReturn(ofpPort).atLeastOnce();
346 swTest.write(EasyMock.anyObject(OFMessage.class), EasyMock.anyObject(FloodlightContext.class));
347 EasyMock.expectLastCall().times(1);
348 swTest.flush();
349 EasyMock.expectLastCall().once();
350 replay(swTest);
Yuta HIGUCHI91a8f502014-06-17 10:15:29 -0700351
Jonathan Hartba354e02014-06-30 19:18:16 -0700352 topology.sendDiscoveryMessage(3L, portNum, false);
Yuta HIGUCHI91a8f502014-06-17 10:15:29 -0700353
srikanth9f383342014-06-12 11:49:00 -0700354 verify(swTest);
355 }
Jonathan Hartcd1ab172014-07-03 14:59:48 -0700356
357 @Test
358 public void testHandlePortStatusForNewPort() throws IOException {
359 byte[] macAddress = new byte[] {0x0, 0x0, 0x0, 0x0, 0x0, 0x1};
360
361 LinkDiscoveryManager linkDiscovery = getTopology();
362
363 long dpid = 3L;
364 IOFSwitch sw = createMockSwitch(dpid);
365 getMockFloodlightProvider().getSwitches().put(dpid, sw);
366
367 short portNum = 1;
368 OFPhysicalPort ofpPort = new OFPhysicalPort();
369 ofpPort.setPortNumber(portNum);
370 ofpPort.setHardwareAddress(macAddress);
371
372 OFPortStatus portStatus = new OFPortStatus();
373 portStatus.setDesc(ofpPort);
374 portStatus.setReason((byte) OFPortReason.OFPPR_ADD.ordinal());
375
376 expect(sw.getPort(portNum)).andReturn(ofpPort).anyTimes();
377 sw.write(EasyMock.anyObject(OFMessage.class),
378 EasyMock.anyObject(FloodlightContext.class));
379 sw.flush();
380
381 replay(sw);
382
383 linkDiscovery.handlePortStatus(sw, portStatus);
384
385 verify(sw);
386 }
387
388 @Test
389 public void testHandlePortStatusForExistingPort() {
390 byte[] macAddress = new byte[] {0x0, 0x0, 0x0, 0x0, 0x0, 0x1};
391
392 LinkDiscoveryManager linkDiscovery = getTopology();
393
394 // Add a link that we can update later during the test
395 Link lt = new Link(1L, 1, 2L, 1);
396 LinkInfo info = new LinkInfo(System.currentTimeMillis(),
397 System.currentTimeMillis(), 0, 0);
398 linkDiscovery.addOrUpdateLink(lt, info);
399
400 short portNum = 1;
401 // src port
402 int srcPortState = 2;
403 OFPhysicalPort srcPort = new OFPhysicalPort();
404 srcPort.setPortNumber(portNum);
405 srcPort.setHardwareAddress(macAddress);
406 srcPort.setState(srcPortState);
407
408 // dst port
409 int dstPortState = 4;
410 OFPhysicalPort dstPort = new OFPhysicalPort();
411 dstPort.setPortNumber(portNum);
412 dstPort.setHardwareAddress(macAddress);
413 dstPort.setState(dstPortState);
414
415 OFPortStatus srcPortStatus = new OFPortStatus();
416 srcPortStatus.setDesc(srcPort);
417 srcPortStatus.setReason((byte) OFPortReason.OFPPR_MODIFY.ordinal());
418
419 OFPortStatus dstPortStatus = new OFPortStatus();
420 dstPortStatus.setDesc(dstPort);
421 dstPortStatus.setReason((byte) OFPortReason.OFPPR_MODIFY.ordinal());
422
423 linkDiscovery.handlePortStatus(
424 getMockFloodlightProvider().getSwitches().get(1L), srcPortStatus);
425
426
427 LinkInfo newInfo = linkDiscovery.links.get(lt);
428 assertEquals(srcPortState, newInfo.getSrcPortState());
429 assertEquals(0, newInfo.getDstPortState());
430
431
432 linkDiscovery.handlePortStatus(
433 getMockFloodlightProvider().getSwitches().get(2L), dstPortStatus);
434
435 newInfo = linkDiscovery.links.get(lt);
436 assertEquals(srcPortState, newInfo.getSrcPortState());
437 assertEquals(dstPortState, newInfo.getDstPortState());
438 }
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800439}