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