google-ipmi-sys: Refactor to use new version of OEM IPMI Handler

Using the new version of ipmi handler provide a higher level wrapper
over the same functionalities. It helps us parse the input and output to
have more control of the input/output we see.

The input and output will be
`std::uint8_t, std::optional<std::vector<uint8_t>>`.

This represents `subcommand` and any input data.

Changes to note,
- all subcommand in the request/response struct are removed. It will be
  managed by the wrapper directly.
    - Unit tests checking for input with only the subcommand are
      removed.
- Move all reply struct to header files to be accessible in unit test.

Tested:
All IPMI OEM command still works the same as before this change.

Change-Id: I4230ab84a497a867248fe82224e32cc69b314b64
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/test/poweroff_unittest.cpp b/test/poweroff_unittest.cpp
index 4bbd40a..6a90fc6 100644
--- a/test/poweroff_unittest.cpp
+++ b/test/poweroff_unittest.cpp
@@ -14,6 +14,7 @@
 
 #include "commands.hpp"
 #include "handler_mock.hpp"
+#include "helper.hpp"
 #include "host_power_off.hpp"
 
 #include <cstdint>
@@ -22,8 +23,6 @@
 
 #include <gtest/gtest.h>
 
-#define MAX_IPMI_BUFFER 64
-
 namespace google
 {
 namespace ipmi
@@ -32,12 +31,10 @@
 TEST(PowerOffCommandTest, InvalidRequestLength)
 {
     std::vector<std::uint8_t> request = {SysOEMCommands::SysHostPowerOff};
-    size_t dataLen = request.size();
-    std::uint8_t reply[MAX_IPMI_BUFFER];
-
     HandlerMock hMock;
-    EXPECT_EQ(IPMI_CC_REQ_DATA_LEN_INVALID,
-              hostPowerOff(request.data(), reply, &dataLen, &hMock));
+
+    EXPECT_EQ(::ipmi::responseReqDataLenInvalid(),
+              hostPowerOff(request, &hMock));
 }
 
 TEST(PowerOffCommandTest, ValidRequest)
@@ -45,18 +42,17 @@
     // Set the dealy to 15 mins
     std::uint32_t delayValue = 0x384;
     struct HostPowerOffRequest requestContents;
-    requestContents.subcommand = SysOEMCommands::SysHostPowerOff;
     requestContents.delay = delayValue;
 
     std::vector<std::uint8_t> request(sizeof(requestContents));
     std::memcpy(request.data(), &requestContents, sizeof(requestContents));
-    size_t dataLen = request.size();
-    std::uint8_t reply[MAX_IPMI_BUFFER];
 
     HandlerMock hMock;
     EXPECT_CALL(hMock, hostPowerOffDelay(delayValue));
-    EXPECT_EQ(IPMI_CC_OK,
-              hostPowerOff(request.data(), reply, &dataLen, &hMock));
+
+    auto reply = hostPowerOff(request, &hMock);
+    auto result = ValidateReply(reply, false);
+    EXPECT_EQ(SysOEMCommands::SysHostPowerOff, result.first);
 }
 
 } // namespace ipmi