Fix HOST event handling in MulticastRouteManager
Change-Id: I721470bd1879c1dc252346a0f4f085ca80f54156
(cherry picked from commit beea3e38fac2f6d763c62bb28bd7256b95bebd9c)
diff --git a/apps/mcast/api/src/main/java/org/onosproject/mcast/api/McastRouteData.java b/apps/mcast/api/src/main/java/org/onosproject/mcast/api/McastRouteData.java
index 9965818..e95c417 100644
--- a/apps/mcast/api/src/main/java/org/onosproject/mcast/api/McastRouteData.java
+++ b/apps/mcast/api/src/main/java/org/onosproject/mcast/api/McastRouteData.java
@@ -97,9 +97,7 @@
*/
public void addSources(Set<ConnectPoint> sources) {
checkArgument(!sources.contains(null));
- sources.forEach(source -> {
- this.sources.put(source, true);
- });
+ sources.forEach(source -> this.sources.put(source, true));
}
/**
@@ -129,7 +127,12 @@
public void addSinks(HostId hostId, Set<ConnectPoint> sinks) {
checkNotNull(hostId);
checkArgument(!sinks.contains(null));
- this.sinks.put(hostId, sinks);
+ //if existing we add to current set, otherwise we put them all
+ if (this.sinks.containsKey(hostId)) {
+ this.sinks.get(hostId).addAll(sinks);
+ } else {
+ this.sinks.put(hostId, sinks);
+ }
}
/**
@@ -168,7 +171,10 @@
public void removeSinks(HostId hostId, Set<ConnectPoint> sinks) {
checkNotNull(hostId);
checkArgument(!sinks.contains(null));
- this.sinks.get(hostId).removeAll(sinks);
+ //if existing we remove from current set, otherwise just skip them
+ if (this.sinks.containsKey(hostId)) {
+ this.sinks.get(hostId).removeAll(sinks);
+ }
}
/**