Tomáš Pecka | ba2dc31 | 2021-01-23 22:29:11 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2020 CESNET, https://photonics.cesnet.cz/ |
| 3 | * |
| 4 | * Written by Tomáš Pecka <tomas.pecka@fit.cvut.cz> |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #pragma once |
| 9 | |
| 10 | #include <sysrepo-cpp/Session.hpp> |
Václav Kubernát | 7efd6d5 | 2021-11-09 01:31:11 +0100 | [diff] [blame] | 11 | #include <map> |
Tomáš Pecka | ba2dc31 | 2021-01-23 22:29:11 +0100 | [diff] [blame] | 12 | #include <string> |
| 13 | |
| 14 | namespace velia::utils { |
| 15 | |
Tomáš Pecka | 53f08ee | 2021-04-28 12:38:11 +0200 | [diff] [blame] | 16 | struct YANGPair { |
| 17 | std::string m_xpath; |
| 18 | std::string m_value; |
| 19 | |
| 20 | YANGPair(std::string xpath, std::string value); |
| 21 | }; |
| 22 | |
Jan Kundrát | 498c3f8 | 2023-05-24 19:25:48 +0200 | [diff] [blame] | 23 | void valuesToYang(const std::vector<YANGPair>& values, const std::vector<std::string>& removePaths, const std::vector<std::string>& discardPaths, ::sysrepo::Session session, std::optional<libyang::DataNode>& parent); |
| 24 | void valuesToYang(const std::map<std::string, std::string>& values, const std::vector<std::string>& removePaths, const std::vector<std::string>& discardPaths, ::sysrepo::Session session, std::optional<libyang::DataNode>& parent); |
Tomáš Pecka | 53f08ee | 2021-04-28 12:38:11 +0200 | [diff] [blame] | 25 | |
Jan Kundrát | 498c3f8 | 2023-05-24 19:25:48 +0200 | [diff] [blame] | 26 | void valuesPush(const std::map<std::string, std::string>& values, const std::vector<std::string>& removePaths, const std::vector<std::string>& discardPaths, ::sysrepo::Session session); |
| 27 | void valuesPush(const std::vector<YANGPair>& values, const std::vector<std::string>& removePaths, const std::vector<std::string>& discardPaths, ::sysrepo::Session session); |
| 28 | void valuesPush(const std::map<std::string, std::string>& values, const std::vector<std::string>& removePaths, const std::vector<std::string>& discardPaths, ::sysrepo::Session session, sysrepo::Datastore datastore); |
| 29 | void valuesPush(const std::vector<YANGPair>& values, const std::vector<std::string>& removePaths, const std::vector<std::string>& discardPaths, ::sysrepo::Session session, sysrepo::Datastore datastore); |
Tomáš Pecka | 53f08ee | 2021-04-28 12:38:11 +0200 | [diff] [blame] | 30 | |
Tomáš Pecka | ba2dc31 | 2021-01-23 22:29:11 +0100 | [diff] [blame] | 31 | void initLogsSysrepo(); |
Václav Kubernát | 7efd6d5 | 2021-11-09 01:31:11 +0100 | [diff] [blame] | 32 | void ensureModuleImplemented(::sysrepo::Session session, const std::string& module, const std::string& revision); |
Tomáš Pecka | ba2dc31 | 2021-01-23 22:29:11 +0100 | [diff] [blame] | 33 | |
Václav Kubernát | 7efd6d5 | 2021-11-09 01:31:11 +0100 | [diff] [blame] | 34 | void setErrors(::sysrepo::Session session, const std::string& msg); |
Tomáš Pecka | ba2dc31 | 2021-01-23 22:29:11 +0100 | [diff] [blame] | 35 | } |