1 module ietf-netconf-server {
3 namespace "urn:ietf:params:xml:ns:yang:ietf-netconf-server";
6 import ietf-yang-types {
9 "RFC 6991: Common YANG Data Types";
12 import ietf-x509-cert-to-name {
15 "RFC 7407: A YANG Data Model for SNMP Configuration";
18 import ietf-tcp-client {
21 "RFC DDDD: YANG Groupings for TCP Clients and TCP Servers";
24 import ietf-tcp-server {
27 "RFC DDDD: YANG Groupings for TCP Clients and TCP Servers";
30 import ietf-ssh-common {
33 "RFC EEEE: YANG Groupings for SSH Clients and SSH Servers";
36 import ietf-ssh-server {
39 "RFC EEEE: YANG Groupings for SSH Clients and SSH Servers";
42 import ietf-tls-server {
45 "RFC FFFF: YANG Groupings for TLS Clients and TLS Servers";
49 "IETF NETCONF (Network Configuration) Working Group";
52 "WG Web: https://datatracker.ietf.org/wg/netconf
53 WG List: NETCONF WG list <mailto:netconf@ietf.org>
54 Author: Kent Watsen <mailto:kent+ietf@watsen.net>";
57 "This module contains a collection of YANG definitions
58 for configuring NETCONF servers.
60 Copyright (c) 2023 IETF Trust and the persons identified
61 as authors of the code. All rights reserved.
63 Redistribution and use in source and binary forms, with
64 or without modification, is permitted pursuant to, and
65 subject to the license terms contained in, the Revised
66 BSD License set forth in Section 4.c of the IETF Trust's
67 Legal Provisions Relating to IETF Documents
68 (https://trustee.ietf.org/license-info).
70 This version of this YANG module is part of RFC HHHH
71 (https://www.rfc-editor.org/info/rfcHHHH); see the RFC
72 itself for full legal notices.
74 The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL',
75 'SHALL NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED',
76 'NOT RECOMMENDED', 'MAY', and 'OPTIONAL' in this document
77 are to be interpreted as described in BCP 14 (RFC 2119)
78 (RFC 8174) when, and only when, they appear in all
79 capitals, as shown here.";
85 "RFC HHHH: NETCONF Client and Server Models";
92 "The 'ssh-listen' feature indicates that the NETCONF server
93 supports opening a port to accept NETCONF over SSH
97 Using the NETCONF Protocol over Secure Shell (SSH)";
102 "The 'tls-listen' feature indicates that the NETCONF server
103 supports opening a port to accept NETCONF over TLS
104 client connections.";
106 "RFC 7589: Using the NETCONF Protocol over Transport
107 Layer Security (TLS) with Mutual X.509
111 feature ssh-call-home {
113 "The 'ssh-call-home' feature indicates that the NETCONF
114 server supports initiating a NETCONF over SSH call
115 home connection to NETCONF clients.";
117 "RFC 8071: NETCONF Call Home and RESTCONF Call Home";
120 feature tls-call-home {
122 "The 'tls-call-home' feature indicates that the NETCONF
123 server supports initiating a NETCONF over TLS call
124 home connection to NETCONF clients.";
126 "RFC 8071: NETCONF Call Home and RESTCONF Call Home";
129 feature central-netconf-server-supported {
131 "The 'central-netconf-server-supported' feature indicates
132 that the server supports the top-level 'netconf-server'
135 This feature is needed as some servers may want to use
136 features defined in this module, which requires this
137 module to be implemented, without having to support
138 the top-level 'netconf-server' node.";
143 grouping netconf-server-grouping {
145 "A reusable grouping for configuring a NETCONF server
146 without any consideration for how underlying transport
147 sessions are established.
149 Note that this grouping uses a fairly typical descendant
150 node name such that a stack of 'uses' statements will
151 have name conflicts. It is intended that the consuming
152 data model will resolve the issue by wrapping the 'uses'
153 statement in a container called, e.g.,
154 'netconf-server-parameters'. This model purposely does
155 not do this itself so as to provide maximum flexibility
156 to consuming models.";
158 container client-identity-mappings {
160 "Specifies mappings through which NETCONF client X.509
161 certificates are used to determine a NETCONF username,
164 For TLS-based transports, if no matching and valid
165 cert-to-name list entry can be found, then the NETCONF
166 server MUST close the connection, and MUST NOT accept
167 NETCONF messages over it, per Section 7 in RFC 7589.
169 For SSH-based transports, a matching cert-to-name
170 entry overrides the username provided by the SSH
171 implementation, consistent with the second paragraph
172 of Section 3 in RFC 6242.";
175 Using the NETCONF Protocol over Secure Shell (SSH)
177 Using the NETCONF Protocol over Transport Layer
178 Security (TLS) with Mutual X.509 Authentication";
179 uses x509c2n:cert-to-name {
180 refine "cert-to-name/fingerprint" {
183 "A 'fingerprint' value does not need to be specified
184 when the 'cert-to-name' mapping is independent of
185 fingerprint matching. A 'cert-to-name' having no
186 fingerprint value will match any client certificate
187 and therefore should only be present at the end of
188 the user-ordered 'cert-to-name' list.";
194 grouping netconf-server-listen-stack-grouping {
196 "A reusable grouping for configuring a NETCONF server
197 'listen' protocol stack for a single connection.";
201 "Selects between available transports.";
203 if-feature "ssh-listen";
206 "SSH-specific listening configuration for inbound
208 container tcp-server-parameters {
210 "A wrapper around the TCP client parameters
211 to avoid name collisions.";
212 uses tcps:tcp-server-grouping {
213 refine "local-port" {
216 "The NETCONF server will listen on the
217 IANA-assigned well-known port value
218 for 'netconf-ssh' (830) if no value
223 container ssh-server-parameters {
225 "A wrapper around the SSH server parameters
226 to avoid name collisions.";
227 uses sshs:ssh-server-grouping;
229 container netconf-server-parameters {
231 "A wrapper around the NETCONF server parameters
232 to avoid name collisions.";
233 uses ncs:netconf-server-grouping {
234 refine "client-identity-mappings" {
235 if-feature "sshcmn:ssh-x509-certs";
237 "Augments in an 'if-feature' statement
238 ensuring the 'client-identity-mappings'
239 descendant is enabled only when SSH
240 supports X.509 certificates.";
242 augment "client-identity-mappings" {
244 "Adds a flag indicating if a cert-to-name
246 leaf mapping-required {
249 "Indicates that the cert-to-name mapping
250 is required (i.e., the SSH-level username
259 if-feature "tls-listen";
262 "TLS-specific listening configuration for inbound
264 container tcp-server-parameters {
266 "A wrapper around the TCP client parameters
267 to avoid name collisions.";
268 uses tcps:tcp-server-grouping {
269 refine "local-port" {
272 "The NETCONF server will listen on the
273 IANA-assigned well-known port value
274 for 'netconf-tls' (6513) if no value
279 container tls-server-parameters {
281 "A wrapper around the TLS server parameters to
282 avoid name collisions.";
283 uses tlss:tls-server-grouping {
284 refine "client-authentication" {
285 must 'ca-certs or ee-certs';
287 "NETCONF/TLS servers MUST validate client
288 certificates. This configures certificates
289 at the socket-level (i.e. bags), more
290 discriminating client-certificate checks
291 SHOULD be implemented by the application.";
294 Using the NETCONF Protocol over Transport Layer
295 Security (TLS) with Mutual X.509 Authentication";
299 container netconf-server-parameters {
301 "A wrapper around the NETCONF server parameters
302 to avoid name collisions.";
303 uses ncs:netconf-server-grouping {
304 refine "client-identity-mappings/cert-to-name" {
307 "The TLS transport requires a mapping.";
316 grouping netconf-server-callhome-stack-grouping {
318 "A reusable grouping for configuring a NETCONF server
319 'call-home' protocol stack, for a single connection.";
323 "Selects between available transports.";
325 if-feature "ssh-call-home";
328 "Specifies SSH-specific call-home transport
330 container tcp-client-parameters {
332 "A wrapper around the TCP client parameters
333 to avoid name collisions.";
334 uses tcpc:tcp-client-grouping {
335 refine "remote-port" {
338 "The NETCONF server will attempt to connect
339 to the IANA-assigned well-known port for
340 'netconf-ch-ssh' (4334) if no value is
345 container ssh-server-parameters {
347 "A wrapper around the SSH server parameters
348 to avoid name collisions.";
349 uses sshs:ssh-server-grouping;
351 container netconf-server-parameters {
353 "A wrapper around the NETCONF server parameters
354 to avoid name collisions.";
355 uses ncs:netconf-server-grouping {
356 refine "client-identity-mappings" {
357 if-feature "sshcmn:ssh-x509-certs";
359 "Augments in an 'if-feature' statement
360 ensuring the 'client-identity-mappings'
361 descendant is enabled only when SSH
362 supports X.509 certificates.";
364 augment "client-identity-mappings" {
366 "Adds a flag indicating if a cert-to-name
368 leaf mapping-required {
371 "Indicates that the cert-to-name mapping
372 is required (i.e., the SSH-level username
381 if-feature "tls-call-home";
384 "Specifies TLS-specific call-home transport
386 container tcp-client-parameters {
388 "A wrapper around the TCP client parameters
389 to avoid name collisions.";
390 uses tcpc:tcp-client-grouping {
391 refine "remote-port" {
394 "The NETCONF server will attempt to connect
395 to the IANA-assigned well-known port for
396 'netconf-ch-tls' (4335) if no value is
401 container tls-server-parameters {
403 "A wrapper around the TLS server parameters to
404 avoid name collisions.";
405 uses tlss:tls-server-grouping {
406 refine "client-authentication" {
407 must 'ca-certs or ee-certs';
409 "NETCONF/TLS servers MUST validate client
410 certificates. This configures certificates
411 at the socket-level (i.e. bags), more
412 discriminating client-certificate checks
413 SHOULD be implemented by the application.";
416 Using the NETCONF Protocol over Transport Layer
417 Security (TLS) with Mutual X.509 Authentication";
421 container netconf-server-parameters {
423 "A wrapper around the NETCONF server parameters
424 to avoid name collisions.";
425 uses ncs:netconf-server-grouping {
426 refine "client-identity-mappings/cert-to-name" {
429 "The TLS transport requires a mapping.";
438 grouping netconf-server-app-grouping {
440 "A reusable grouping for configuring a NETCONF server
441 application that supports both 'listen' and 'call-home'
442 protocol stacks for a multiplicity of connections.";
444 if-feature "ssh-listen or tls-listen";
446 "Indicates that server-listening ports have been configured.
447 This statement is present so the mandatory descendant
448 nodes do not imply that this node must be configured.";
450 "Configures listen behavior";
454 default "180"; // three minutes
456 "Specifies the maximum number of seconds that a NETCONF
457 session may remain idle. A NETCONF session will be
458 dropped if it is idle for an interval longer than this
459 number of seconds. If set to zero, then the server
460 will never drop a session because it is idle.";
466 "List of endpoints to listen for NETCONF connections.";
470 "An arbitrary name for the NETCONF listen endpoint.";
472 uses netconf-server-listen-stack-grouping;
475 container call-home {
476 if-feature "ssh-call-home or tls-call-home";
478 "Indicates that server-initiated call home connections have
479 been configured. This statement is present so the mandatory
480 descendant nodes do not imply that this node must be
483 "Configures the NETCONF server to initiate the underlying
484 transport connection to NETCONF clients.";
485 list netconf-client {
489 "List of NETCONF clients the NETCONF server is to
490 maintain simultaneous call-home connections with.";
494 "An arbitrary name for the remote NETCONF client.";
496 container endpoints {
498 "Container for the list of endpoints.";
504 "A non-empty user-ordered list of endpoints for this
505 NETCONF server to try to connect to in sequence.
506 Defining more than one enables high-availability.";
510 "An arbitrary name for this endpoint.";
512 uses netconf-server-callhome-stack-grouping;
515 container connection-type {
517 "Indicates the NETCONF server's preference for how the
518 NETCONF connection is maintained.";
519 choice connection-type {
522 "Selects between available connection types.";
523 case persistent-connection {
524 container persistent {
526 "Indicates that a persistent connection is to be
529 "Maintain a persistent connection to the NETCONF
530 client. If the connection goes down, immediately
531 start trying to reconnect to the NETCONF client,
532 using the reconnection strategy.
534 This connection type minimizes any NETCONF client
535 to NETCONF server data-transfer delay, albeit at
536 the expense of holding resources longer.";
539 case periodic-connection {
541 presence "Indicates that a periodic connection is
544 "Periodically connect to the NETCONF client.
546 This connection type decreases resource
547 utilization, albeit with increased delay in
548 NETCONF client to NETCONF server interactions.
550 The NETCONF client SHOULD gracefully close the
551 connection using <close-session> upon completing
552 planned activities. If the NETCONF session is
553 not closed gracefully, the NETCONF server MUST
554 immediately attempt to reestablish the connection.
556 Connections are established at the same start
557 time regardless how long the previous connection
560 In the case that the previous connection is still
561 active (i.e., the NETCONF client has not closed
562 it yet), establishing a new connection is NOT
569 "Duration of time between periodic connections.";
572 type yang:date-and-time {
573 // constrained to minute-level granularity
574 pattern '[0-9]{4}-(1[0-2]|0[1-9])-(0[1-9]|[1-2]'
575 + '[0-9]|3[0-1])T(0[0-9]|1[0-9]|2[0-3]):['
576 + '0-5][0-9]:00(Z|[\+\-]((1[0-3]|0[0-9]):'
577 + '([0-5][0-9])|14:00))?';
580 "Designates a timestamp before or after which a
581 series of periodic connections are determined.
582 The periodic connections occur at a whole
583 multiple interval from the anchor time.
585 If an 'anchor-time' is not provided, then the
586 server may implicitly set it to the time when
587 this configuraton is applied (e.g., on boot).
589 For example, for an anchor time is 15 minutes
590 past midnight and a period interval of 24 hours,
591 then a periodic connection will occur 15 minutes
592 past midnight everyday.";
597 default "180"; // three minutes
599 "Specifies the maximum number of seconds that
600 a NETCONF session may remain idle. A NETCONF
601 session will be dropped if it is idle for an
602 interval longer than this number of seconds.
603 If set to zero, then the server will never
604 drop a session because it is idle.";
607 } // case periodic-connection
608 } // choice connection-type
609 } // container connection-type
610 container reconnect-strategy {
612 "The reconnection strategy directs how a NETCONF server
613 reconnects to a NETCONF client, after discovering its
614 connection to the client has dropped, even if due to a
615 reboot. The NETCONF server starts with the specified
616 endpoint and tries to connect to it max-attempts times
617 before trying the next endpoint in the list (round
623 "Indicates that reconnections should start with
624 the first endpoint listed.";
626 enum last-connected {
628 "Indicates that reconnections should start with
629 the endpoint last connected to. If no previous
630 connection has ever been established, then the
631 first endpoint configured is used. NETCONF
632 servers SHOULD be able to remember the last
633 endpoint connected to across reboots.";
635 enum random-selection {
637 "Indicates that reconnections should start with
641 default "first-listed";
643 "Specifies which of the NETCONF client's endpoints
644 the NETCONF server should start with when trying
645 to connect to the NETCONF client.";
654 "Specifies the amount of time in seconds after which,
655 if the connection is not established, an endpoint
656 connection attempt is considered unsuccessful.";
664 "Specifies the number times the NETCONF server tries
665 to connect to a specific endpoint before moving on
666 to the next endpoint in the list (round robin).";
668 } // container reconnect-strategy
669 } // list netconf-client
670 } // container call-home
671 } // grouping netconf-server-app-grouping
673 // Protocol accessible node for servers that implement this module.
674 container netconf-server {
675 if-feature central-netconf-server-supported;
676 uses netconf-server-app-grouping;
678 "Top-level container for NETCONF server configuration.";