Index: plugins/ilo2_ribcl/ilo2_ribcl_xml.c
===================================================================
--- plugins/ilo2_ribcl/ilo2_ribcl_xml.c	(revision 7263)
+++ plugins/ilo2_ribcl/ilo2_ribcl_xml.c	(working copy)
@@ -60,7 +60,9 @@
 static int ir_xml_scan_fans( ilo2_ribcl_handler_t *, xmlNodePtr);
 static int ir_xml_record_fandata( ilo2_ribcl_handler_t *, char *, char *,
 		char *, char *, char *);
-static void ir_xml_scan_temperature( ilo2_ribcl_handler_t *, xmlNodePtr);
+static int ir_xml_scan_temperature( ilo2_ribcl_handler_t *, xmlNodePtr);
+static int ir_xml_record_temperaturedata( ilo2_ribcl_handler_t *, char *, 
+		char *, char *, char *, char *);
 static void ir_xml_scan_firmware_revision(ilo2_ribcl_handler_t *, xmlNodePtr);
 static int ir_xml_scan_vrm( ilo2_ribcl_handler_t *, xmlNodePtr);
 static int ir_xml_record_vrmdata( ilo2_ribcl_handler_t *, char *, char *);
@@ -214,7 +216,10 @@
 	}
 
 	/* Extract data for temp sensors */
-	ir_xml_scan_temperature( ir_handler, eh_data_node);
+        if(ir_xml_scan_temperature( ir_handler, eh_data_node) != RIBCL_SUCCESS){
+                xmlFreeDoc( doc);
+                return( -1);
+       }
 
 
 	xmlFreeDoc( doc);
@@ -366,8 +371,12 @@
 	}
 
 	/* Extract data for temp sensors */
-	ir_xml_scan_temperature( ir_handler, h_node);
+	if(ir_xml_scan_temperature( ir_handler, h_node) != RIBCL_SUCCESS){
+                xmlFreeDoc( doc);
+                return( -1);
+        }
 
+
 	/* Extract firmware revision information */
 	/* Now we parse the output from the GET_FW_VERSION RIBCL command */
 
@@ -1384,7 +1393,7 @@
  *
  * Return value: None
  **/
