Rework BGP timers to work with channel
[bgpcep.git] / bgp / rib-impl / src / main / yang / odl-bgp-rib-impl-cfg.yang
1 // vi: set smarttab et sw=4 tabstop=4:
2 module odl-bgp-rib-impl-cfg {
3     yang-version 1;
4     namespace "urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl";
5     prefix "bgprib-impl";
6
7     import bgp-multiprotocol { prefix bgp-mp; revision-date 2013-09-19; }
8     import bgp-rib { prefix rib; revision-date 2013-09-25; }
9     import bgp-types { prefix bgp-t; revision-date 2013-09-19; }
10     import odl-bgp-rib-cfg { prefix bgprib; revision-date 2013-07-01; }
11     import odl-bgp-parser-spi-cfg { prefix bgpspi; revision-date 2013-11-15; }
12     import odl-bgp-rib-spi-cfg { prefix ribspi; revision-date 2013-11-15; }
13     import ietf-inet-types { prefix inet; revision-date 2010-09-24; }
14     import opendaylight-md-sal-binding {prefix mdsb; revision-date 2013-10-28; }
15     import netty { prefix netty; revision-date 2013-11-19; }
16     import config { prefix config; revision-date 2013-04-05; }
17     import protocol-framework { prefix pf; revision-date 2014-03-13; }
18     import odl-tcpmd5-cfg { prefix tcpmd5; revision-date 2014-04-27; }
19     import odl-tcpmd5-netty-cfg { prefix tcpmd5n; revision-date 2014-04-27; }
20
21     organization "Cisco Systems, Inc.";
22
23     contact "Robert Varga <rovarga@cisco.com>";
24
25     description
26         "This module contains the base YANG definitions for
27          BGP listener implementation.
28
29         Copyright (c)2013 Cisco Systems, Inc. All rights reserved.;
30
31         This program and the accompanying materials are made available
32         under the terms of the Eclipse Public License v1.0 which
33         accompanies this distribution, and is available at
34         http://www.eclipse.org/legal/epl-v10.html";
35
36     revision "2013-04-09" {
37         description
38             "Initial revision";
39     }
40
41     identity base-bgp-parser {
42         base config:module-type;
43         config:java-name-prefix BaseBGPParser;
44         config:provided-service bgpspi:extension;
45     }
46
47     augment "/config:modules/config:module/config:configuration" {
48         case base-bgp-parser {
49             when "/config:modules/config:module/config:type = 'base-bgp-parser'";
50         }
51     }
52
53     identity bgp-dispatcher {
54         description
55             "Service representing a BGP Dispatcher.";
56
57         base "config:service-type";
58         config:java-class "org.opendaylight.protocol.bgp.rib.impl.spi.BGPDispatcher";
59     }
60
61     identity bgp-dispatcher-impl {
62         base config:module-type;
63         config:provided-service bgp-dispatcher;
64         config:java-name-prefix BGPDispatcherImpl;
65     }
66
67     augment "/config:modules/config:module/config:configuration" {
68         case bgp-dispatcher-impl {
69             when "/config:modules/config:module/config:type = 'bgp-dispatcher-impl'";
70
71             container bgp-extensions {
72                 uses config:service-ref {
73                     refine type {
74                         mandatory true;
75                         config:required-identity bgpspi:consumer-extensions;
76                     }
77                 }
78             }
79
80             container boss-group {
81                 uses config:service-ref {
82                     refine type {
83                         mandatory true;
84                         config:required-identity netty:netty-threadgroup;
85                     }
86                 }
87             }
88
89             container worker-group {
90                 uses config:service-ref {
91                     refine type {
92                         mandatory true;
93                         config:required-identity netty:netty-threadgroup;
94                     }
95                 }
96             }
97
98             container md5-channel-factory {
99                 uses config:service-ref {
100                     refine type {
101                         mandatory false;
102                         config:required-identity tcpmd5n:md5-channel-factory;
103                     }
104                 }
105             }
106
107             container md5-server-channel-factory {
108                 uses config:service-ref {
109                     refine type {
110                         mandatory false;
111                         config:required-identity tcpmd5n:md5-server-channel-factory;
112                     }
113                 }
114             }
115         }
116     }
117
118     identity base-bgp-rib {
119         base config:module-type;
120         config:provided-service ribspi:extension;
121         config:java-name-prefix BaseBGPRIB;
122     }
123
124     augment "/config:modules/config:module/config:configuration" {
125         case base-bgp-rib {
126             when "/config:modules/config:module/config:type = 'base-bgp-rib'";
127         }
128     }
129
130     identity rib-instance {
131         description
132             "Service representing a RIB instance";
133
134         base "config:service-type";
135         config:java-class "org.opendaylight.protocol.bgp.rib.impl.spi.RIB";
136     }
137
138     identity bgp-peer-registry {
139         description
140             "Registry of BGP peers. Every new BGP in/out connection looks for peers to handle bgp messages in this registry";
141
142         base "config:service-type";
143         config:java-class "org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry";
144     }
145
146     identity strict-bgp-peer-registry {
147         description
148             "Registry of BGP peers that allows only one connection per 2 peers. Uses IP address for Peer identification and BGP Ids to resolve duplicate connections";
149
150         config:provided-service bgp-peer-registry;
151         base config:module-type;
152         config:java-name-prefix StrictBgpPeerRegistry;
153     }
154
155
156      augment "/config:modules/config:module/config:configuration" {
157         case strict-bgp-peer-registry {
158             when "/config:modules/config:module/config:type = 'strict-bgp-peer-registry'";
159         }
160     }
161
162     identity bgp-peer {
163         description
164             "BGP peer instance.";
165
166         base config:module-type;
167         config:java-name-prefix BGPPeer;
168     }
169
170     identity bgp-peer-acceptor {
171         description
172             "BGP peer acceptor that handles incomming bgp connections. Uses BGP peer registry to accept or decline incomming connections";
173
174         base config:module-type;
175         config:java-name-prefix BGPPeerAcceptor;
176     }
177
178      augment "/config:modules/config:module/config:configuration" {
179         case bgp-peer-acceptor {
180             when "/config:modules/config:module/config:type = 'bgp-peer-acceptor'";
181
182             leaf binding-address {
183                 description "IP address to bind to";
184                 type inet:ip-address;
185                 default "0.0.0.0";
186             }
187
188             leaf binding-port {
189                 description "Port to bind to";
190                 type inet:port-number;
191                 default "179";
192             }
193
194             container bgp-dispatcher {
195                 uses config:service-ref {
196                     refine type {
197                         mandatory true;
198                         config:required-identity bgp-dispatcher;
199                     }
200                 }
201             }
202
203             container peer-registry {
204                 uses config:service-ref {
205                     refine type {
206                         mandatory true;
207                         config:required-identity bgp-peer-registry;
208                     }
209                 }
210             }
211         }
212     }
213
214     identity bgp-table-type {
215         description
216             "Service representing a AFI/SAFI pair";
217
218         base "config:service-type";
219         config:java-class "org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.BgpTableType";
220     }
221
222     identity bgp-table-type-impl {
223         description
224             "Simple provider for bgp-table-type.";
225
226         config:provided-service bgp-table-type;
227         base config:module-type;
228         config:java-name-prefix BGPTableTypeImpl;
229     }
230
231     augment "/config:modules/config:module/config:configuration" {
232         case bgp-table-type-impl {
233             when "/config:modules/config:module/config:type = 'bgp-table-type-impl'";
234
235             leaf afi {
236                 type identityref {
237                     base bgp-t:address-family;
238                 }
239                 mandatory true;
240             }
241             leaf safi {
242                 type identityref {
243                     base bgp-t:subsequent-address-family;
244                 }
245                 mandatory true;
246             }
247         }
248     }
249
250     augment "/config:modules/config:module/config:configuration" {
251         case bgp-peer {
252             when "/config:modules/config:module/config:type = 'bgp-peer'";
253
254             leaf host {
255                 description "Remote host IP address";
256                 type inet:ip-address;
257                 mandatory true;
258             }
259
260             leaf port {
261                 description "Remote host port";
262                 type inet:port-number;
263                 default 179;
264             }
265
266             leaf holdtimer {
267                 type int16;
268                 default 180;
269             }
270
271             leaf initiate-connection {
272                 description "If true, connection will be initiated right away from current device.
273                     If not, the peer will only be registered to peer registry and available for incomming bgp connections.";
274                 type boolean;
275                 default true;
276             }
277
278             list advertized-table {
279                 uses config:service-ref {
280                     refine type {
281                         mandatory true;
282                         config:required-identity bgp-table-type;
283                     }
284                 }
285             }
286
287             leaf remote-as {
288                 description
289                     "Expected remote AS number. If not present, it is assumed
290                     to be the same as our local AS number.";
291                 type uint32;
292             }
293
294             leaf password {
295                 type tcpmd5:rfc2385-key;
296                 description "RFC2385 shared secret";
297             }
298
299             container rib {
300                 uses config:service-ref {
301                     refine type {
302                         mandatory true;
303                         config:required-identity rib-instance;
304                     }
305                 }
306             }
307
308             container peer-registry {
309                 description "BGP peer registry where current instance of BGP peer will be registered.";
310                 uses config:service-ref {
311                     refine type {
312                         // FIXME backwards compatibility. If not configured, GLOBAL instance is used
313                         mandatory false;
314                         config:required-identity bgp-peer-registry;
315                     }
316                 }
317             }
318         }
319     }
320
321     identity rib-impl {
322         base config:module-type;
323         config:provided-service bgprib:rib;
324         config:provided-service rib-instance;
325         config:java-name-prefix RIBImpl;
326     }
327
328     augment "/config:modules/config:module/config:configuration" {
329         case rib-impl {
330             when "/config:modules/config:module/config:type = 'rib-impl'";
331
332             container extensions {
333                 uses config:service-ref {
334                     refine type {
335                         mandatory true;
336                         config:required-identity ribspi:consumer-extensions;
337                     }
338                 }
339             }
340
341             container bgp-dispatcher {
342                 uses config:service-ref {
343                     refine type {
344                         mandatory true;
345                         config:required-identity bgp-dispatcher;
346                     }
347                 }
348             }
349
350             container session-reconnect-strategy {
351                 uses config:service-ref {
352                     refine type {
353                         mandatory true;
354                         config:required-identity pf:reconnect-strategy-factory;
355                     }
356                 }
357             }
358
359             container tcp-reconnect-strategy {
360                 uses config:service-ref {
361                     refine type {
362                         mandatory true;
363                         config:required-identity pf:reconnect-strategy-factory;
364                     }
365                 }
366             }
367
368             container data-provider {
369                 uses config:service-ref {
370                     refine type {
371                         mandatory true;
372                         config:required-identity mdsb:binding-data-broker;
373                     }
374                 }
375             }
376
377             leaf local-as {
378                 description "Our local AS number. Needed by best selection path attribute.";
379                 type uint32;
380                 mandatory true;
381             }
382
383             leaf bgp-id {
384                 description "Our local BGP identifier. Needed by best selection path attribute.";
385                 mandatory true;
386                 type inet:ipv4-address;
387             }
388
389             list local-table {
390                 uses config:service-ref {
391                     refine type {
392                         mandatory true;
393                         config:required-identity bgp-table-type;
394                     }
395                 }
396             }
397
398             leaf rib-id {
399                 description "Identifier of this RIB in local data store.";
400                 type rib:rib-id;
401                 mandatory true;
402             }
403         }
404     }
405 }
406