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