Add intents removal feature
Change-Id: Ibb7512adc6c3bf29cfd9dba5dbc31690f94ee6ed
diff --git a/src/main/java/net/onrc/onos/intent/PathIntents.java b/src/main/java/net/onrc/onos/intent/PathIntents.java
index 1a8deab..9371fd5 100644
--- a/src/main/java/net/onrc/onos/intent/PathIntents.java
+++ b/src/main/java/net/onrc/onos/intent/PathIntents.java
@@ -26,6 +26,14 @@
value.add(intent);
}
}
+
+ public void removeIntent(PathIntent intent) {
+ intents.remove(intent);
+ for (Link link: intent.getPath()) {
+ HashSet<PathIntent> value = linkToIntents.get(link);
+ value.remove(intent);
+ }
+ }
public void addIntents(PathIntents intents) {
for(PathIntent intent: intents.getIntents()) {
@@ -33,6 +41,12 @@
}
}
+ public void removeIntents(PathIntents intents) {
+ for(PathIntent intent: intents.getIntents()) {
+ removeIntent(intent);
+ }
+ }
+
public Collection<PathIntent> getIntentByLink(Link link) {
return Collections.unmodifiableCollection(linkToIntents.get(link));
}