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             leaf-list available-capability {
170                 type string;
171             }
172         }
173
174         container unavailable-capabilities {
175             config false;
176             list unavailable-capability {
177                 leaf capability {
178                     type string;
179                 }
180
181                 leaf failure-reason {
182                     type enumeration {
183                         enum missing-source;
184                         enum unable-to-resolve;
185                     }
186                 }
187             }
188         }
189
190         container pass-through {
191             when "../connection-status = connected";
192             description
193                 "When the underlying node is connected, its NETCONF context
194                 is available verbatim under this container through the
195                 mount extension.";
196         }
197
198     }
199
200     grouping netconf-schema-storage {
201         leaf schema-cache-directory {
202             config true;
203             type string;
204             default "schema";
205             description "The destination schema repository for yang files relative to the cache directory.  This may be specified per netconf mount
206                          so that the loaded yang files are stored to a distinct directory to avoid potential conflict.";
207         }
208
209         container yang-library {
210             leaf yang-library-url {
211                 config true;
212                 type inet:uri;
213                 description "Yang library to be plugged as additional source provider into the shared schema repository";
214             }
215
216             // credentials for basic http authentication
217             leaf username {
218                 config true;
219                 type string;
220             }
221
222             leaf password {
223                 config true;
224                 type string;
225             }
226         }
227     }
228
229     grouping netconf-node-fields {
230
231         uses netconf-node-credentials;
232
233         uses netconf-node-connection-parameters;
234
235         uses netconf-node-connection-status;
236
237         uses netconf-schema-storage;
238
239     }
240
241     augment "/nt:network-topology/nt:topology/nt:node" {
242         when "../../nt:topology-types/topology-netconf";
243         ext:augment-identifier "netconf-node";
244
245         uses netconf-node-fields;
246     }
247 }