Tomáš Pecka | c164ca6 | 2024-01-24 13:38:03 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016-2019 CESNET, https://photonics.cesnet.cz/ |
| 3 | * |
| 4 | * Written by Jan Kundrát <jan.kundrat@cesnet.cz> |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #pragma once |
| 9 | #include "trompeloeil_doctest.h" |
| 10 | #include <map> |
| 11 | #include <sysrepo-cpp/Session.hpp> |
| 12 | #include <sysrepo-cpp/Connection.hpp> |
| 13 | #include "test_log_setup.h" |
| 14 | |
Tomáš Pecka | 7eb6459 | 2024-01-24 14:10:47 +0100 | [diff] [blame] | 15 | struct Deleted { }; |
| 16 | bool operator==(const Deleted&, const Deleted&); |
| 17 | |
Tomáš Pecka | c164ca6 | 2024-01-24 13:38:03 +0100 | [diff] [blame] | 18 | using Values = std::map<std::string, std::string>; |
Tomáš Pecka | 7eb6459 | 2024-01-24 14:10:47 +0100 | [diff] [blame] | 19 | using ValueChanges = std::map<std::string, std::variant<std::string, Deleted>>; |
| 20 | |
| 21 | std::string nodeAsString(const libyang::DataNode& node); |
Tomáš Pecka | c164ca6 | 2024-01-24 13:38:03 +0100 | [diff] [blame] | 22 | |
| 23 | Values dataFromSysrepo(const sysrepo::Session& session, const std::string& xpath); |
| 24 | Values rpcFromSysrepo(sysrepo::Session session, const std::string& rpcPath, std::map<std::string, std::string> input); |
| 25 | Values dataFromSysrepo(sysrepo::Session session, const std::string& xpath, sysrepo::Datastore datastore); |
| 26 | |
Tomáš Pecka | de06290 | 2024-01-24 13:41:16 +0100 | [diff] [blame] | 27 | std::string moduleFromXpath(const std::string& xpath); |
| 28 | |
Tomáš Pecka | c164ca6 | 2024-01-24 13:38:03 +0100 | [diff] [blame] | 29 | #define TEST_SYSREPO_INIT \ |
| 30 | auto srConn = sysrepo::Connection{}; \ |
| 31 | auto srSess = srConn.sessionStart(); |
| 32 | |
| 33 | #define TEST_SYSREPO_INIT_CLIENT \ |
| 34 | auto clientConn = sysrepo::Connection{}; \ |
| 35 | auto client = clientConn.sessionStart(); |