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