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