BUG-223: Support having multiple RIB instances
[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         grouping route {
35                 container attributes {
36                         uses bgp-msg:path-attributes;
37                 }
38         }
39
40         grouping rib {
41                 list tables {
42                         uses bgp-mp:bgp-table-type;
43                         key "afi safi";
44
45                         leaf uptodate {
46                                 type boolean;
47                                 default false;
48                         }
49
50                         choice routes {
51                                 case ipv4-routes-case {
52                                         container ipv4-routes {
53                                                 list ipv4-route {
54                                                         when "../../afi = ipv4";
55
56                                                         leaf prefix {
57                                                                 type inet:ipv4-prefix;
58                                                         }
59                                                         key prefix;
60
61                                                         uses route;
62                                                 }
63                                         }
64                                 }
65                                 case ipv6-routes-case {
66                                         container ipv6-routes {
67                                                 list ipv6-route {
68                                                         when "../../afi = ipv6";
69
70                                                         leaf prefix {
71                                                                 type inet:ipv6-prefix;
72                                                         }
73                                                         key prefix;
74
75                                                         uses route;
76                                                 }
77                                         }
78                                 }
79                         }
80                 }
81         }
82
83         container bgp-rib {
84                 list rib {
85                         config false;
86
87                         leaf id {
88                                 type rib-id;
89                         }
90                         key id;
91
92                         container loc-rib {
93                                 uses rib;
94                         }
95                 }
96         }
97 }