base: GetTID responder implementation
A pldm terminus is defined as the point of communication termination
for PLDM messages and the PLDM functions associated with those messages.
The Terminus ID(TID) is a value that identifies a PLDM terminus.
This commit assignes 1 to the BMC as the TID.
Signed-off-by: John Wang <wangzqbj@inspur.com>
Change-Id: I7adb0e1274f326fe6cf148771f230f530c9a567c
diff --git a/test/libpldmresponder_base_test.cpp b/test/libpldmresponder_base_test.cpp
index 6138341..bbd986a 100644
--- a/test/libpldmresponder_base_test.cpp
+++ b/test/libpldmresponder_base_test.cpp
@@ -37,7 +37,7 @@
auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
uint8_t* payload_ptr = responsePtr->payload;
ASSERT_EQ(payload_ptr[0], 0);
- ASSERT_EQ(payload_ptr[1], 56); // 56 = 0b111000
+ ASSERT_EQ(payload_ptr[1], 60); // 60 = 0b111100
ASSERT_EQ(payload_ptr[2], 0);
}
@@ -118,3 +118,18 @@
ASSERT_EQ(responsePtr->payload[0], PLDM_ERROR_INVALID_PLDM_TYPE);
}
+
+TEST(GetTID, testGoodRequest)
+{
+ std::array<uint8_t, sizeof(pldm_msg_hdr)> requestPayload{};
+ auto request = reinterpret_cast<pldm_msg*>(requestPayload.data());
+ size_t requestPayloadLength = 0;
+
+ auto response = getTID(request, requestPayloadLength);
+
+ auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
+ uint8_t* payload = responsePtr->payload;
+
+ ASSERT_EQ(payload[0], 0);
+ ASSERT_EQ(payload[1], 1);
+}