Skip to content

Commit 3936132

Browse files
committed
server UPDATE call NC RPC directly, not using sysrepo
Is faster and simpler. For applications, new notification module is added.
1 parent 6d1cb61 commit 3936132

24 files changed

+2104
-2028
lines changed

CMakeLists.txt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ set(LIBYANG_DEP_SOVERSION 3.0.0)
4949
set(LIBYANG_DEP_SOVERSION_MAJOR 3)
5050

5151
# libnetconf2 required version
52-
set(LIBNETCONF2_DEP_VERSION 3.5.4)
53-
set(LIBNETCONF2_DEP_SOVERSION 4.4.4)
52+
set(LIBNETCONF2_DEP_VERSION 3.5.7)
53+
set(LIBNETCONF2_DEP_SOVERSION 4.5.0)
5454
set(LIBNETCONF2_DEP_SOVERSION_MAJOR 4)
5555

5656
# sysrepo required version
57-
set(SYSREPO_DEP_VERSION 2.12.0)
58-
set(SYSREPO_DEP_SOVERSION 7.27.20)
57+
set(SYSREPO_DEP_VERSION 3.4.3)
58+
set(SYSREPO_DEP_SOVERSION 7.30.0)
5959
set(SYSREPO_DEP_SOVERSION_MAJOR 7)
6060

6161
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -std=c99")
@@ -128,8 +128,7 @@ set(SERVER_SRC
128128
src/netconf_nmda.c
129129
src/netconf_subscribed_notifications.c
130130
src/netconf_confirmed_commit.c
131-
src/log.c
132-
src/err_netconf.c)
131+
src/log.c)
133132

134133
# source files to be covered by the 'format' target
135134
set(FORMAT_SRC
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
module netopeer-notifications {
2+
namespace "urn:cesnet:netopeer-notifcations";
3+
prefix npn;
4+
5+
yang-version 1.1;
6+
7+
import ietf-datastores {
8+
prefix ds;
9+
}
10+
11+
import ietf-netconf-notifications {
12+
prefix ncn;
13+
}
14+
15+
organization
16+
"CESNET";
17+
18+
contact
19+
"Author: Michal Vasko
20+
<mvasko@cesnet.cz>";
21+
22+
description
23+
"Netopeer2 NETCONF server YANG notifications.";
24+
25+
revision "2025-01-15" {
26+
description
27+
"Initial revision.";
28+
}
29+
30+
grouping session-type-params {
31+
description
32+
"Parameters to identify the type of NETCONF session.";
33+
34+
leaf session-type {
35+
type enumeration {
36+
enum standard {
37+
description
38+
"Standard NETCONF session created by the client connecting to the listening server.";
39+
}
40+
enum call-home {
41+
description
42+
"Call-Home NETCONF session created by the server connecting to the listening client.";
43+
}
44+
}
45+
mandatory true;
46+
description
47+
"Distinguishes the type of session.";
48+
}
49+
}
50+
51+
notification netconf-rpc-execution {
52+
description
53+
"NETCONF RPC is being executed.";
54+
55+
choice stage-of-execution {
56+
mandatory true;
57+
description
58+
"Distinguishes between pre-execution and post-execution notifications.";
59+
60+
leaf pre-execution {
61+
type empty;
62+
description
63+
"Notification sent before the RPC is executed.";
64+
}
65+
leaf post-execution {
66+
description
67+
"Notification sent after the RPC is executed.";
68+
type enumeration {
69+
enum success {
70+
description
71+
"RPC executed successfully.";
72+
}
73+
enum fail {
74+
description
75+
"RPC execution failed.";
76+
}
77+
}
78+
}
79+
}
80+
81+
leaf name {
82+
type enumeration {
83+
enum get-config {
84+
description
85+
"ietf-netconf get-config RPC";
86+
}
87+
enum edit-config {
88+
description
89+
"ietf-netconf edit-config RPC";
90+
}
91+
enum copy-config {
92+
description
93+
"ietf-netconf copy-config RPC";
94+
}
95+
enum delete-config {
96+
description
97+
"ietf-netconf delete-config RPC";
98+
}
99+
enum lock {
100+
description
101+
"ietf-netconf lock RPC";
102+
}
103+
enum unlock {
104+
description
105+
"ietf-netconf unlock RPC";
106+
}
107+
enum get {
108+
description
109+
"ietf-netconf get RPC";
110+
}
111+
enum kill-session {
112+
description
113+
"ietf-netconf kill-session RPC";
114+
}
115+
enum commit {
116+
description
117+
"ietf-netconf commit RPC";
118+
}
119+
enum discard-changes {
120+
description
121+
"ietf-netconf discard-changes RPC";
122+
}
123+
enum cancel-commit {
124+
description
125+
"ietf-netconf cancel-commit RPC";
126+
}
127+
enum validate {
128+
description
129+
"ietf-netconf validate RPC";
130+
}
131+
132+
enum get-schema {
133+
description
134+
"ietf-netconf-monitoring get-schema RPC";
135+
}
136+
137+
enum create-subscription {
138+
description
139+
"notifications create-subscription RPC";
140+
}
141+
142+
enum get-data {
143+
description
144+
"ietf-netconf-nmda get-data RPC";
145+
}
146+
enum edit-data {
147+
description
148+
"ietf-netconf-nmda edit-data RPC";
149+
}
150+
151+
enum establish-subscription {
152+
description
153+
"ietf-subscribed-notifications establish-subscription RPC";
154+
}
155+
enum modify-subscription {
156+
description
157+
"ietf-subscribed-notifications modify-subscription RPC";
158+
}
159+
enum delete-subscription {
160+
description
161+
"ietf-subscribed-notifications delete-subscription RPC";
162+
}
163+
enum kill-subscription {
164+
description
165+
"ietf-subscribed-notifications kill-subscription RPC";
166+
}
167+
168+
enum resync-subscription {
169+
description
170+
"ietf-yang-push resync-subscription RPC";
171+
}
172+
}
173+
mandatory true;
174+
description
175+
"Name of the executed RPC.";
176+
}
177+
178+
leaf datastore {
179+
type ds:datastore-ref;
180+
description
181+
"Affected datastore by the RPC, if relevant.";
182+
}
183+
}
184+
185+
augment "/ncn:netconf-session-start" {
186+
uses session-type-params;
187+
}
188+
189+
augment "/ncn:netconf-session-end" {
190+
uses session-type-params;
191+
}
192+
}

scripts/common.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ NP2_MODULES=(
1212
"ietf-network-instance@2019-01-21.yang"
1313
"ietf-subscribed-notifications@2019-09-09.yang -e encode-xml -e replay -e subtree -e xpath"
1414
"ietf-yang-push@2019-09-09.yang -e on-change"
15+
"netopeer-notifications@2025-01-15.yang"
1516
)
1617

1718
LN2_MODULES=(

0 commit comments

Comments
 (0)