Add intent error handling features.
- added ErrorIntent class to express intent processing errors
- added ERROR to IntentOperation.Operator enum
- made IntentMap to change intents' state automatically when it processes ErrorIntent instances
- made PathCalcRuntime to create ErrorIntent instance for failed intents
- made PathCalcRuntimeModule to process ErrorIntent and reflect them to high-level intents' states
Change-Id: Ib0cf9c284a37812695864d75d3cde2499a76e2a7
diff --git a/src/main/java/net/onrc/onos/intent/ErrorIntent.java b/src/main/java/net/onrc/onos/intent/ErrorIntent.java
new file mode 100644
index 0000000..3365350
--- /dev/null
+++ b/src/main/java/net/onrc/onos/intent/ErrorIntent.java
@@ -0,0 +1,30 @@
+package net.onrc.onos.intent;
+
+/**
+ * This class is instantiated by Run-times to express intent calculation error
+ * @author Toshio Koide (t-koide@onlab.us)
+ */
+public class ErrorIntent extends Intent {
+ public enum ErrorType {
+ UNSUPPORTED_INTENT,
+ SWITCH_NOT_FOUND,
+ PATH_NOT_FOUND,
+ }
+
+ public ErrorType errorType;
+ public String message;
+ public Intent parentIntent;
+
+ /**
+ * Default constructor for Kryo deserialization
+ */
+ protected ErrorIntent() {
+ }
+
+ public ErrorIntent(ErrorType errorType, String message, Intent parentIntent) {
+ this.id = parentIntent.getId();
+ this.errorType = errorType;
+ this.message = message;
+ this.parentIntent = parentIntent;
+ }
+}