host-bmc: handle PDR repo change event from remote endpoint

When the PDR repository change event is initiated with the
event data operation as RECORDS_DELETED, we need to delete the
PDRs from the repository based on the record handles.

Change-Id: Ia484b7a0465169bc471f93bda0baa3c4b8ed5f63
Signed-off-by: Pavithra Barithaya <pavithrabarithaya07@gmail.com>
diff --git a/libpldmresponder/platform.cpp b/libpldmresponder/platform.cpp
index 7a3b63c..5ffc572 100644
--- a/libpldmresponder/platform.cpp
+++ b/libpldmresponder/platform.cpp
@@ -524,6 +524,7 @@
     uint8_t tid, size_t eventDataOffset)
 {
     uint8_t eventDataFormat{};
+    uint8_t eventDataOperation{};
     uint8_t numberOfChangeRecords{};
     size_t dataOffset{};
 
@@ -548,7 +549,6 @@
 
     if (eventDataFormat == FORMAT_IS_PDR_HANDLES)
     {
-        uint8_t eventDataOperation{};
         uint8_t numberOfChangeEntries{};
 
         auto changeRecordData = eventData + dataOffset;
@@ -613,7 +613,14 @@
                 }
             }
         }
-        hostPDRHandler->fetchPDR(std::move(pdrRecordHandles));
+        if (eventDataOperation == PLDM_RECORDS_DELETED)
+        {
+            hostPDRHandler->deletePDRFromRepo(std::move(pdrRecordHandles));
+        }
+        else
+        {
+            hostPDRHandler->fetchPDR(std::move(pdrRecordHandles));
+        }
     }
 
     return PLDM_SUCCESS;