blob: 7f8a244be547517070372d6067996efee6606442 [file] [log] [blame]
Tomáš Peckaba2dc312021-01-23 22:29:11 +01001/*
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át7efd6d52021-11-09 01:31:11 +010011#include <map>
Tomáš Peckaba2dc312021-01-23 22:29:11 +010012#include <string>
13
14namespace velia::utils {
15
Tomáš Pecka53f08ee2021-04-28 12:38:11 +020016struct YANGPair {
17 std::string m_xpath;
18 std::string m_value;
19
20 YANGPair(std::string xpath, std::string value);
21};
22
Jan Kundrát498c3f82023-05-24 19:25:48 +020023void 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);
24void 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áš Pecka53f08ee2021-04-28 12:38:11 +020025
Jan Kundrát498c3f82023-05-24 19:25:48 +020026void valuesPush(const std::map<std::string, std::string>& values, const std::vector<std::string>& removePaths, const std::vector<std::string>& discardPaths, ::sysrepo::Session session);
27void valuesPush(const std::vector<YANGPair>& values, const std::vector<std::string>& removePaths, const std::vector<std::string>& discardPaths, ::sysrepo::Session session);
28void 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);
29void 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áš Pecka53f08ee2021-04-28 12:38:11 +020030
Tomáš Peckaba2dc312021-01-23 22:29:11 +010031void initLogsSysrepo();
Václav Kubernát7efd6d52021-11-09 01:31:11 +010032void ensureModuleImplemented(::sysrepo::Session session, const std::string& module, const std::string& revision);
Tomáš Peckaba2dc312021-01-23 22:29:11 +010033
Václav Kubernát7efd6d52021-11-09 01:31:11 +010034void setErrors(::sysrepo::Session session, const std::string& msg);
Tomáš Peckaba2dc312021-01-23 22:29:11 +010035}