Updating Intent Manager to deal with failures.

Added ids to Flow batch futures.
Adding some basic unit tests for IntentManger
Adding failedIds to the completedOperation in FlowRuleManager

Change-Id: I7645cead193299f70d319d254cd1e82d96909e7b
diff --git a/core/api/src/main/java/org/onlab/onos/net/flow/CompletedBatchOperation.java b/core/api/src/main/java/org/onlab/onos/net/flow/CompletedBatchOperation.java
index b988744..a7bffe7 100644
--- a/core/api/src/main/java/org/onlab/onos/net/flow/CompletedBatchOperation.java
+++ b/core/api/src/main/java/org/onlab/onos/net/flow/CompletedBatchOperation.java
@@ -15,6 +15,9 @@
  */
 package org.onlab.onos.net.flow;
 
+
+import java.util.Collections;
+
 import java.util.Set;
 
 import com.google.common.collect.ImmutableSet;
@@ -26,6 +29,21 @@
 
     private final boolean success;
     private final Set<FlowRule> failures;
+    private final Set<Long> failedIds;
+
+    /**
+     * Creates a new batch completion result.
+     *
+     * @param success  indicates whether the completion is successful.
+     * @param failures set of any failures encountered
+     * @param failedIds (optional) set of failed operation ids
+     */
+    public CompletedBatchOperation(boolean success, Set<? extends FlowRule> failures,
+                                   Set<Long> failedIds) {
+        this.success = success;
+        this.failures = ImmutableSet.copyOf(failures);
+        this.failedIds = ImmutableSet.copyOf(failedIds);
+    }
 
     /**
      * Creates a new batch completion result.
@@ -36,8 +54,11 @@
     public CompletedBatchOperation(boolean success, Set<? extends FlowRule> failures) {
         this.success = success;
         this.failures = ImmutableSet.copyOf(failures);
+        this.failedIds = Collections.emptySet();
     }
 
+
+
     @Override
     public boolean isSuccess() {
         return success;
@@ -48,4 +69,8 @@
         return failures;
     }
 
+    public Set<Long> failedIds() {
+        return failedIds;
+    }
+
 }