-static void ir_xml_scan_temperature( ilo2_ribcl_handler_t *ir_handler,
+static int ir_xml_scan_temperature( ilo2_ribcl_handler_t *ir_handler,
 			      xmlNodePtr eh_data_node)
 {
 	xmlNodePtr t_node;
@@ -1394,6 +1403,7 @@
 	xmlChar *stat = NULL;
 	xmlChar *cur_reading = NULL;
 	xmlChar *unit = NULL;
+	int ret;
 
 	t_node = ir_xml_find_node( eh_data_node, "TEMPERATURE");
 
@@ -1426,6 +1436,9 @@
 
 			/* Call to process temperature data goes here, when
 			 * we add support to this plugin for sensors. */
+			ret = ir_xml_record_temperaturedata( ir_handler, 
+				(char *)lbl, (char *)loc, (char *)stat, (char *)cur_reading,
+                                (char *)unit);
 
 			if( lbl){
 				xmlFree( lbl);
@@ -1448,10 +1461,101 @@
 		t_node = t_node->next;
 
 	} /* end while t_node != NULL */
+	return( RIBCL_SUCCESS);
 
 } /* end  ir_xml_scan_temperature() */
 
 /**
+ * ir_xml_record_temperaturedata
+ * @ir_handler: ptr to the ilo2_ribcl plugin private handler.
+ * @temperaturelabel:   string label for the temperature sensor from iLO2.
+ * @temperaturelocation:        string location location for the temperature
+ *  sensor from iLO2.
+ * @temperaturestat:    string status for the temperature sensor from iLO2.
+ * @temperaturereading: string reading for the temperature sensor from iLO2.
+ * @temperatureunits:   string units for the temperature.
+ *
+ * This routine records the data for a temperature sensor reported by 
+ * iLO2 into the DiscoveryData structure within the plugin's private handler.
+ *
+ * Detailed description:
+ *
+ *      - Extract an index for this temperature sensor from the temperature 
+ *	  sensor label provided by iLO2.
+ *      - Use this index to access the DiscoveryData.tsdata[] array.
+ *      - Set the IR_DISCOVERED bit in tsflags.
+ *      - Store updated values for the temperature sensor reading, label,
+ *	   location, status, and
+ *        temperatureunit for this temperature sensor.
+ *
+ * Return value: RIBCL_SUCCESS if success, -1 if failure.
+ **/
+static int ir_xml_record_temperaturedata( ilo2_ribcl_handler_t *ir_handler,
+                        char *temperaturelabel, char *temperaturelocation, 
+			char *temperaturestat, char *temperaturereading, 
+			char *temperatureunits)
+{
+
+        int temperatureindex = 0;
+        int cur_readingval;
+        I2R_SensorDataT *sensordat;
+
+        /* Find the index of this temperature sensor. The parameter 
+	 * 'temperaturelabel' should be of the form 'Temp N', where N ranges 
+	 * from 1 to ILO2_RIBCL_DISCOVER_TS_MAX.
+         */
+
+        temperatureindex = 
+		ir_xml_extract_index("Temp", (char *)temperaturelabel, 1);
+        if( temperatureindex == IR_NO_PREFIX){
+                /* We didn't parse the temperaturelabel string prefix 
+		 * correctly
+		 */
+                err("ir_xml_record_temperaturedata: incorrect temperature label string: %s", 
+			temperaturelabel);
+                return( -1);
+        }
+
+        if( temperatureindex == IR_NO_INDEX){
+                /* We didn't parse the temperaturelabel string index correctly*/
+                err("ir_xml_record_temperaturedata: could not extract index from temperature label string: %s", 
+			temperaturelabel);
+                return( -1);
+        }
+
+        /* The index of this temperature sensor should be between 1 and
+ 	 * ILO2_RIBCL_DISCOVER_TS_MAX.
+	 */
+
+        if( (temperatureindex < 1) || 
+			(temperatureindex > ILO2_RIBCL_DISCOVER_TS_MAX) ){
+                err("ir_xml_record_temperaturedata: temperatureindex out of range: %d.", 
+			temperatureindex);
+                return( -1);
+        }
+
+        /* Now, if this information is different than what's already in
+         * DiscoveryData, update DiscoveryData with the latest info */
+        sensordat =
+              &(ir_handler->DiscoveryData.chassis_sensors[temperatureindex+3]);
+
+        sensordat->tsflags |= IR_DISCOVERED;
+
+        cur_readingval = atoi(temperaturereading);
+        if( sensordat->reading.intval != cur_readingval){
+
+        sensordat->reading.intval = atoi(temperaturereading);
+        }
+
+        if( ir_xml_replacestr( &(sensordat->discription), temperaturelocation)
+							!= RIBCL_SUCCESS){
+                  return( -1);
+        }
+
+        return( RIBCL_SUCCESS);
+
+} /* end ir_xml_record_temparaturedata()*/ 
+/**
  * ir_xml_firmaware_revision
  * @ir_handler: Ptr to this instance's custom handler.
  * @eh_data_node: Points to GET_FW_VERSION subtree in the output xml
Index: plugins/ilo2_ribcl/ilo2_ribcl_discover.c
===================================================================
--- plugins/ilo2_ribcl/ilo2_ribcl_discover.c	(revision 7263)
+++ plugins/ilo2_ribcl/ilo2_ribcl_discover.c	(working copy)
@@ -72,6 +72,10 @@
 static SaErrorT ilo2_ribcl_add_severity_sensor( struct oh_handler_state *,
 	struct oh_event *, int, SaHpiSensorTypeT, SaHpiEventStateT,
 	struct ilo2_ribcl_sensinfo *, char *);
+static SaErrorT ilo2_ribcl_add_threshold_sensor( struct oh_handler_state *,
+        struct oh_event *, int, SaHpiSensorTypeT, SaHpiEventStateT,
+        struct ilo2_ribcl_sensinfo *, char *);
+
 static void ilo2_ribcl_discover_chassis_sensors( struct oh_handler_state *, 
 	struct oh_event *);
 void ilo2_ribcl_add_resource_capability( struct oh_handler_state *, 
@@ -374,7 +378,12 @@
 	for( idex = 1; idex <= ILO2_RIBCL_DISCOVER_PSU_MAX; idex++){
 		ddata->vrmdata[idex].vrmflags &= ~IR_DISCOVERED;
 	}
+	 /* Clear the TEMP flags */
+        for( idex = 1; idex <= ILO2_RIBCL_DISCOVER_TS_MAX; idex++){
+                ddata->chassis_sensors[idex].tsflags &= ~IR_DISCOVERED;
+        }
 
+
 } /* end ilo2_ribcl_clear_discoveryflags() */
 
 
