Tomáš Pecka | 6fcb759 | 2024-01-24 14:42:14 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2024 CESNET, https://photonics.cesnet.cz/ |
| 3 | * |
| 4 | * Written by Tomáš Pecka <tomas.pecka@cesnet.cz> |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #include "rpc.h" |
| 9 | #include "sysrepo-helpers/common.h" |
| 10 | |
| 11 | RPCWatcher::RPCWatcher(sysrepo::Session& session, const std::string& xpath) |
| 12 | : m_sub(session.onRPCAction(xpath, [&](auto, auto, auto, const libyang::DataNode input, auto, auto, auto) { |
| 13 | std::map<std::string, std::string> in; |
| 14 | |
| 15 | for (auto n : input.childrenDfs()) { |
| 16 | in.emplace(n.path(), nodeAsString(n)); |
| 17 | } |
| 18 | |
| 19 | rpc(in); |
| 20 | return sysrepo::ErrorCode::Ok; |
| 21 | })) |
| 22 | { |
| 23 | } |