f4cfd914d7cf0b5b03ed96cecf1f9028c6ad2bbc
[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 opendaylight-md-sal-binding-v1-codec { prefix mdsb1; revision-date 2016-07-14; }
18     import netty { prefix netty; revision-date 2013-11-19; }
19     import config { prefix config; revision-date 2013-04-05; }
20     import rpc-context { prefix rpcx; revision-date 2013-06-17; }
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-application-peer {
113         description
114             "Application peer handler which handles translation from custom RIB into local RIB";
115
116         base config:module-type;
117         config:java-name-prefix BGPApplicationPeer;
118     }
119
120     augment "/config:modules/config:module/config:configuration" {
121         case bgp-application-peer {
122             when "/config:modules/config:module/config:type = 'bgp-application-peer'";
123
124             container data-broker {
125                 uses config:service-ref {
126                     refine type {
127                         mandatory true;
128                         config:required-identity sal:dom-async-data-broker;
129                     }
130                 }
131             }
132
133             container target-rib {
134                 uses config:service-ref {
135                     refine type {
136                         mandatory true;
137                         config:required-identity rib-instance;
138                     }
139                 }
140             }
141
142             container bgp-peer-registry {
143                 description "BGP peer registry where current instance of BGP peer will be registered.";
144                 uses config:service-ref {
145                     refine type {
146                         // FIXME backwards compatibility. If not configured, GLOBAL instance is used
147                         mandatory false;
148                         config:required-identity bgp-peer-registry;
149                     }
150                 }
151             }
152
153             leaf application-rib-id {
154                 type rib:application-rib-id;
155                 mandatory true;
156             }
157
158             leaf bgp-peer-id {
159                 type bgp-t:bgp-id;
160                 mandatory true;
161             }
162         }
163     }
164
165     identity bgp-table-type {
166         description
167             "Service representing a AFI/SAFI pair";
168
169         base "config:service-type";
170         config:java-class "org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.BgpTableType";
171     }
172
173     identity add-path {
174         base "config:service-type";
175         config:java-class "org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.mp.capabilities.add.path.capability.AddressFamilies";
176     }
177
178     identity add-path-impl {
179         config:provided-service add-path;
180         base config:module-type;
181         config:java-name-prefix AddPathImpl;
182     }
183
184     identity bgp-table-type-impl {
185         description
186             "Simple provider for bgp-table-type.";
187
188         config:provided-service bgp-table-type;
189         base config:module-type;
190         config:java-name-prefix BGPTableTypeImpl;
191     }
192
193     augment "/config:modules/config:module/config:configuration" {
194         case bgp-table-type-impl {
195             when "/config:modules/config:module/config:type = 'bgp-table-type-impl'";
196
197             uses bgp-mp:bgp-table-type;
198         }
199     }
200
201     augment "/config:modules/config:module/config:configuration" {
202         case add-path-impl {
203             when "/config:modules/config:module/config:type = 'add-path-impl'";
204             container address-family {
205                 uses config:service-ref {
206                     refine type {
207                         mandatory true;
208                         config:required-identity bgp-table-type;
209                     }
210                 }
211             }
212             leaf send-receive {
213                 type bgp-mp:send-receive;
214                 mandatory true;
215             }
216         }
217     }
218
219     augment "/config:modules/config:module/config:configuration" {
220         case bgp-peer {
221             when "/config:modules/config:module/config:type = 'bgp-peer'";
222
223             uses peer:bgp-peer-config;
224
225             list advertized-table {
226                 key "type name";
227                 uses config:service-ref {
228                     refine type {
229                         mandatory true;
230                         config:required-identity bgp-table-type;
231                     }
232                 }
233             }
234
235             list add-path {
236                 key "type name";
237                 uses config:service-ref {
238                     refine type {
239                         config:required-identity add-path;
240                     }
241                 }
242             }
243
244             container rpc-registry {
245                 uses config:service-ref {
246                     refine type {
247                         mandatory false;
248                         config:required-identity mdsb:binding-rpc-registry;
249                     }
250                 }
251             }
252
253             container rib {
254                 uses config:service-ref {
255                     refine type {
256                         mandatory true;
257                         config:required-identity rib-instance;
258                     }
259                 }
260             }
261
262             container peer-registry {
263                 description "BGP peer registry where current instance of BGP peer will be registered.";
264                 uses config:service-ref {
265                     refine type {
266                         // FIXME backwards compatibility. If not configured, GLOBAL instance is used
267                         mandatory false;
268                         config:required-identity bgp-peer-registry;
269                     }
270                 }
271             }
272         }
273     }
274
275     identity peer-rpc;
276
277     augment "/config:modules/config:module/config:state" {
278         case bgp-peer {
279             when "/config:modules/config:module/config:type = 'bgp-peer'";
280
281             rpcx:rpc-context-instance "peer-rpc";
282             uses peer-stats:bgp-peer-stats;
283         }
284
285         case rib-impl {
286             when "/config:modules/config:module/config:type = 'rib-impl'";
287
288             uses rib-impl-stats:bgp-render-stats;
289         }
290     }
291
292     rpc reset-session {
293         description "Restart the session between BGP peers";
294         input {
295             uses rpcx:rpc-context-ref {
296                 refine context-instance {
297                     rpcx:rpc-context-instance peer-rpc;
298                 }
299             }
300         }
301     }
302
303     rpc reset-stats {
304         description "Reset the BGP peer statistics.";
305         input {
306             uses rpcx:rpc-context-ref {
307                 refine context-instance {
308                     rpcx:rpc-context-instance peer-rpc;
309                 }
310             }
311         }
312     }
313
314     identity bgp-path-selection-mode {
315         description
316             "Service representing an address family + path selection mode.";
317
318         base "config:service-type";
319         config:java-class "org.opendaylight.protocol.bgp.rib.impl.spi.BGPBestPathSelection";
320     }
321
322     identity bgp-psm-impl {
323         base config:module-type;
324         config:provided-service bgp-path-selection-mode;
325         config:java-name-prefix BGPPSMImpl;
326     }
327
328     augment "/config:modules/config:module/config:configuration" {
329         case bgp-psm-impl {
330             when "/config:modules/config:module/config:type = 'bgp-psm-impl'";
331             container path-address-family {
332                 uses config:service-ref {
333                     refine type {
334                         mandatory true;
335                         config:required-identity bgp-table-type;
336                     }
337                 }
338             }
339             container path-selection-mode {
340                 uses config:service-ref {
341                     refine type {
342                         mandatory true;
343                         config:required-identity bps:path-selection-mode-factory;
344                     }
345                 }
346             }
347         }
348     }
349
350     identity rib-impl {
351         base config:module-type;
352         config:provided-service bgprib:rib;
353         config:provided-service rib-instance;
354         config:java-name-prefix RIBImpl;
355     }
356
357     augment "/config:modules/config:module/config:configuration" {
358         case rib-impl {
359             when "/config:modules/config:module/config:type = 'rib-impl'";
360
361             uses bgp-rib-impl:bgp-rib-impl-identifiers;
362
363             container extensions {
364                 uses config:service-ref {
365                     refine type {
366                         mandatory true;
367                         config:required-identity ribspi:consumer-extensions;
368                     }
369                 }
370             }
371
372             container bgp-dispatcher {
373                 uses config:service-ref {
374                     refine type {
375                         mandatory true;
376                         config:required-identity bgp-dispatcher;
377                     }
378                 }
379             }
380
381             container data-provider {
382                 uses config:service-ref {
383                     refine type {
384                         mandatory true;
385                         config:required-identity mdsb:binding-async-data-broker;
386                     }
387                 }
388             }
389
390             container codec-tree-factory {
391                 uses config:service-ref {
392                     refine type {
393                         mandatory true;
394                         config:required-identity mdsb1:binding-v1-codec-tree-factory;
395                     }
396                 }
397             }
398
399             container dom-data-provider {
400                 uses config:service-ref {
401                     refine type {
402                         mandatory true;
403                         config:required-identity sal:dom-async-data-broker;
404                     }
405                 }
406             }
407
408             list local-table {
409                 uses config:service-ref {
410                     refine type {
411                         mandatory true;
412                         config:required-identity bgp-table-type;
413                     }
414                 }
415             }
416
417             list rib-path-selection-mode {
418                 uses config:service-ref {
419                     refine type {
420                         config:required-identity bgp-path-selection-mode;
421                     }
422                 }
423             }
424         }
425     }
426 }
427