Fix netconf-node-topology
[netconf.git] / netconf / sal-netconf-connector / src / main / yang / netconf-node-topology.yang
1 module netconf-node-topology {
2     namespace "urn:opendaylight:netconf-node-topology";
3     prefix "nettop";
4
5     import network-topology { prefix nt; revision-date 2013-10-21; }
6     import yang-ext { prefix ext; revision-date "2013-07-09";}
7     import ietf-inet-types { prefix inet; revision-date "2013-07-15"; }
8
9     revision "2015-01-14" {
10         description "Initial revision of Topology model";
11     }
12
13     augment "/nt:network-topology/nt:topology/nt:topology-types" {
14         container topology-netconf {
15             presence "The presence of the container node indicates a network
16                       of NETCONF devices";
17         }
18     }
19
20     grouping username-password {
21         leaf username {
22             type string;
23         }
24
25         leaf password {
26             type string;
27         }
28     }
29
30     grouping netconf-node-credentials {
31         choice credentials {
32             config true;
33             case login-password {
34                 description "Deprecated way of storing credentials, unencrypted.";
35
36                 status deprecated;
37                 uses username-password;
38             }
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 netconf-node-connection-parameters {
70
71         leaf host {
72             type inet:host;
73         }
74
75         leaf port {
76             type inet:port-number;
77         }
78
79         leaf tcp-only {
80             config true;
81             type boolean;
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 remote device.
150                          The connector subscribes (right after connect) to base netconf notifications and listens for netconf-capability-change notification";
151         }
152
153         leaf connection-timeout-millis {
154             description "Specifies timeout in milliseconds after which connection must be established.";
155             config true;
156             type uint32;
157             default 20000;
158         }
159
160         leaf default-request-timeout-millis {
161             description "Timeout for blocking operations within transactions.";
162             config true;
163             type uint32;
164             default 60000;
165         }
166
167         leaf max-connection-attempts {
168             description "Maximum number of connection retries. Non positive value or null is interpreted as infinity.";
169             config true;
170             type uint32;
171             default 0; // retry forever
172         }
173
174         leaf between-attempts-timeout-millis {
175             description "Initial timeout in milliseconds to wait between connection attempts. Will be multiplied by 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 the delay between keepalive RPC in seconds
195                          If a value <1 is provided, no keepalives will be sent";
196         }
197
198         leaf concurrent-rpc-limit {
199             config true;
200             type uint16;
201             default 0;
202             description "Limit of concurrent messages that can be send before reply messages are received.
203                          If value <1 is provided, no limit will be enforced";
204         }
205
206         leaf actor-response-wait-time {
207                     config true;
208                     type uint16 {
209                       range "1..max";
210                     }
211                     default 5;
212                     description "Time that slave actor will wait for response from master.";
213         }
214
215         container odl-hello-message-capabilities {
216             config true;
217             leaf-list capability {
218                 type inet:uri;
219                 description "Certain devices are non-accepting of ODL's hello message.  This allows specification of
220                              a custom ODL hello message based on a list of supported capabilities.";
221             }
222         }
223     }
224
225     grouping netconf-node-connection-status {
226
227         leaf connection-status {
228             config false;
229             type enumeration {
230                 enum connecting;
231                 enum connected;
232                 enum unable-to-connect;
233             }
234         }
235
236         container clustered-connection-status {
237             config false;
238             list node-status {
239                 leaf node {
240                     type string;
241                 }
242                 leaf status {
243                     type enumeration {
244                         enum connected;
245                         enum unavailable;
246                         enum failed;
247                     }
248                 }
249             }
250             leaf netconf-master-node {
251                 config false;
252                 type string;
253             }
254         }
255
256         leaf connected-message {
257             config false;
258             type string;
259         }
260
261         container available-capabilities {
262             config false;
263             list available-capability {
264                 leaf capability {
265                     type string;
266                 }
267                 leaf capability-origin {
268                     type enumeration {
269                         enum user-defined;
270                         enum device-advertised;
271                     }
272                 }
273             }
274         }
275
276         container unavailable-capabilities {
277             config false;
278             list unavailable-capability {
279                 leaf capability {
280                     type string;
281                 }
282
283                 leaf failure-reason {
284                     type enumeration {
285                         enum missing-source;
286                         enum unable-to-resolve;
287                     }
288                 }
289             }
290         }
291
292         container pass-through {
293             when "../connection-status = connected";
294             description
295                 "When the underlying node is connected, its NETCONF context
296                 is available verbatim under this container through the
297                 mount extension.";
298         }
299
300     }
301
302     grouping netconf-schema-storage {
303         leaf schema-cache-directory {
304             config true;
305             type string;
306             default "schema";
307             description "The destination schema repository for yang files relative to the cache directory.  This may be specified per netconf mount
308                          so that the loaded yang files are stored to a distinct directory to avoid potential conflict.";
309         }
310
311         container yang-library {
312             leaf yang-library-url {
313                 config true;
314                 type inet:uri;
315                 description "Yang library to be plugged as additional source provider into the shared schema repository";
316             }
317
318             // credentials for basic http authentication
319             leaf username {
320                 config true;
321                 type string;
322             }
323
324             leaf password {
325                 config true;
326                 type string;
327             }
328         }
329     }
330
331     grouping netconf-node-fields {
332
333         uses netconf-node-credentials;
334
335         uses netconf-node-connection-parameters;
336
337         uses netconf-node-connection-status;
338
339         uses netconf-schema-storage;
340
341     }
342
343     rpc create-device {
344         input {
345             uses netconf-node-fields;
346             leaf node-id {
347                 type string;
348             }
349         }
350     }
351
352     rpc delete-device {
353         input {
354             leaf node-id {
355                 type string;
356             }
357         }
358     }
359
360     augment "/nt:network-topology/nt:topology/nt:node" {
361         when "../../nt:topology-types/topology-netconf";
362         ext:augment-identifier "netconf-node";
363
364         uses netconf-node-fields;
365     }
366
367 }