1e37f8451SRapkiewicz, Pawel /* 2e37f8451SRapkiewicz, Pawel // Copyright (c) 2018 Intel Corporation 3e37f8451SRapkiewicz, Pawel // 4e37f8451SRapkiewicz, Pawel // Licensed under the Apache License, Version 2.0 (the "License"); 5e37f8451SRapkiewicz, Pawel // you may not use this file except in compliance with the License. 6e37f8451SRapkiewicz, Pawel // You may obtain a copy of the License at 7e37f8451SRapkiewicz, Pawel // 8e37f8451SRapkiewicz, Pawel // http://www.apache.org/licenses/LICENSE-2.0 9e37f8451SRapkiewicz, Pawel // 10e37f8451SRapkiewicz, Pawel // Unless required by applicable law or agreed to in writing, software 11e37f8451SRapkiewicz, Pawel // distributed under the License is distributed on an "AS IS" BASIS, 12e37f8451SRapkiewicz, Pawel // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13e37f8451SRapkiewicz, Pawel // See the License for the specific language governing permissions and 14e37f8451SRapkiewicz, Pawel // limitations under the License. 15e37f8451SRapkiewicz, Pawel */ 16e37f8451SRapkiewicz, Pawel #pragma once 17e37f8451SRapkiewicz, Pawel 18*b49ac873SJames Feist #include "health.hpp" 19e37f8451SRapkiewicz, Pawel #include "node.hpp" 201abe55efSEd Tanous 21e37f8451SRapkiewicz, Pawel #include <boost/container/flat_map.hpp> 22abf2add6SEd Tanous #include <variant> 23e37f8451SRapkiewicz, Pawel 241abe55efSEd Tanous namespace redfish 251abe55efSEd Tanous { 26e37f8451SRapkiewicz, Pawel 27e37f8451SRapkiewicz, Pawel /** 28beeca0aeSGunnar Mills * @brief Retrieves chassis state properties over dbus 29beeca0aeSGunnar Mills * 30beeca0aeSGunnar Mills * @param[in] aResp - Shared pointer for completing asynchronous calls. 31beeca0aeSGunnar Mills * 32beeca0aeSGunnar Mills * @return None. 33beeca0aeSGunnar Mills */ 34beeca0aeSGunnar Mills void getChassisState(std::shared_ptr<AsyncResp> aResp) 35beeca0aeSGunnar Mills { 36beeca0aeSGunnar Mills crow::connections::systemBus->async_method_call( 37beeca0aeSGunnar Mills [aResp{std::move(aResp)}]( 38beeca0aeSGunnar Mills const boost::system::error_code ec, 39beeca0aeSGunnar Mills const std::variant<std::string> &chassisState) { 40beeca0aeSGunnar Mills if (ec) 41beeca0aeSGunnar Mills { 42beeca0aeSGunnar Mills BMCWEB_LOG_DEBUG << "DBUS response error " << ec; 43beeca0aeSGunnar Mills messages::internalError(aResp->res); 44beeca0aeSGunnar Mills return; 45beeca0aeSGunnar Mills } 46beeca0aeSGunnar Mills 47beeca0aeSGunnar Mills const std::string *s = std::get_if<std::string>(&chassisState); 48beeca0aeSGunnar Mills BMCWEB_LOG_DEBUG << "Chassis state: " << *s; 49beeca0aeSGunnar Mills if (s != nullptr) 50beeca0aeSGunnar Mills { 51beeca0aeSGunnar Mills // Verify Chassis State 52beeca0aeSGunnar Mills if (*s == "xyz.openbmc_project.State.Chassis.PowerState.On") 53beeca0aeSGunnar Mills { 54beeca0aeSGunnar Mills aResp->res.jsonValue["PowerState"] = "On"; 55beeca0aeSGunnar Mills aResp->res.jsonValue["Status"]["State"] = "Enabled"; 56beeca0aeSGunnar Mills } 57beeca0aeSGunnar Mills else if (*s == 58beeca0aeSGunnar Mills "xyz.openbmc_project.State.Chassis.PowerState.Off") 59beeca0aeSGunnar Mills { 60beeca0aeSGunnar Mills aResp->res.jsonValue["PowerState"] = "Off"; 61beeca0aeSGunnar Mills aResp->res.jsonValue["Status"]["State"] = "StandbyOffline"; 62beeca0aeSGunnar Mills } 63beeca0aeSGunnar Mills } 64beeca0aeSGunnar Mills }, 65beeca0aeSGunnar Mills "xyz.openbmc_project.State.Chassis", 66beeca0aeSGunnar Mills "/xyz/openbmc_project/state/chassis0", 67beeca0aeSGunnar Mills "org.freedesktop.DBus.Properties", "Get", 68beeca0aeSGunnar Mills "xyz.openbmc_project.State.Chassis", "CurrentPowerState"); 69beeca0aeSGunnar Mills } 70beeca0aeSGunnar Mills 71beeca0aeSGunnar Mills /** 72e37f8451SRapkiewicz, Pawel * DBus types primitives for several generic DBus interfaces 73e37f8451SRapkiewicz, Pawel * TODO(Pawel) consider move this to separate file into boost::dbus 74e37f8451SRapkiewicz, Pawel */ 7555c7b7a2SEd Tanous // Note, this is not a very useful Variant, but because it isn't used to get 76aa2e59c1SEd Tanous // values, it should be as simple as possible 77aa2e59c1SEd Tanous // TODO(ed) invent a nullvariant type 78abf2add6SEd Tanous using VariantType = std::variant<bool, std::string, uint64_t>; 79aa2e59c1SEd Tanous using ManagedObjectsType = std::vector<std::pair< 80aa2e59c1SEd Tanous sdbusplus::message::object_path, 81aa2e59c1SEd Tanous std::vector<std::pair<std::string, 82aa2e59c1SEd Tanous std::vector<std::pair<std::string, VariantType>>>>>>; 83e37f8451SRapkiewicz, Pawel 84aa2e59c1SEd Tanous using PropertiesType = boost::container::flat_map<std::string, VariantType>; 85e37f8451SRapkiewicz, Pawel 86c181942fSQiang XU void getIntrusionByService(std::shared_ptr<AsyncResp> aResp, 87c181942fSQiang XU const std::string &service, 88c181942fSQiang XU const std::string &objPath) 89c181942fSQiang XU { 90c181942fSQiang XU BMCWEB_LOG_DEBUG << "Get intrusion status by service \n"; 91c181942fSQiang XU 92c181942fSQiang XU crow::connections::systemBus->async_method_call( 93c181942fSQiang XU [aResp{std::move(aResp)}](const boost::system::error_code ec, 94c181942fSQiang XU const std::variant<std::string> &value) { 95c181942fSQiang XU if (ec) 96c181942fSQiang XU { 97c181942fSQiang XU // do not add err msg in redfish response, becaues this is not 98c181942fSQiang XU // mandatory property 99c181942fSQiang XU BMCWEB_LOG_ERROR << "DBUS response error " << ec << "\n"; 100c181942fSQiang XU return; 101c181942fSQiang XU } 102c181942fSQiang XU 103c181942fSQiang XU const std::string *status = std::get_if<std::string>(&value); 104c181942fSQiang XU 105c181942fSQiang XU if (status == nullptr) 106c181942fSQiang XU { 107c181942fSQiang XU BMCWEB_LOG_ERROR << "intrusion status read error \n"; 108c181942fSQiang XU return; 109c181942fSQiang XU } 110c181942fSQiang XU 111c181942fSQiang XU aResp->res.jsonValue["PhysicalSecurity"] = { 112c181942fSQiang XU {"IntrusionSensorNumber", 1}, {"IntrusionSensor", *status}}; 113c181942fSQiang XU }, 114c181942fSQiang XU service, objPath, "org.freedesktop.DBus.Properties", "Get", 115c181942fSQiang XU "xyz.openbmc_project.Chassis.Intrusion", "Status"); 116c181942fSQiang XU } 117c181942fSQiang XU 118c181942fSQiang XU /** 119c181942fSQiang XU * Retrieves physical security properties over dbus 120c181942fSQiang XU */ 121c181942fSQiang XU void getPhysicalSecurityData(std::shared_ptr<AsyncResp> aResp) 122c181942fSQiang XU { 123c181942fSQiang XU crow::connections::systemBus->async_method_call( 124c181942fSQiang XU [aResp{std::move(aResp)}]( 125c181942fSQiang XU const boost::system::error_code ec, 126c181942fSQiang XU const std::vector<std::pair< 127c181942fSQiang XU std::string, 128c181942fSQiang XU std::vector<std::pair<std::string, std::vector<std::string>>>>> 129c181942fSQiang XU &subtree) { 130c181942fSQiang XU if (ec) 131c181942fSQiang XU { 132c181942fSQiang XU // do not add err msg in redfish response, becaues this is not 133c181942fSQiang XU // mandatory property 134c181942fSQiang XU BMCWEB_LOG_ERROR << "DBUS error: no matched iface " << ec 135c181942fSQiang XU << "\n"; 136c181942fSQiang XU return; 137c181942fSQiang XU } 138c181942fSQiang XU // Iterate over all retrieved ObjectPaths. 139c181942fSQiang XU for (const auto &object : subtree) 140c181942fSQiang XU { 141c181942fSQiang XU for (const auto &service : object.second) 142c181942fSQiang XU { 143c181942fSQiang XU getIntrusionByService(aResp, service.first, object.first); 144c181942fSQiang XU return; 145c181942fSQiang XU } 146c181942fSQiang XU } 147c181942fSQiang XU }, 148c181942fSQiang XU "xyz.openbmc_project.ObjectMapper", 149c181942fSQiang XU "/xyz/openbmc_project/object_mapper", 150c181942fSQiang XU "xyz.openbmc_project.ObjectMapper", "GetSubTree", 151c181942fSQiang XU "/xyz/openbmc_project/Intrusion", int32_t(1), 152c181942fSQiang XU std::array<const char *, 1>{"xyz.openbmc_project.Chassis.Intrusion"}); 153c181942fSQiang XU } 154c181942fSQiang XU 155e37f8451SRapkiewicz, Pawel /** 156e37f8451SRapkiewicz, Pawel * ChassisCollection derived class for delivering Chassis Collection Schema 157e37f8451SRapkiewicz, Pawel */ 1581abe55efSEd Tanous class ChassisCollection : public Node 1591abe55efSEd Tanous { 160e37f8451SRapkiewicz, Pawel public: 1611abe55efSEd Tanous ChassisCollection(CrowApp &app) : Node(app, "/redfish/v1/Chassis/") 1621abe55efSEd Tanous { 163e0d918bcSEd Tanous entityPrivileges = { 164e0d918bcSEd Tanous {boost::beast::http::verb::get, {{"Login"}}}, 165e0d918bcSEd Tanous {boost::beast::http::verb::head, {{"Login"}}}, 166e0d918bcSEd Tanous {boost::beast::http::verb::patch, {{"ConfigureComponents"}}}, 167e0d918bcSEd Tanous {boost::beast::http::verb::put, {{"ConfigureComponents"}}}, 168e0d918bcSEd Tanous {boost::beast::http::verb::delete_, {{"ConfigureComponents"}}}, 169e0d918bcSEd Tanous {boost::beast::http::verb::post, {{"ConfigureComponents"}}}}; 170e37f8451SRapkiewicz, Pawel } 171e37f8451SRapkiewicz, Pawel 172e37f8451SRapkiewicz, Pawel private: 173e37f8451SRapkiewicz, Pawel /** 174e37f8451SRapkiewicz, Pawel * Functions triggers appropriate requests on DBus 175e37f8451SRapkiewicz, Pawel */ 17655c7b7a2SEd Tanous void doGet(crow::Response &res, const crow::Request &req, 1771abe55efSEd Tanous const std::vector<std::string> ¶ms) override 1781abe55efSEd Tanous { 1790f74e643SEd Tanous res.jsonValue["@odata.type"] = "#ChassisCollection.ChassisCollection"; 1800f74e643SEd Tanous res.jsonValue["@odata.id"] = "/redfish/v1/Chassis"; 1810f74e643SEd Tanous res.jsonValue["@odata.context"] = 1820f74e643SEd Tanous "/redfish/v1/$metadata#ChassisCollection.ChassisCollection"; 1830f74e643SEd Tanous res.jsonValue["Name"] = "Chassis Collection"; 1840f74e643SEd Tanous 185603a6640SGunnar Mills const std::array<const char *, 3> interfaces = { 186603a6640SGunnar Mills "xyz.openbmc_project.Inventory.Item.Board", 187603a6640SGunnar Mills "xyz.openbmc_project.Inventory.Item.Chassis", 188603a6640SGunnar Mills "xyz.openbmc_project.Inventory.Item.PowerSupply"}; 189603a6640SGunnar Mills 19062d5e2e4SEd Tanous auto asyncResp = std::make_shared<AsyncResp>(res); 19162d5e2e4SEd Tanous crow::connections::systemBus->async_method_call( 19262d5e2e4SEd Tanous [asyncResp](const boost::system::error_code ec, 19362d5e2e4SEd Tanous const std::vector<std::string> &chassisList) { 19462d5e2e4SEd Tanous if (ec) 1951abe55efSEd Tanous { 196f12894f8SJason M. Bills messages::internalError(asyncResp->res); 19762d5e2e4SEd Tanous return; 198e37f8451SRapkiewicz, Pawel } 19962d5e2e4SEd Tanous nlohmann::json &chassisArray = 20062d5e2e4SEd Tanous asyncResp->res.jsonValue["Members"]; 20162d5e2e4SEd Tanous chassisArray = nlohmann::json::array(); 20262d5e2e4SEd Tanous for (const std::string &objpath : chassisList) 20362d5e2e4SEd Tanous { 20462d5e2e4SEd Tanous std::size_t lastPos = objpath.rfind("/"); 20562d5e2e4SEd Tanous if (lastPos == std::string::npos) 20662d5e2e4SEd Tanous { 20762d5e2e4SEd Tanous BMCWEB_LOG_ERROR << "Failed to find '/' in " << objpath; 20862d5e2e4SEd Tanous continue; 20962d5e2e4SEd Tanous } 21062d5e2e4SEd Tanous chassisArray.push_back( 21162d5e2e4SEd Tanous {{"@odata.id", "/redfish/v1/Chassis/" + 21262d5e2e4SEd Tanous objpath.substr(lastPos + 1)}}); 213e37f8451SRapkiewicz, Pawel } 214e37f8451SRapkiewicz, Pawel 21562d5e2e4SEd Tanous asyncResp->res.jsonValue["Members@odata.count"] = 21662d5e2e4SEd Tanous chassisArray.size(); 21762d5e2e4SEd Tanous }, 21862d5e2e4SEd Tanous "xyz.openbmc_project.ObjectMapper", 21962d5e2e4SEd Tanous "/xyz/openbmc_project/object_mapper", 22062d5e2e4SEd Tanous "xyz.openbmc_project.ObjectMapper", "GetSubTreePaths", 221734bfe90SGunnar Mills "/xyz/openbmc_project/inventory", int32_t(0), interfaces); 22262d5e2e4SEd Tanous } 223e37f8451SRapkiewicz, Pawel }; 224e37f8451SRapkiewicz, Pawel 225e37f8451SRapkiewicz, Pawel /** 226e37f8451SRapkiewicz, Pawel * Chassis override class for delivering Chassis Schema 227e37f8451SRapkiewicz, Pawel */ 2281abe55efSEd Tanous class Chassis : public Node 2291abe55efSEd Tanous { 230e37f8451SRapkiewicz, Pawel public: 2311abe55efSEd Tanous Chassis(CrowApp &app) : 2321abe55efSEd Tanous Node(app, "/redfish/v1/Chassis/<str>/", std::string()) 2331abe55efSEd Tanous { 234e0d918bcSEd Tanous entityPrivileges = { 235e0d918bcSEd Tanous {boost::beast::http::verb::get, {{"Login"}}}, 236e0d918bcSEd Tanous {boost::beast::http::verb::head, {{"Login"}}}, 237e0d918bcSEd Tanous {boost::beast::http::verb::patch, {{"ConfigureComponents"}}}, 238e0d918bcSEd Tanous {boost::beast::http::verb::put, {{"ConfigureComponents"}}}, 239e0d918bcSEd Tanous {boost::beast::http::verb::delete_, {{"ConfigureComponents"}}}, 240e0d918bcSEd Tanous {boost::beast::http::verb::post, {{"ConfigureComponents"}}}}; 241e37f8451SRapkiewicz, Pawel } 242e37f8451SRapkiewicz, Pawel 243e37f8451SRapkiewicz, Pawel private: 244e37f8451SRapkiewicz, Pawel /** 245e37f8451SRapkiewicz, Pawel * Functions triggers appropriate requests on DBus 246e37f8451SRapkiewicz, Pawel */ 24755c7b7a2SEd Tanous void doGet(crow::Response &res, const crow::Request &req, 2481abe55efSEd Tanous const std::vector<std::string> ¶ms) override 2491abe55efSEd Tanous { 250734bfe90SGunnar Mills const std::array<const char *, 3> interfaces = { 251734bfe90SGunnar Mills "xyz.openbmc_project.Inventory.Item.Board", 252734bfe90SGunnar Mills "xyz.openbmc_project.Inventory.Item.Chassis", 253734bfe90SGunnar Mills "xyz.openbmc_project.Inventory.Item.PowerSupply"}; 254734bfe90SGunnar Mills 255e37f8451SRapkiewicz, Pawel // Check if there is required param, truly entering this shall be 256e37f8451SRapkiewicz, Pawel // impossible. 2571abe55efSEd Tanous if (params.size() != 1) 2581abe55efSEd Tanous { 259f12894f8SJason M. Bills messages::internalError(res); 260e37f8451SRapkiewicz, Pawel res.end(); 261e37f8451SRapkiewicz, Pawel return; 262e37f8451SRapkiewicz, Pawel } 26399cffd7fSShawn McCarney const std::string &chassisId = params[0]; 264e37f8451SRapkiewicz, Pawel 26562d5e2e4SEd Tanous auto asyncResp = std::make_shared<AsyncResp>(res); 26655c7b7a2SEd Tanous crow::connections::systemBus->async_method_call( 26762d5e2e4SEd Tanous [asyncResp, chassisId(std::string(chassisId))]( 26862d5e2e4SEd Tanous const boost::system::error_code ec, 269daf36e2eSEd Tanous const std::vector<std::pair< 2701abe55efSEd Tanous std::string, std::vector<std::pair< 2711abe55efSEd Tanous std::string, std::vector<std::string>>>>> 272daf36e2eSEd Tanous &subtree) { 27362d5e2e4SEd Tanous if (ec) 2741abe55efSEd Tanous { 275f12894f8SJason M. Bills messages::internalError(asyncResp->res); 276daf36e2eSEd Tanous return; 277daf36e2eSEd Tanous } 278daf36e2eSEd Tanous // Iterate over all retrieved ObjectPaths. 2791abe55efSEd Tanous for (const std::pair< 2801abe55efSEd Tanous std::string, 2811abe55efSEd Tanous std::vector< 2821abe55efSEd Tanous std::pair<std::string, std::vector<std::string>>>> 2831abe55efSEd Tanous &object : subtree) 2841abe55efSEd Tanous { 285daf36e2eSEd Tanous const std::string &path = object.first; 2861abe55efSEd Tanous const std::vector< 2871abe55efSEd Tanous std::pair<std::string, std::vector<std::string>>> 288daf36e2eSEd Tanous &connectionNames = object.second; 289e0d918bcSEd Tanous 2901abe55efSEd Tanous if (!boost::ends_with(path, chassisId)) 2911abe55efSEd Tanous { 292daf36e2eSEd Tanous continue; 293daf36e2eSEd Tanous } 29426f03899SShawn McCarney 295*b49ac873SJames Feist auto health = std::make_shared<HealthPopulate>(asyncResp); 296*b49ac873SJames Feist 297*b49ac873SJames Feist crow::connections::systemBus->async_method_call( 298*b49ac873SJames Feist [health](const boost::system::error_code ec, 299*b49ac873SJames Feist std::variant<std::vector<std::string>> &resp) { 300*b49ac873SJames Feist if (ec) 301*b49ac873SJames Feist { 302*b49ac873SJames Feist return; // no sensors = no failures 303*b49ac873SJames Feist } 304*b49ac873SJames Feist std::vector<std::string> *data = 305*b49ac873SJames Feist std::get_if<std::vector<std::string>>(&resp); 306*b49ac873SJames Feist if (data == nullptr) 307*b49ac873SJames Feist { 308*b49ac873SJames Feist return; 309*b49ac873SJames Feist } 310*b49ac873SJames Feist health->inventory = std::move(*data); 311*b49ac873SJames Feist }, 312*b49ac873SJames Feist "xyz.openbmc_project.ObjectMapper", 313*b49ac873SJames Feist path + "/all_sensors", 314*b49ac873SJames Feist "org.freedesktop.DBus.Properties", "Get", 315*b49ac873SJames Feist "xyz.openbmc_project.Association", "endpoints"); 316*b49ac873SJames Feist 317*b49ac873SJames Feist health->populate(); 318*b49ac873SJames Feist 3191abe55efSEd Tanous if (connectionNames.size() < 1) 3201abe55efSEd Tanous { 3211abe55efSEd Tanous BMCWEB_LOG_ERROR << "Only got " 3221abe55efSEd Tanous << connectionNames.size() 32355c7b7a2SEd Tanous << " Connection names"; 324e0d918bcSEd Tanous continue; 325daf36e2eSEd Tanous } 326e0d918bcSEd Tanous 32749c53ac9SJohnathan Mantey asyncResp->res.jsonValue["@odata.type"] = 32849c53ac9SJohnathan Mantey "#Chassis.v1_4_0.Chassis"; 32949c53ac9SJohnathan Mantey asyncResp->res.jsonValue["@odata.id"] = 33049c53ac9SJohnathan Mantey "/redfish/v1/Chassis/" + chassisId; 33149c53ac9SJohnathan Mantey asyncResp->res.jsonValue["@odata.context"] = 33249c53ac9SJohnathan Mantey "/redfish/v1/$metadata#Chassis.Chassis"; 33349c53ac9SJohnathan Mantey asyncResp->res.jsonValue["Name"] = "Chassis Collection"; 33449c53ac9SJohnathan Mantey asyncResp->res.jsonValue["ChassisType"] = "RackMount"; 33549c53ac9SJohnathan Mantey 33649c53ac9SJohnathan Mantey const std::string &connectionName = 33749c53ac9SJohnathan Mantey connectionNames[0].first; 33855c7b7a2SEd Tanous crow::connections::systemBus->async_method_call( 33962d5e2e4SEd Tanous [asyncResp, chassisId(std::string(chassisId))]( 34062d5e2e4SEd Tanous const boost::system::error_code ec, 3411abe55efSEd Tanous const std::vector<std::pair< 3421abe55efSEd Tanous std::string, VariantType>> &propertiesList) { 3431abe55efSEd Tanous for (const std::pair<std::string, VariantType> 3441abe55efSEd Tanous &property : propertiesList) 3451abe55efSEd Tanous { 34699cffd7fSShawn McCarney // Store DBus properties that are also Redfish 34799cffd7fSShawn McCarney // properties with same name and a string value 34899cffd7fSShawn McCarney const std::string &propertyName = 34999cffd7fSShawn McCarney property.first; 35099cffd7fSShawn McCarney if ((propertyName == "PartNumber") || 35199cffd7fSShawn McCarney (propertyName == "SerialNumber") || 35299cffd7fSShawn McCarney (propertyName == "Manufacturer") || 35399cffd7fSShawn McCarney (propertyName == "Model")) 35499cffd7fSShawn McCarney { 355daf36e2eSEd Tanous const std::string *value = 35699cffd7fSShawn McCarney std::get_if<std::string>( 35799cffd7fSShawn McCarney &property.second); 3581abe55efSEd Tanous if (value != nullptr) 3591abe55efSEd Tanous { 36099cffd7fSShawn McCarney asyncResp->res.jsonValue[propertyName] = 36162d5e2e4SEd Tanous *value; 362daf36e2eSEd Tanous } 363daf36e2eSEd Tanous } 36499cffd7fSShawn McCarney } 36562d5e2e4SEd Tanous asyncResp->res.jsonValue["Name"] = chassisId; 36662d5e2e4SEd Tanous asyncResp->res.jsonValue["Id"] = chassisId; 36762d5e2e4SEd Tanous asyncResp->res.jsonValue["Thermal"] = { 3681abe55efSEd Tanous {"@odata.id", "/redfish/v1/Chassis/" + 3691abe55efSEd Tanous chassisId + "/Thermal"}}; 3702474adfaSEd Tanous // Power object 3712474adfaSEd Tanous asyncResp->res.jsonValue["Power"] = { 3722474adfaSEd Tanous {"@odata.id", "/redfish/v1/Chassis/" + 3732474adfaSEd Tanous chassisId + "/Power"}}; 374029573d4SEd Tanous asyncResp->res.jsonValue["Status"] = { 375029573d4SEd Tanous {"State", "Enabled"}, 376029573d4SEd Tanous }; 3772474adfaSEd Tanous 378029573d4SEd Tanous asyncResp->res 379029573d4SEd Tanous .jsonValue["Links"]["ComputerSystems"] = { 380029573d4SEd Tanous {{"@odata.id", "/redfish/v1/Systems/system"}}}; 381029573d4SEd Tanous asyncResp->res.jsonValue["Links"]["ManagedBy"] = { 382029573d4SEd Tanous {{"@odata.id", "/redfish/v1/Managers/bmc"}}}; 383beeca0aeSGunnar Mills getChassisState(asyncResp); 384daf36e2eSEd Tanous }, 385daf36e2eSEd Tanous connectionName, path, "org.freedesktop.DBus.Properties", 3861abe55efSEd Tanous "GetAll", 3871abe55efSEd Tanous "xyz.openbmc_project.Inventory.Decorator.Asset"); 388daf36e2eSEd Tanous return; 389daf36e2eSEd Tanous } 390e0d918bcSEd Tanous 391daf36e2eSEd Tanous // Couldn't find an object with that name. return an error 392f12894f8SJason M. Bills messages::resourceNotFound( 393f12894f8SJason M. Bills asyncResp->res, "#Chassis.v1_4_0.Chassis", chassisId); 394daf36e2eSEd Tanous }, 395daf36e2eSEd Tanous "xyz.openbmc_project.ObjectMapper", 396daf36e2eSEd Tanous "/xyz/openbmc_project/object_mapper", 397daf36e2eSEd Tanous "xyz.openbmc_project.ObjectMapper", "GetSubTree", 398734bfe90SGunnar Mills "/xyz/openbmc_project/inventory", int32_t(0), interfaces); 399c181942fSQiang XU 400c181942fSQiang XU getPhysicalSecurityData(asyncResp); 401e37f8451SRapkiewicz, Pawel } 40262d5e2e4SEd Tanous }; 403e37f8451SRapkiewicz, Pawel } // namespace redfish 404