Adding pre-req for IPMI assertions

A pre-req condition can be added for a sensor value,
for example presence of a unit should be true for
functional to be true.

Change-Id: I7b87c7ffa29f06160164aba2b39c743f0f9c733f
Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
diff --git a/gen_ipmi_sensor.pl b/gen_ipmi_sensor.pl
index 053cf33..766bab1 100755
--- a/gen_ipmi_sensor.pl
+++ b/gen_ipmi_sensor.pl
@@ -138,10 +138,20 @@
                     #will write property named "Property" first then
                     #other properties.
             print $fh "      ".$dbusProperty.":\n";
-            while (my ( $offset,$values) = each %{$dbusPropertyValue}) {
-                print $fh "          $offset:\n";
-                while (my ( $key,$value) = each %{$values})  {
-                    print $fh "            $key: ". $value."\n";
+            while (my ($offset,$values) = each %{$dbusPropertyValue}) {
+                if ($offset eq "prereq") {
+                    print $fh "          $offset:\n";
+                    while (my ($preOffset,$preValues) = each %{$values}) {
+                        print $fh "            $preOffset:\n";
+                        while (my ($key,$value) = each %{$preValues})  {
+                            print $fh "              $key: ". $value."\n";
+                        }
+                    }
+                } else {
+                    print $fh "          $offset:\n";
+                    while (my ($key,$value) = each %{$values})  {
+                        print $fh "            $key: ". $value."\n";
+                    }
                 }
             }
         }