google-ipmi-sys: Add "Entity Id:Entity Instance" mapping to Entity name
Say the system has a JSON file like :
{
"cpu": [
{"instance": 1, "name": "CPU0"},
{"instance": 2, "name": "CPU1"}
],
"memory_module": [
{"instance": 1, "name": "DIMM_A1"},
{"instance": 2, "name": "DIMM_A2"},
{"instance": 3, "name": "DIMM_B1"},
{"instance": 4, "name": "DIMM_B2"},
{"instance": 5, "name": "DIMM_C1"},
{"instance": 6, "name": "DIMM_C2"},
{"instance": 7, "name": "DIMM_D1"},
{"instance": 8, "name": "DIMM_D2"},
{"instance": 9, "name": "DIMM_E1"},
{"instance": 10, "name": "DIMM_E2"},
{"instance": 11, "name": "DIMM_F1"},
],
"add_in_card": [
{"instance": 1, "name": "slot1"},
{"instance": 2, "name": "slot2"},
{"instance": 3, "name": "slot3"},
{"instance": 4, "name": "slot5"}
],
"storage_device": [
{"instance": 1, "name": "SATA0"},
{"instance": 2, "name": "SATA1"},
{"instance": 3, "name": "SATA2"},
{"instance": 4, "name": "SATA3"}
]
}
The system can query the BMC for an Entity name given the Entity ID and Entity Instance.
Tested:
Yes;
1) Sending GetEntityName command; Expecting error since entity ID and
entity instance are not specified.
root@adler:~# ipmitool -I dbus raw 0x2e 0x32 0x79 0x2b 0x00 0x06
Unable to send RAW command (channel=0x0 netfn=0x2e lun=0x0 cmd=0x32
rsp=0xc7): Request data length invalid
2) Sending GetEntityName command; Expecting error since entity instance
is not specified.
root@adler:~# ipmitool -I dbus raw 0x2e 0x32 0x79 0x2b 0x00 0x06 0x01
Unable to send RAW command (channel=0x0 netfn=0x2e lun=0x0 cmd=0x32
rsp=0xc7): Request data length invalid
3) Sending GetEntityName command; Expecting error since Entity Id = 0x07
is not supported.
root@adler:~# ipmitool -I dbus raw 0x2e 0x32 0x79 0x2b 0x00 0x06 0x07 0x01
Unable to send RAW command (channel=0x0 netfn=0x2e lun=0x0 cmd=0x32
rsp=0xcc): Invalid data field in request
4) Sending GetEntityName command; Expecting error since Entity Instance
= 0x06 is not added in the JSON file.
root@adler:~# ipmitool -I dbus raw 0x2e 0x32 0x79 0x2b 0x00 0x06 0x3
0x06
Unable to send RAW command (channel=0x0 netfn=0x2e lun=0x0 cmd=0x32
rsp=0xcc): Invalid data field in request
5) Sending GetEntityName command; Expecting success.
root@adler:~# ipmitool -I dbus raw 0x2e 0x32 0x79 0x2b 0x00 0x06 0x3
0x01
79 2b 00 06 04 43 50 55 30
root@adler:~# ipmitool -I dbus raw 0x2e 0x32 0x79 0x2b 0x00 0x06 0x0B
0x01
79 2b 00 06 05 73 6c 6f 74 31
root@adler:~#
Change-Id: Idf6caae863acacd62460cbb7f73bf56fc927bcff
Signed-off-by: Jaghathiswari Rankappagounder Natarajan <jaghu@google.com>
diff --git a/main.hpp b/main.hpp
index f1cfccf..dfe8f29 100644
--- a/main.hpp
+++ b/main.hpp
@@ -19,6 +19,8 @@
SysPcieSlotCount = 4,
// The Sys pcie slot to i2c bus mapping command.
SysPcieSlotI2cBusMapping = 5,
+ // The Sys "entity id:entity instance" to entity name mapping command.
+ SysEntityName = 6,
};
} // namespace ipmi