Initial implementation of CORRUPT state (ONOS-1060)

- Added CORRUPT state to state machine and event type
- Simplified phases using new request field
- Improved null-safety by using Optionals

Change-Id: I1d576b719765b5664aef73477ee04593e8acc4fd
diff --git a/core/api/src/main/java/org/onosproject/net/intent/IntentEvent.java b/core/api/src/main/java/org/onosproject/net/intent/IntentEvent.java
index f73cee5..369636a 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/IntentEvent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/IntentEvent.java
@@ -34,7 +34,8 @@
         INSTALLED,
 
         /**
-         * Signifies that an intent has failed compilation or installation.
+         * Signifies that an intent has failed compilation and that it cannot
+         * be satisfied by the network at this time.
          */
         FAILED,
 
@@ -49,6 +50,13 @@
         WITHDRAWN,
 
         /**
+         * Signifies that an intent has failed installation or withdrawal, but
+         * still hold some or all of its resources.
+         * (e.g. link reservations, flow rules on the data plane, etc.)
+         */
+        CORRUPT,
+
+        /**
          * Signifies that an intent has been purged from the system.
          */
         PURGED
@@ -115,6 +123,9 @@
             case FAILED:
                 type = Type.FAILED;
                 break;
+            case CORRUPT:
+                type = Type.CORRUPT;
+                break;
             case PURGE_REQ:
                 type = Type.PURGED;
                 break;