[ONOS-6493] Fix VPLS Intent failure handling problem

Any Intent failure of one VPLS might affect other VPLSs which are also
adding or updating.

Change-Id: I0f6f6129543965638fe51b9881bb66d0d1674a65
(cherry picked from commit 0ee6aa2d9275178391480a2d1beab56bc6a020e8)
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/VplsOperationManager.java b/apps/vpls/src/main/java/org/onosproject/vpls/VplsOperationManager.java
index 8d4d1db..c4cc39a 100644
--- a/apps/vpls/src/main/java/org/onosproject/vpls/VplsOperationManager.java
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/VplsOperationManager.java
@@ -570,7 +570,8 @@
              * @param pendingIntentKeys the Intent keys to wait
              * @param expectedEventType expect Intent event type
              */
-            public IntentCompleter(Set<Key> pendingIntentKeys, IntentEvent.Type expectedEventType) {
+            public IntentCompleter(Set<Key> pendingIntentKeys,
+                                   IntentEvent.Type expectedEventType) {
                 this.completableFuture = new CompletableFuture<>();
                 this.pendingIntentKeys = Sets.newConcurrentHashSet(pendingIntentKeys);
                 this.expectedEventType = expectedEventType;
@@ -579,6 +580,11 @@
             @Override
             public void event(IntentEvent event) {
                 Intent intent = event.subject();
+                Key key = intent.key();
+                if (!pendingIntentKeys.contains(key)) {
+                    // ignore Intent events from other VPLS
+                    return;
+                }
                 // Intent failed, throw an exception to completable future
                 if (event.type() == IntentEvent.Type.CORRUPT ||
                         event.type() == IntentEvent.Type.FAILED) {
@@ -587,7 +593,6 @@
                 }
                 // If event type matched to expected type, remove from pending
                 if (event.type() == expectedEventType) {
-                    Key key = intent.key();
                     pendingIntentKeys.remove(key);
                 }
                 if (pendingIntentKeys.isEmpty()) {