Add session-id to the operational datastore
[netconf.git] / plugins / 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 session-id {
223       config false;
224       type uint32 {
225         range "1..max";
226       }
227     }
228
229     leaf connection-status {
230       config false;
231       type enumeration {
232         enum connecting;
233         enum connected;
234         enum unable-to-connect;
235       }
236     }
237
238     container clustered-connection-status {
239       config false;
240       list node-status {
241         leaf node {
242           type string;
243         }
244         leaf status {
245           type enumeration {
246             enum connected;
247             enum unavailable;
248             enum failed;
249           }
250         }
251       }
252       leaf netconf-master-node {
253         config false;
254         type string;
255       }
256     }
257
258     leaf connected-message {
259       config false;
260       type string;
261     }
262
263     container available-capabilities {
264       config false;
265       list available-capability {
266         leaf capability {
267             type string;
268         }
269         leaf capability-origin {
270           type enumeration {
271             enum user-defined;
272             enum device-advertised;
273           }
274         }
275       }
276     }
277
278     container unavailable-capabilities {
279       config false;
280       list unavailable-capability {
281         leaf capability {
282           type string;
283         }
284
285         leaf failure-reason {
286           type enumeration {
287             enum missing-source;
288             enum unable-to-resolve;
289           }
290         }
291       }
292     }
293
294     container pass-through {
295       when "../connection-status = connected";
296       description
297         "When the underlying node is connected, its NETCONF context
298         is available verbatim under this container through the
299         mount extension.";
300     }
301   }
302   
303   grouping netconf-schema-storage {
304     leaf schema-cache-directory {
305       config true;
306       type string;
307       default "schema";
308       description
309         "The destination schema repository for yang files relative to the cache directory.
310          This may be specified per netconf mount so that the loaded yang files are stored
311          to a distinct directory to avoid potential conflict.";
312     }
313
314     container yang-library {
315       leaf yang-library-url {
316           config true;
317           type inet:uri;
318           description
319             "Yang library to be plugged as additional source provider into the shared schema repository";
320       }
321
322       // credentials for basic http authentication
323       leaf username {
324           config true;
325           type string;
326       }
327
328       leaf password {
329           config true;
330           type string;
331       }
332     }
333   }
334
335   grouping datastore-access {
336     leaf lock-datastore {
337       type boolean;
338       default true;
339       description "The operation allows the client to lock the entire configuration datastore
340                    system of a device.
341                    WARNING - With blocking the lock/unlock operations, the user is coming to operate
342                    in a manner which is not supported. Concurrent access to the data store may interfere
343                    with data consistency.";
344     }
345   }
346 }