summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--redfish-core/include/utils/systemd_utils.hpp54
-rw-r--r--redfish-core/lib/managers.hpp2
-rw-r--r--redfish-core/lib/service_root.hpp25
3 files changed, 58 insertions, 23 deletions
diff --git a/redfish-core/include/utils/systemd_utils.hpp b/redfish-core/include/utils/systemd_utils.hpp
new file mode 100644
index 0000000000..1c34fca279
--- /dev/null
+++ b/redfish-core/include/utils/systemd_utils.hpp
@@ -0,0 +1,54 @@
+/*
+// Copyright (c) 2019 Intel Corporation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+*/
+#pragma once
+
+#include <systemd/sd-id128.h>
+
+namespace redfish
+{
+
+namespace systemd_utils
+{
+
+/**
+ * @brief Retrieve service root UUID
+ *
+ * @return Service root UUID
+ */
+
+const std::string getUuid()
+{
+ std::string ret;
+ // This ID needs to match the one in ipmid
+ sd_id128_t appId = SD_ID128_MAKE(e0, e1, 73, 76, 64, 61, 47, da, a5, 0c, d0,
+ cc, 64, 12, 45, 78);
+ sd_id128_t machineId = SD_ID128_NULL;
+
+ if (sd_id128_get_machine_app_specific(appId, &machineId) == 0)
+ {
+ std::array<char, SD_ID128_STRING_MAX> str;
+ ret = sd_id128_to_string(machineId, str.data());
+ ret.insert(8, 1, '-');
+ ret.insert(13, 1, '-');
+ ret.insert(18, 1, '-');
+ ret.insert(23, 1, '-');
+ }
+
+ return ret;
+}
+
+} // namespace systemd_utils
+} // namespace redfish
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index a9efb4c79e..65bea03318 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -21,6 +21,7 @@
#include <boost/date_time.hpp>
#include <dbus_utility.hpp>
#include <sstream>
+#include <utils/systemd_utils.hpp>
#include <variant>
namespace redfish
@@ -944,6 +945,7 @@ class Manager : public Node
res.jsonValue["Status"] = {{"State", "Enabled"}, {"Health", "OK"}};
res.jsonValue["ManagerType"] = "BMC";
res.jsonValue["UUID"] = uuid;
+ res.jsonValue["ServiceEntryPointUUID"] = systemd_utils::getUuid();
res.jsonValue["Model"] = "OpenBmc"; // TODO(ed), get model
res.jsonValue["LogServices"] = {
diff --git a/redfish-core/lib/service_root.hpp b/redfish-core/lib/service_root.hpp
index 8cbab6f68f..a525ca66cb 100644
--- a/redfish-core/lib/service_root.hpp
+++ b/redfish-core/lib/service_root.hpp
@@ -17,7 +17,7 @@
#include "node.hpp"
-#include <systemd/sd-id128.h>
+#include <utils/systemd_utils.hpp>
namespace redfish
{
@@ -64,30 +64,9 @@ class ServiceRoot : public Node
res.jsonValue["UpdateService"] = {
{"@odata.id", "/redfish/v1/UpdateService"}};
- res.jsonValue["UUID"] = getUuid();
+ res.jsonValue["UUID"] = systemd_utils::getUuid();
res.end();
}
-
- const std::string getUuid()
- {
- std::string ret;
- // This ID needs to match the one in ipmid
- sd_id128_t appId = SD_ID128_MAKE(e0, e1, 73, 76, 64, 61, 47, da, a5, 0c,
- d0, cc, 64, 12, 45, 78);
- sd_id128_t machineId = SD_ID128_NULL;
-
- if (sd_id128_get_machine_app_specific(appId, &machineId) == 0)
- {
- std::array<char, SD_ID128_STRING_MAX> str;
- ret = sd_id128_to_string(machineId, str.data());
- ret.insert(8, 1, '-');
- ret.insert(13, 1, '-');
- ret.insert(18, 1, '-');
- ret.insert(23, 1, '-');
- }
-
- return ret;
- }
};
} // namespace redfish