libpldm : Add encode API for QueryDeviceIdentifiers cmd

QueryDeviceIdentifiers command is used by update agent to obtain the
firmware identifiers for the fimrware device and its defined in DSP0267
Version 1.1.0 sec:10.1.

Tested: Unit tests passed

Signed-off-by: gokulsanker <gokul.sanker.v.g@intel.com>
Change-Id: I472e85414b1a04b550b88c3e6058b86efb9b89b1
diff --git a/libpldm/tests/libpldm_firmware_update_test.cpp b/libpldm/tests/libpldm_firmware_update_test.cpp
new file mode 100644
index 0000000..8387b77
--- /dev/null
+++ b/libpldm/tests/libpldm_firmware_update_test.cpp
@@ -0,0 +1,22 @@
+#include "libpldm/base.h"

+#include "libpldm/firmware_update.h"

+

+#include <gtest/gtest.h>

+

+constexpr auto hdrSize = sizeof(pldm_msg_hdr);

+

+TEST(QueryDeviceIdentifiers, goodPathEncodeRequest)

+{

+    std::array<uint8_t, sizeof(pldm_msg_hdr)> requestMsg{};

+    auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());

+

+    uint8_t instanceId = 0x01;

+

+    auto rc = encode_query_device_identifiers_req(

+        instanceId, PLDM_QUERY_DEVICE_IDENTIFIERS_REQ_BYTES, requestPtr);

+    EXPECT_EQ(rc, PLDM_SUCCESS);

+    EXPECT_EQ(requestPtr->hdr.request, PLDM_REQUEST);

+    EXPECT_EQ(requestPtr->hdr.instance_id, instanceId);

+    EXPECT_EQ(requestPtr->hdr.type, PLDM_FWUP);

+    EXPECT_EQ(requestPtr->hdr.command, PLDM_QUERY_DEVICE_IDENTIFIERS);

+}

diff --git a/libpldm/tests/meson.build b/libpldm/tests/meson.build
index 607dd7d..b94959a 100644
--- a/libpldm/tests/meson.build
+++ b/libpldm/tests/meson.build
@@ -5,7 +5,8 @@
   'libpldm_bios_table_test',
   'libpldm_fru_test',
   'libpldm_utils_test',
-  'libpldm_pdr_test'
+  'libpldm_pdr_test',
+  'libpldm_firmware_update_test'
 ]
 
 if get_option('oem-ibm').enabled()