143cc2a3b2a5438c0575e4db1eafc0844c0cf924
[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             default false;
83         }
84
85         container protocol {
86             config true;
87             leaf name {
88                 type enumeration {
89                     enum SSH;
90                     enum TLS;
91                 }
92                 default SSH;
93             }
94
95             choice specification {
96                 case tls-case {
97                    container tls {
98                        leaf-list excluded-versions {
99                            type string;
100                            description "A list of TLS version names provided in JDK that are not supported by the
101                                         target netconf device, eg, the netopeer2 simulator does not support the
102                                         SSLv2Hello. Most of the time, this list need not be set";
103                        }
104                    }
105                 }
106             }
107         }
108
109         leaf schemaless {
110             type boolean;
111             default false;
112         }
113
114         container yang-module-capabilities {
115             config true;
116             leaf override {
117                 type boolean;
118                 default false;
119                 description "Whether to override or merge this list of capabilities with capabilities from device";
120             }
121
122             leaf-list capability {
123                 type string;
124                 description "Set a list of capabilities to override capabilities provided in device's hello message.
125                              Can be used for devices that do not report any yang modules in their hello message";
126             }
127         }
128
129         container non-module-capabilities {
130             config true;
131             leaf override {
132                 type boolean;
133                 default false;
134                 description "Whether to override or merge this list of non-module based capabilities with non-module
135                              based capabilities from device";
136             }
137
138             leaf-list capability {
139                 type string;
140                 description "Set a list of non-module based capabilities to override or merge non-module capabilities
141                              provided in device's hello message. Can be used for devices that do not report or
142                              incorrectly report non-module based capabilities in their hello message";
143             }
144         }
145
146         leaf reconnect-on-changed-schema {
147             config true;
148             type boolean;
149             default false;
150             description "If true, the connector would auto disconnect/reconnect when schemas are changed in the remote device.
151                          The connector subscribes (right after connect) to base netconf notifications and listens for netconf-capability-change notification";
152         }
153
154         leaf connection-timeout-millis {
155             description "Specifies timeout in milliseconds after which connection must be established.";
156             config true;
157             type uint32;
158             default 20000;
159         }
160
161         leaf default-request-timeout-millis {
162             description "Timeout for blocking operations within transactions.";
163             config true;
164             type uint32;
165             default 60000;
166         }
167
168         leaf max-connection-attempts {
169             description "Maximum number of connection retries. Non positive value or null is interpreted as infinity.";
170             config true;
171             type uint32;
172             default 0; // retry forever
173         }
174
175         leaf between-attempts-timeout-millis {
176             description "Initial timeout in milliseconds to wait between connection attempts. Will be multiplied by sleep-factor with every additional attempt";
177             config true;
178             type uint16;
179             default 2000;
180         }
181
182         leaf sleep-factor {
183             config true;
184             type decimal64 {
185                 fraction-digits 1;
186             }
187             default 1.5;
188         }
189
190         // Keepalive configuration
191         leaf keepalive-delay {
192             config true;
193             type uint32;
194             default 120;
195             description "Netconf connector sends keepalive RPCs while the session is idle, this delay specifies 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 netconf-node-connection-status {
227
228         leaf connection-status {
229             config false;
230             type enumeration {
231                 enum connecting;
232                 enum connected;
233                 enum unable-to-connect;
234             }
235         }
236
237         container clustered-connection-status {
238             config false;
239             list node-status {
240                 leaf node {
241                     type string;
242                 }
243                 leaf status {
244                     type enumeration {
245                         enum connected;
246                         enum unavailable;
247                         enum failed;
248                     }
249                 }
250             }
251             leaf netconf-master-node {
252                 config false;
253                 type string;
254             }
255         }
256
257         leaf connected-message {
258             config false;
259             type string;
260         }
261
262         container available-capabilities {
263             config false;
264             list available-capability {
265                 leaf capability {
266                     type string;
267                 }
268                 leaf capability-origin {
269                     type enumeration {
270                         enum user-defined;
271                         enum device-advertised;
272                     }
273                 }
274             }
275         }
276
277         container unavailable-capabilities {
278             config false;
279             list unavailable-capability {
280                 leaf capability {
281                     type string;
282                 }
283
284                 leaf failure-reason {
285                     type enumeration {
286                         enum missing-source;
287                         enum unable-to-resolve;
288                     }
289                 }
290             }
291         }
292
293         container pass-through {
294             when "../connection-status = connected";
295             description
296                 "When the underlying node is connected, its NETCONF context
297                 is available verbatim under this container through the
298                 mount extension.";
299         }
300
301     }
302
303     grouping netconf-schema-storage {
304         leaf schema-cache-directory {
305             config true;
306             type string;
307             default "schema";
308             description "The destination schema repository for yang files relative to the cache directory.  This may be specified per netconf mount
309                          so that the loaded yang files are stored to a distinct directory to avoid potential conflict.";
310         }
311
312         container yang-library {
313             leaf yang-library-url {
314                 config true;
315                 type inet:uri;
316                 description "Yang library to be plugged as additional source provider into the shared schema repository";
317             }
318
319             // credentials for basic http authentication
320             leaf username {
321                 config true;
322                 type string;
323             }
324
325             leaf password {
326                 config true;
327                 type string;
328             }
329         }
330     }
331
332     grouping netconf-node-fields {
333
334         uses netconf-node-credentials;
335
336         uses netconf-node-connection-parameters;
337
338         uses netconf-node-connection-status;
339
340         uses netconf-schema-storage;
341
342     }
343
344     rpc create-device {
345         input {
346             uses netconf-node-fields;
347             leaf node-id {
348                 type string;
349             }
350         }
351     }
352
353     rpc delete-device {
354         input {
355             leaf node-id {
356                 type string;
357             }
358         }
359     }
360
361     augment "/nt:network-topology/nt:topology/nt:node" {
362         when "../../nt:topology-types/topology-netconf";
363         ext:augment-identifier "netconf-node";
364
365         uses netconf-node-fields;
366     }
367
368 }