pdr: Sensor/Effecter support for enc fault and identify leds

This is to support sensor/effecter pdrs for enclosure fault led
and enclosure identify led.

Testing Result:

EFFECTER:

Enclosure Identify Use Cases:

pldmtool platform GetPDR -d 55
{
    "nextRecordHandle": 56,
    "responseCount": 29,
    "recordHandle": 55,
    "PDRHeaderVersion": 1,
    "PDRType": "State Effecter PDR",
    "recordChangeNumber": 0,
    "dataLength": 19,
    "PLDMTerminusHandle": 1,
    "effecterID": 2,
    "entityType": "System chassis (main enclosure)",
    "entityInstanceNumber": 0,
    "containerID": 0,
    "effecterSemanticID": 0,
    "effecterInit": "noInit",
    "effecterDescriptionPDR": false,
    "compositeEffecterCount": 1,
    "stateSetID[0]": "17",
    "possibleStatesSize[0]": 1,
    "possibleStates[0]": " 1 2"
}

Set On:
pldmtool raw -d 0x80 0x02 0x39 0x02 0x00 0x01 0x01 0x01
Request Message:
08 01 80 02 39 02 00 01 01 01
Response Message:
08 01 00 02 39 00

busctl get-property xyz.openbmc_project.LED.GroupManager
/xyz/openbmc_project/led/groups/enclosure_identify
xyz.openbmc_project.Led.Group Asserted
b true

Set Off:
pldmtool raw -d 0x80 0x02 0x39 0x02 0x00 0x01 0x01 0x02
Request Message:
08 01 80 02 39 02 00 01 01 02
Response Message:
08 01 00 02 39 00

busctl get-property xyz.openbmc_project.LED.GroupManager
/xyz/openbmc_project/led/groups/enclosure_identify
xyz.openbmc_project.Led.Group Asserted
b false

Enclosure Fault Use Cases:

pldmtool platform GetPDR -d 56
{
    "nextRecordHandle": 57,
    "responseCount": 29,
    "recordHandle": 56,
    "PDRHeaderVersion": 1,
    "PDRType": "State Effecter PDR",
    "recordChangeNumber": 0,
    "dataLength": 19,
    "PLDMTerminusHandle": 1,
    "effecterID": 3,
    "entityType": "System chassis (main enclosure)",
    "entityInstanceNumber": 0,
    "containerID": 0,
    "effecterSemanticID": 0,
    "effecterInit": "noInit",
    "effecterDescriptionPDR": false,
    "compositeEffecterCount": 1,
    "stateSetID[0]": "10",
    "possibleStatesSize[0]": 1,
    "possibleStates[0]": " 1 2"
}

Set state as On:
pldmtool raw -d 0x80 0x02 0x39 0x03 0x00 0x01 0x01 0x01
Request Message:
08 01 80 02 39 03 00 01 01 01
Response Message:
08 01 00 02 39 00

busctl get-property xyz.openbmc_project.LED.GroupManager
/xyz/openbmc_project/led/groups/enclosure_fault
xyz.openbmc_project.Led.Group Asserted
b true

Set state as Off:
pldmtool raw -d 0x80 0x02 0x39 0x03 0x00 0x01 0x01 0x02
Request Message:
08 01 80 02 39 03 00 01 01 02
Response Message:
08 01 00 02 39 00

busctl get-property xyz.openbmc_project.LED.GroupManager
/xyz/openbmc_project/led/groups/enclosure_fault
xyz.openbmc_project.Led.Group Asserted
b false

SENSOR:

Enc Identify Use Cases:

pldmtool platform GetPDR -d 24
{
    "nextRecordHandle": 25,
    "responseCount": 27,
    "recordHandle": 24,
    "PDRHeaderVersion": 1,
    "PDRType": "State Sensor PDR",
    "recordChangeNumber": 0,
    "dataLength": 17,
    "PLDMTerminusHandle": 0,
    "sensorID": 3,
    "entityType": "System chassis (main enclosure)",
    "entityInstanceNumber": 0,
    "containerID": 0,
    "sensorInit": "noInit",
    "sensorAuxiliaryNamesPDR": false,
    "compositeSensorCount": 1,
    "stateSetID[0]": "17",
    "possibleStatesSize[0]": 1,
    "possibleStates[0]": " 1 2"
}

Set On:
busctl set-property xyz.openbmc_project.LED.Controller.virtual_enc_id
/xyz/openbmc_project/led/physical/virtual_enc_id xyz.openbmc_project.Led.Physical
State s "xyz.openbmc_project.Led.Physical.Action.On"
pldmtool raw --data 0x80 0x02 0x21 0x03 0x00 0x01 0x00
Request Message:
08 01 80 02 21 03 00 01 00
Response Message:
08 01 00 02 21 00 01 00 01 00 01

Set Off:
busctl set-property xyz.openbmc_project.LED.Controller.virtual_enc_id
/xyz/openbmc_project/led/physical/virtual_enc_id xyz.openbmc_project.Led.Physical
State s "xyz.openbmc_project.Led.Physical.Action.Off"

pldmtool raw --data 0x80 0x02 0x21 0x03 0x00 0x01 0x00
Request Message:
08 01 80 02 21 03 00 01 00
Response Message:
08 01 00 02 21 00 01 00 01 00 02

Enc Fault Use Cases:

