d520672ffdf853a96afa4c24e8c1973eebbff8e5
[netconf.git] / plugins / netconf-client-mdsal / src / main / yang / odl-netconf-device.yang
1 module odl-netconf-device {
2   namespace "urn:opendaylight:netconf:device";
3   prefix "ond";
4
5   description
6     "Common groupings for describing configuration and operational status
7      of an OpenDaylight southbound NETCONF device.";
8
9   import ietf-inet-types { prefix inet; }
10   import ietf-netconf { prefix nc; }
11
12   revision 2023-10-25 {
13     description "Remove deprecated login-password case";
14   }
15
16   revision 2023-10-24 {
17     description "Marking deprecated login-password as obsolete before removing it";
18   }
19
20   revision 2023-04-30 {
21     description "Use ietf-netconf's session-id-type";
22   }
23
24   revision 2022-12-25;
25
26   grouping username-password {
27     leaf username {
28       type string;
29     }
30
31     leaf password {
32       type string;
33     }
34   }
35
36   grouping credentials {
37     choice credentials {
38       config true;
39       case login-pw {
40         description "login-password credentials, encrypted.";
41
42         container login-password {
43           uses username-password;
44         }
45       }
46       case login-pw-unencrypted {
47         description "login-password credentials, not encrypted.";
48
49         container login-password-unencrypted {
50           uses username-password;
51         }
52       }
53       case key-auth {
54         description "key-based authentication, use the id for the pair thats stored in the keystore.";
55
56         container key-based {
57           leaf key-id {
58             type string;
59           }
60
61           leaf username {
62             type string;
63           }
64         }
65       }
66     }
67   }
68
69   grouping connection-parameters {
70     leaf host {
71       type inet:host;
72     }
73
74     leaf port {
75       type inet:port-number;
76     }
77
78     leaf tcp-only {
79       config true;
80       type boolean;
81       default false;
82     }
83
84     container protocol {
85       config true;
86       leaf name {
87         type enumeration {
88           enum SSH;
89           enum TLS;
90         }
91         default SSH;
92       }
93
94       choice specification {
95         case tls-case {
96           container tls {
97             leaf-list excluded-versions {
98               type string;
99               description "A list of TLS version names provided in JDK that are not supported by the
100                            target netconf device, eg, the netopeer2 simulator does not support the
101                            SSLv2Hello. Most of the time, this list need not be set";
102             }
103           }
104         }
105       }
106     }
107
108     leaf schemaless {
109       type boolean;
110       default false;
111     }
112
113     container yang-module-capabilities {
114       config true;
115       leaf override {
116         type boolean;
117         default false;
118         description "Whether to override or merge this list of capabilities with capabilities from device";
119       }
120
121       leaf-list capability {
122         type string;
123         description "Set a list of capabilities to override capabilities provided in device's hello message.
124                      Can be used for devices that do not report any yang modules in their hello message";
125       }
126     }
127
128     container non-module-capabilities {
129       config true;
130       leaf override {
131         type boolean;
132         default false;
133         description "Whether to override or merge this list of non-module based capabilities with non-module
134                      based capabilities from device";
135       }
136
137       leaf-list capability {
138         type string;
139         description "Set a list of non-module based capabilities to override or merge non-module capabilities
140                      provided in device's hello message. Can be used for devices that do not report or
141                      incorrectly report non-module based capabilities in their hello message";
142       }
143     }
144
145     leaf reconnect-on-changed-schema {
146       config true;
147       type boolean;
148       default false;
149       description "If true, the connector would auto disconnect/reconnect when schemas are changed in the
150                    remote device. The connector subscribes (right after connect) to base netconf notifications
151                    and listens for netconf-capability-change notification";
152     }
153
154     leaf connection-timeout-millis {
155       description "Specifies timeout in milliseconds after which connection must be established.";
156       config true;
157       type uint32;
158       default 20000;
159     }
160
161     leaf default-request-timeout-millis {
162       description "Timeout for blocking operations within transactions.";
163       config true;
164       type uint32;
165       default 60000;
166     }
167
168     leaf max-connection-attempts {
169       description "Maximum number of connection retries. Non positive value or null is interpreted as infinity.";
170       config true;
171       type uint32;
172       default 0; // retry forever
173     }
174
175     leaf between-attempts-timeout-millis {
176       description "Initial timeout in milliseconds to wait between connection attempts. Will be multiplied by
177                    sleep-factor with every additional attempt";
178       config true;
179       type uint16;
180       default 2000;
181     }
182
183     leaf sleep-factor {
184       config true;
185       type decimal64 {
186         fraction-digits 1;
187       }
188       default 1.5;
189     }
190
191     // Keepalive configuration
192     leaf keepalive-delay {
193       config true;
194       type uint32;
195       default 120;
196       description "Netconf connector sends keepalive RPCs while the session is idle, this delay specifies
197                    the delay between keepalive RPC in seconds.
198                    If a value <1 is provided, no keepalives will be sent";
199     }
200
201     leaf concurrent-rpc-limit {
202       config true;
203       type uint16;
204       default 0;
205       description "Limit of concurrent messages that can be send before reply messages are received.
206                    If value <1 is provided, no limit will be enforced";
207     }
208
209     leaf actor-response-wait-time {
210       config true;
211       type uint16 {
212         range "1..max";
213       }
214       default 5;
215       description "Time that slave actor will wait for response from master.";
216     }
217
218     container odl-hello-message-capabilities {
219       config true;
220       leaf-list capability {
221         type inet:uri;
222         description "Certain devices are non-accepting of ODL's hello message.  This allows specification of
223                      a custom ODL hello message based on a list of supported capabilities.";
224       }
225     }
226   }
227
228   grouping connection-oper {
229     leaf session-id {
230       config false;
231       type nc:session-id-type;
232     }
233
234     leaf connection-status {
235       config false;
236       type enumeration {
237         enum connecting;
238         enum connected;
239         enum unable-to-connect;
240       }
241     }
242
243     container clustered-connection-status {
244       config false;
245       list node-status {
246         leaf node {
247           type string;
248         }
249         leaf status {
250           type enumeration {
251             enum connected;
252             enum unavailable;
253             enum failed;
254           }
255         }
256       }
257       leaf netconf-master-node {
258         config false;
259         type string;
260       }
261     }
262
263     leaf connected-message {
264       config false;
265       type string;
266     }
267
268     container available-capabilities {
269       config false;
270       list available-capability {
271         leaf capability {
272             type string;
273         }
274         leaf capability-origin {
275           type enumeration {
276             enum user-defined;
277             enum device-advertised;
278           }
279         }
280       }
281     }
282
283     container unavailable-capabilities {
284       config false;
285       list unavailable-capability {
286         leaf capability {
287           type string;
288         }
289
290         leaf failure-reason {
291           type enumeration {
292             enum missing-source;
293             enum unable-to-resolve;
294           }
295         }
296       }
297     }
298
299     container pass-through {
300       when "../connection-status = connected";
301       description
302         "When the underlying node is connected, its NETCONF context
303         is available verbatim under this container through the
304         mount extension.";
305     }
306   }
307   
308   grouping netconf-schema-storage {
309     leaf schema-cache-directory {
310       config true;
311       type string;
312       default "schema";
313       description
314         "The destination schema repository for yang files relative to the cache directory.
315          This may be specified per netconf mount so that the loaded yang files are stored
316          to a distinct directory to avoid potential conflict.";
317     }
318
319     container yang-library {
320       leaf yang-library-url {
321           config true;
322           type inet:uri;
323           description
324             "Yang library to be plugged as additional source provider into the shared schema repository";
325       }
326
327       // credentials for basic http authentication
328       leaf username {
329           config true;
330           type string;
331       }
332
333       leaf password {
334           config true;
335           type string;
336       }
337     }
338   }
339
340   grouping datastore-access {
341     leaf lock-datastore {
342       type boolean;
343       default true;
344       description "The operation allows the client to lock the entire configuration datastore
345                    system of a device.
346                    WARNING - With blocking the lock/unlock operations, the user is coming to operate
347                    in a manner which is not supported. Concurrent access to the data store may interfere
348                    with data consistency.";
349     }
350   }
351 }