event-manager: Fix handling the event of undiscovered terminus

Currently, there are two event handlers, one from IBM `oem/ibm` and one
from `platform-mc` code. The event-manager in `platform-mc` should only
handles the event from the discovered termini by `platform-mc` code.
Add the valid TID checking before start handling the received events
from termini.

Signed-off-by: Thu Nguyen <thu@os.amperecomputing.com>
Change-Id: Idcbd33424a82c0cf7c9aebbd132435747534b2f8
diff --git a/platform-mc/event_manager.cpp b/platform-mc/event_manager.cpp
index b50daf2..8212598 100644
--- a/platform-mc/event_manager.cpp
+++ b/platform-mc/event_manager.cpp
@@ -22,6 +22,14 @@
     pldm_tid_t tid, uint16_t eventId, uint8_t eventClass,
     const uint8_t* eventData, size_t eventDataSize)
 {
+    /* Only handle the event of the discovered termini*/
+    if (!termini.contains(tid))
+    {
+        lg2::error("Terminus ID {TID} is not in the managing list.", "TID",
+                   tid);
+        return PLDM_ERROR;
+    }
+
     /* EventClass sensorEvent `Table 11 - PLDM Event Types` DSP0248 */
     if (eventClass == PLDM_SENSOR_EVENT)
     {
@@ -348,6 +356,12 @@
             terminusName = static_cast<std::string>(tmp.value());
         }
     }
+    else
+    {
+        lg2::error("Terminus ID {TID} is not in the managing list.", "TID",
+                   tid);
+        return PLDM_ERROR;
+    }
 
     // Save event data to file
     std::filesystem::path dirName{"/var/cper"};