Skip to content

Commit 542fd40

Browse files
committed
Bump sysrepo,lignetconf2, libyang and netopeer2
This update got pretty messy, since libyang had some breaking changes. And unfortunatly rousette, libyang-cpp and sysrepo-cpp has not made any new release yet.
1 parent e69d53a commit 542fd40

File tree

79 files changed

+8340
-187
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+8340
-187
lines changed

doc/ChangeLog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ All notable changes to the project are documented in this file.
99
### Changes
1010

1111
- Upgrade Linux kernel to 6.12.62 (LTS)
12+
- Upgrade libyang to 4.2.2
13+
- Upgrade sysrepo to 4.2.10
14+
- Upgrade netopeer2 (NETCONF) to 2.7.0
1215
- Add RIPv2 routing support, issue #582
1316
- Add support for configurable OSPF debug logging, issue #1281. Debug options
1417
can now be enabled per category (bfd, packet, ism, nsm, default-information,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Locally calculated
22
sha256 9d9d33b873917ca5d0bdcc47a36d2fd385971ab0c045d1472fcadf95ee5bcf5b LICENCE
3-
sha256 cfe1064849a158f3eb9e82f12a709723115fc9bc4d30056e0e96ea0ba03672a2 klish-plugin-sysrepo-4e86a836c9b09a14c9625ea3d3b56b6578be4833-git4.tar.gz
3+
sha256 71802708c96521a8bf43e38d6e5ac36de5481e087eaabdbebbc282ec0e29b8d3 klish-plugin-sysrepo-0846fa6b8d5d665eebfc7b1664542646915a79f7-git4.tar.gz

package/klish-plugin-sysrepo/klish-plugin-sysrepo.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
################################################################################
66

7-
KLISH_PLUGIN_SYSREPO_VERSION = 4e86a836c9b09a14c9625ea3d3b56b6578be4833
7+
KLISH_PLUGIN_SYSREPO_VERSION = 0846fa6b8d5d665eebfc7b1664542646915a79f7
88
KLISH_PLUGIN_SYSREPO_SITE = https://github.com/kernelkit/klish-plugin-sysrepo.git
99
#KLISH_PLUGIN_SYSREPO_VERSION = cdd3eb51a7f7ee0ed5bd925fa636061d3b1b85fb
1010
#KLISH_PLUGIN_SYSREPO_SITE = https://src.libcode.org/pkun/klish-plugin-sysrepo.git

package/libyang-cpp/0001-Implement-SchemaNode-actionRpcs.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 22b41e7ed8268b94ccc139138e2037c390a3a616 Mon Sep 17 00:00:00 2001
22
From: =?UTF-8?q?Bed=C5=99ich=20Schindler?= <[email protected]>
33
Date: Thu, 10 Jul 2025 15:00:45 +0200
4-
Subject: [PATCH] Implement `SchemaNode::actionRpcs()`
4+
Subject: [PATCH 1/7] Implement `SchemaNode::actionRpcs()`
55
MIME-Version: 1.0
66
Content-Type: text/plain; charset=UTF-8
77
Content-Transfer-Encoding: 8bit
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
From 1f8e502cf0308faa0336b1077308184de6a83ee0 Mon Sep 17 00:00:00 2001
2+
From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= <[email protected]>
3+
Date: Mon, 20 Oct 2025 11:45:06 +0200
4+
Subject: [PATCH 2/7] CI: pin to libyang v3
5+
MIME-Version: 1.0
6+
Content-Type: text/plain; charset=UTF-8
7+
Content-Transfer-Encoding: 8bit
8+
Organization: Wires
9+
10+
Change-Id: Idba085ad9c9c137874801f1d4089f8ee6bb390c7
11+
Signed-off-by: Mattias Walström <[email protected]>
12+
---
13+
.zuul.yaml | 4 ++--
14+
1 file changed, 2 insertions(+), 2 deletions(-)
15+
16+
diff --git a/.zuul.yaml b/.zuul.yaml
17+
index 7b92766..fd89549 100644
18+
--- a/.zuul.yaml
19+
+++ b/.zuul.yaml
20+
@@ -4,13 +4,13 @@
21+
- f38-gcc-cover:
22+
required-projects:
23+
- name: github/CESNET/libyang
24+
- override-checkout: devel
25+
+ override-checkout: cesnet/2025-08-07
26+
- name: github/doctest/doctest
27+
override-checkout: v2.3.6
28+
- f38-clang-asan-ubsan:
29+
required-projects: &projects
30+
- name: github/CESNET/libyang
31+
- override-checkout: devel
32+
+ override-checkout: cesnet/2025-08-07
33+
- name: github/doctest/doctest
34+
override-checkout: v2.4.11
35+
- f38-clang-tsan:
36+
--
37+
2.43.0
38+
Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
From b27a65d5d5f6ffffbd2c26c1b5bea57a6de584d0 Mon Sep 17 00:00:00 2001
2+
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Pecka?= <[email protected]>
3+
Date: Mon, 20 Oct 2025 18:46:38 +0200
4+
Subject: [PATCH 3/7] wrap lyd_validate_op
5+
MIME-Version: 1.0
6+
Content-Type: text/plain; charset=UTF-8
7+
Content-Transfer-Encoding: 8bit
8+
Organization: Wires
9+
10+
This patch wraps lyd_validate_op from libyang. Downstream users can now
11+
validate operations (RPC input, replies, and notifications).
12+
13+
Change-Id: Ib03070bbc3e1d0dccd6bf38eda82e944db1093b1
14+
Signed-off-by: Mattias Walström <[email protected]>
15+
---
16+
include/libyang-cpp/DataNode.hpp | 2 +
17+
src/DataNode.cpp | 24 +++++++++++
18+
tests/context.cpp | 2 +-
19+
tests/data_node.cpp | 72 ++++++++++++++++++++++++++++++++
20+
tests/example_schema.hpp | 22 ++++++++++
21+
5 files changed, 121 insertions(+), 1 deletion(-)
22+
23+
diff --git a/include/libyang-cpp/DataNode.hpp b/include/libyang-cpp/DataNode.hpp
24+
index 50d6c0e..e202a96 100644
25+
--- a/include/libyang-cpp/DataNode.hpp
26+
+++ b/include/libyang-cpp/DataNode.hpp
27+
@@ -59,6 +59,7 @@ template <typename Operation, typename Siblings>
28+
void handleLyTreeOperation(DataNode* affectedNode, Operation operation, Siblings siblings, std::shared_ptr<internal_refcount> newRefs);
29+
30+
LIBYANG_CPP_EXPORT void validateAll(std::optional<libyang::DataNode>& node, const std::optional<ValidationOptions>& opts = std::nullopt);
31+
+LIBYANG_CPP_EXPORT void validateOp(libyang::DataNode& input, const std::optional<libyang::DataNode>& opsTree, OperationType opType);
32+
33+
LIBYANG_CPP_EXPORT Set<DataNode> findXPathAt(
34+
const std::optional<libyang::DataNode>& contextNode,
35+
@@ -147,6 +148,7 @@ public:
36+
friend LIBYANG_CPP_EXPORT lyd_node* getRawNode(DataNode node);
37+
38+
friend LIBYANG_CPP_EXPORT void validateAll(std::optional<libyang::DataNode>& node, const std::optional<ValidationOptions>& opts);
39+
+ friend LIBYANG_CPP_EXPORT void validateOp(libyang::DataNode& input, const std::optional<libyang::DataNode>& opsTree, OperationType opType);
40+
friend LIBYANG_CPP_EXPORT Set<DataNode> findXPathAt(const std::optional<libyang::DataNode>& contextNode, const libyang::DataNode& forest, const std::string& xpath);
41+
42+
bool operator==(const DataNode& node) const;
43+
diff --git a/src/DataNode.cpp b/src/DataNode.cpp
44+
index 7e87917..e28ef30 100644
45+
--- a/src/DataNode.cpp
46+
+++ b/src/DataNode.cpp
47+
@@ -1226,6 +1226,30 @@ void validateAll(std::optional<libyang::DataNode>& node, const std::optional<Val
48+
}
49+
}
50+
51+
+/** @brief Validate op after parsing with lyd_parse_op.
52+
+ *
53+
+ * Wraps `lyd_validate_op`.
54+
+ *
55+
+ * @param input The tree with the op to validate.
56+
+ * @param opsTree The optional data tree to validate the input against.
57+
+ * @param opType The operation type. Contrary to `lyd_validate_op`, we accept not only YANG but also NETCONF and RESTCONF operation types (and internally convert them to YANG).
58+
+ */
59+
+void validateOp(libyang::DataNode& input, const std::optional<libyang::DataNode>& opsTree, OperationType opType)
60+
+{
61+
+ if (opType == OperationType::RpcYang || opType == OperationType::RpcRestconf || opType == OperationType::RpcNetconf) {
62+
+ opType = OperationType::RpcYang;
63+
+ } else if (opType == OperationType::ReplyYang || opType == OperationType::ReplyRestconf || opType == OperationType::ReplyNetconf) {
64+
+ opType = OperationType::ReplyYang;
65+
+ } else if (opType == OperationType::NotificationYang || opType == OperationType::NotificationRestconf || opType == OperationType::NotificationNetconf) {
66+
+ opType = OperationType::NotificationYang;
67+
+ } else {
68+
+ throw Error("validateOp: DataYang datatype is not supported");
69+
+ }
70+
+
71+
+ auto ret = lyd_validate_op(input.m_node, opsTree ? opsTree->m_node : nullptr, utils::toOpType(opType), nullptr);
72+
+ throwIfError(ret, "libyang:validateOp: lyd_validate_op failed");
73+
+}
74+
+
75+
/** @short Find instances matching the provided XPath
76+
*
77+
* @param contextNode The node which serves as the "context node" for XPath evaluation. Use nullopt to start at root.
78+
diff --git a/tests/context.cpp b/tests/context.cpp
79+
index 6c5dde8..c0b7e09 100644
80+
--- a/tests/context.cpp
81+
+++ b/tests/context.cpp
82+
@@ -154,7 +154,7 @@ TEST_CASE("context")
83+
{
84+
auto mod = ctx->parseModule(example_schema, libyang::SchemaFormat::YANG);
85+
auto rpcs = mod.actionRpcs();
86+
- REQUIRE(rpcs.size() == 1);
87+
+ REQUIRE(rpcs.size() == 2);
88+
REQUIRE(rpcs[0].module().name() == "example-schema");
89+
REQUIRE(rpcs[0].name() == "myRpc");
90+
91+
diff --git a/tests/data_node.cpp b/tests/data_node.cpp
92+
index db5a28e..9215b12 100644
93+
--- a/tests/data_node.cpp
94+
+++ b/tests/data_node.cpp
95+
@@ -2430,6 +2430,78 @@ TEST_CASE("Data Node manipulation")
96+
"Can't parse into operation data tree: LY_EVALID", libyang::Error);
97+
}
98+
}
99+
+
100+
+ DOCTEST_SUBCASE("Validation")
101+
+ {
102+
+ DOCTEST_SUBCASE("Valid input")
103+
+ {
104+
+ std::string rpcInput;
105+
+ std::string rpcPath;
106+
+ std::string expected;
107+
+ std::optional<libyang::DataNode> depTree;
108+
+
109+
+ DOCTEST_SUBCASE("RPC")
110+
+ {
111+
+ rpcInput = R"({"example-schema:input": { "number": 42 } })";
112+
+ rpcPath = "/example-schema:rpc-with-choice";
113+
+ expected = R"({
114+
+ "example-schema:rpc-with-choice": {
115+
+ "number": 42
116+
+ }
117+
+}
118+
+)";
119+
+ }
120+
+
121+
+ DOCTEST_SUBCASE("Action")
122+
+ {
123+
+ rpcInput = R"({ "example-schema:input": { "friend": "Kuba" } })";
124+
+ rpcPath = "/example-schema:person[name='Franta']/poke-a-friend";
125+
+ expected = R"({
126+
+ "example-schema:poke-a-friend": {
127+
+ "friend": "Kuba"
128+
+ }
129+
+}
130+
+)";
131+
+ depTree = ctx.newPath("/example-schema:person[name='Kuba']");
132+
+ }
133+
+
134+
+ auto [parent, rpcTree] = ctx.newPath2(rpcPath);
135+
+ auto rpcOp = rpcTree->parseOp(rpcInput, dataTypeFor(rpcInput), libyang::OperationType::RpcRestconf);
136+
+
137+
+ REQUIRE(!rpcOp.op);
138+
+ REQUIRE(rpcOp.tree);
139+
+
140+
+ libyang::validateOp(*rpcTree, depTree, libyang::OperationType::RpcRestconf);
141+
+ REQUIRE(*rpcTree->printStr(libyang::DataFormat::JSON, libyang::PrintFlags::KeepEmptyCont) == expected);
142+
+ }
143+
+
144+
+ DOCTEST_SUBCASE("Nodes in disjunctive cases defined together")
145+
+ {
146+
+ auto rpcInput = R"({ "example-schema:input": { "number": 42, "text": "The ultimate answer" } })";
147+
+
148+
+ auto rpcTree = ctx.newPath("/example-schema:rpc-with-choice");
149+
+ auto rpcOp = rpcTree.parseOp(rpcInput, dataTypeFor(rpcInput), libyang::OperationType::RpcRestconf);
150+
+
151+
+ REQUIRE(!rpcOp.op);
152+
+ REQUIRE(rpcOp.tree);
153+
+
154+
+ REQUIRE_THROWS_WITH_AS(libyang::validateOp(rpcTree, std::nullopt, libyang::OperationType::RpcRestconf), "libyang:validateOp: lyd_validate_op failed: LY_EVALID", libyang::Error);
155+
+ }
156+
+
157+
+ DOCTEST_SUBCASE("Action without the leafref node")
158+
+ {
159+
+ auto rpcInput = R"({ "example-schema:input": { "friend": "Kuba" } })";
160+
+ auto rpcPath = "/example-schema:person[name='Franta']/poke-a-friend";
161+
+
162+
+ auto [parent, rpcTree] = ctx.newPath2(rpcPath);
163+
+ auto rpcOp = rpcTree->parseOp(rpcInput, dataTypeFor(rpcInput), libyang::OperationType::RpcRestconf);
164+
+
165+
+ REQUIRE(!rpcOp.op);
166+
+ REQUIRE(rpcOp.tree);
167+
+
168+
+ REQUIRE_THROWS_WITH_AS(libyang::validateOp(*rpcTree, std::nullopt, libyang::OperationType::RpcRestconf), "libyang:validateOp: lyd_validate_op failed: LY_EVALID", libyang::Error);
169+
+ }
170+
+ }
171+
}
172+
173+
DOCTEST_SUBCASE("comparing") {
174+
diff --git a/tests/example_schema.hpp b/tests/example_schema.hpp
175+
index 02d3d74..acc6ecc 100644
176+
--- a/tests/example_schema.hpp
177+
+++ b/tests/example_schema.hpp
178+
@@ -108,6 +108,16 @@ module example-schema {
179+
}
180+
181+
action poke { }
182+
+
183+
+ action poke-a-friend {
184+
+ input {
185+
+ leaf friend {
186+
+ type leafref {
187+
+ path '../../../person/name';
188+
+ }
189+
+ }
190+
+ }
191+
+ }
192+
}
193+
194+
leaf bossPerson {
195+
@@ -284,6 +294,18 @@ module example-schema {
196+
}
197+
}
198+
}
199+
+ rpc rpc-with-choice {
200+
+ input {
201+
+ choice the-impossible-choice {
202+
+ leaf text {
203+
+ type string;
204+
+ }
205+
+ leaf number {
206+
+ type int32;
207+
+ }
208+
+ }
209+
+ }
210+
+ }
211+
212+
anydata myData {
213+
}
214+
--
215+
2.43.0
216+

0 commit comments

Comments
 (0)