Restore the deprecated credentials name.
[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         leaf schemaless {
83             type boolean;
84             default false;
85         }
86
87         container yang-module-capabilities {
88             config true;
89             leaf override {
90                 type boolean;
91                 default false;
92                 description "Whether to override or merge this list of capabilities with capabilities from device";
93             }
94
95             leaf-list capability {
96                 type string;
97                 description "Set a list of capabilities to override capabilities provided in device's hello message.
98                              Can be used for devices that do not report any yang modules in their hello message";
99             }
100         }
101
102         container non-module-capabilities {
103             config true;
104             leaf override {
105                 type boolean;
106                 default false;
107                 description "Whether to override or merge this list of non-module based capabilities with non-module
108                              based capabilities from device";
109             }
110
111             leaf-list capability {
112                 type string;
113                 description "Set a list of non-module based capabilities to override or merge non-module capabilities
114                              provided in device's hello message. Can be used for devices that do not report or
115                              incorrectly report non-module based capabilities in their hello message";
116             }
117         }
118
119         leaf reconnect-on-changed-schema {
120             config true;
121             type boolean;
122             default false;
123             description "If true, the connector would auto disconnect/reconnect when schemas are changed in the remote device.
124                          The connector subscribes (right after connect) to base netconf notifications and listens for netconf-capability-change notification";
125         }
126
127         leaf connection-timeout-millis {
128             description "Specifies timeout in milliseconds after which connection must be established.";
129             config true;
130             type uint32;
131             default 20000;
132         }
133
134         leaf default-request-timeout-millis {
135             description "Timeout for blocking operations within transactions.";
136             config true;
137             type uint32;
138             default 60000;
139         }
140
141         leaf max-connection-attempts {
142             description "Maximum number of connection retries. Non positive value or null is interpreted as infinity.";
143             config true;
144             type uint32;
145             default 0; // retry forever
146         }
147
148         leaf between-attempts-timeout-millis {
149             description "Initial timeout in milliseconds to wait between connection attempts. Will be multiplied by sleep-factor with every additional attempt";
150             config true;
151             type uint16;
152             default 2000;
153         }
154
155         leaf sleep-factor {
156             config true;
157             type decimal64 {
158                 fraction-digits 1;
159             }
160             default 1.5;
161         }
162
163         // Keepalive configuration
164         leaf keepalive-delay {
165             config true;
166             type uint32;
167             default 120;
168             description "Netconf connector sends keepalive RPCs while the session is idle, this delay specifies the delay between keepalive RPC in seconds
169                          If a value <1 is provided, no keepalives will be sent";
170         }
171
172         leaf concurrent-rpc-limit {
173             config true;
174             type uint16;
175             default 0;
176             description "Limit of concurrent messages that can be send before reply messages are received.
177                          If value <1 is provided, no limit will be enforced";
178         }
179
180         leaf actor-response-wait-time {
181                     config true;
182                     type uint16 {
183                       range "1..max";
184                     }
185                     default 5;
186                     description "Time that slave actor will wait for response from master.";
187         }
188     }
189
190     grouping netconf-node-connection-status {
191
192         leaf connection-status {
193             config false;
194             type enumeration {
195                 enum connecting;
196                 enum connected;
197                 enum unable-to-connect;
198             }
199         }
200
201         container clustered-connection-status {
202             config false;
203             list node-status {
204                 leaf node {
205                     type string;
206                 }
207                 leaf status {
208                     type enumeration {
209                         enum connected;
210                         enum unavailable;
211                         enum failed;
212                     }
213                 }
214             }
215             leaf netconf-master-node {
216                 config false;
217                 type string;
218             }
219         }
220
221         leaf connected-message {
222             config false;
223             type string;
224         }
225
226         container available-capabilities {
227             config false;
228             list available-capability {
229                 leaf capability {
230                     type string;
231                 }
232                 leaf capability-origin {
233                     type enumeration {
234                         enum user-defined;
235                         enum device-advertised;
236                     }
237                 }
238             }
239         }
240
241         container unavailable-capabilities {
242             config false;
243             list unavailable-capability {
244                 leaf capability {
245                     type string;
246                 }
247
248                 leaf failure-reason {
249                     type enumeration {
250                         enum missing-source;
251                         enum unable-to-resolve;
252                     }
253                 }
254             }
255         }
256
257         container pass-through {
258             when "../connection-status = connected";
259             description
260                 "When the underlying node is connected, its NETCONF context
261                 is available verbatim under this container through the
262                 mount extension.";
263         }
264
265     }
266
267     grouping netconf-schema-storage {
268         leaf schema-cache-directory {
269             config true;
270             type string;
271             default "schema";
272             description "The destination schema repository for yang files relative to the cache directory.  This may be specified per netconf mount
273                          so that the loaded yang files are stored to a distinct directory to avoid potential conflict.";
274         }
275
276         container yang-library {
277             leaf yang-library-url {
278                 config true;
279                 type inet:uri;
280                 description "Yang library to be plugged as additional source provider into the shared schema repository";
281             }
282
283             // credentials for basic http authentication
284             leaf username {
285                 config true;
286                 type string;
287             }
288
289             leaf password {
290                 config true;
291                 type string;
292             }
293         }
294     }
295
296     grouping netconf-node-fields {
297
298         uses netconf-node-credentials;
299
300         uses netconf-node-connection-parameters;
301
302         uses netconf-node-connection-status;
303
304         uses netconf-schema-storage;
305
306     }
307
308     rpc create-device {
309         input {
310             uses netconf-node-fields;
311             leaf node-id {
312                 type string;
313             }
314         }
315     }
316
317     rpc delete-device {
318         input {
319             leaf node-id {
320                 type string;
321             }
322         }
323     }
324
325     augment "/nt:network-topology/nt:topology/nt:node" {
326         when "../../nt:topology-types/topology-netconf";
327         ext:augment-identifier "netconf-node";
328
329         uses netconf-node-fields;
330     }
331
332 }