blob: abbb0b305fc7ad4978d51bf20d3d2afff8a97355 [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);
Richard Marian Thomaiyar4ae87cd2019-01-28 20:55:37 +053032 auto server = sdbusplus::asio::object_server(conn, true);
33 auto mgrInterface =
34 server.add_interface("/xyz/openbmc_project/control/service", "");
35 mgrInterface->initialize();
36 server.add_manager("/xyz/openbmc_project/control/service");
AppaRao Puli00840472018-10-03 19:37:46 +053037 for (const auto &service : serviceList)
38 {
39 std::string objPath("/xyz/openbmc_project/control/service/" +
40 service.first);
41 auto srvCfgObj = std::make_unique<phosphor::service::ServiceConfig>(
42 server, conn, objPath, service.second);
43 srvMgrObjects.emplace(
44 std::make_pair(std::move(service.first), std::move(srvCfgObj)));
45 }
46 io.run();
47
48 return 0;
49}