af3810f102364b281ab191ef5e2219fb1c86c3e8
[bgpcep.git] / bgp / rib-api / src / main / yang / bgp-rib.yang
1 module bgp-rib {
2     yang-version 1;
3     namespace "urn:opendaylight:params:xml:ns:yang:bgp-rib";
4     prefix "rib";
5
6     import bgp-message { prefix bgp-msg; revision-date 2020-01-20; }
7     import bgp-multiprotocol { prefix bgp-mp; revision-date 2018-03-29; }
8     import ietf-inet-types { prefix inet; revision-date 2013-07-15; }
9
10     organization "Cisco Systems, Inc.";
11     contact "Robert Varga <rovarga@cisco.com>";
12
13     description
14         "This module contains the concept of a Routing Information Base,
15         as defined by RFC4271.
16
17         Copyright (c)2013 Cisco Systems, Inc. All rights reserved.
18
19         This program and the accompanying materials are made available
20         under the terms of the Eclipse Public License v1.0 which
21         accompanies this distribution, and is available at
22         http://www.eclipse.org/legal/epl-v10.html";
23
24     revision "2018-03-29" {
25         description "Add support for add-path for all afi/safi.";
26     }
27
28     revision "2017-12-07" {
29         description "Add support for add-path in base BGP NLRI.";
30     }
31
32     revision "2013-09-25" {
33         description
34             "Initial revision.";
35         reference "RFC4271";
36     }
37
38     typedef rib-id {
39         type inet:uri;
40     }
41
42     typedef application-rib-id {
43         type inet:uri;
44     }
45
46     typedef peer-id {
47         description
48             "An abstract peer identifier. The protocol part identifies
49             the type of the peer. One well-known protocol is define, which
50             has the following format: bgp://1.2.3.4, where 1.2.3.4 is the
51             peer's BGP Identifier in IPv4 dotted-quad format.";
52         type inet:uri;
53     }
54
55     typedef peer-role {
56         type enumeration {
57             enum ebgp;
58             enum ibgp;
59             enum rr-client;
60             enum internal;
61         }
62     }
63
64     grouping route {
65         uses bgp-msg:path-id-grouping;
66         leaf route-key {
67             description
68                 "The sole function of this leaf
69                 to act as the key in the list.
70                 Its format does not form the
71                 API contract of this model.";
72             type string;
73         }
74         uses bgp-msg:path-attributes;
75     }
76
77     grouping rib {
78         list tables {
79             uses bgp-mp:bgp-table-type;
80             key "afi safi";
81
82             container attributes {
83                 leaf uptodate {
84                     type boolean;
85                     default false;
86                 }
87             }
88
89             choice routes {
90                // to be augmented
91             }
92         }
93     }
94
95     list application-rib {
96         config true;
97
98         leaf id {
99             type application-rib-id;
100         }
101         key id;
102
103         uses rib;
104     }
105
106     container bgp-rib {
107         list rib {
108             config false;
109
110             leaf id {
111                 type rib-id;
112             }
113             key id;
114
115             list peer {
116                 key peer-id;
117                 leaf peer-id {
118                     type peer-id;
119                 }
120                 leaf peer-role {
121                     type peer-role;
122                     mandatory true;
123                 }
124                 list supported-tables {
125                     key "afi safi";
126                     uses bgp-mp:bgp-add-path-table-type;
127                 }
128                 container adj-rib-in {
129                     description "Routes as we have received them from the peer.";
130                     uses rib {
131                         augment tables/attributes {
132                             leaf llgr-stale {
133                                 type empty;
134                                 description "Presence indicates that all routes in this table
135                                              are to be treated as having LLGR_STALE community
136                                              attached to them";
137                             }
138                         }
139                     }
140                 }
141                 container effective-rib-in {
142                     description "Routes as processed by inbound policy.";
143                     uses rib;
144                 }
145                 container adj-rib-out {
146                     uses rib;
147                 }
148             }
149
150             container loc-rib {
151                 uses rib;
152             }
153         }
154     }
155 }