Committed by
Gerrit Code Review
It helps to get IGMP join and leaves the right way round
Change-Id: I7ada6835fa56aefaa421610ae8a303f2751be2b3
Showing
2 changed files
with
27 additions
and
10 deletions
... | @@ -214,6 +214,10 @@ public class CordMcast { | ... | @@ -214,6 +214,10 @@ public class CordMcast { |
214 | } | 214 | } |
215 | 215 | ||
216 | private void unprovisionGroup(McastRouteInfo info) { | 216 | private void unprovisionGroup(McastRouteInfo info) { |
217 | + if (info.sinks().isEmpty()) { | ||
218 | + removeSyncedRoute(info); | ||
219 | + } | ||
220 | + | ||
217 | if (!info.sink().isPresent()) { | 221 | if (!info.sink().isPresent()) { |
218 | log.warn("No sink given after sink removed event: {}", info); | 222 | log.warn("No sink given after sink removed event: {}", info); |
219 | return; | 223 | return; |
... | @@ -242,8 +246,6 @@ public class CordMcast { | ... | @@ -242,8 +246,6 @@ public class CordMcast { |
242 | }); | 246 | }); |
243 | 247 | ||
244 | flowObjectiveService.next(loc.deviceId(), next); | 248 | flowObjectiveService.next(loc.deviceId(), next); |
245 | - | ||
246 | - | ||
247 | } | 249 | } |
248 | 250 | ||
249 | private void provisionGroup(McastRouteInfo info) { | 251 | private void provisionGroup(McastRouteInfo info) { |
... | @@ -364,6 +366,21 @@ public class CordMcast { | ... | @@ -364,6 +366,21 @@ public class CordMcast { |
364 | builder.post(json.toString()); | 366 | builder.post(json.toString()); |
365 | } | 367 | } |
366 | 368 | ||
369 | + private void removeSyncedRoute(McastRouteInfo info) { | ||
370 | + if (syncHost == null) { | ||
371 | + log.warn("No host configured for synchronization; route will be dropped"); | ||
372 | + return; | ||
373 | + } | ||
374 | + | ||
375 | + log.debug("Removing route from other ONOS: {}", info.route()); | ||
376 | + | ||
377 | + WebResource.Builder builder = getClientBuilder(fabricOnosUrl); | ||
378 | + | ||
379 | + ObjectNode json = codecService.getCodec(McastRoute.class) | ||
380 | + .encode(info.route(), new AbstractWebResource()); | ||
381 | + builder.delete(json.toString()); | ||
382 | + } | ||
383 | + | ||
367 | private Integer allocateId() { | 384 | private Integer allocateId() { |
368 | return channels.getAndIncrement(); | 385 | return channels.getAndIncrement(); |
369 | } | 386 | } | ... | ... |
... | @@ -275,9 +275,10 @@ public class IgmpSnoop { | ... | @@ -275,9 +275,10 @@ public class IgmpSnoop { |
275 | IGMPMembership membership = (IGMPMembership) group; | 275 | IGMPMembership membership = (IGMPMembership) group; |
276 | 276 | ||
277 | // TODO allow pulling source from IGMP packet | 277 | // TODO allow pulling source from IGMP packet |
278 | - IpAddress source = IpAddress.valueOf("0.0.0.0"); | 278 | + IpAddress source = ssmTranslateTable.get(group.getGaddr()); |
279 | - if (ssmTranslateTable.containsKey(group.getGaddr())) { | 279 | + if (source == null) { |
280 | - source = ssmTranslateTable.get(group.getGaddr()); | 280 | + log.warn("No source found in SSM translate table for {}", group.getGaddr()); |
281 | + return; | ||
281 | } | 282 | } |
282 | 283 | ||
283 | McastRoute route = new McastRoute(source, | 284 | McastRoute route = new McastRoute(source, |
... | @@ -287,14 +288,13 @@ public class IgmpSnoop { | ... | @@ -287,14 +288,13 @@ public class IgmpSnoop { |
287 | if (membership.getRecordType() == IGMPMembership.MODE_IS_INCLUDE || | 288 | if (membership.getRecordType() == IGMPMembership.MODE_IS_INCLUDE || |
288 | membership.getRecordType() == IGMPMembership.CHANGE_TO_INCLUDE_MODE) { | 289 | membership.getRecordType() == IGMPMembership.CHANGE_TO_INCLUDE_MODE) { |
289 | 290 | ||
291 | + multicastService.removeSink(route, location); | ||
292 | + // TODO remove route if all sinks are gone | ||
293 | + } else if (membership.getRecordType() == IGMPMembership.MODE_IS_EXCLUDE || | ||
294 | + membership.getRecordType() == IGMPMembership.CHANGE_TO_EXCLUDE_MODE) { | ||
290 | 295 | ||
291 | multicastService.add(route); | 296 | multicastService.add(route); |
292 | multicastService.addSink(route, location); | 297 | multicastService.addSink(route, location); |
293 | - | ||
294 | - } else if (membership.getRecordType() == IGMPMembership.MODE_IS_EXCLUDE || | ||
295 | - membership.getRecordType() == IGMPMembership.CHANGE_TO_EXCLUDE_MODE) { | ||
296 | - multicastService.removeSink(route, location); | ||
297 | - // TODO remove route if all sinks are gone | ||
298 | } | 298 | } |
299 | 299 | ||
300 | }); | 300 | }); | ... | ... |
-
Please register or login to post a comment