It helps to get IGMP join and leaves the right way round
Change-Id: I7ada6835fa56aefaa421610ae8a303f2751be2b3
diff --git a/src/main/java/org/onosproject/cordmcast/CordMcast.java b/src/main/java/org/onosproject/cordmcast/CordMcast.java
index 2b140a8..86cd367 100644
--- a/src/main/java/org/onosproject/cordmcast/CordMcast.java
+++ b/src/main/java/org/onosproject/cordmcast/CordMcast.java
@@ -214,6 +214,10 @@
}
private void unprovisionGroup(McastRouteInfo info) {
+ if (info.sinks().isEmpty()) {
+ removeSyncedRoute(info);
+ }
+
if (!info.sink().isPresent()) {
log.warn("No sink given after sink removed event: {}", info);
return;
@@ -242,8 +246,6 @@
});
flowObjectiveService.next(loc.deviceId(), next);
-
-
}
private void provisionGroup(McastRouteInfo info) {
@@ -364,6 +366,21 @@
builder.post(json.toString());
}
+ private void removeSyncedRoute(McastRouteInfo info) {
+ if (syncHost == null) {
+ log.warn("No host configured for synchronization; route will be dropped");
+ return;
+ }
+
+ log.debug("Removing route from other ONOS: {}", info.route());
+
+ WebResource.Builder builder = getClientBuilder(fabricOnosUrl);
+
+ ObjectNode json = codecService.getCodec(McastRoute.class)
+ .encode(info.route(), new AbstractWebResource());
+ builder.delete(json.toString());
+ }
+
private Integer allocateId() {
return channels.getAndIncrement();
}