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