Committed by
Gerrit Code Review
ONOS-1791 : Populates MPLS rules also at edge routers
- Adds check for mastership when updating group description. Change-Id: I536bcec595b8727689de11eb41e4b2f86cabb936
Showing
2 changed files
with
16 additions
and
12 deletions
... | @@ -124,9 +124,12 @@ public class DefaultRoutingHandler { | ... | @@ -124,9 +124,12 @@ public class DefaultRoutingHandler { |
124 | synchronized (populationStatus) { | 124 | synchronized (populationStatus) { |
125 | 125 | ||
126 | if (populationStatus == Status.STARTED) { | 126 | if (populationStatus == Status.STARTED) { |
127 | + log.warn("Previous rule population is not finished."); | ||
127 | return true; | 128 | return true; |
128 | } | 129 | } |
129 | 130 | ||
131 | + log.info("Starts rule population from link change"); | ||
132 | + | ||
130 | Set<ArrayList<DeviceId>> routeChanges; | 133 | Set<ArrayList<DeviceId>> routeChanges; |
131 | populationStatus = Status.STARTED; | 134 | populationStatus = Status.STARTED; |
132 | if (linkFail == null) { | 135 | if (linkFail == null) { |
... | @@ -138,7 +141,7 @@ public class DefaultRoutingHandler { | ... | @@ -138,7 +141,7 @@ public class DefaultRoutingHandler { |
138 | } | 141 | } |
139 | 142 | ||
140 | if (routeChanges.isEmpty()) { | 143 | if (routeChanges.isEmpty()) { |
141 | - log.debug("No route changes for the link status change"); | 144 | + log.info("No route changes for the link status change"); |
142 | populationStatus = Status.SUCCEEDED; | 145 | populationStatus = Status.SUCCEEDED; |
143 | return true; | 146 | return true; |
144 | } | 147 | } |
... | @@ -164,6 +167,9 @@ public class DefaultRoutingHandler { | ... | @@ -164,6 +167,9 @@ public class DefaultRoutingHandler { |
164 | ECMPShortestPathGraph ecmpSpg = new ECMPShortestPathGraph(link.get(0), srManager); | 167 | ECMPShortestPathGraph ecmpSpg = new ECMPShortestPathGraph(link.get(0), srManager); |
165 | if (populateEcmpRoutingRules(link.get(0), ecmpSpg)) { | 168 | if (populateEcmpRoutingRules(link.get(0), ecmpSpg)) { |
166 | currentEcmpSpgMap.put(link.get(0), ecmpSpg); | 169 | currentEcmpSpgMap.put(link.get(0), ecmpSpg); |
170 | + } else { | ||
171 | + log.warn("Failed to populate the flow ruls from {} to all", link.get(0)); | ||
172 | + return false; | ||
167 | } | 173 | } |
168 | continue; | 174 | continue; |
169 | } | 175 | } |
... | @@ -358,8 +364,7 @@ public class DefaultRoutingHandler { | ... | @@ -358,8 +364,7 @@ public class DefaultRoutingHandler { |
358 | } | 364 | } |
359 | 365 | ||
360 | // If both target switch and dest switch are edge routers, then set IP | 366 | // If both target switch and dest switch are edge routers, then set IP |
361 | - // rule | 367 | + // rule for both subnet and router IP. |
362 | - // for both subnet and router IP. | ||
363 | if (config.isEdgeDevice(targetSw) && config.isEdgeDevice(destSw)) { | 368 | if (config.isEdgeDevice(targetSw) && config.isEdgeDevice(destSw)) { |
364 | List<Ip4Prefix> subnets = config.getSubnets(destSw); | 369 | List<Ip4Prefix> subnets = config.getSubnets(destSw); |
365 | result = rulePopulator.populateIpRuleForSubnet(targetSw, | 370 | result = rulePopulator.populateIpRuleForSubnet(targetSw, |
... | @@ -377,7 +382,7 @@ public class DefaultRoutingHandler { | ... | @@ -377,7 +382,7 @@ public class DefaultRoutingHandler { |
377 | return false; | 382 | return false; |
378 | } | 383 | } |
379 | 384 | ||
380 | - // TODO: If the target switch is an edge router, then set IP rules for the router IP. | 385 | + // If the target switch is an edge router, then set IP rules for the router IP. |
381 | } else if (config.isEdgeDevice(targetSw)) { | 386 | } else if (config.isEdgeDevice(targetSw)) { |
382 | Ip4Address routerIp = config.getRouterIp(destSw); | 387 | Ip4Address routerIp = config.getRouterIp(destSw); |
383 | IpPrefix routerIpPrefix = IpPrefix.valueOf(routerIp, IpPrefix.MAX_INET_MASK_LENGTH); | 388 | IpPrefix routerIpPrefix = IpPrefix.valueOf(routerIp, IpPrefix.MAX_INET_MASK_LENGTH); |
... | @@ -385,13 +390,12 @@ public class DefaultRoutingHandler { | ... | @@ -385,13 +390,12 @@ public class DefaultRoutingHandler { |
385 | if (!result) { | 390 | if (!result) { |
386 | return false; | 391 | return false; |
387 | } | 392 | } |
393 | + } | ||
388 | 394 | ||
389 | - // TODO: If the target switch is an transit router, then set MPLS rules only. | 395 | + // Populates MPLS rules to all routers |
390 | - } else if (!config.isEdgeDevice(targetSw)) { | 396 | + result = rulePopulator.populateMplsRule(targetSw, destSw, nextHops); |
391 | - result = rulePopulator.populateMplsRule(targetSw, destSw, nextHops); | 397 | + if (!result) { |
392 | - if (!result) { | 398 | + return false; |
393 | - return false; | ||
394 | - } | ||
395 | } | 399 | } |
396 | 400 | ||
397 | return true; | 401 | return true; | ... | ... |
... | @@ -463,8 +463,8 @@ public class DistributedGroupStore | ... | @@ -463,8 +463,8 @@ public class DistributedGroupStore |
463 | GroupBuckets newBuckets, | 463 | GroupBuckets newBuckets, |
464 | GroupKey newAppCookie) { | 464 | GroupKey newAppCookie) { |
465 | // Check if group update to be done by a remote instance | 465 | // Check if group update to be done by a remote instance |
466 | - if (mastershipService. | 466 | + if (mastershipService.getMasterFor(deviceId) != null && |
467 | - getLocalRole(deviceId) != MastershipRole.MASTER) { | 467 | + mastershipService.getLocalRole(deviceId) != MastershipRole.MASTER) { |
468 | GroupStoreMessage groupOp = GroupStoreMessage. | 468 | GroupStoreMessage groupOp = GroupStoreMessage. |
469 | createGroupUpdateRequestMsg(deviceId, | 469 | createGroupUpdateRequestMsg(deviceId, |
470 | oldAppCookie, | 470 | oldAppCookie, | ... | ... |
-
Please register or login to post a comment