b12744d537453ef84a984aa05a0d96e4cb7ddb97
[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-rib-impl { prefix bgp-rib-impl; revision-date 2016-06-06; }
10     import bgp-types { prefix bgp-t; revision-date 2013-09-19; }
11     import odl-bgp-rib-cfg { prefix bgprib; revision-date 2013-07-01; }
12     import odl-bgp-parser-spi-cfg { prefix bgpspi; revision-date 2013-11-15; }
13     import odl-bgp-rib-spi-cfg { prefix ribspi; revision-date 2013-11-15; }
14     import ietf-inet-types { prefix inet; revision-date 2010-09-24; }
15     import ietf-yang-types { prefix yang; revision-date 2013-07-15; }
16     import opendaylight-md-sal-binding {prefix mdsb; revision-date 2013-10-28; }
17     import opendaylight-md-sal-dom {prefix sal; revision-date 2013-10-28; }
18     import netty { prefix netty; revision-date 2013-11-19; }
19     import config { prefix config; revision-date 2013-04-05; }
20     import odl-tcpmd5-cfg { prefix tcpmd5; revision-date 2014-04-27; }
21     import odl-tcpmd5-netty-cfg { prefix tcpmd5n; revision-date 2014-04-27; }
22     import rpc-context { prefix rpcx; revision-date 2013-06-17; }
23     import odl-bgp-openconfig-spi-cfg { prefix bgp-oc-spi; revision-date 2015-09-25; }
24     import odl-bgp-path-selection-mode { prefix bps; revision-date 2016-03-01;}
25     import bgp-peer { prefix peer; revision-date 2016-06-06; }
26     import bgp-stats-peer { prefix peer-stats; revision-date 2016-06-06; }
27     import bgp-stats-rib-impl { prefix rib-impl-stats; revision-date 2016-06-06; }
28
29     organization "Cisco Systems, Inc.";
30
31     contact "Robert Varga <rovarga@cisco.com>";
32
33     description
34         "This module contains the base YANG definitions for
35          BGP listener implementation.
36
37         Copyright (c)2013 Cisco Systems, Inc. All rights reserved.;
38
39         This program and the accompanying materials are made available
40         under the terms of the Eclipse Public License v1.0 which
41         accompanies this distribution, and is available at
42         http://www.eclipse.org/legal/epl-v10.html";
43
44     revision "2016-03-30" {
45         description
46             "Updated to simplify reconnection strategy.";
47     }
48     revision "2013-04-09" {
49         description
50             "Initial revision";
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 rib-instance {
119         description
120             "Service representing a RIB instance";
121
122         base "config:service-type";
123         config:java-class "org.opendaylight.protocol.bgp.rib.impl.spi.RIB";
124     }
125
126     identity bgp-peer-registry {
127         description
128             "Registry of BGP peers. Every new BGP in/out connection looks for peers to handle bgp messages in this registry";
129
130         base "config:service-type";
131         config:java-class "org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry";
132     }
133
134     identity strict-bgp-peer-registry {
135         description
136             "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";
137
138         config:provided-service bgp-peer-registry;
139         base config:module-type;
140         config:java-name-prefix StrictBgpPeerRegistry;
141     }
142
143     augment "/config:modules/config:module/config:configuration" {
144         case strict-bgp-peer-registry {
145             when "/config:modules/config:module/config:type = 'strict-bgp-peer-registry'";
146         }
147     }
148
149     identity bgp-peer {
150         description
151             "BGP peer instance.";
152
153         base config:module-type;
154         config:java-name-prefix BGPPeer;
155     }
156
157     identity bgp-peer-acceptor {
158         description
159             "BGP peer acceptor that handles incoming bgp connections. Uses BGP peer registry to accept or decline incoming connections";
160
161         base config:module-type;
162         config:java-name-prefix BGPPeerAcceptor;
163     }
164
165     augment "/config:modules/config:module/config:configuration" {
166         case bgp-peer-acceptor {
167             when "/config:modules/config:module/config:type = 'bgp-peer-acceptor'";
168
169             leaf binding-address {
170                 description "IP address to bind to";
171                 type inet:ip-address;
172                 default "0.0.0.0";
173             }
174
175             leaf binding-port {
176                 description "Port to bind to";
177                 type inet:port-number;
178                 default "179";
179             }
180
181             container accepting-bgp-dispatcher {
182                 uses config:service-ref {
183                     refine type {
184                         mandatory true;
185                         config:required-identity bgp-dispatcher;
186                     }
187                 }
188             }
189
190             container accepting-peer-registry {
191                 uses config:service-ref {
192                     refine type {
193                         mandatory true;
194                         config:required-identity bgp-peer-registry;
195                     }
196                 }
197             }
198         }
199     }
200
201     identity bgp-application-peer {
202         description
203             "Application peer handler which handles translation from custom RIB into local RIB";
204
205         base config:module-type;
206         config:java-name-prefix BGPApplicationPeer;
207     }
208
209     augment "/config:modules/config:module/config:configuration" {
210         case bgp-application-peer {
211             when "/config:modules/config:module/config:type = 'bgp-application-peer'";
212
213             container data-broker {
214                 uses config:service-ref {
215                     refine type {
216                         mandatory true;
217                         config:required-identity sal:dom-async-data-broker;
218                     }
219                 }
220             }
221
222             container target-rib {
223                 uses config:service-ref {
224                     refine type {
225                         mandatory true;
226                         config:required-identity rib-instance;
227                     }
228                 }
229             }
230
231             container bgp-peer-registry {
232                 description "BGP peer registry where current instance of BGP peer will be registered.";
233                 uses config:service-ref {
234                     refine type {
235                         // FIXME backwards compatibility. If not configured, GLOBAL instance is used
236                         mandatory false;
237                         config:required-identity bgp-peer-registry;
238                     }
239                 }
240             }
241
242             leaf application-rib-id {
243                 type rib:application-rib-id;
244                 mandatory true;
245             }
246
247             leaf bgp-peer-id {
248                 type bgp-t:bgp-id;
249                 mandatory true;
250             }
251         }
252     }
253
254     identity bgp-table-type {
255         description
256             "Service representing a AFI/SAFI pair";
257
258         base "config:service-type";
259         config:java-class "org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.BgpTableType";
260     }
261
262     identity add-path {
263         base "config:service-type";
264         config:java-class "org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.mp.capabilities.add.path.capability.AddressFamilies";
265     }
266
267     identity add-path-impl {
268         config:provided-service add-path;
269         base config:module-type;
270         config:java-name-prefix AddPathImpl;
271     }
272
273     identity bgp-table-type-impl {
274         description
275             "Simple provider for bgp-table-type.";
276
277         config:provided-service bgp-table-type;
278         base config:module-type;
279         config:java-name-prefix BGPTableTypeImpl;
280     }
281
282     augment "/config:modules/config:module/config:configuration" {
283         case bgp-table-type-impl {
284             when "/config:modules/config:module/config:type = 'bgp-table-type-impl'";
285
286             uses bgp-mp:bgp-table-type;
287         }
288     }
289
290     augment "/config:modules/config:module/config:configuration" {
291         case add-path-impl {
292             when "/config:modules/config:module/config:type = 'add-path-impl'";
293             container address-family {
294                 uses config:service-ref {
295                     refine type {
296                         mandatory true;
297                         config:required-identity bgp-table-type;
298                     }
299                 }
300             }
301             leaf send-receive {
302                 type bgp-mp:send-receive;
303                 mandatory true;
304             }
305         }
306     }
307
308     augment "/config:modules/config:module/config:configuration" {
309         case bgp-peer {
310             when "/config:modules/config:module/config:type = 'bgp-peer'";
311
312             uses peer:bgp-peer-config;
313
314             list advertized-table {
315                 key "type name";
316                 uses config:service-ref {
317                     refine type {
318                         mandatory true;
319                         config:required-identity bgp-table-type;
320                     }
321                 }
322             }
323
324             list add-path {
325                 key "type name";
326                 uses config:service-ref {
327                     refine type {
328                         config:required-identity add-path;
329                     }
330                 }
331             }
332
333             container rpc-registry {
334                 uses config:service-ref {
335                     refine type {
336                         mandatory false;
337                         config:required-identity mdsb:binding-rpc-registry;
338                     }
339                 }
340             }
341
342             container rib {
343                 uses config:service-ref {
344                     refine type {
345                         mandatory true;
346                         config:required-identity rib-instance;
347                     }
348                 }
349             }
350
351             container peer-registry {
352                 description "BGP peer registry where current instance of BGP peer will be registered.";
353                 uses config:service-ref {
354                     refine type {
355                         // FIXME backwards compatibility. If not configured, GLOBAL instance is used
356                         mandatory false;
357                         config:required-identity bgp-peer-registry;
358                     }
359                 }
360             }
361         }
362     }
363
364     identity peer-rpc;
365
366     augment "/config:modules/config:module/config:state" {
367         case bgp-peer {
368             when "/config:modules/config:module/config:type = 'bgp-peer'";
369
370             rpcx:rpc-context-instance "peer-rpc";
371             uses peer-stats:bgp-peer-stats;
372         }
373
374         case rib-impl {
375             when "/config:modules/config:module/config:type = 'rib-impl'";
376
377             uses rib-impl-stats:bgp-render-stats;
378         }
379     }
380
381     rpc reset-session {
382         description "Restart the session between BGP peers";
383         input {
384             uses rpcx:rpc-context-ref {
385                 refine context-instance {
386                     rpcx:rpc-context-instance peer-rpc;
387                 }
388             }
389         }
390     }
391
392     rpc reset-stats {
393         description "Reset the BGP peer statistics.";
394         input {
395             uses rpcx:rpc-context-ref {
396                 refine context-instance {
397                     rpcx:rpc-context-instance peer-rpc;
398                 }
399             }
400         }
401     }
402
403     identity bgp-path-selection-mode {
404         description
405             "Service representing an address family + path selection mode.";
406
407         base "config:service-type";
408         config:java-class "org.opendaylight.protocol.bgp.rib.impl.spi.BGPBestPathSelection";
409     }
410
411     identity bgp-psm-impl {
412         base config:module-type;
413         config:provided-service bgp-path-selection-mode;
414         config:java-name-prefix BGPPSMImpl;
415     }
416
417     augment "/config:modules/config:module/config:configuration" {
418         case bgp-psm-impl {
419             when "/config:modules/config:module/config:type = 'bgp-psm-impl'";
420             container path-address-family {
421                 uses config:service-ref {
422                     refine type {
423                         mandatory true;
424                         config:required-identity bgp-table-type;
425                     }
426                 }
427             }
428             container path-selection-mode {
429                 uses config:service-ref {
430                     refine type {
431                         mandatory true;
432                         config:required-identity bps:path-selection-mode-factory;
433                     }
434                 }
435             }
436         }
437     }
438
439     identity rib-impl {
440         base config:module-type;
441         config:provided-service bgprib:rib;
442         config:provided-service rib-instance;
443         config:java-name-prefix RIBImpl;
444     }
445
446     augment "/config:modules/config:module/config:configuration" {
447         case rib-impl {
448             when "/config:modules/config:module/config:type = 'rib-impl'";
449
450             uses bgp-rib-impl:bgp-rib-impl-identifiers;
451
452             container extensions {
453                 uses config:service-ref {
454                     refine type {
455                         mandatory true;
456                         config:required-identity ribspi:consumer-extensions;
457                     }
458                 }
459             }
460
461             container bgp-dispatcher {
462                 uses config:service-ref {
463                     refine type {
464                         mandatory true;
465                         config:required-identity bgp-dispatcher;
466                     }
467                 }
468             }
469
470             container data-provider {
471                 uses config:service-ref {
472                     refine type {
473                         mandatory true;
474                         config:required-identity mdsb:binding-async-data-broker;
475                     }
476                 }
477             }
478
479             container codec-tree-factory {
480                 uses config:service-ref {
481                     refine type {
482                         mandatory true;
483                         config:required-identity mdsb:binding-codec-tree-factory;
484                     }
485                 }
486             }
487
488             container dom-data-provider {
489                 uses config:service-ref {
490                     refine type {
491                         mandatory true;
492                         config:required-identity sal:dom-async-data-broker;
493                     }
494                 }
495             }
496
497             container openconfig-provider {
498                 uses config:service-ref {
499                     refine type {
500                         mandatory false;
501                         config:required-identity bgp-oc-spi:bgp-openconfig-provider;
502                     }
503                 }
504             }
505
506             list local-table {
507                 uses config:service-ref {
508                     refine type {
509                         mandatory true;
510                         config:required-identity bgp-table-type;
511                     }
512                 }
513             }
514
515             list rib-path-selection-mode {
516                 uses config:service-ref {
517                     refine type {
518                         config:required-identity bgp-path-selection-mode;
519                     }
520                 }
521             }
522         }
523     }
524 }
525
526