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