blob: eb32038bd97438e43ae68a24108ae53685c84fcd [file] [log] [blame]
Tomáš Pecka6fcb7592024-01-24 14:42:14 +01001/*
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
11RPCWatcher::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}