@@ -1994,6 +2003,7 @@
 	ilo2_ribcl_handler_t *ir_handler = NULL;
 	struct ilo2_ribcl_sensinfo si_initial;
 	I2R_SensorDataT *sensordat;
+	int i;
 
 	ir_handler = (ilo2_ribcl_handler_t *) oh_handler->data;
 
@@ -2091,10 +2101,120 @@
 		}
 	}
 
+	for(i=1 ; i <= ILO2_RIBCL_DISCOVER_TS_MAX; i++){
+        
+
+        sensordat =
+             	 &(ir_handler->DiscoveryData.chassis_sensors[i+3]);
+                if(sensordat->tsflags != IR_DISCOVERED){
+                        break;
+                }
+        if( sensordat->reading.intval != I2R_SEN_VAL_UNINITIALIZED){
+
+                        si_initial.sens_num = i+3;
+                        si_initial.sens_ev_state = SAHPI_ES_UNSPECIFIED;
+                        si_initial.sens_enabled = SAHPI_TRUE;
+                        si_initial.sens_ev_enabled = SAHPI_FALSE;
+                        si_initial.sens_assertmask = SAHPI_ES_UNSPECIFIED;
+                        si_initial.sens_deassertmask = SAHPI_ES_UNSPECIFIED;
+                        si_initial.sens_value = I2R_SEN_VAL_UNINITIALIZED;
+
+                        ret =  ilo2_ribcl_add_threshold_sensor( oh_handler, 
+				event, i+3, SAHPI_TEMPERATURE,
+                                I2R_SEVERITY_THREESTATE_EV, &si_initial,
+                                sensordat->discription);
+
+                        if( ret == SA_OK){
+                                sensordat->state = I2R_INITIAL;
+                                sensordat->rid = event->resource.ResourceId;
+                                ilo2_ribcl_add_resource_capability( oh_handler,
+                                          event, (SAHPI_CAPABILITY_RDR | 
+						SAHPI_CAPABILITY_SENSOR));
+                        } else {
+
+                                err("ilo2_ribcl_discover_chassis_sensors:Failed to set up sensor.");
+                        }
+
+                }
+        }
+
+
 } /* end ilo2_ribcl_discover_chassis_sensors() */
 
