825c2e8f8067d7f95742a326f85cbac9e1f427b4
[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 timer {
81                 uses config:service-ref {
82                     refine type {
83                         mandatory true;
84                         config:required-identity netty:netty-timer;
85                     }
86                 }
87             }
88
89             container boss-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 worker-group {
99                 uses config:service-ref {
100                     refine type {
101                         mandatory true;
102                         config:required-identity netty:netty-threadgroup;
103                     }
104                 }
105             }
106
107             container md5-channel-factory {
108                 uses config:service-ref {
109                     refine type {
110                         mandatory false;
111                         config:required-identity tcpmd5n:md5-channel-factory;
112                     }
113                 }
114             }
115
116             container md5-server-channel-factory {
117                 uses config:service-ref {
118                     refine type {
119                         mandatory false;
120                         config:required-identity tcpmd5n:md5-server-channel-factory;
121                     }
122                 }
123             }
124         }
125     }
126
127     identity base-bgp-rib {
128         base config:module-type;
129         config:provided-service ribspi:extension;
130         config:java-name-prefix BaseBGPRIB;
131     }
132
133     augment "/config:modules/config:module/config:configuration" {
134         case base-bgp-rib {
135             when "/config:modules/config:module/config:type = 'base-bgp-rib'";
136         }
137     }
138
139     identity rib-instance {
140         description
141             "Service representing a RIB instance";
142
143         base "config:service-type";
144         config:java-class "org.opendaylight.protocol.bgp.rib.impl.spi.RIB";
145     }
146
147     identity bgp-peer-registry {
148         description
149             "Registry of BGP peers. Every new BGP in/out connection looks for peers to handle bgp messages in this registry";
150
151         base "config:service-type";
152         config:java-class "org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry";
153     }
154
155     identity strict-bgp-peer-registry {
156         description
157             "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";
158
159         config:provided-service bgp-peer-registry;
160         base config:module-type;
161         config:java-name-prefix StrictBgpPeerRegistry;
162     }
163
164
165      augment "/config:modules/config:module/config:configuration" {
166         case strict-bgp-peer-registry {
167             when "/config:modules/config:module/config:type = 'strict-bgp-peer-registry'";
168         }
169     }
170
171     identity bgp-peer {
172         description
173             "BGP peer instance.";
174
175         base config:module-type;
176         config:java-name-prefix BGPPeer;
177     }
178
179     identity bgp-peer-acceptor {
180         description
181             "BGP peer acceptor that handles incomming bgp connections. Uses BGP peer registry to accept or decline incomming connections";
182
183         base config:module-type;
184         config:java-name-prefix BGPPeerAcceptor;
185     }
186
187      augment "/config:modules/config:module/config:configuration" {
188         case bgp-peer-acceptor {
189             when "/config:modules/config:module/config:type = 'bgp-peer-acceptor'";
190
191             leaf binding-address {
192                 description "IP address to bind to";
193                 type inet:ip-address;
194                 default "0.0.0.0";
195             }
196
197             leaf binding-port {
198                 description "Port to bind to";
199                 type inet:port-number;
200                 default "179";
201             }
202
203             container bgp-dispatcher {
204                 uses config:service-ref {
205                     refine type {
206                         mandatory true;
207                         config:required-identity bgp-dispatcher;
208                     }
209                 }
210             }
211
212             container peer-registry {
213                 uses config:service-ref {
214                     refine type {
215                         mandatory true;
216                         config:required-identity bgp-peer-registry;
217                     }
218                 }
219             }
220         }
221     }
222
223     identity bgp-table-type {
224         description
225             "Service representing a AFI/SAFI pair";
226
227         base "config:service-type";
228         config:java-class "org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.BgpTableType";
229     }
230
231     identity bgp-table-type-impl {
232         description
233             "Simple provider for bgp-table-type.";
234
235         config:provided-service bgp-table-type;
236         base config:module-type;
237         config:java-name-prefix BGPTableTypeImpl;
238     }
239
240     augment "/config:modules/config:module/config:configuration" {
241         case bgp-table-type-impl {
242             when "/config:modules/config:module/config:type = 'bgp-table-type-impl'";
243
244             leaf afi {
245                 type identityref {
246                     base bgp-t:address-family;
247                 }
248                 mandatory true;
249             }
250             leaf safi {
251                 type identityref {
252                     base bgp-t:subsequent-address-family;
253                 }
254                 mandatory true;
255             }
256         }
257     }
258
259     augment "/config:modules/config:module/config:configuration" {
260         case bgp-peer {
261             when "/config:modules/config:module/config:type = 'bgp-peer'";
262
263             leaf host {
264                 description "Remote host IP address";
265                 type inet:ip-address;
266                 mandatory true;
267             }
268
269             leaf port {
270                 description "Remote host port";
271                 type inet:port-number;
272                 default 179;
273             }
274
275             leaf holdtimer {
276                 type int16;
277                 default 180;
278             }
279
280             leaf initiate-connection {
281                 description "If true, connection will be initiated right away from current device.
282                     If not, the peer will only be registered to peer registry and available for incomming bgp connections.";
283                 type boolean;
284                 default true;
285             }
286
287             list advertized-table {
288                 uses config:service-ref {
289                     refine type {
290                         mandatory true;
291                         config:required-identity bgp-table-type;
292                     }
293                 }
294             }
295
296             leaf remote-as {
297                 description
298                     "Expected remote AS number. If not present, it is assumed
299                     to be the same as our local AS number.";
300                 type uint32;
301             }
302
303             leaf password {
304                 type tcpmd5:rfc2385-key;
305                 description "RFC2385 shared secret";
306             }
307
308             container rib {
309                 uses config:service-ref {
310                     refine type {
311                         mandatory true;
312                         config:required-identity rib-instance;
313                     }
314                 }
315             }
316
317             container peer-registry {
318                 description "BGP peer registry where current instance of BGP peer will be registered.";
319                 uses config:service-ref {
320                     refine type {
321                         // FIXME backwards compatibility. If not configured, GLOBAL instance is used
322                         mandatory false;
323                         config:required-identity bgp-peer-registry;
324                     }
325                 }
326             }
327         }
328     }
329
330     identity rib-impl {
331         base config:module-type;
332         config:provided-service bgprib:rib;
333         config:provided-service rib-instance;
334         config:java-name-prefix RIBImpl;
335     }
336
337     augment "/config:modules/config:module/config:configuration" {
338         case rib-impl {
339             when "/config:modules/config:module/config:type = 'rib-impl'";
340
341             container extensions {
342                 uses config:service-ref {
343                     refine type {
344                         mandatory true;
345                         config:required-identity ribspi:consumer-extensions;
346                     }
347                 }
348             }
349
350             container bgp-dispatcher {
351                 uses config:service-ref {
352                     refine type {
353                         mandatory true;
354                         config:required-identity bgp-dispatcher;
355                     }
356                 }
357             }
358
359             container session-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 tcp-reconnect-strategy {
369                 uses config:service-ref {
370                     refine type {
371                         mandatory true;
372                         config:required-identity pf:reconnect-strategy-factory;
373                     }
374                 }
375             }
376
377             container data-provider {
378                 uses config:service-ref {
379                     refine type {
380                         mandatory true;
381                         config:required-identity mdsb:binding-data-broker;
382                     }
383                 }
384             }
385
386             leaf local-as {
387                 description "Our local AS number. Needed by best selection path attribute.";
388                 type uint32;
389                 mandatory true;
390             }
391
392             leaf bgp-id {
393                 description "Our local BGP identifier. Needed by best selection path attribute.";
394                 mandatory true;
395                 type inet:ipv4-address;
396             }
397
398             list local-table {
399                 uses config:service-ref {
400                     refine type {
401                         mandatory true;
402                         config:required-identity bgp-table-type;
403                     }
404                 }
405             }
406
407             leaf rib-id {
408                 description "Identifier of this RIB in local data store.";
409                 type rib:rib-id;
410                 mandatory true;
411             }
412         }
413     }
414 }
415