2c327d495e7781e7dfa91df84b48d0297be2fd36
[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 "2010-09-24"; }
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
123     grouping netconf-node-connection-status {
124
125         leaf connection-status {
126             config false;
127             type enumeration {
128                 enum connecting;
129                 enum connected;
130                 enum unable-to-connect;
131             }
132         }
133
134         container clustered-connection-status {
135             config false;
136             list node-status {
137                 leaf node {
138                     type string;
139                 }
140                 leaf status {
141                     type enumeration {
142                         enum connected;
143                         enum unavailable;
144                         enum failed;
145                     }
146                 }
147             }
148         }
149
150         leaf connected-message {
151             config false;
152             type string;
153         }
154
155         container available-capabilities {
156             config false;
157             leaf-list available-capability {
158                 type string;
159             }
160         }
161
162         container unavailable-capabilities {
163             config false;
164             list unavailable-capability {
165                 leaf capability {
166                     type string;
167                 }
168
169                 leaf failure-reason {
170                     type enumeration {
171                         enum missing-source;
172                         enum unable-to-resolve;
173                     }
174                 }
175             }
176         }
177
178         container pass-through {
179             when "../connection-status = connected";
180             description
181                 "When the underlying node is connected, its NETCONF context
182                 is available verbatim under this container through the
183                 mount extension.";
184         }
185
186     }
187
188     grouping netconf-schema-storage {
189         leaf schema-cache-directory {
190             config true;
191             type string;
192             default "schema";
193             description "The destination schema repository for yang files relative to the cache directory.  This may be specified per netconf mount
194                          so that the loaded yang files are stored to a distinct directory to avoid potential conflict.";
195         }
196
197         container yang-library {
198             leaf yang-library-url {
199                 config true;
200                 type inet:uri;
201                 description "Yang library to be plugged as additional source provider into the shared schema repository";
202             }
203
204             // credentials for basic http authentication
205             leaf username {
206                 config true;
207                 type string;
208             }
209
210             leaf password {
211                 config true;
212                 type string;
213             }
214         }
215     }
216
217     grouping netconf-node-fields {
218
219         uses netconf-node-credentials;
220
221         uses netconf-node-connection-parameters;
222
223         uses netconf-node-connection-status;
224
225         uses netconf-schema-storage;
226
227     }
228
229     augment "/nt:network-topology/nt:topology/nt:node" {
230         when "../../nt:topology-types/topology-netconf";
231         ext:augment-identifier "netconf-node";
232
233         uses netconf-node-fields;
234     }
235 }