Committed by
Brian O'Connor
ONOS-4107: ISIS Provider - Bug Fixes
Change-Id: I1945f614c02a39326d22e268fbb015e50d075368
Showing
6 changed files
with
75 additions
and
8 deletions
... | @@ -122,4 +122,11 @@ public interface IsisLsdb { | ... | @@ -122,4 +122,11 @@ public interface IsisLsdb { |
122 | * @param l2LspSeqNo link state sequence number | 122 | * @param l2LspSeqNo link state sequence number |
123 | */ | 123 | */ |
124 | void setL2LspSeqNo(int l2LspSeqNo); | 124 | void setL2LspSeqNo(int l2LspSeqNo); |
125 | + /** | ||
126 | + * Removes topology information when neighbor down. | ||
127 | + * | ||
128 | + * @param neighbor ISIS neighbor instance | ||
129 | + * @param isisInterface ISIS interface instance | ||
130 | + */ | ||
131 | + void removeTopology(IsisNeighbor neighbor, IsisInterface isisInterface); | ||
125 | } | 132 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
protocols/isis/ctl/src/main/java/org/onosproject/isis/controller/impl/DefaultIsisNeighbor.java
100644 → 100755
... | @@ -356,6 +356,8 @@ public class DefaultIsisNeighbor implements IsisNeighbor { | ... | @@ -356,6 +356,8 @@ public class DefaultIsisNeighbor implements IsisNeighbor { |
356 | stopInactivityTimeCheck(); | 356 | stopInactivityTimeCheck(); |
357 | stopHoldingTimeCheck(); | 357 | stopHoldingTimeCheck(); |
358 | isisInterface.removeNeighbor(this); | 358 | isisInterface.removeNeighbor(this); |
359 | + | ||
360 | + isisInterface.isisLsdb().removeTopology(this, isisInterface); | ||
359 | } | 361 | } |
360 | 362 | ||
361 | /** | 363 | /** | ... | ... |
protocols/isis/ctl/src/main/java/org/onosproject/isis/controller/impl/LspEventConsumer.java
100644 → 100755
This diff is collapsed. Click to expand it.
protocols/isis/ctl/src/main/java/org/onosproject/isis/controller/impl/lsdb/DefaultIsisLsdb.java
100644 → 100755
... | @@ -21,7 +21,9 @@ import org.onosproject.isis.controller.IsisLsdb; | ... | @@ -21,7 +21,9 @@ import org.onosproject.isis.controller.IsisLsdb; |
21 | import org.onosproject.isis.controller.IsisLsdbAge; | 21 | import org.onosproject.isis.controller.IsisLsdbAge; |
22 | import org.onosproject.isis.controller.IsisLspBin; | 22 | import org.onosproject.isis.controller.IsisLspBin; |
23 | import org.onosproject.isis.controller.IsisMessage; | 23 | import org.onosproject.isis.controller.IsisMessage; |
24 | +import org.onosproject.isis.controller.IsisNeighbor; | ||
24 | import org.onosproject.isis.controller.IsisPduType; | 25 | import org.onosproject.isis.controller.IsisPduType; |
26 | +import org.onosproject.isis.controller.IsisRouterType; | ||
25 | import org.onosproject.isis.controller.LspWrapper; | 27 | import org.onosproject.isis.controller.LspWrapper; |
26 | import org.onosproject.isis.controller.impl.Controller; | 28 | import org.onosproject.isis.controller.impl.Controller; |
27 | import org.onosproject.isis.controller.impl.LspEventConsumer; | 29 | import org.onosproject.isis.controller.impl.LspEventConsumer; |
... | @@ -394,4 +396,39 @@ public class DefaultIsisLsdb implements IsisLsdb { | ... | @@ -394,4 +396,39 @@ public class DefaultIsisLsdb implements IsisLsdb { |
394 | log.debug("Added LSp In Blocking queue: {}", lspWrapper); | 396 | log.debug("Added LSp In Blocking queue: {}", lspWrapper); |
395 | } | 397 | } |
396 | } | 398 | } |
399 | + | ||
400 | + /** | ||
401 | + * Removes topology information when neighbor down. | ||
402 | + * | ||
403 | + * @param neighbor ISIS neighbor instance | ||
404 | + * @param isisInterface ISIS interface instance | ||
405 | + */ | ||
406 | + public void removeTopology(IsisNeighbor neighbor, IsisInterface isisInterface) { | ||
407 | + String lspKey = neighbor.neighborSystemId() + ".00-00"; | ||
408 | + LspWrapper lspWrapper = null; | ||
409 | + switch (IsisRouterType.get(isisInterface.reservedPacketCircuitType())) { | ||
410 | + case L1: | ||
411 | + lspWrapper = findLsp(IsisPduType.L1LSPDU, lspKey); | ||
412 | + break; | ||
413 | + case L2: | ||
414 | + lspWrapper = findLsp(IsisPduType.L2LSPDU, lspKey); | ||
415 | + break; | ||
416 | + case L1L2: | ||
417 | + lspWrapper = findLsp(IsisPduType.L1LSPDU, lspKey); | ||
418 | + if (lspWrapper == null) { | ||
419 | + lspWrapper = findLsp(IsisPduType.L2LSPDU, lspKey); | ||
420 | + } | ||
421 | + break; | ||
422 | + default: | ||
423 | + log.debug("Unknown type"); | ||
424 | + } | ||
425 | + try { | ||
426 | + if (lspWrapper != null) { | ||
427 | + lspWrapper.setLspProcessing(IsisConstants.LSPREMOVED); | ||
428 | + lspForProviderQueue.put(lspWrapper); | ||
429 | + } | ||
430 | + } catch (Exception e) { | ||
431 | + log.debug("Added LSp In Blocking queue: {}", lspWrapper); | ||
432 | + } | ||
433 | + } | ||
397 | } | 434 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
providers/isis/topology/src/main/java/org/onosproject/provider/isis/topology/impl/IsisTopologyProvider.java
100644 → 100755
... | @@ -52,6 +52,7 @@ import org.onosproject.net.link.LinkDescription; | ... | @@ -52,6 +52,7 @@ import org.onosproject.net.link.LinkDescription; |
52 | import org.onosproject.net.link.LinkProvider; | 52 | import org.onosproject.net.link.LinkProvider; |
53 | import org.onosproject.net.link.LinkProviderRegistry; | 53 | import org.onosproject.net.link.LinkProviderRegistry; |
54 | import org.onosproject.net.link.LinkProviderService; | 54 | import org.onosproject.net.link.LinkProviderService; |
55 | +import org.onosproject.net.link.LinkService; | ||
55 | import org.onosproject.net.provider.AbstractProvider; | 56 | import org.onosproject.net.provider.AbstractProvider; |
56 | import org.onosproject.net.provider.ProviderId; | 57 | import org.onosproject.net.provider.ProviderId; |
57 | import org.slf4j.Logger; | 58 | import org.slf4j.Logger; |
... | @@ -86,6 +87,8 @@ public class IsisTopologyProvider extends AbstractProvider implements DeviceProv | ... | @@ -86,6 +87,8 @@ public class IsisTopologyProvider extends AbstractProvider implements DeviceProv |
86 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 87 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
87 | protected NetworkConfigService networkConfigService; | 88 | protected NetworkConfigService networkConfigService; |
88 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 89 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
90 | + protected LinkService linkService; | ||
91 | + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
89 | protected IsisController controller; | 92 | protected IsisController controller; |
90 | //This Interface that defines how this provider can interact with the core. | 93 | //This Interface that defines how this provider can interact with the core. |
91 | private LinkProviderService linkProviderService; | 94 | private LinkProviderService linkProviderService; |
... | @@ -155,8 +158,14 @@ public class IsisTopologyProvider extends AbstractProvider implements DeviceProv | ... | @@ -155,8 +158,14 @@ public class IsisTopologyProvider extends AbstractProvider implements DeviceProv |
155 | String localSystemId = isisLink.localSystemId(); | 158 | String localSystemId = isisLink.localSystemId(); |
156 | String remoteSystemId = isisLink.remoteSystemId(); | 159 | String remoteSystemId = isisLink.remoteSystemId(); |
157 | //Changing of port numbers | 160 | //Changing of port numbers |
158 | - srcAddress = isisLink.interfaceIp().toInt(); | 161 | + if (isisLink.interfaceIp() != null) { |
159 | - dstAddress = isisLink.neighborIp().toInt(); | 162 | + //srcAddress = isisLink.interfaceIp().toInt(); |
163 | + srcAddress = (long) Long.parseUnsignedLong(Integer.toBinaryString(isisLink.interfaceIp().toInt()), 2); | ||
164 | + } | ||
165 | + if (isisLink.neighborIp() != null) { | ||
166 | + //dstAddress = isisLink.neighborIp().toInt(); | ||
167 | + dstAddress = (long) Long.parseUnsignedLong(Integer.toBinaryString(isisLink.neighborIp().toInt()), 2); | ||
168 | + } | ||
160 | DeviceId srcId = DeviceId.deviceId(IsisRouterId.uri(localSystemId)); | 169 | DeviceId srcId = DeviceId.deviceId(IsisRouterId.uri(localSystemId)); |
161 | DeviceId dstId = DeviceId.deviceId(IsisRouterId.uri(remoteSystemId)); | 170 | DeviceId dstId = DeviceId.deviceId(IsisRouterId.uri(remoteSystemId)); |
162 | if (checkIsDis(isisLink.localSystemId())) { | 171 | if (checkIsDis(isisLink.localSystemId())) { |
... | @@ -285,6 +294,7 @@ public class IsisTopologyProvider extends AbstractProvider implements DeviceProv | ... | @@ -285,6 +294,7 @@ public class IsisTopologyProvider extends AbstractProvider implements DeviceProv |
285 | new DefaultDeviceDescription(IsisRouterId.uri(systemId), deviceType, UNKNOWN, UNKNOWN, UNKNOWN, | 294 | new DefaultDeviceDescription(IsisRouterId.uri(systemId), deviceType, UNKNOWN, UNKNOWN, UNKNOWN, |
286 | UNKNOWN, cId, newBuilder.build()); | 295 | UNKNOWN, cId, newBuilder.build()); |
287 | deviceProviderService.deviceConnected(deviceId, description); | 296 | deviceProviderService.deviceConnected(deviceId, description); |
297 | + System.out.println("Device added: " + systemId); | ||
288 | } | 298 | } |
289 | 299 | ||
290 | @Override | 300 | @Override |
... | @@ -302,17 +312,26 @@ public class IsisTopologyProvider extends AbstractProvider implements DeviceProv | ... | @@ -302,17 +312,26 @@ public class IsisTopologyProvider extends AbstractProvider implements DeviceProv |
302 | @Override | 312 | @Override |
303 | public void addLink(IsisLink isisLink) { | 313 | public void addLink(IsisLink isisLink) { |
304 | log.debug("Addlink {}", isisLink.localSystemId()); | 314 | log.debug("Addlink {}", isisLink.localSystemId()); |
305 | - if (linkProviderService == null) { | 315 | + |
306 | - return; | ||
307 | - } | ||
308 | LinkDescription linkDes = buildLinkDes(isisLink); | 316 | LinkDescription linkDes = buildLinkDes(isisLink); |
309 | //Updating ports of the link | 317 | //Updating ports of the link |
310 | - deviceProviderService.updatePorts(linkDes.src().deviceId(), buildPortDescriptions(linkDes.src().deviceId(), | 318 | + //If already link exists, return |
319 | + if (linkService.getLink(linkDes.src(), linkDes.dst()) != null || linkProviderService == null) { | ||
320 | + return; | ||
321 | + } | ||
322 | + ConnectPoint destconnectPoint = linkDes.dst(); | ||
323 | + PortNumber destport = destconnectPoint.port(); | ||
324 | + if (destport.toLong() != 0) { | ||
325 | + deviceProviderService.updatePorts(linkDes.src().deviceId(), | ||
326 | + buildPortDescriptions(linkDes.src().deviceId(), | ||
311 | linkDes.src().port())); | 327 | linkDes.src().port())); |
312 | - deviceProviderService.updatePorts(linkDes.dst().deviceId(), buildPortDescriptions(linkDes.dst().deviceId(), | 328 | + deviceProviderService.updatePorts(linkDes.dst().deviceId(), |
329 | + buildPortDescriptions(linkDes.dst().deviceId(), | ||
313 | linkDes.dst().port())); | 330 | linkDes.dst().port())); |
314 | registerBandwidth(linkDes, isisLink); | 331 | registerBandwidth(linkDes, isisLink); |
315 | linkProviderService.linkDetected(linkDes); | 332 | linkProviderService.linkDetected(linkDes); |
333 | + System.out.println("link desc " + linkDes.toString()); | ||
334 | + } | ||
316 | } | 335 | } |
317 | 336 | ||
318 | @Override | 337 | @Override | ... | ... |
... | @@ -81,6 +81,7 @@ public class IsisTopologyProviderTest { | ... | @@ -81,6 +81,7 @@ public class IsisTopologyProviderTest { |
81 | private final TestDeviceRegistry nodeRegistry = new TestDeviceRegistry(); | 81 | private final TestDeviceRegistry nodeRegistry = new TestDeviceRegistry(); |
82 | private final TestLinkRegistry linkRegistry = new TestLinkRegistry(); | 82 | private final TestLinkRegistry linkRegistry = new TestLinkRegistry(); |
83 | private final TestController controller = new TestController(); | 83 | private final TestController controller = new TestController(); |
84 | + private final TestLinkService linkService = new TestLinkService(); | ||
84 | private MockNetConfigRegistryAdapter networkConfigService = new MockNetConfigRegistryAdapter(); | 85 | private MockNetConfigRegistryAdapter networkConfigService = new MockNetConfigRegistryAdapter(); |
85 | 86 | ||
86 | @Before | 87 | @Before |
... | @@ -89,6 +90,7 @@ public class IsisTopologyProviderTest { | ... | @@ -89,6 +90,7 @@ public class IsisTopologyProviderTest { |
89 | provider.linkProviderRegistry = linkRegistry; | 90 | provider.linkProviderRegistry = linkRegistry; |
90 | provider.networkConfigService = networkConfigService; | 91 | provider.networkConfigService = networkConfigService; |
91 | provider.controller = controller; | 92 | provider.controller = controller; |
93 | + provider.linkService = linkService; | ||
92 | provider.activate(); | 94 | provider.activate(); |
93 | assertNotNull("provider should be registered", nodeRegistry.provider); | 95 | assertNotNull("provider should be registered", nodeRegistry.provider); |
94 | assertNotNull("listener should be registered", controller.nodeListener); | 96 | assertNotNull("listener should be registered", controller.nodeListener); |
... | @@ -289,9 +291,9 @@ public class IsisTopologyProviderTest { | ... | @@ -289,9 +291,9 @@ public class IsisTopologyProviderTest { |
289 | 291 | ||
290 | } | 292 | } |
291 | } | 293 | } |
294 | + } | ||
292 | 295 | ||
293 | 296 | ||
294 | - } | ||
295 | 297 | ||
296 | private class TestDeviceService extends DeviceServiceAdapter { | 298 | private class TestDeviceService extends DeviceServiceAdapter { |
297 | private DeviceListener listener; | 299 | private DeviceListener listener; | ... | ... |
-
Please register or login to post a comment