Added an explicit failure mode to cfgdef tool if it cannot elaborate a constant.

Change-Id: I0aa091858f35ed6bf2127830eac5485a8f28fbb7
diff --git a/tools/build/cfgdef/src/main/java/org/onosproject/cfgdef/CfgDefGenerator.java b/tools/build/cfgdef/src/main/java/org/onosproject/cfgdef/CfgDefGenerator.java
index 89954f2..9488261 100644
--- a/tools/build/cfgdef/src/main/java/org/onosproject/cfgdef/CfgDefGenerator.java
+++ b/tools/build/cfgdef/src/main/java/org/onosproject/cfgdef/CfgDefGenerator.java
@@ -152,7 +152,7 @@
         if (value instanceof Add) {
             return elaborate(((Add) value).getLeft()) + elaborate(((Add) value).getRight());
         } else if (value instanceof FieldRef) {
-            return stripped(constants.get(((FieldRef) value).getName()));
+            return elaborate((FieldRef) value);
         } else if (value != null) {
             return stripped(value.toString());
         } else {
@@ -160,6 +160,16 @@
         }
     }
 
+    private String elaborate(FieldRef field) {
+        String name = field.getName();
+        String value = constants.get(name);
+        if (value != null) {
+            return stripped(value);
+        }
+        throw new IllegalStateException("Constant " + name + " cannot be elaborated;" +
+                                                " value not in the same compilation context");
+    }
+
     private String stripped(String s) {
         return s.trim().replaceFirst("^[^\"]*\"", "").replaceFirst("\"$", "");
     }