Added error count for IntentData (ONOS-1060)

Change-Id: Ida6313603c15fb6c1c1793c298206587b370a13e
diff --git a/core/api/src/main/java/org/onosproject/net/intent/IntentData.java b/core/api/src/main/java/org/onosproject/net/intent/IntentData.java
index 6a9c9ae..c54c5bc 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/IntentData.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/IntentData.java
@@ -44,6 +44,7 @@
     private IntentState state;
     private Timestamp version;
     private NodeId origin;
+    private int errorCount;
 
     private List<Intent> installables;
 
@@ -75,6 +76,7 @@
         version = intentData.version;
         origin = intentData.origin;
         installables = intentData.installables;
+        errorCount = intentData.errorCount;
     }
 
     // kryo constructor
@@ -165,6 +167,32 @@
     }
 
     /**
+     * Increments the error count for this intent.
+     */
+    public void incrementErrorCount() {
+        errorCount++;
+    }
+
+    /**
+     * Sets the error count for this intent.
+     *
+     * @param newCount new count
+     */
+    public void setErrorCount(int newCount) {
+        errorCount = newCount;
+    }
+
+    /**
+     * Returns the number of times that this intent has encountered an error
+     * during installation or withdrawal.
+     *
+     * @return error count
+     */
+    public int errorCount() {
+        return errorCount;
+    }
+
+    /**
      * Sets the intent installables to the given list of intents.
      *
      * @param installables list of installables for this intent