pldmtool platform GetPDR -d 25
{
    "nextRecordHandle": 26,
    "responseCount": 27,
    "recordHandle": 25,
    "PDRHeaderVersion": 1,
    "PDRType": "State Sensor PDR",
    "recordChangeNumber": 0,
    "dataLength": 17,
    "PLDMTerminusHandle": 0,
    "sensorID": 4,
    "entityType": "System chassis (main enclosure)",
    "entityInstanceNumber": 0,
    "containerID": 0,
    "sensorInit": "noInit",
    "sensorAuxiliaryNamesPDR": false,
    "compositeSensorCount": 1,
    "stateSetID[0]": "10",
    "possibleStatesSize[0]": 1,
    "possibleStates[0]": " 1 2"
}

Set On:
busctl set-property xyz.openbmc_project.LED.Controller.virtual_enc_fault
/xyz/openbmc_project/led/physical/virtual_enc_fault xyz.openbmc_project.Led.Physical
State s "xyz.openbmc_project.Led.Physical.Action.On"
pldmtool raw --data 0x80 0x02 0x21 0x04 0x00 0x01 0x00
Request Message:
08 01 80 02 21 04 00 01 00
Response Message:
08 01 00 02 21 00 01 00 01 00 01

Set Off:
busctl set-property xyz.openbmc_project.LED.Controller.virtual_enc_fault
/xyz/openbmc_project/led/physical/virtual_enc_fault xyz.openbmc_project.Led.Physical
State s "xyz.openbmc_project.Led.Physical.Action.Off"
pldmtool raw --data 0x80 0x02 0x21 0x04 0x00 0x01 0x00
Request Message:
08 01 80 02 21 04 00 01 00
Response Message:
08 01 00 02 21 00 01 00 01 00 02

Signed-off-by: Jayashankar Padath <jayashankar.padath@in.ibm.com>
Change-Id: Id9ae0ce5bba1c1a63d3de20daa22571d24a8d9f2
diff --git a/configurations/pdr/11.json b/configurations/pdr/11.json
index 5656cf0..753e23e 100644
--- a/configurations/pdr/11.json
+++ b/configurations/pdr/11.json
@@ -31,6 +31,25 @@
         }]
     },
     {
+        "type" : 45,
+        "instance" : 0,
+        "container" : 0,
+        "effecters" : [{
+            "set" : {
+                "id" : 17,
+                "size" : 1,
+                "states" : [1,2]
+            },
+            "dbus" : {
+                "path": "/xyz/openbmc_project/led/groups/enclosure_identify",
+                "interface": "xyz.openbmc_project.Led.Group",
+                "property_name": "Asserted",
+                "property_type": "bool",
+                "property_values" : [true, false]
+             }
+        }]
+    },
+    {
         "entity_path" : "/xyz/openbmc_project/inventory/system/chassis/motherboard/base_op_panel_blyth",
         "effecters" : [{
             "set" : {
@@ -337,6 +356,25 @@
         }]
     },
     {
+        "type" : 45,
+        "instance" : 0,
+        "container" : 0,
+        "effecters" : [{
+            "set" : {
+                "id" : 10,
+                "size" : 1,
+                "states" : [1,2]
+            },
+            "dbus" : {
+                "path": "/xyz/openbmc_project/led/groups/enclosure_fault",
+                "interface": "xyz.openbmc_project.Led.Group",
+                "property_name": "Asserted",
+                "property_type": "bool",
+                "property_values" : [true, false]
+             }
+        }]
+    },
+    {
        "type" : 45,
        "instance" : 0,
        "container" : 0,
diff --git a/configurations/pdr/4.json b/configurations/pdr/4.json
index 350b691..9cba985 100644
--- a/configurations/pdr/4.json
+++ b/configurations/pdr/4.json
@@ -41,6 +41,28 @@
         }]
     },
     {
+        "type" : 45,
+        "instance" : 0,
+        "container" : 0,
+        "sensors" : [{
+            "set" : {
+                "id" : 17,
+                "size" : 1,
+                "states" : [1,2]
+            },
+            "dbus" : {
+                "path": "/xyz/openbmc_project/led/physical/virtual_enc_id",
+                "interface": "xyz.openbmc_project.Led.Physical",
+                "property_name": "State",
+                "property_type": "string",
+                "property_values": [
+                         "xyz.openbmc_project.Led.Physical.Action.On || xyz.openbmc_project.Led.Physical.Action.Blink",
+                         "xyz.openbmc_project.Led.Physical.Action.Off"
+                ]
+             }
+        }]
+    },
+    {
         "entity_path" : "/xyz/openbmc_project/inventory/system/chassis/motherboard/base_op_panel_blyth",
         "sensors" : [{
             "set" : {
@@ -364,6 +386,28 @@
                 "property_values" : [true, false]
              }
         }]
+    },
+    {
+        "type" : 45,
+        "instance" : 0,
+        "container" : 0,
+        "sensors" : [{
+            "set" : {
+                "id" : 10,
+                "size" : 1,
+                "states" : [1,2]
+            },
+            "dbus" : {
+                "path": "/xyz/openbmc_project/led/physical/virtual_enc_fault",
+                "interface": "xyz.openbmc_project.Led.Physical",
+                "property_name": "State",
+                "property_type": "string",
+                "property_values": [
+                         "xyz.openbmc_project.Led.Physical.Action.On || xyz.openbmc_project.Led.Physical.Action.Blink",
+                         "xyz.openbmc_project.Led.Physical.Action.Off"
+                ]
+             }
+        }]
     }]
   }]
 }