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