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.
Changes to note,
- All cmd are removed from the request data. That is automatically
extracted now.
Tested:
Unit Test Passed.
All IPMI OEM command still works the same as before this change.
```
$ burn_my_bmc -command stage -image /tmp/test.txt -interface ipmipci
Set up ipmi flash updater with /flash/dummy
Received failure on delete: Received IPMI_CC: 255
Sending over the firmware image.
Find [0x1050 0x750]
bar0[0x94000000]
Upload to BMC 100% |Goooooooooooooooooooooooooooooooooooooooooooooooooooooooogle| Time: 00:00:00
Opening the verification file
Committing to /flash/verify to trigger service
Calling stat on /flash/verify session to check status
success
succeeded
```
Also tested gBMC Update workflow which worked fine.
Change-Id: Ib2bfeab0c2ec5aa72ede1ff457ef5f90e488053c
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/test/helper.cpp b/test/helper.cpp
new file mode 100644
index 0000000..73e19aa
--- /dev/null
+++ b/test/helper.cpp
@@ -0,0 +1,32 @@
+#include "helper.hpp"
+
+#include "ipmi.hpp"
+
+#include <ipmid/api-types.hpp>
+#include <optional>
+#include <span>
+#include <tuple>
+#include <utility>
+#include <vector>
+
+#include <gtest/gtest.h>
+
+namespace blobs
+{
+std::vector<std::uint8_t>
+ validateReply(ipmi::RspType<std::vector<uint8_t>> reply, bool hasData)
+{
+ // Reply is in the form of
+ // std::tuple<ipmi::Cc, std::optional<std::tuple<RetTypes...>>>
+ EXPECT_EQ(::ipmi::ccSuccess, std::get<0>(reply));
+
+ auto actualReply = std::get<1>(reply);
+ EXPECT_TRUE(actualReply.has_value());
+
+ auto data = std::get<0>(*actualReply);
+ EXPECT_EQ(hasData, !data.empty());
+
+ return hasData ? data : std::vector<uint8_t>{};
+}
+
+} // namespace blobs