PLDMTOOL: Implement raw option in the pldmtool
raw option enables user sending raw bytes and printing response
HELP OUTPUT:
root@witherspoon-128:/tmp# ./pldmtool -h
PLDM requester tool for OpenBMC
Usage: ./pldmtool [OPTIONS] [—command...] [raw] [GetPLDMTypes] [GetPLDMVersion] [SUBCOMMAND]
Positionals:
—command TEXT ... PLDM request command
raw TEXT Send a RAW PLDM request and print response
GetPLDMTypes TEXT Get PLDM Type
GetPLDMVersion TEXT Get PLDM Version
Options:
-h,--help Print this help message and exit
-c TEXT ... PLDM request command
Subcommands:
BASE PLDM Command Type = BASE
BIOS PLDM Command Type = BIOS
OEM PLDM Command Type = OEM
Currently option to be given as raw instead of --raw because
of bug in the CLI11 :
FIX: required positional arguments and a vector positionals #306
pldm_set_state_effecter_states:
root@witherspoon-128:/tmp# ./pldmtool raw 0x80 0x02 0x39 0x00 0x01 0x00 0x01 0x09
Request Message
08 01 80 02 39 00 01 00 01 09
Success in creating the socket : RC = 3
Success in connecting to socket : RC = 0
Success in sending message type as pldm to mctp : RC = 0
Write to socket successful : RC = 10
Total length:10
Loopback response message:
08 01 80 02 39 00 01 00 01 09
On first recv(),response == request : RC = 0
Total length: 6
Shutdown Socket successful : RC = 0
Socket recv() successful : RC = 0
Response Message:
08 01 00 02 39 00
GetPLDMVersion:
./pldmtool raw 0x80 0x00 0x03 0x00 0x00 0x00 0x00 0x01 0x00
Request Message
08 01 80 00 03 00 00 00 00 01 00
Success in creating the socket : RC = 3
Success in connecting to socket : RC = 0
Success in sending message type as pldm to mctp : RC = 0
Write to socket successful : RC = 11
Total length:11
Loopback response message:
08 01 80 00 03 00 00 00 00 01 00
On first recv(),response == request : RC = 0
Total length: 15
Shutdown Socket successful : RC = 0
Socket recv() successful : RC = 0
Response Message:
08 01 00 00 03 00 00 00 00 00 05 f1 f0 f0 00
Signed-off-by: Lakshminarayana R. Kammath <lkammath@in.ibm.com>
Change-Id: I4057108444db8f8809f4310e1ffbb0565adbbf3c
diff --git a/tool/handler.hpp b/tool/handler.hpp
index 4ee7fe8..086c132 100644
--- a/tool/handler.hpp
+++ b/tool/handler.hpp
@@ -16,5 +16,7 @@
{"GetPLDMTypes",
[](Args&& args) { return getPLDMTypes(std::move(args)); }},
{"GetPLDMVersion",
- [](Args&& args) { return getPLDMVersion(std::move(args)); }}};
+ [](Args&& args) { return getPLDMVersion(std::move(args)); }},
+ {"HandleRawOp",
+ [](Args&& args) { return handleRawOp(std::move(args)); }}};
};