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