summaryrefslogtreecommitdiffstats
path: root/redfish-core/include/utils
diff options
context:
space:
mode:
authorBernard Wong <trials13@hotmail.com>2019-03-20 16:17:21 +0800
committerEd Tanous <ed.tanous@intel.com>2019-05-02 00:31:32 +0000
commit7bffdb7e9da69ae5416cda8df826372c33716beb (patch)
tree413b11465dd38d9d62f0e658f5397dc228f080ce /redfish-core/include/utils
parent9a6fc6fe4ad7ad2e3b028419bdb081a42e88ff0a (diff)
downloadbmcweb-7bffdb7e9da69ae5416cda8df826372c33716beb.tar.gz
bmcweb-7bffdb7e9da69ae5416cda8df826372c33716beb.zip
Redfish: Supporting ServiceRootUUID field for /redfish/v1/Managers/{ManagerId}schema
- Created a common utiity file called, systemd_utils.hpp to hold the function getUuid. - Added json field support for ServiceEntryPointUUID field to retrieve it from system_utils.hpp. - Amended the header file, service_root.hpp to get the uuid from the newly created system_utils.hpp file. Changes tested with QEMU emulator and Witherspoon image => Passed Redfish Validator => Passed Change-Id: If7f2aba49942a0b315fb012da29af194ebd0ea6f Signed-off-by: Bernard Wong <trials13@hotmail.com>
Diffstat (limited to 'redfish-core/include/utils')
-rw-r--r--redfish-core/include/utils/systemd_utils.hpp54
1 files changed, 54 insertions, 0 deletions
diff --git a/redfish-core/include/utils/systemd_utils.hpp b/redfish-core/include/utils/systemd_utils.hpp
new file mode 100644
index 0000000..1c34fca
--- /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
OpenPOWER on IntegriCloud