BUG-4931: Simple routing policy
[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 2013-09-19; }
7     import bgp-multiprotocol { prefix bgp-mp; revision-date 2013-09-19; }
8     import ietf-inet-types { prefix inet; revision-date 2010-09-24; }
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 "2013-09-25" {
25                 description
26                         "Initial revision.";
27                 reference "RFC4271";
28         }
29
30     typedef rib-id {
31         type inet:uri;
32     }
33
34     typedef application-rib-id {
35         type inet:uri;
36     }
37
38     typedef peer-id {
39         description
40             "An abstract peer identifier. The protocol part identifies
41             the type of the peer. One well-known protocol is define, which
42             has the following format: bgp://1.2.3.4, where 1.2.3.4 is the
43             peer's BGP Identifier in IPv4 dotted-quad format.";
44         type inet:uri;
45     }
46
47     typedef peer-role {
48         type enumeration {
49             enum ebgp;
50             enum ibgp;
51             enum rr-client;
52             enum internal;
53         }
54     }
55
56     typedef simple-routing-policy {
57         type enumeration {
58             enum announce-none { description "Don't announce routes to this peer"; }
59             enum learn-none { description "Don't learn routes from this peer"; }
60         }
61     }
62
63     grouping route {
64         uses bgp-msg:path-attributes;
65     }
66
67     grouping rib {
68         list tables {
69             uses bgp-mp:bgp-table-type;
70             key "afi safi";
71
72             container attributes {
73                 leaf uptodate {
74                     type boolean;
75                     default false;
76                 }
77             }
78
79             choice routes {
80                // to be augmented
81             }
82         }
83     }
84
85     list application-rib {
86         config true;
87
88         leaf id {
89             type application-rib-id;
90         }
91         key id;
92
93         uses rib;
94     }
95
96     container bgp-rib {
97         list rib {
98             config false;
99
100             leaf id {
101                 type rib-id;
102             }
103             key id;
104
105             list peer {
106                 key peer-id;
107                 leaf peer-id {
108                     type peer-id;
109                 }
110                 leaf peer-role {
111                     type peer-role;
112                     mandatory true;
113                 }
114                 leaf simple-routing-policy {
115                     type simple-routing-policy;
116                 }
117                 list supported-tables {
118                     key "afi safi";
119                     uses bgp-mp:bgp-add-path-table-type;
120                 }
121                 container adj-rib-in {
122                     description "Routes as we have received them from the peer.";
123                     uses rib;
124                 }
125                 container effective-rib-in {
126                     description "Routes as processed by inbound policy.";
127                     uses rib;
128                 }
129                 container adj-rib-out {
130                     uses rib;
131                 }
132             }
133
134             container loc-rib {
135                 uses rib;
136             }
137         }
138     }
139 }