mirror of
https://github.com/kernelkit/infix.git
synced 2026-08-06 07:33:01 +02:00
Remove local libyang-cpp and sysrepo-cpp
It has been included in buildroot
This commit is contained in:
@@ -1,47 +0,0 @@
|
||||
From ee0ce2ea31f3ecba4a4753a761df08f0698c2726 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= <jan.kundrat@cesnet.cz>
|
||||
Date: Mon, 20 Oct 2025 11:47:26 +0200
|
||||
Subject: [PATCH 1/9] CI: pin to libyang v3
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
Organization: Wires
|
||||
|
||||
Depends-on: https://gerrit.cesnet.cz/c/CzechLight/libyang-cpp/+/8978
|
||||
Change-Id: I2521ad3a62d6197e757e636b88478deeb3bb5592
|
||||
Signed-off-by: Mattias Walström <lazzer@gmail.com>
|
||||
---
|
||||
.zuul.yaml | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/.zuul.yaml b/.zuul.yaml
|
||||
index 7ada6f7..cef174f 100644
|
||||
--- a/.zuul.yaml
|
||||
+++ b/.zuul.yaml
|
||||
@@ -4,9 +4,9 @@
|
||||
- f38-gcc-cover:
|
||||
required-projects:
|
||||
- name: github/CESNET/libyang
|
||||
- override-checkout: devel
|
||||
+ override-checkout: cesnet/2025-07-08
|
||||
- name: github/sysrepo/sysrepo
|
||||
- override-checkout: devel
|
||||
+ override-checkout: cesnet/2025-06-02
|
||||
- name: github/doctest/doctest
|
||||
override-checkout: v2.4.8
|
||||
- name: github/rollbear/trompeloeil
|
||||
@@ -15,9 +15,9 @@
|
||||
- f38-clang-asan-ubsan:
|
||||
required-projects: &projects
|
||||
- name: github/CESNET/libyang
|
||||
- override-checkout: devel
|
||||
+ override-checkout: cesnet/2025-07-08
|
||||
- name: github/sysrepo/sysrepo
|
||||
- override-checkout: devel
|
||||
+ override-checkout: cesnet/2025-06-02
|
||||
- name: github/doctest/doctest
|
||||
override-checkout: v2.4.11
|
||||
- name: github/rollbear/trompeloeil
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
From e49463aba8b44b932fdd342d1c1d117e70414aba Mon Sep 17 00:00:00 2001
|
||||
From: Edoardo Bortolozzo <edoardo.bortolozzo@thinkquantum.com>
|
||||
Date: Fri, 17 Oct 2025 18:08:47 +0200
|
||||
Subject: [PATCH 2/9] fix: implicit dependency on optional
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
Organization: Wires
|
||||
|
||||
chrono imports optional in gcc >=13.
|
||||
added the explicit include to compile in gcc <=12.
|
||||
|
||||
Change-Id: I18cc1a45ab522ee6738d4bc7080696cba8284903
|
||||
Signed-off-by: Mattias Walström <lazzer@gmail.com>
|
||||
---
|
||||
include/sysrepo-cpp/Connection.hpp | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/include/sysrepo-cpp/Connection.hpp b/include/sysrepo-cpp/Connection.hpp
|
||||
index bf72bcd..a469a2c 100644
|
||||
--- a/include/sysrepo-cpp/Connection.hpp
|
||||
+++ b/include/sysrepo-cpp/Connection.hpp
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
+#include <optional>
|
||||
#include <chrono>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
From b8e349aacae4c7063517a1bc652e9e93f90e28ba Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= <jan.kundrat@cesnet.cz>
|
||||
Date: Fri, 24 Oct 2025 17:05:52 +0200
|
||||
Subject: [PATCH 3/9] fix #include for for our public headers
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
Organization: Wires
|
||||
|
||||
Change-Id: Idcbfe38348e3ca2e4331fc1fad542ae759b8d0f1
|
||||
Signed-off-by: Mattias Walström <lazzer@gmail.com>
|
||||
---
|
||||
src/utils/utils.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/utils/utils.cpp b/src/utils/utils.cpp
|
||||
index ff4a32c..c13b394 100644
|
||||
--- a/src/utils/utils.cpp
|
||||
+++ b/src/utils/utils.cpp
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
#include <sysrepo-cpp/Connection.hpp>
|
||||
-#include "sysrepo-cpp/utils/exception.hpp"
|
||||
+#include <sysrepo-cpp/utils/exception.hpp>
|
||||
extern "C" {
|
||||
#include <sysrepo.h>
|
||||
}
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
From 753a3e6eb346f2a9f6263b2d9fcd1c6dbb508247 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= <jan.kundrat@cesnet.cz>
|
||||
Date: Fri, 24 Oct 2025 17:06:56 +0200
|
||||
Subject: [PATCH 4/9] reduce number of files which are named "utils.hpp"
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
Organization: Wires
|
||||
|
||||
We used to have three (one in publicheaders, one in src/utils/, one
|
||||
below tests/). Let's cut that by one to increase our collective sanity.
|
||||
|
||||
Change-Id: I9e3d93c65dffb29ba18b3ae325ddd7712a8be7a4
|
||||
Signed-off-by: Mattias Walström <lazzer@gmail.com>
|
||||
---
|
||||
src/Connection.cpp | 2 +-
|
||||
src/Session.cpp | 2 +-
|
||||
src/Subscription.cpp | 2 +-
|
||||
src/utils/{utils.hpp => misc.hpp} | 0
|
||||
src/utils/utils.cpp | 2 +-
|
||||
5 files changed, 4 insertions(+), 4 deletions(-)
|
||||
rename src/utils/{utils.hpp => misc.hpp} (100%)
|
||||
|
||||
diff --git a/src/Connection.cpp b/src/Connection.cpp
|
||||
index 0297ebe..1717b9a 100644
|
||||
--- a/src/Connection.cpp
|
||||
+++ b/src/Connection.cpp
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
#include <sysrepo-cpp/utils/exception.hpp>
|
||||
#include "utils/enum.hpp"
|
||||
#include "utils/exception.hpp"
|
||||
-#include "utils/utils.hpp"
|
||||
+#include "utils/misc.hpp"
|
||||
|
||||
namespace sysrepo {
|
||||
|
||||
diff --git a/src/Session.cpp b/src/Session.cpp
|
||||
index dfe1044..994ce87 100644
|
||||
--- a/src/Session.cpp
|
||||
+++ b/src/Session.cpp
|
||||
@@ -21,7 +21,7 @@ extern "C" {
|
||||
#include <utility>
|
||||
#include "utils/enum.hpp"
|
||||
#include "utils/exception.hpp"
|
||||
-#include "utils/utils.hpp"
|
||||
+#include "utils/misc.hpp"
|
||||
|
||||
using namespace std::string_literals;
|
||||
namespace sysrepo {
|
||||
diff --git a/src/Subscription.cpp b/src/Subscription.cpp
|
||||
index 303b54c..5bb724e 100644
|
||||
--- a/src/Subscription.cpp
|
||||
+++ b/src/Subscription.cpp
|
||||
@@ -16,7 +16,7 @@ extern "C" {
|
||||
}
|
||||
#include "utils/enum.hpp"
|
||||
#include "utils/exception.hpp"
|
||||
-#include "utils/utils.hpp"
|
||||
+#include "utils/misc.hpp"
|
||||
|
||||
namespace sysrepo {
|
||||
/**
|
||||
diff --git a/src/utils/utils.hpp b/src/utils/misc.hpp
|
||||
similarity index 100%
|
||||
rename from src/utils/utils.hpp
|
||||
rename to src/utils/misc.hpp
|
||||
diff --git a/src/utils/utils.cpp b/src/utils/utils.cpp
|
||||
index c13b394..2e8d8b4 100644
|
||||
--- a/src/utils/utils.cpp
|
||||
+++ b/src/utils/utils.cpp
|
||||
@@ -12,7 +12,7 @@ extern "C" {
|
||||
#include <sysrepo.h>
|
||||
}
|
||||
#include "enum.hpp"
|
||||
-#include "utils.hpp"
|
||||
+#include "misc.hpp"
|
||||
|
||||
namespace sysrepo {
|
||||
/**
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
From dc118efa44b13508e1af47d924ad02ce58c58cea Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= <jan.kundrat@cesnet.cz>
|
||||
Date: Fri, 24 Oct 2025 17:18:49 +0200
|
||||
Subject: [PATCH 5/9] Fix a different function return type
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
Organization: Wires
|
||||
|
||||
The prototype that was specified in the header file did not match what
|
||||
was used in the corresponding .cpp implementation. This has not been a
|
||||
problem because that implementation .cpp file was not including the
|
||||
actual header, so this was not detected. Then, at runtime, this was not
|
||||
a problem due to the way how derived types are laid out in memory.
|
||||
|
||||
Fixes: 6ed5442 Utilities for working with existing sysrepo:discard-items nodes
|
||||
Change-Id: Ie4cf8c0e39e9c8486a6289c0328510ad6f7360fb
|
||||
Signed-off-by: Mattias Walström <lazzer@gmail.com>
|
||||
---
|
||||
src/utils/utils.cpp | 7 ++++---
|
||||
1 file changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/utils/utils.cpp b/src/utils/utils.cpp
|
||||
index 2e8d8b4..61d0c7f 100644
|
||||
--- a/src/utils/utils.cpp
|
||||
+++ b/src/utils/utils.cpp
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <sysrepo-cpp/Connection.hpp>
|
||||
#include <sysrepo-cpp/utils/exception.hpp>
|
||||
+#include <sysrepo-cpp/utils/utils.hpp>
|
||||
extern "C" {
|
||||
#include <sysrepo.h>
|
||||
}
|
||||
@@ -78,7 +79,7 @@ void checkNoThreadFlag(const SubscribeOptions opts, const std::optional<FDHandli
|
||||
* @see Session::operationalChanges()
|
||||
* @see Session::dropForeignOperationalContent()
|
||||
*/
|
||||
-std::optional<libyang::DataNode> findMatchingDiscard(libyang::DataNode root, const std::string& xpath)
|
||||
+std::optional<libyang::DataNodeOpaque> findMatchingDiscard(libyang::DataNode root, const std::string& xpath)
|
||||
{
|
||||
auto discard = root.firstOpaqueSibling();
|
||||
while (discard) {
|
||||
@@ -97,11 +98,11 @@ std::optional<libyang::DataNode> findMatchingDiscard(libyang::DataNode root, con
|
||||
/**
|
||||
* @short Find all sysrepo:discard-items nodes which match the given XPath or the descendants of this XPath
|
||||
*/
|
||||
-std::vector<libyang::DataNode> findMatchingDiscardPrefixes(libyang::DataNode root, const std::string& xpathPrefix)
|
||||
+std::vector<libyang::DataNodeOpaque> findMatchingDiscardPrefixes(libyang::DataNode root, const std::string& xpathPrefix)
|
||||
{
|
||||
auto withSlash = (xpathPrefix.empty() || xpathPrefix[xpathPrefix.size() - 1] == '/') ? xpathPrefix : xpathPrefix + '/';
|
||||
auto withBracket = (xpathPrefix.empty() || xpathPrefix[xpathPrefix.size() - 1] == '[') ? xpathPrefix : xpathPrefix + '[';
|
||||
- std::vector<libyang::DataNode> res;
|
||||
+ std::vector<libyang::DataNodeOpaque> res;
|
||||
auto discard = root.firstOpaqueSibling();
|
||||
while (discard) {
|
||||
if (discard->name().matches("sysrepo", "discard-items")) {
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
From b943faea3cb00c5e86f21710647a2ca370e41f33 Mon Sep 17 00:00:00 2001
|
||||
From: Edoardo Bortolozzo <edoardo.bortolozzo@thinkquantum.com>
|
||||
Date: Fri, 24 Oct 2025 13:45:00 +0200
|
||||
Subject: [PATCH 6/9] fix: raw strings and macros break gcc < 13
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
Organization: Wires
|
||||
|
||||
see bug report:
|
||||
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55971
|
||||
|
||||
Change-Id: I04afc2b3bee86a7e4b038b277aad0e3a150a1940
|
||||
Signed-off-by: Mattias Walström <lazzer@gmail.com>
|
||||
---
|
||||
tests/subscriptions-dynamic.cpp | 21 ++++++++++++++-------
|
||||
1 file changed, 14 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/tests/subscriptions-dynamic.cpp b/tests/subscriptions-dynamic.cpp
|
||||
index 5ed173b..561df0c 100644
|
||||
--- a/tests/subscriptions-dynamic.cpp
|
||||
+++ b/tests/subscriptions-dynamic.cpp
|
||||
@@ -39,21 +39,28 @@
|
||||
REQUIRE(pipeStatus((SUBSCRIPTION).fd(), -1) == PipeStatus::DataReady); \
|
||||
(SUBSCRIPTION).processEvent(cbNotif);
|
||||
|
||||
-#define SUBSCRIPTION_TERMINATED(SUBSCRIPTION) R"({
|
||||
+auto SUBSCRIPTION_TERMINATED(const auto& SUBSCRIPTION)
|
||||
+{
|
||||
+ return R"({
|
||||
"ietf-subscribed-notifications:subscription-terminated": {
|
||||
- "id": )" + std::to_string((SUBSCRIPTION).subscriptionId()) + R"(,
|
||||
+ "id": )"
|
||||
+ + std::to_string((SUBSCRIPTION).subscriptionId()) + R"(,
|
||||
"reason": "no-such-subscription"
|
||||
}
|
||||
}
|
||||
-)"
|
||||
+)";
|
||||
+};
|
||||
|
||||
-#define REPLAY_COMPLETED(SUBSCRIPTION) R"({
|
||||
+auto REPLAY_COMPLETED(const auto& SUBSCRIPTION)
|
||||
+{
|
||||
+ return R"({
|
||||
"ietf-subscribed-notifications:replay-completed": {
|
||||
- "id": )" \
|
||||
- + std::to_string((SUBSCRIPTION).subscriptionId()) + R"(
|
||||
+ "id": )"
|
||||
+ + std::to_string((SUBSCRIPTION).subscriptionId()) + R"(
|
||||
}
|
||||
}
|
||||
-)"
|
||||
+)";
|
||||
+};
|
||||
|
||||
#define REQUIRE_YANG_PUSH_UPDATE(SUBSCRIPTION, NOTIFICATION) \
|
||||
TROMPELOEIL_REQUIRE_CALL(rec, recordYangPushUpdate((SUBSCRIPTION).subscriptionId(), NOTIFICATION)).IN_SEQUENCE(seq);
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@@ -1,305 +0,0 @@
|
||||
From 5fd8cf4fb8db1d65b6a20d2777bad22647e7f5e0 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= <jan.kundrat@cesnet.cz>
|
||||
Date: Thu, 23 Oct 2025 16:04:10 +0200
|
||||
Subject: [PATCH 7/9] Port to libyang v4
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
Organization: Wires
|
||||
|
||||
I'm rather disappointed with the upstream changes that implement that
|
||||
shared libyang "printed context" mapped to a fixed address, I think it's
|
||||
effectively a step backwards. Upstream is happy with their solution, so
|
||||
here we are.
|
||||
|
||||
Change-Id: I6b89422ec66bc694dc2c6ecd0d40aa1e7f76a741
|
||||
Depends-on: https://gerrit.cesnet.cz/c/CzechLight/libyang-cpp/+/8984
|
||||
Signed-off-by: Mattias Walström <lazzer@gmail.com>
|
||||
---
|
||||
.zuul.yaml | 8 +++---
|
||||
CMakeLists.txt | 6 ++---
|
||||
ci/build.sh | 4 +++
|
||||
include/sysrepo-cpp/Enum.hpp | 18 ++++++++++---
|
||||
include/sysrepo-cpp/utils/utils.hpp | 5 ++++
|
||||
src/Connection.cpp | 3 +--
|
||||
src/Session.cpp | 2 +-
|
||||
src/utils/enum.hpp | 18 +++++++------
|
||||
src/utils/utils.cpp | 18 +++++++++++++
|
||||
tests/session.cpp | 39 +++++++++++++++++++++--------
|
||||
10 files changed, 90 insertions(+), 31 deletions(-)
|
||||
|
||||
diff --git a/.zuul.yaml b/.zuul.yaml
|
||||
index cef174f..7ada6f7 100644
|
||||
--- a/.zuul.yaml
|
||||
+++ b/.zuul.yaml
|
||||
@@ -4,9 +4,9 @@
|
||||
- f38-gcc-cover:
|
||||
required-projects:
|
||||
- name: github/CESNET/libyang
|
||||
- override-checkout: cesnet/2025-07-08
|
||||
+ override-checkout: devel
|
||||
- name: github/sysrepo/sysrepo
|
||||
- override-checkout: cesnet/2025-06-02
|
||||
+ override-checkout: devel
|
||||
- name: github/doctest/doctest
|
||||
override-checkout: v2.4.8
|
||||
- name: github/rollbear/trompeloeil
|
||||
@@ -15,9 +15,9 @@
|
||||
- f38-clang-asan-ubsan:
|
||||
required-projects: &projects
|
||||
- name: github/CESNET/libyang
|
||||
- override-checkout: cesnet/2025-07-08
|
||||
+ override-checkout: devel
|
||||
- name: github/sysrepo/sysrepo
|
||||
- override-checkout: cesnet/2025-06-02
|
||||
+ override-checkout: devel
|
||||
- name: github/doctest/doctest
|
||||
override-checkout: v2.4.11
|
||||
- name: github/rollbear/trompeloeil
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index f2a9b09..49338dd 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -19,7 +19,7 @@ add_custom_target(sysrepo-cpp-version-cmake
|
||||
cmake/ProjectGitVersionRunner.cmake
|
||||
)
|
||||
include(cmake/ProjectGitVersion.cmake)
|
||||
-set(SYSREPO_CPP_PKG_VERSION "6")
|
||||
+set(SYSREPO_CPP_PKG_VERSION "7")
|
||||
prepare_git_version(SYSREPO_CPP_VERSION ${SYSREPO_CPP_PKG_VERSION})
|
||||
|
||||
find_package(Doxygen)
|
||||
@@ -27,8 +27,8 @@ option(WITH_DOCS "Create and install internal documentation (needs Doxygen)" ${D
|
||||
option(WITH_EXAMPLES "Build examples" ON)
|
||||
|
||||
find_package(PkgConfig)
|
||||
-pkg_check_modules(LIBYANG_CPP REQUIRED libyang-cpp>=3 IMPORTED_TARGET)
|
||||
-pkg_check_modules(SYSREPO REQUIRED sysrepo>=3.7.4 IMPORTED_TARGET)
|
||||
+pkg_check_modules(LIBYANG_CPP REQUIRED libyang-cpp>=5 IMPORTED_TARGET)
|
||||
+pkg_check_modules(SYSREPO REQUIRED sysrepo>=4.2.4 IMPORTED_TARGET)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
|
||||
diff --git a/ci/build.sh b/ci/build.sh
|
||||
index 785a811..67bc7d3 100755
|
||||
--- a/ci/build.sh
|
||||
+++ b/ci/build.sh
|
||||
@@ -47,6 +47,10 @@ if [[ $ZUUL_JOB_NAME =~ .*-tsan ]]; then
|
||||
# Our TSAN does not have interceptors for a variety of "less common" functions such as pthread_mutex_clocklock.
|
||||
# Disable all functions which are optional in sysrepo/libnetconf2/Netopeer2.
|
||||
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DHAVE_PTHREAD_MUTEX_TIMEDLOCK=OFF -DHAVE_PTHREAD_MUTEX_CLOCKLOCK=OFF -DHAVE_PTHREAD_RWLOCK_CLOCKRDLOCK=OFF -DHAVE_PTHREAD_RWLOCK_CLOCKWRLOCK=OFF -DHAVE_PTHREAD_COND_CLOCKWAIT=OFF"
|
||||
+
|
||||
+ # This is currently broken on TSAN ("Failed to map the printed context (Operation not permitted).").
|
||||
+ # Even if it wasn't broken, I want at least one build in the matrix with this (mis)feature disabled.
|
||||
+ CMAKE_OPTIONS="${CMAKE_OPTIONS} -DPRINTED_CONTEXT_ADDRESS=0"
|
||||
fi
|
||||
|
||||
if [[ $ZUUL_JOB_NAME =~ .*-cover.* ]]; then
|
||||
diff --git a/include/sysrepo-cpp/Enum.hpp b/include/sysrepo-cpp/Enum.hpp
|
||||
index 48467c6..505797a 100644
|
||||
--- a/include/sysrepo-cpp/Enum.hpp
|
||||
+++ b/include/sysrepo-cpp/Enum.hpp
|
||||
@@ -176,12 +176,24 @@ enum class NotificationType : uint32_t {
|
||||
};
|
||||
|
||||
/**
|
||||
- * Wraps `sr_conn_flag_e`.
|
||||
+ * Wraps `sr_context_flag_t`.
|
||||
+ */
|
||||
+enum class ContextFlags : uint32_t {
|
||||
+ Default = 0x00, /**< SR_CTX_DEFAULT */
|
||||
+ NoPrinted = 0x01, /**< SR_CTX_NO_PRINTED */
|
||||
+ LibYangPrivParsed = 0x02, /**< SR_CTX_SET_PRIV_PARSED */
|
||||
+};
|
||||
+
|
||||
+constexpr ContextFlags operator|(const ContextFlags a, const ContextFlags b)
|
||||
+{
|
||||
+ return implEnumBitOr(a, b);
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * Wraps `sr_conn_flag_t`.
|
||||
*/
|
||||
enum class ConnectionFlags : uint32_t {
|
||||
Default = 0x00, /**< SR_CONN_DEFAULT */
|
||||
- CacheRunning = 0x01, /**< SR_CONN_CACHE_RUNNING */
|
||||
- LibYangPrivParsed = 0x02, /**< SR_CONN_CTX_SET_PRIV_PARSED */
|
||||
};
|
||||
|
||||
constexpr ConnectionFlags operator|(const ConnectionFlags a, const ConnectionFlags b)
|
||||
diff --git a/include/sysrepo-cpp/utils/utils.hpp b/include/sysrepo-cpp/utils/utils.hpp
|
||||
index 64b1c2e..6f2446f 100644
|
||||
--- a/include/sysrepo-cpp/utils/utils.hpp
|
||||
+++ b/include/sysrepo-cpp/utils/utils.hpp
|
||||
@@ -12,6 +12,11 @@
|
||||
namespace sysrepo {
|
||||
Session wrapUnmanagedSession(sr_session_ctx_s* session);
|
||||
void setLogLevelStderr(const LogLevel);
|
||||
+enum class GlobalContextEffect {
|
||||
+ Lazy, /**< Set these flags the next time the shared context is applied */
|
||||
+ Immediate, /**< Apply immediately */
|
||||
+};
|
||||
+ContextFlags setGlobalContextOptions(const ContextFlags flags, const GlobalContextEffect when);
|
||||
std::optional<libyang::DataNodeOpaque> findMatchingDiscard(libyang::DataNode root, const std::string& xpath);
|
||||
std::vector<libyang::DataNodeOpaque> findMatchingDiscardPrefixes(libyang::DataNode root, const std::string& xpathPrefix);
|
||||
void unlinkFromForest(std::optional<libyang::DataNode>& root, libyang::DataNode node);
|
||||
diff --git a/src/Connection.cpp b/src/Connection.cpp
|
||||
index 1717b9a..96e340c 100644
|
||||
--- a/src/Connection.cpp
|
||||
+++ b/src/Connection.cpp
|
||||
@@ -26,7 +26,7 @@ Connection::Connection(const ConnectionFlags options)
|
||||
: ctx(nullptr)
|
||||
{
|
||||
sr_conn_ctx_t* ctx;
|
||||
- auto res = sr_connect(static_cast<sr_conn_options_t>(options), &ctx);
|
||||
+ auto res = sr_connect(static_cast<sr_conn_flag_t>(options), &ctx);
|
||||
|
||||
throwIfError(res, "Couldn't connect to sysrepo");
|
||||
this->ctx = std::shared_ptr<sr_conn_ctx_t>(ctx, sr_disconnect);
|
||||
@@ -96,5 +96,4 @@ uint32_t Connection::getId() const
|
||||
{
|
||||
return sr_get_cid(ctx.get());
|
||||
}
|
||||
-
|
||||
}
|
||||
diff --git a/src/Session.cpp b/src/Session.cpp
|
||||
index 994ce87..95b8f24 100644
|
||||
--- a/src/Session.cpp
|
||||
+++ b/src/Session.cpp
|
||||
@@ -241,7 +241,7 @@ std::optional<libyang::DataNode> Session::operationalChanges(const std::optional
|
||||
void Session::discardOperationalChanges(const std::optional<std::string>& moduleName, std::chrono::milliseconds timeout)
|
||||
{
|
||||
SYSREPO_CPP_SESSION_MTX;
|
||||
- auto res = sr_discard_oper_changes(nullptr, m_sess.get(), moduleName ? nullptr : moduleName->c_str(), timeout.count());
|
||||
+ auto res = sr_discard_oper_changes(m_sess.get(), moduleName ? nullptr : moduleName->c_str(), timeout.count());
|
||||
throwIfError(res, "Session::discardOoperationalChanges: Couldn't discard "s + (moduleName ? "for module \"" + *moduleName + "\"" : "globally"s), m_sess.get());
|
||||
}
|
||||
|
||||
diff --git a/src/utils/enum.hpp b/src/utils/enum.hpp
|
||||
index 2d3a298..e917b21 100644
|
||||
--- a/src/utils/enum.hpp
|
||||
+++ b/src/utils/enum.hpp
|
||||
@@ -151,13 +151,16 @@ static_assert(toNotificationType(SR_EV_NOTIF_MODIFIED) == NotificationType::Modi
|
||||
static_assert(toNotificationType(SR_EV_NOTIF_SUSPENDED) == NotificationType::Suspended);
|
||||
static_assert(toNotificationType(SR_EV_NOTIF_RESUMED) == NotificationType::Resumed);
|
||||
|
||||
-static_assert(std::is_same_v<sr_conn_options_t, std::underlying_type_t<ConnectionFlags>>);
|
||||
+static_assert(std::is_same_v<std::underlying_type_t<sr_conn_flag_t>, std::underlying_type_t<ConnectionFlags>>);
|
||||
static_assert(static_cast<ConnectionFlags>(SR_CONN_DEFAULT) == ConnectionFlags::Default);
|
||||
-static_assert(static_cast<ConnectionFlags>(SR_CONN_CACHE_RUNNING) == ConnectionFlags::CacheRunning);
|
||||
-static_assert(static_cast<ConnectionFlags>(SR_CONN_CTX_SET_PRIV_PARSED) == ConnectionFlags::LibYangPrivParsed);
|
||||
-static_assert(static_cast<ConnectionFlags>(SR_CONN_CACHE_RUNNING | SR_CONN_CTX_SET_PRIV_PARSED) == (ConnectionFlags::CacheRunning | ConnectionFlags::LibYangPrivParsed));
|
||||
|
||||
-static_assert(std::is_same_v<sr_get_options_t, std::underlying_type_t<GetOptions>>);
|
||||
+static_assert(std::is_same_v<std::underlying_type_t<sr_context_flag_t>, std::underlying_type_t<ContextFlags>>);
|
||||
+static_assert(static_cast<ContextFlags>(SR_CTX_DEFAULT) == ContextFlags::Default);
|
||||
+static_assert(static_cast<ContextFlags>(SR_CTX_SET_PRIV_PARSED) == ContextFlags::LibYangPrivParsed);
|
||||
+static_assert(static_cast<ContextFlags>(SR_CTX_NO_PRINTED) == ContextFlags::NoPrinted);
|
||||
+static_assert(static_cast<ContextFlags>(SR_CTX_SET_PRIV_PARSED | SR_CTX_NO_PRINTED) == (ContextFlags::LibYangPrivParsed | ContextFlags::NoPrinted));
|
||||
+
|
||||
+// upstream project provides no dedicated type for these
|
||||
static_assert(static_cast<GetOptions>(SR_OPER_DEFAULT) == GetOptions::Default);
|
||||
static_assert(static_cast<GetOptions>(SR_OPER_NO_STATE) == GetOptions::OperNoState);
|
||||
static_assert(static_cast<GetOptions>(SR_OPER_NO_CONFIG) == GetOptions::OperNoConfig);
|
||||
@@ -168,9 +171,10 @@ static_assert(static_cast<GetOptions>(SR_OPER_NO_POLL_CACHED) == GetOptions::Ope
|
||||
static_assert(static_cast<GetOptions>(SR_OPER_NO_RUN_CACHED) == GetOptions::OperNoRunningCached);
|
||||
static_assert(static_cast<GetOptions>(SR_GET_NO_FILTER) == GetOptions::NoFilter);
|
||||
|
||||
-constexpr sr_get_options_t toGetOptions(const GetOptions opts)
|
||||
+// upstream project provides no dedicated type for these
|
||||
+constexpr uint32_t toGetOptions(const GetOptions opts)
|
||||
{
|
||||
- return static_cast<sr_get_options_t>(opts);
|
||||
+ return static_cast<uint32_t>(opts);
|
||||
}
|
||||
|
||||
static_assert(static_cast<YangPushChange>(SRSN_YP_CHANGE_CREATE) == YangPushChange::Create);
|
||||
diff --git a/src/utils/utils.cpp b/src/utils/utils.cpp
|
||||
index 61d0c7f..dbbc5ce 100644
|
||||
--- a/src/utils/utils.cpp
|
||||
+++ b/src/utils/utils.cpp
|
||||
@@ -13,6 +13,7 @@ extern "C" {
|
||||
#include <sysrepo.h>
|
||||
}
|
||||
#include "enum.hpp"
|
||||
+#include "exception.hpp"
|
||||
#include "misc.hpp"
|
||||
|
||||
namespace sysrepo {
|
||||
@@ -37,6 +38,23 @@ void setLogLevelStderr(const LogLevel level)
|
||||
sr_log_stderr(toLogLevel(level));
|
||||
}
|
||||
|
||||
+/**
|
||||
+ * @brief Set global sysrepo-level context options
|
||||
+ *
|
||||
+ * Be advised of consequences of manipulating a shared global state, especially when using multiple connections.
|
||||
+ *
|
||||
+ * Wraps `sr_context_options`.
|
||||
+ */
|
||||
+ContextFlags setGlobalContextOptions(const ContextFlags flags, const GlobalContextEffect when)
|
||||
+{
|
||||
+ uint32_t old;
|
||||
+ throwIfError(
|
||||
+ sr_context_options(static_cast<uint32_t>(flags), when == GlobalContextEffect::Immediate, &old),
|
||||
+ "sr_context_options failed",
|
||||
+ nullptr);
|
||||
+ return static_cast<ContextFlags>(old);
|
||||
+}
|
||||
+
|
||||
std::timespec toTimespec(std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> tp)
|
||||
{
|
||||
// https://embeddedartistry.com/blog/2019/01/31/converting-between-timespec-stdchrono#-std-chrono-time_point-to-timespec-
|
||||
diff --git a/tests/session.cpp b/tests/session.cpp
|
||||
index 47b5631..a709a09 100644
|
||||
--- a/tests/session.cpp
|
||||
+++ b/tests/session.cpp
|
||||
@@ -627,17 +627,34 @@ TEST_CASE("session")
|
||||
|
||||
DOCTEST_SUBCASE("libyang context flags")
|
||||
{
|
||||
- sess.setItem("/test_module:popelnice/s", "666");
|
||||
- REQUIRE(sess.getOneNode("/test_module:popelnice/s").asTerm().valueStr() == "666");
|
||||
- // Parsed type info is not preserved by libyang unless its context is constructed with a flag,
|
||||
- // and that flag is not used by sysrepo by default...
|
||||
- REQUIRE_THROWS_AS(sess.getOneNode("/test_module:popelnice/s").schema().asLeaf().valueType().asString().length(), libyang::ParsedInfoUnavailable);
|
||||
-
|
||||
- // ...unless we pass that flag explicitly as a parameter to the connection.
|
||||
- auto sess2 = sysrepo::Connection{sysrepo::ConnectionFlags::LibYangPrivParsed}.sessionStart();
|
||||
- sess2.setItem("/test_module:popelnice/s", "333");
|
||||
- REQUIRE(sess2.getOneNode("/test_module:popelnice/s").asTerm().valueStr() == "333");
|
||||
- REQUIRE(sess2.getOneNode("/test_module:popelnice/s").schema().asLeaf().valueType().asString().length().parts[0].max == 10);
|
||||
+ DOCTEST_SUBCASE("default")
|
||||
+ {
|
||||
+ sess.setItem("/test_module:popelnice/s", "666");
|
||||
+ REQUIRE(sess.getOneNode("/test_module:popelnice/s").asTerm().valueStr() == "666");
|
||||
+ // Parsed type info is not preserved by libyang unless its context is constructed with a flag,
|
||||
+ // and that flag is not used by sysrepo by default.
|
||||
+ REQUIRE_THROWS_AS(sess.getOneNode("/test_module:popelnice/s").schema().asLeaf().valueType().asString().length(), libyang::ParsedInfoUnavailable);
|
||||
+
|
||||
+ // pending changes hold the context lock, so we cannot change the global context options
|
||||
+ REQUIRE_THROWS_WITH_AS(
|
||||
+ sysrepo::setGlobalContextOptions(
|
||||
+ sysrepo::ContextFlags::LibYangPrivParsed | sysrepo::ContextFlags::NoPrinted,
|
||||
+ sysrepo::GlobalContextEffect::Immediate),
|
||||
+ "sr_context_options failed: SR_ERR_TIME_OUT",
|
||||
+ sysrepo::ErrorWithCode);
|
||||
+ }
|
||||
+
|
||||
+ // Since this is actually a shared global state, changing it is "tricky". The best bet is to actually
|
||||
+ // ensure that there are no other connections (which we cannot do here, we already have a connection opened
|
||||
+ // from the common code at the very top of this test case), and especially no internal sysrepo-level locks
|
||||
+ // on the shared libyang context. For example, no uncommited changes -- hence a new subcase.
|
||||
+ DOCTEST_SUBCASE("Connection::setGlobalContextOptions LibYangPrivParsed")
|
||||
+ {
|
||||
+ sysrepo::setGlobalContextOptions(sysrepo::ContextFlags::LibYangPrivParsed | sysrepo::ContextFlags::NoPrinted, sysrepo::GlobalContextEffect::Immediate);
|
||||
+ sess.setItem("/test_module:popelnice/s", "333");
|
||||
+ REQUIRE(sess.getOneNode("/test_module:popelnice/s").asTerm().valueStr() == "333");
|
||||
+ REQUIRE(sess.getOneNode("/test_module:popelnice/s").schema().asLeaf().valueType().asString().length().parts[0].max == 10);
|
||||
+ }
|
||||
}
|
||||
|
||||
DOCTEST_SUBCASE("replay support")
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
From 6e9dbd8513ce75e51f2f714df69c08af5b556d1d Mon Sep 17 00:00:00 2001
|
||||
From: Edoardo Bortolozzo <edoardo.bortolozzo@thinkquantum.com>
|
||||
Date: Tue, 28 Oct 2025 13:24:13 +0100
|
||||
Subject: [PATCH 8/9] fix: onOperGet unconsistent with C library.
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
Organization: Wires
|
||||
|
||||
Fixes: https://github.com/sysrepo/sysrepo-cpp/issues/29
|
||||
Change-Id: I5a21069889c59466df8e9457c3a316b58e2571bb
|
||||
Signed-off-by: Mattias Walström <lazzer@gmail.com>
|
||||
---
|
||||
include/sysrepo-cpp/Session.hpp | 2 +-
|
||||
include/sysrepo-cpp/Subscription.hpp | 2 +-
|
||||
src/Session.cpp | 4 ++--
|
||||
src/Subscription.cpp | 4 ++--
|
||||
4 files changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/include/sysrepo-cpp/Session.hpp b/include/sysrepo-cpp/Session.hpp
|
||||
index aae7068..3af4b10 100644
|
||||
--- a/include/sysrepo-cpp/Session.hpp
|
||||
+++ b/include/sysrepo-cpp/Session.hpp
|
||||
@@ -127,7 +127,7 @@ public:
|
||||
[[nodiscard]] Subscription onOperGet(
|
||||
const std::string& moduleName,
|
||||
OperGetCb cb,
|
||||
- const std::optional<std::string>& xpath = std::nullopt,
|
||||
+ const std::string& path,
|
||||
const SubscribeOptions opts = SubscribeOptions::Default,
|
||||
ExceptionHandler handler = nullptr,
|
||||
const std::optional<FDHandling>& callbacks = std::nullopt);
|
||||
diff --git a/include/sysrepo-cpp/Subscription.hpp b/include/sysrepo-cpp/Subscription.hpp
|
||||
index c8f3ff8..14ecce4 100644
|
||||
--- a/include/sysrepo-cpp/Subscription.hpp
|
||||
+++ b/include/sysrepo-cpp/Subscription.hpp
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
Subscription& operator=(Subscription&&) noexcept;
|
||||
|
||||
void onModuleChange(const std::string& moduleName, ModuleChangeCb cb, const std::optional<std::string>& xpath = std::nullopt, uint32_t priority = 0, const SubscribeOptions opts = SubscribeOptions::Default);
|
||||
- void onOperGet(const std::string& moduleName, OperGetCb cb, const std::optional<std::string>& xpath, const SubscribeOptions opts = SubscribeOptions::Default);
|
||||
+ void onOperGet(const std::string& moduleName, OperGetCb cb, const std::string& path, const SubscribeOptions opts = SubscribeOptions::Default);
|
||||
void onRPCAction(const std::string& xpath, RpcActionCb cb, uint32_t priority = 0, const SubscribeOptions opts = SubscribeOptions::Default);
|
||||
void onNotification(
|
||||
const std::string& moduleName,
|
||||
diff --git a/src/Session.cpp b/src/Session.cpp
|
||||
index 95b8f24..6f0327d 100644
|
||||
--- a/src/Session.cpp
|
||||
+++ b/src/Session.cpp
|
||||
@@ -505,14 +505,14 @@ Subscription Session::onModuleChange(
|
||||
Subscription Session::onOperGet(
|
||||
const std::string& moduleName,
|
||||
OperGetCb cb,
|
||||
- const std::optional<std::string>& xpath,
|
||||
+ const std::string& path,
|
||||
const SubscribeOptions opts,
|
||||
ExceptionHandler handler,
|
||||
const std::optional<FDHandling>& callbacks)
|
||||
{
|
||||
checkNoThreadFlag(opts, callbacks);
|
||||
auto sub = Subscription{*this, handler, callbacks};
|
||||
- sub.onOperGet(moduleName, cb, xpath, opts);
|
||||
+ sub.onOperGet(moduleName, cb, path, opts);
|
||||
return sub;
|
||||
}
|
||||
|
||||
diff --git a/src/Subscription.cpp b/src/Subscription.cpp
|
||||
index 5bb724e..dca1176 100644
|
||||
--- a/src/Subscription.cpp
|
||||
+++ b/src/Subscription.cpp
|
||||
@@ -215,14 +215,14 @@ void Subscription::onModuleChange(const std::string& moduleName, ModuleChangeCb
|
||||
* @param xpath XPath that identifies which data this subscription is able to provide.
|
||||
* @param opts Options further changing the behavior of this method.
|
||||
*/
|
||||
-void Subscription::onOperGet(const std::string& moduleName, OperGetCb cb, const std::optional<std::string>& xpath, const SubscribeOptions opts)
|
||||
+void Subscription::onOperGet(const std::string& moduleName, OperGetCb cb, const std::string& path, const SubscribeOptions opts)
|
||||
{
|
||||
SYSREPO_CPP_SESSION_MTX_OF(m_sess);
|
||||
checkNoThreadFlag(opts, m_customEventLoopCbs);
|
||||
|
||||
auto& privRef = m_operGetCbs.emplace_back(PrivData{cb, m_exceptionHandler.get()});
|
||||
sr_subscription_ctx_s* ctx = m_sub.get();
|
||||
- auto res = sr_oper_get_subscribe(m_sess.m_sess.get(), moduleName.c_str(), xpath ? xpath->c_str() : nullptr, operGetItemsCb, reinterpret_cast<void*>(&privRef), toSubscribeOptions(opts), &ctx);
|
||||
+ auto res = sr_oper_get_subscribe(m_sess.m_sess.get(), moduleName.c_str(), path.c_str(), operGetItemsCb, reinterpret_cast<void*>(&privRef), toSubscribeOptions(opts), &ctx);
|
||||
throwIfError(res, "Couldn't create operational get items subscription", m_sess.m_sess.get());
|
||||
|
||||
saveContext(ctx);
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@@ -1,121 +0,0 @@
|
||||
From 60d729e4791e5447cf0d969be6da9f8f1878af64 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= <jan.kundrat@cesnet.cz>
|
||||
Date: Thu, 20 Nov 2025 15:38:04 +0100
|
||||
Subject: [PATCH 9/9] Update to libyang v4.2
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
Organization: Wires
|
||||
|
||||
Depends-on: https://gerrit.cesnet.cz/c/CzechLight/libyang-cpp/+/9009
|
||||
Change-Id: Ia4c53dba0befa8dade38e728489edc6473aa5f4f
|
||||
Signed-off-by: Mattias Walström <lazzer@gmail.com>
|
||||
---
|
||||
CMakeLists.txt | 4 ++--
|
||||
tests/session.cpp | 14 +++++++-------
|
||||
tests/subscriptions-dynamic.cpp | 4 ++--
|
||||
3 files changed, 11 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 49338dd..8234464 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -27,8 +27,8 @@ option(WITH_DOCS "Create and install internal documentation (needs Doxygen)" ${D
|
||||
option(WITH_EXAMPLES "Build examples" ON)
|
||||
|
||||
find_package(PkgConfig)
|
||||
-pkg_check_modules(LIBYANG_CPP REQUIRED libyang-cpp>=5 IMPORTED_TARGET)
|
||||
-pkg_check_modules(SYSREPO REQUIRED sysrepo>=4.2.4 IMPORTED_TARGET)
|
||||
+pkg_check_modules(LIBYANG_CPP REQUIRED libyang-cpp>=6 IMPORTED_TARGET)
|
||||
+pkg_check_modules(SYSREPO REQUIRED sysrepo>=4.2.8 IMPORTED_TARGET)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
|
||||
diff --git a/tests/session.cpp b/tests/session.cpp
|
||||
index a709a09..0e92e65 100644
|
||||
--- a/tests/session.cpp
|
||||
+++ b/tests/session.cpp
|
||||
@@ -105,7 +105,7 @@ TEST_CASE("session")
|
||||
|
||||
auto data = sess.getData("/test_module:popelnice", 0);
|
||||
REQUIRE(data);
|
||||
- REQUIRE(*data->printStr(libyang::DataFormat::JSON, libyang::PrintFlags::KeepEmptyCont) == R"({
|
||||
+ REQUIRE(*data->printStr(libyang::DataFormat::JSON, libyang::PrintFlags::EmptyContainers) == R"({
|
||||
"test_module:popelnice": {
|
||||
"content": {
|
||||
"trash": [
|
||||
@@ -126,14 +126,14 @@ TEST_CASE("session")
|
||||
|
||||
data = sess.getData("/test_module:popelnice", 1);
|
||||
REQUIRE(data);
|
||||
- REQUIRE(*data->printStr(libyang::DataFormat::JSON, libyang::PrintFlags::KeepEmptyCont) == R"({
|
||||
+ REQUIRE(*data->printStr(libyang::DataFormat::JSON, libyang::PrintFlags::EmptyContainers) == R"({
|
||||
"test_module:popelnice": {}
|
||||
}
|
||||
)");
|
||||
|
||||
data = sess.getData("/test_module:popelnice", 2);
|
||||
REQUIRE(data);
|
||||
- REQUIRE(*data->printStr(libyang::DataFormat::JSON, libyang::PrintFlags::KeepEmptyCont) == R"({
|
||||
+ REQUIRE(*data->printStr(libyang::DataFormat::JSON, libyang::PrintFlags::EmptyContainers) == R"({
|
||||
"test_module:popelnice": {
|
||||
"content": {}
|
||||
}
|
||||
@@ -143,7 +143,7 @@ TEST_CASE("session")
|
||||
// If a list should be returned, its keys are always returned as well.
|
||||
data = sess.getData("/test_module:popelnice", 3);
|
||||
REQUIRE(data);
|
||||
- REQUIRE(*data->printStr(libyang::DataFormat::JSON, libyang::PrintFlags::KeepEmptyCont) == R"({
|
||||
+ REQUIRE(*data->printStr(libyang::DataFormat::JSON, libyang::PrintFlags::EmptyContainers) == R"({
|
||||
"test_module:popelnice": {
|
||||
"content": {
|
||||
"trash": [
|
||||
@@ -161,7 +161,7 @@ TEST_CASE("session")
|
||||
|
||||
data = sess.getData("/test_module:popelnice", 4);
|
||||
REQUIRE(data);
|
||||
- REQUIRE(*data->printStr(libyang::DataFormat::JSON, libyang::PrintFlags::KeepEmptyCont) == R"({
|
||||
+ REQUIRE(*data->printStr(libyang::DataFormat::JSON, libyang::PrintFlags::EmptyContainers) == R"({
|
||||
"test_module:popelnice": {
|
||||
"content": {
|
||||
"trash": [
|
||||
@@ -497,7 +497,7 @@ TEST_CASE("session")
|
||||
{
|
||||
sess.switchDatastore(sysrepo::Datastore::FactoryDefault);
|
||||
auto data = sess.getData("/*");
|
||||
- REQUIRE(*data->printStr(libyang::DataFormat::JSON, libyang::PrintFlags::WithSiblings) == "{\n\n}\n");
|
||||
+ REQUIRE(*data->printStr(libyang::DataFormat::JSON, libyang::PrintFlags::Siblings) == "{\n\n}\n");
|
||||
REQUIRE_THROWS_AS(sess.setItem(leaf, "123"), sysrepo::ErrorWithCode);
|
||||
}
|
||||
|
||||
@@ -622,7 +622,7 @@ TEST_CASE("session")
|
||||
}
|
||||
|
||||
// the original tree is not corrupted
|
||||
- REQUIRE(*conf->printStr(libyang::DataFormat::JSON, libyang::PrintFlags::WithSiblings) != "");
|
||||
+ REQUIRE(*conf->printStr(libyang::DataFormat::JSON, libyang::PrintFlags::Siblings) != "");
|
||||
}
|
||||
|
||||
DOCTEST_SUBCASE("libyang context flags")
|
||||
diff --git a/tests/subscriptions-dynamic.cpp b/tests/subscriptions-dynamic.cpp
|
||||
index 561df0c..0d4ce7c 100644
|
||||
--- a/tests/subscriptions-dynamic.cpp
|
||||
+++ b/tests/subscriptions-dynamic.cpp
|
||||
@@ -140,12 +140,12 @@ TEST_CASE("Dynamic subscriptions")
|
||||
const auto subId = std::get<uint32_t>(idNode->asTerm().value());
|
||||
idNode->unlink();
|
||||
|
||||
- rec.recordYangPushUpdate(subId, tree->printStr(libyang::DataFormat::JSON, libyang::PrintFlags::WithSiblings));
|
||||
+ rec.recordYangPushUpdate(subId, tree->printStr(libyang::DataFormat::JSON, libyang::PrintFlags::Siblings));
|
||||
};
|
||||
|
||||
auto cbNotif = [&](const std::optional<libyang::DataNode>& tree, auto) {
|
||||
REQUIRE(tree);
|
||||
- rec.recordNotification(tree->printStr(libyang::DataFormat::JSON, libyang::PrintFlags::WithSiblings));
|
||||
+ rec.recordNotification(tree->printStr(libyang::DataFormat::JSON, libyang::PrintFlags::Siblings));
|
||||
};
|
||||
|
||||
// write some initial data
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
config BR2_PACKAGE_SYSREPO_CPP
|
||||
bool "sysrepo-cpp"
|
||||
depends on BR2_USE_MMU
|
||||
select BR2_PACKAGE_LIBYANG_CPP
|
||||
select BR2_PACKAGE_SYSREPO
|
||||
help
|
||||
Sysrepo CPP bindings
|
||||
@@ -1,3 +0,0 @@
|
||||
# Locally calculated
|
||||
sha256 82e3758011ec44c78e98d0777799d6e12aec5b8a64b32ebb20d0fe50e32488bb LICENSE
|
||||
sha256 d7fbeaba7f2fdaf70c67cc70f438943eee636b21f08854e58967d0d97801bacc sysrepo-cpp-v6.tar.gz
|
||||
@@ -1,13 +0,0 @@
|
||||
################################################################################
|
||||
#
|
||||
# CPP bindings for sysrepo
|
||||
#
|
||||
################################################################################
|
||||
SYSREPO_CPP_VERSION = v6
|
||||
SYSREPO_CPP_SITE = $(call github,sysrepo,sysrepo-cpp,$(SYSREPO_CPP_VERSION))
|
||||
SYSREPO_CPP_LICENSE = BSD-3-Clause
|
||||
SYSREPO_CPP_LICENSE_FILES = LICENSE
|
||||
SYSREPO_CPP_DEPENDENCIES = sysrepo libyang-cpp
|
||||
SYSREPO_CPP_INSTALL_STAGING = YES
|
||||
|
||||
$(eval $(cmake-package))
|
||||
Reference in New Issue
Block a user