+static SaErrorT ilo2_ribcl_add_threshold_sensor(
+                        struct oh_handler_state *oh_handler,
+                        struct oh_event *event,
+                        int sens_num,
+                        SaHpiSensorTypeT sens_type,
+                        SaHpiEventStateT supported_states,
+                        struct ilo2_ribcl_sensinfo *sens_info,
+                        char *description)
+{
 
+        SaErrorT ret = SA_OK;
+        SaHpiRdrT *rdr;
+        SaHpiSensorRecT *sensor_rec;
+        struct ilo2_ribcl_sensinfo *si;
+        rdr = (SaHpiRdrT *)g_malloc0(sizeof(SaHpiRdrT));
+        if( rdr == NULL){
+                err("ilo2_ribcl_add_severity_sensor: Memory allocation failed.");
+                return(SA_ERR_HPI_OUT_OF_MEMORY);
+        }
 
+        /* Fill in generic RDR stuff */
+        rdr->RdrType = SAHPI_SENSOR_RDR;
+        rdr->Entity  = event->resource.ResourceEntity;
+        rdr->IsFru   = SAHPI_FALSE;
+
+        /* Fill in sensor specific info */
+        sensor_rec = &(rdr->RdrTypeUnion.SensorRec);
+        sensor_rec->Num = sens_num;
+        sensor_rec->Type = sens_type;
+        sensor_rec->Category = SAHPI_EC_THRESHOLD;
+        sensor_rec->EnableCtrl = SAHPI_TRUE;
+        sensor_rec->EventCtrl  = SAHPI_SEC_READ_ONLY;
+        sensor_rec->Events = SAHPI_ES_UNSPECIFIED;
+
+        sensor_rec->DataFormat.IsSupported = SAHPI_TRUE;
+        sensor_rec->DataFormat.ReadingType = SAHPI_SENSOR_READING_TYPE_INT64;
+        sensor_rec->DataFormat.BaseUnits   = SAHPI_SU_DEGREES_C;
+        sensor_rec->DataFormat.ModifierUse = SAHPI_SMUU_NONE;
+        sensor_rec->DataFormat.Percentage  = SAHPI_FALSE;
+        /* Range and AccuracyFactor have been cleared by g_malloc0() */
+
+        sensor_rec->ThresholdDefn.IsAccessible = SAHPI_FALSE;
+
+        oh_init_textbuffer(&(rdr->IdString));
+        oh_append_textbuffer(&(rdr->IdString), description);
+
+
+        /* Copy the private sensor data initial values into a new allocation
+         * to be associated with this RDR. */
+        si = g_memdup(sens_info, sizeof(struct ilo2_ribcl_sensinfo));
+        if( si == NULL){
+                g_free( rdr);
+                err("ilo2_ribcl_add_severity_sensor: Memory allocation failed.");
+                return(SA_ERR_HPI_OUT_OF_MEMORY);
+        }
+	  ret = oh_add_rdr(oh_handler->rptcache, event->resource.ResourceId,
+                rdr, si, 0);
+        if( ret != SA_OK){
+                err("ilo2_ribcl_add_threshold_sensor: could not add RDR.Error = %s.", 
+			oh_lookup_error(ret));
+                g_free( si);
+                g_free( rdr);
+                return( SA_ERR_HPI_INTERNAL_ERROR);
+        } else {
+                event->rdrs = g_slist_append(event->rdrs, rdr);
+        }
+
+        return( SA_OK);
+
+} /* end ilo2_ribcl_add_threshold_sensor() */
+
+
+
+
 /**
  * ilo2_ribcl_add_resource_capability:
  * @oh_handler:  Handler data pointer.
Index: plugins/ilo2_ribcl/ilo2_ribcl.h
===================================================================
--- plugins/ilo2_ribcl/ilo2_ribcl.h	(revision 7263)
+++ plugins/ilo2_ribcl/ilo2_ribcl.h	(working copy)
@@ -203,7 +203,7 @@
 /* The number of chassis sensors for our data structures. Note that
  * sensor numbers begin with 1, so this number may be one greater than
  * you would think. */
-#define I2R_NUM_CHASSIS_SENSORS	4
+#define I2R_NUM_CHASSIS_SENSORS	54	
 
 /* These are the sensor numbers for the sensors on our chassis */
 #define I2R_SEN_FANHEALTH	1
@@ -271,6 +271,8 @@
 	SaHpiResourceIdT rid;	/* So we can locate other HPI info from here */
 	I2R_SensorStateT state;
 	I2R_ReadingUnionT reading;
+	char* discription;
+        unsigned int tsflags;
 } I2R_SensorDataT;
 
 
