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