Add Ramoops dump to common create

This commit adjusts the handling of ramoops (RAM OOPS)
dumps to use the common BMC dump creation interface.
Previously, when a ramoops dump was detected, the
ramoops manager would inform the dump manager via an
internal D-Bus interface. With the changes in this
commit, upon detecting a ramoops event, the ramoops
manager will now request the dump manager to create
a BMC dump, incorporating the relevant ramoops data,
via the common create DBus interface.

Change-Id: I0437cfa6c63fe261ca9b51f6a90c8183abacd5c7
Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
diff --git a/ramoops_manager.cpp b/ramoops_manager.cpp
index 321f90f..a3df837 100644
--- a/ramoops_manager.cpp
+++ b/ramoops_manager.cpp
@@ -2,9 +2,13 @@
 
 #include "ramoops_manager.hpp"
 
+#include "dump_manager.hpp"
+
 #include <phosphor-logging/lg2.hpp>
 #include <sdbusplus/bus.hpp>
 #include <sdbusplus/exception.hpp>
+#include <xyz/openbmc_project/Dump/Create/common.hpp>
+#include <xyz/openbmc_project/Dump/Create/server.hpp>
 
 #include <filesystem>
 #include <set>
@@ -37,14 +41,12 @@
     constexpr auto MAPPER_BUSNAME = "xyz.openbmc_project.ObjectMapper";
     constexpr auto MAPPER_PATH = "/xyz/openbmc_project/object_mapper";
     constexpr auto MAPPER_INTERFACE = "xyz.openbmc_project.ObjectMapper";
-    constexpr auto IFACE_INTERNAL("xyz.openbmc_project.Dump.Internal.Create");
-    constexpr auto RAMOOPS =
-        "xyz.openbmc_project.Dump.Internal.Create.Type.Ramoops";
+    constexpr auto DUMP_CREATE_IFACE = "xyz.openbmc_project.Dump.Create";
 
     auto b = sdbusplus::bus::new_default();
     auto mapper = b.new_method_call(MAPPER_BUSNAME, MAPPER_PATH,
                                     MAPPER_INTERFACE, "GetObject");
-    mapper.append(OBJ_INTERNAL, std::set<std::string>({IFACE_INTERNAL}));
+    mapper.append(BMC_DUMP_OBJPATH, std::set<std::string>({DUMP_CREATE_IFACE}));
 
     std::map<std::string, std::set<std::string>> mapperResponse;
     try
@@ -65,9 +67,20 @@
     }
 
     const auto& host = mapperResponse.cbegin()->first;
-    auto m = b.new_method_call(host.c_str(), OBJ_INTERNAL, IFACE_INTERNAL,
-                               "Create");
-    m.append(RAMOOPS, files);
+    auto m = b.new_method_call(host.c_str(), BMC_DUMP_OBJPATH,
+                               DUMP_CREATE_IFACE, "CreateDump");
+    phosphor::dump::DumpCreateParams params;
+    using CreateParameters =
+        sdbusplus::common::xyz::openbmc_project::dump::Create::CreateParameters;
+    using DumpType =
+        sdbusplus::common::xyz::openbmc_project::dump::Create::DumpType;
+    using DumpIntr = sdbusplus::common::xyz::openbmc_project::dump::Create;
+    params[DumpIntr::convertCreateParametersToString(
+        CreateParameters::DumpType)] =
+        DumpIntr::convertDumpTypeToString(DumpType::Ramoops);
+    params[DumpIntr::convertCreateParametersToString(
+        CreateParameters::FilePath)] = files.front();
+    m.append(params);
     try
     {
         b.call_noreply(m);