elog-gen.py : check error inheritance

Check if errors that are being inherited from have their interfaces
defined. Throw an error if not.

Change-Id: I13c6b844ef46eef7fead7a5f8ae1d8b56d914ecf
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
diff --git a/tools/elog-gen.py b/tools/elog-gen.py
index 88e46c8..d1acb79 100755
--- a/tools/elog-gen.py
+++ b/tools/elog-gen.py
@@ -18,6 +18,14 @@
 import os
 
 
+def check_error_inheritance(i_errors, i_parents):
+    for parent in i_parents:
+        if(parent and (parent not in i_errors)):
+            print parent + " inhertied from, but not defined"
+            return False
+    return True
+
+
 def get_error_yaml_files(i_yaml_dir):
     yaml_files = filter(
         lambda file: file.endswith('.errors.yaml'),
@@ -99,6 +107,10 @@
                        meta_data,
                        parents))
 
+    if(not check_error_inheritance(errors, parents)):
+        print "Error - failed to validate error inheritance"
+        exit(1)
+
     # Load the mako template and call it with the required data
     yaml_dir = i_yaml_dir.strip("./")
     yaml_dir = yaml_dir.strip("../")