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 18b49ac873SJames 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 185adc4f0dbSShawn McCarney const std::array<const char *, 2> interfaces = { 186603a6640SGunnar Mills "xyz.openbmc_project.Inventory.Item.Board", 187adc4f0dbSShawn McCarney "xyz.openbmc_project.Inventory.Item.Chassis"}; 188603a6640SGunnar Mills 18962d5e2e4SEd Tanous auto asyncResp = std::make_shared<AsyncResp>(res); 19062d5e2e4SEd Tanous crow::connections::systemBus->async_method_call( 19162d5e2e4SEd Tanous [asyncResp](const boost::system::error_code ec, 19262d5e2e4SEd Tanous const std::vector<std::string> &chassisList) { 19362d5e2e4SEd Tanous if (ec) 1941abe55efSEd Tanous { 195f12894f8SJason M. Bills messages::internalError(asyncResp->res); 19662d5e2e4SEd Tanous return; 197e37f8451SRapkiewicz, Pawel } 19862d5e2e4SEd Tanous nlohmann::json &chassisArray = 19962d5e2e4SEd Tanous asyncResp->res.jsonValue["Members"]; 20062d5e2e4SEd Tanous chassisArray = nlohmann::json::array(); 20162d5e2e4SEd Tanous for (const std::string &objpath : chassisList) 20262d5e2e4SEd Tanous { 20362d5e2e4SEd Tanous std::size_t lastPos = objpath.rfind("/"); 20462d5e2e4SEd Tanous if (lastPos == std::string::npos) 20562d5e2e4SEd Tanous { 20662d5e2e4SEd Tanous BMCWEB_LOG_ERROR << "Failed to find '/' in " << objpath; 20762d5e2e4SEd Tanous continue; 20862d5e2e4SEd Tanous } 20962d5e2e4SEd Tanous chassisArray.push_back( 21062d5e2e4SEd Tanous {{"@odata.id", "/redfish/v1/Chassis/" + 21162d5e2e4SEd Tanous objpath.substr(lastPos + 1)}}); 212e37f8451SRapkiewicz, Pawel } 213e37f8451SRapkiewicz, Pawel 21462d5e2e4SEd Tanous asyncResp->res.jsonValue["Members@odata.count"] = 21562d5e2e4SEd Tanous chassisArray.size(); 21662d5e2e4SEd Tanous }, 21762d5e2e4SEd Tanous "xyz.openbmc_project.ObjectMapper", 21862d5e2e4SEd Tanous "/xyz/openbmc_project/object_mapper", 21962d5e2e4SEd Tanous "xyz.openbmc_project.ObjectMapper", "GetSubTreePaths", 220734bfe90SGunnar Mills "/xyz/openbmc_project/inventory", int32_t(0), interfaces); 22162d5e2e4SEd Tanous } 222e37f8451SRapkiewicz, Pawel }; 223e37f8451SRapkiewicz, Pawel 224e37f8451SRapkiewicz, Pawel /** 225e37f8451SRapkiewicz, Pawel * Chassis override class for delivering Chassis Schema 226e37f8451SRapkiewicz, Pawel */ 2271abe55efSEd Tanous class Chassis : public Node 2281abe55efSEd Tanous { 229e37f8451SRapkiewicz, Pawel public: 2301abe55efSEd Tanous Chassis(CrowApp &app) : 2311abe55efSEd Tanous Node(app, "/redfish/v1/Chassis/<str>/", std::string()) 2321abe55efSEd Tanous { 233e0d918bcSEd Tanous entityPrivileges = { 234e0d918bcSEd Tanous {boost::beast::http::verb::get, {{"Login"}}}, 235e0d918bcSEd Tanous {boost::beast::http::verb::head, {{"Login"}}}, 236e0d918bcSEd Tanous {boost::beast::http::verb::patch, {{"ConfigureComponents"}}}, 237e0d918bcSEd Tanous {boost::beast::http::verb::put, {{"ConfigureComponents"}}}, 238e0d918bcSEd Tanous {boost::beast::http::verb::delete_, {{"ConfigureComponents"}}}, 239e0d918bcSEd Tanous {boost::beast::http::verb::post, {{"ConfigureComponents"}}}}; 240e37f8451SRapkiewicz, Pawel } 241e37f8451SRapkiewicz, Pawel 242e37f8451SRapkiewicz, Pawel private: 243e37f8451SRapkiewicz, Pawel /** 244e37f8451SRapkiewicz, Pawel * Functions triggers appropriate requests on DBus 245e37f8451SRapkiewicz, Pawel */ 24655c7b7a2SEd Tanous void doGet(crow::Response &res, const crow::Request &req, 2471abe55efSEd Tanous const std::vector<std::string> ¶ms) override 2481abe55efSEd Tanous { 249adc4f0dbSShawn McCarney const std::array<const char *, 2> interfaces = { 250734bfe90SGunnar Mills "xyz.openbmc_project.Inventory.Item.Board", 251adc4f0dbSShawn McCarney "xyz.openbmc_project.Inventory.Item.Chassis"}; 252734bfe90SGunnar Mills 253e37f8451SRapkiewicz, Pawel // Check if there is required param, truly entering this shall be 254e37f8451SRapkiewicz, Pawel // impossible. 2551abe55efSEd Tanous if (params.size() != 1) 2561abe55efSEd Tanous { 257f12894f8SJason M. Bills messages::internalError(res); 258e37f8451SRapkiewicz, Pawel res.end(); 259e37f8451SRapkiewicz, Pawel return; 260e37f8451SRapkiewicz, Pawel } 26199cffd7fSShawn McCarney const std::string &chassisId = params[0]; 262e37f8451SRapkiewicz, Pawel 26362d5e2e4SEd Tanous auto asyncResp = std::make_shared<AsyncResp>(res); 26455c7b7a2SEd Tanous crow::connections::systemBus->async_method_call( 26562d5e2e4SEd Tanous [asyncResp, chassisId(std::string(chassisId))]( 26662d5e2e4SEd Tanous const boost::system::error_code ec, 267daf36e2eSEd Tanous const std::vector<std::pair< 2681abe55efSEd Tanous std::string, std::vector<std::pair< 2691abe55efSEd Tanous std::string, std::vector<std::string>>>>> 270daf36e2eSEd Tanous &subtree) { 27162d5e2e4SEd Tanous if (ec) 2721abe55efSEd Tanous { 273f12894f8SJason M. Bills messages::internalError(asyncResp->res); 274daf36e2eSEd Tanous return; 275daf36e2eSEd Tanous } 276daf36e2eSEd Tanous // Iterate over all retrieved ObjectPaths. 2771abe55efSEd Tanous for (const std::pair< 2781abe55efSEd Tanous std::string, 2791abe55efSEd Tanous std::vector< 2801abe55efSEd Tanous std::pair<std::string, std::vector<std::string>>>> 2811abe55efSEd Tanous &object : subtree) 2821abe55efSEd Tanous { 283daf36e2eSEd Tanous const std::string &path = object.first; 2841abe55efSEd Tanous const std::vector< 2851abe55efSEd Tanous std::pair<std::string, std::vector<std::string>>> 286daf36e2eSEd Tanous &connectionNames = object.second; 287e0d918bcSEd Tanous 2881abe55efSEd Tanous if (!boost::ends_with(path, chassisId)) 2891abe55efSEd Tanous { 290daf36e2eSEd Tanous continue; 291daf36e2eSEd Tanous } 29226f03899SShawn McCarney 293b49ac873SJames Feist auto health = std::make_shared<HealthPopulate>(asyncResp); 294b49ac873SJames Feist 295b49ac873SJames Feist crow::connections::systemBus->async_method_call( 296b49ac873SJames Feist [health](const boost::system::error_code ec, 297b49ac873SJames Feist std::variant<std::vector<std::string>> &resp) { 298b49ac873SJames Feist if (ec) 299b49ac873SJames Feist { 300b49ac873SJames Feist return; // no sensors = no failures 301b49ac873SJames Feist } 302b49ac873SJames Feist std::vector<std::string> *data = 303b49ac873SJames Feist std::get_if<std::vector<std::string>>(&resp); 304b49ac873SJames Feist if (data == nullptr) 305b49ac873SJames Feist { 306b49ac873SJames Feist return; 307b49ac873SJames Feist } 308b49ac873SJames Feist health->inventory = std::move(*data); 309b49ac873SJames Feist }, 310b49ac873SJames Feist "xyz.openbmc_project.ObjectMapper", 311b49ac873SJames Feist path + "/all_sensors", 312b49ac873SJames Feist "org.freedesktop.DBus.Properties", "Get", 313b49ac873SJames Feist "xyz.openbmc_project.Association", "endpoints"); 314b49ac873SJames Feist 315b49ac873SJames Feist health->populate(); 316b49ac873SJames Feist 3171abe55efSEd Tanous if (connectionNames.size() < 1) 3181abe55efSEd Tanous { 3191abe55efSEd Tanous BMCWEB_LOG_ERROR << "Only got " 3201abe55efSEd Tanous << connectionNames.size() 32155c7b7a2SEd Tanous << " Connection names"; 322e0d918bcSEd Tanous continue; 323daf36e2eSEd Tanous } 324e0d918bcSEd Tanous 32549c53ac9SJohnathan Mantey asyncResp->res.jsonValue["@odata.type"] = 326*95a3ecadSAnthony Wilson "#Chassis.v1_9_0.Chassis"; 32749c53ac9SJohnathan Mantey asyncResp->res.jsonValue["@odata.id"] = 32849c53ac9SJohnathan Mantey "/redfish/v1/Chassis/" + chassisId; 32949c53ac9SJohnathan Mantey asyncResp->res.jsonValue["@odata.context"] = 33049c53ac9SJohnathan Mantey "/redfish/v1/$metadata#Chassis.Chassis"; 33149c53ac9SJohnathan Mantey asyncResp->res.jsonValue["Name"] = "Chassis Collection"; 33249c53ac9SJohnathan Mantey asyncResp->res.jsonValue["ChassisType"] = "RackMount"; 33349c53ac9SJohnathan Mantey 33449c53ac9SJohnathan Mantey const std::string &connectionName = 33549c53ac9SJohnathan Mantey connectionNames[0].first; 33655c7b7a2SEd Tanous crow::connections::systemBus->async_method_call( 33762d5e2e4SEd Tanous [asyncResp, chassisId(std::string(chassisId))]( 33862d5e2e4SEd Tanous const boost::system::error_code ec, 3391abe55efSEd Tanous const std::vector<std::pair< 3401abe55efSEd Tanous std::string, VariantType>> &propertiesList) { 3411abe55efSEd Tanous for (const std::pair<std::string, VariantType> 3421abe55efSEd Tanous &property : propertiesList) 3431abe55efSEd Tanous { 34499cffd7fSShawn McCarney // Store DBus properties that are also Redfish 34599cffd7fSShawn McCarney // properties with same name and a string value 34699cffd7fSShawn McCarney const std::string &propertyName = 34799cffd7fSShawn McCarney property.first; 34899cffd7fSShawn McCarney if ((propertyName == "PartNumber") || 34999cffd7fSShawn McCarney (propertyName == "SerialNumber") || 35099cffd7fSShawn McCarney (propertyName == "Manufacturer") || 35199cffd7fSShawn McCarney (propertyName == "Model")) 35299cffd7fSShawn McCarney { 353daf36e2eSEd Tanous const std::string *value = 35499cffd7fSShawn McCarney std::get_if<std::string>( 35599cffd7fSShawn McCarney &property.second); 3561abe55efSEd Tanous if (value != nullptr) 3571abe55efSEd Tanous { 35899cffd7fSShawn McCarney asyncResp->res.jsonValue[propertyName] = 35962d5e2e4SEd Tanous *value; 360daf36e2eSEd Tanous } 361daf36e2eSEd Tanous } 36299cffd7fSShawn McCarney } 36362d5e2e4SEd Tanous asyncResp->res.jsonValue["Name"] = chassisId; 36462d5e2e4SEd Tanous asyncResp->res.jsonValue["Id"] = chassisId; 36562d5e2e4SEd Tanous asyncResp->res.jsonValue["Thermal"] = { 3661abe55efSEd Tanous {"@odata.id", "/redfish/v1/Chassis/" + 3671abe55efSEd Tanous chassisId + "/Thermal"}}; 3682474adfaSEd Tanous // Power object 3692474adfaSEd Tanous asyncResp->res.jsonValue["Power"] = { 3702474adfaSEd Tanous {"@odata.id", "/redfish/v1/Chassis/" + 3712474adfaSEd Tanous chassisId + "/Power"}}; 372*95a3ecadSAnthony Wilson // SensorCollection 373*95a3ecadSAnthony Wilson asyncResp->res.jsonValue["Sensors"] = { 374*95a3ecadSAnthony Wilson {"@odata.id", "/redfish/v1/Chassis/" + 375*95a3ecadSAnthony Wilson chassisId + "/Sensors"}}; 376029573d4SEd Tanous asyncResp->res.jsonValue["Status"] = { 377029573d4SEd Tanous {"State", "Enabled"}, 378029573d4SEd Tanous }; 3792474adfaSEd Tanous 380029573d4SEd Tanous asyncResp->res 381029573d4SEd Tanous .jsonValue["Links"]["ComputerSystems"] = { 382029573d4SEd Tanous {{"@odata.id", "/redfish/v1/Systems/system"}}}; 383029573d4SEd Tanous asyncResp->res.jsonValue["Links"]["ManagedBy"] = { 384029573d4SEd Tanous {{"@odata.id", "/redfish/v1/Managers/bmc"}}}; 385beeca0aeSGunnar Mills getChassisState(asyncResp); 386daf36e2eSEd Tanous }, 387daf36e2eSEd Tanous connectionName, path, "org.freedesktop.DBus.Properties", 3881abe55efSEd Tanous "GetAll", 3891abe55efSEd Tanous "xyz.openbmc_project.Inventory.Decorator.Asset"); 390daf36e2eSEd Tanous return; 391daf36e2eSEd Tanous } 392e0d918bcSEd Tanous 393daf36e2eSEd Tanous // Couldn't find an object with that name. return an error 394f12894f8SJason M. Bills messages::resourceNotFound( 395*95a3ecadSAnthony Wilson asyncResp->res, "#Chassis.v1_9_0.Chassis", chassisId); 396daf36e2eSEd Tanous }, 397daf36e2eSEd Tanous "xyz.openbmc_project.ObjectMapper", 398daf36e2eSEd Tanous "/xyz/openbmc_project/object_mapper", 399daf36e2eSEd Tanous "xyz.openbmc_project.ObjectMapper", "GetSubTree", 400734bfe90SGunnar Mills "/xyz/openbmc_project/inventory", int32_t(0), interfaces); 401c181942fSQiang XU 402c181942fSQiang XU getPhysicalSecurityData(asyncResp); 403e37f8451SRapkiewicz, Pawel } 40462d5e2e4SEd Tanous }; 405e37f8451SRapkiewicz, Pawel } // namespace redfish 406