blob: ffb0e11b2b7889408d71e3ca4e5246cfa56f4b0c [file] [log] [blame]
AppaRao Puli00840472018-10-03 19:37:46 +05301/*
2// Copyright (c) 2018 Intel Corporation
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15*/
16#include "srvcfg_manager.hpp"
17
18std::shared_ptr<boost::asio::deadline_timer> timer = nullptr;
19std::map<std::string, std::shared_ptr<phosphor::service::ServiceConfig>>
20 srvMgrObjects;
21
22static std::map<std::string, std::string> serviceList = {
23 {"netipmid", "phosphor-ipmi-net"}, {"web", "bmcweb"}, {"ssh", "dropbear"}};
24
25int main()
26{
27 // setup connection to dbus
28 boost::asio::io_service io;
29 auto conn = std::make_shared<sdbusplus::asio::connection>(io);
30 timer = std::make_shared<boost::asio::deadline_timer>(io);
31 conn->request_name(phosphor::service::serviceConfigSrvName);
32 auto server = sdbusplus::asio::object_server(conn);
33 for (const auto &service : serviceList)
34 {
35 std::string objPath("/xyz/openbmc_project/control/service/" +
36 service.first);
37 auto srvCfgObj = std::make_unique<phosphor::service::ServiceConfig>(
38 server, conn, objPath, service.second);
39 srvMgrObjects.emplace(
40 std::make_pair(std::move(service.first), std::move(srvCfgObj)));
41 }
42 io.run();
43
44 return 0;
45}