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