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