Bug 6714 - Use singleton service in clustered netconf topology
[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 netconf-node-credentials {
19
20         choice credentials {
21             config true;
22             case login-password {
23                 leaf username {
24                     type string;
25                 }
26
27                 leaf password {
28                     type string;
29                 }
30             }
31         }
32     }
33
34     grouping netconf-node-connection-parameters {
35
36         leaf host {
37             type inet:host;
38         }
39
40         leaf port {
41             type inet:port-number;
42         }
43
44         leaf tcp-only {
45             config true;
46             type boolean;
47         }
48
49         leaf schemaless {
50             type boolean;
51             default false;
52         }
53
54         container yang-module-capabilities {
55             config true;
56             leaf override {
57                 type boolean;
58                 default false;
59                 description "Whether to override or merge this list of capabilities with capabilities from device";
60             }
61
62             leaf-list capability {
63                 type string;
64                 description "Set a list of capabilities to override capabilities provided in device's hello message.
65                              Can be used for devices that do not report any yang modules in their hello message";
66             }
67         }
68
69         leaf reconnect-on-changed-schema {
70             config true;
71             type boolean;
72             default false;
73             description "If true, the connector would auto disconnect/reconnect when schemas are changed in the remote device.
74                          The connector subscribes (right after connect) to base netconf notifications and listens for netconf-capability-change notification";
75         }
76
77         leaf connection-timeout-millis {
78             description "Specifies timeout in milliseconds after which connection must be established.";
79             config true;
80             type uint32;
81             default 20000;
82         }
83
84         leaf default-request-timeout-millis {
85             description "Timeout for blocking operations within transactions.";
86             config true;
87             type uint32;
88             default 60000;
89         }
90
91         leaf max-connection-attempts {
92             description "Maximum number of connection retries. Non positive value or null is interpreted as infinity.";
93             config true;
94             type uint32;
95             default 0; // retry forever
96         }
97
98         leaf between-attempts-timeout-millis {
99             description "Initial timeout in milliseconds to wait between connection attempts. Will be multiplied by sleep-factor with every additional attempt";
100             config true;
101             type uint16;
102             default 2000;
103         }
104
105         leaf sleep-factor {
106             config true;
107             type decimal64 {
108                 fraction-digits 1;
109             }
110             default 1.5;
111         }
112
113         // Keepalive configuration
114         leaf keepalive-delay {
115             config true;
116             type uint32;
117             default 120;
118             description "Netconf connector sends keepalive RPCs while the session is idle, this delay specifies the delay between keepalive RPC in seconds
119                          If a value <1 is provided, no keepalives will be sent";
120         }
121
122         leaf concurrent-rpc-limit {
123             config true;
124             type uint16;
125             default 0;
126             description "Limit of concurrent messages that can be send before reply messages are received.
127                          If value <1 is provided, no limit will be enforced";
128         }
129     }
130
131     grouping netconf-node-connection-status {
132
133         leaf connection-status {
134             config false;
135             type enumeration {
136                 enum connecting;
137                 enum connected;
138                 enum unable-to-connect;
139             }
140         }
141
142         container clustered-connection-status {
143             config false;
144             list node-status {
145                 leaf node {
146                     type string;
147                 }
148                 leaf status {
149                     type enumeration {
150                         enum connected;
151                         enum unavailable;
152                         enum failed;
153                     }
154                 }
155             }
156             leaf netconf-master-node {
157                 config false;
158                 type string;
159             }
160         }
161
162         leaf connected-message {
163             config false;
164             type string;
165         }
166
167         container available-capabilities {
168             config false;
169             list available-capability {
170                 leaf capability {
171                     type string;
172                 }
173                 leaf capability-origin {
174                     type enumeration {
175                         enum user-defined;
176                         enum device-advertised;
177                     }
178                 }
179             }
180         }
181
182         container unavailable-capabilities {
183             config false;
184             list unavailable-capability {
185                 leaf capability {
186                     type string;
187                 }
188
189                 leaf failure-reason {
190                     type enumeration {
191                         enum missing-source;
192                         enum unable-to-resolve;
193                     }
194                 }
195             }
196         }
197
198         container pass-through {
199             when "../connection-status = connected";
200             description
201                 "When the underlying node is connected, its NETCONF context
202                 is available verbatim under this container through the
203                 mount extension.";
204         }
205
206     }
207
208     grouping netconf-schema-storage {
209         leaf schema-cache-directory {
210             config true;
211             type string;
212             default "schema";
213             description "The destination schema repository for yang files relative to the cache directory.  This may be specified per netconf mount
214                          so that the loaded yang files are stored to a distinct directory to avoid potential conflict.";
215         }
216
217         container yang-library {
218             leaf yang-library-url {
219                 config true;
220                 type inet:uri;
221                 description "Yang library to be plugged as additional source provider into the shared schema repository";
222             }
223
224             // credentials for basic http authentication
225             leaf username {
226                 config true;
227                 type string;
228             }
229
230             leaf password {
231                 config true;
232                 type string;
233             }
234         }
235     }
236
237     grouping netconf-node-fields {
238
239         uses netconf-node-credentials;
240
241         uses netconf-node-connection-parameters;
242
243         uses netconf-node-connection-status;
244
245         uses netconf-schema-storage;
246
247     }
248
249     augment "/nt:network-topology/nt:topology/nt:node" {
250         when "../../nt:topology-types/topology-netconf";
251         ext:augment-identifier "netconf-node";
252
253         uses netconf-node-fields;
254     }
255 }