Bump versions by x.y.(z+1)
[bgpcep.git] / bgp / inet / src / main / yang / bgp-inet.yang
1 module bgp-inet {
2         yang-version 1;
3         namespace "urn:opendaylight:params:xml:ns:yang:bgp-inet";
4         prefix "bgp-inet";
5
6     import bgp-rib { prefix bgp-rib; revision-date 2013-09-25; }
7     import bgp-multiprotocol { prefix bgp-mp; revision-date 2013-09-19; }
8     import ietf-inet-types { prefix inet; revision-date 2013-07-15; }
9     import bgp-message { prefix bgp-msg; revision-date 2013-09-19; }
10     import bmp-monitor { prefix bmp-mon; revision-date 2015-05-12; }
11
12     organization "Cisco Systems, Inc.";
13     contact "Dana Kutenicsova <dkutenic@cisco.com>";
14
15     description
16             "This module contains the concept of IPv4 and IPv6 routes,
17     split from bgp-rib and bgp-multiprotocol models.
18
19             Copyright (c)2015 Cisco Systems, Inc. All rights reserved.
20
21             This program and the accompanying materials are made available
22             under the terms of the Eclipse Public License v1.0 which
23             accompanies this distribution, and is available at
24             http://www.eclipse.org/legal/epl-v10.html";
25
26     revision "2015-03-05" {
27             description
28                     "Initial revision.";
29     }
30
31     grouping ipv4-prefix {
32         leaf prefix {
33             type inet:ipv4-prefix;
34         }
35         uses bgp-msg:path-id-grouping;
36     }
37
38     grouping ipv6-prefix {
39         leaf prefix {
40             type inet:ipv6-prefix;
41         }
42         uses bgp-msg:path-id-grouping;
43     }
44
45     grouping ipv4-prefixes {
46         container destination-ipv4 {
47             list ipv4-prefixes {
48                 uses ipv4-prefix;
49             }
50         }
51     }
52
53     grouping ipv6-prefixes {
54         container destination-ipv6 {
55             list ipv6-prefixes {
56                 uses ipv6-prefix;
57             }
58         }
59     }
60
61     grouping ipv4-routes {
62         container ipv4-routes {
63             list ipv4-route {
64                 uses ipv4-prefix;
65
66                 key "prefix path-id";
67
68                 uses bgp-rib:route;
69             }
70         }
71     }
72
73     grouping ipv6-bgp-prefix-sid-tlv {
74         reference "https://tools.ietf.org/html/draft-ietf-idr-bgp-prefix-sid-02#section-4.2";
75         leaf process-ipv6-head-ability {
76             description "S flag position 0. If set then it means that the BGP speaker is capable of processing the
77                 IPv6 Segment Routing Header.";
78             type boolean;
79             default "true";
80         }
81     }
82
83     grouping ipv6-routes {
84         container ipv6-routes {
85             list ipv6-route {
86                 uses ipv6-prefix;
87
88                 key "prefix path-id";
89
90                 uses bgp-rib:route {
91                     augment "attributes/bgp-prefix-sid/bgp-prefix-sid-tlvs/bgp-prefix-sid-tlv" {
92                         case ipv6-sid-tlv {
93                             uses ipv6-bgp-prefix-sid-tlv;
94                         }
95                     }
96                 }
97             }
98         }
99     }
100
101     augment "/bgp-msg:update/bgp-msg:attributes/bgp-mp:mp-reach-nlri/bgp-mp:advertized-routes/bgp-mp:destination-type" {
102         case destination-ipv4-case {
103             when "../../afi = ipv4";
104             uses ipv4-prefixes;
105         }
106         case destination-ipv6-case {
107             when "../../afi = ipv6";
108             uses ipv6-prefixes;
109         }
110     }
111
112     augment "/bgp-msg:update/bgp-msg:attributes/bgp-mp:mp-unreach-nlri/bgp-mp:withdrawn-routes/bgp-mp:destination-type" {
113         case destination-ipv4-case {
114             when "../../afi = ipv4";
115             uses ipv4-prefixes;
116         }
117         case destination-ipv6-case {
118             when "../../afi = ipv6";
119             uses ipv6-prefixes;
120         }
121     }
122
123     augment "/bgp-rib:application-rib/bgp-rib:tables/bgp-rib:routes" {
124         case ipv4-routes-case {
125             uses ipv4-routes;
126         }
127
128         case ipv6-routes-case {
129             uses ipv6-routes;
130         }
131     }
132
133     augment "/bgp-rib:bgp-rib/bgp-rib:rib/bgp-rib:loc-rib/bgp-rib:tables/bgp-rib:routes" {
134         case ipv4-routes-case {
135             uses ipv4-routes;
136         }
137
138         case ipv6-routes-case {
139             uses ipv6-routes;
140         }
141     }
142
143     augment "/bgp-rib:bgp-rib/bgp-rib:rib/bgp-rib:peer/bgp-rib:adj-rib-in/bgp-rib:tables/bgp-rib:routes" {
144         case ipv4-routes-case {
145             uses ipv4-routes;
146         }
147
148         case ipv6-routes-case {
149             uses ipv6-routes;
150         }
151     }
152
153     augment "/bgp-rib:bgp-rib/bgp-rib:rib/bgp-rib:peer/bgp-rib:effective-rib-in/bgp-rib:tables/bgp-rib:routes" {
154         case ipv4-routes-case {
155             uses ipv4-routes;
156         }
157
158         case ipv6-routes-case {
159             uses ipv6-routes;
160         }
161     }
162
163     augment "/bgp-rib:bgp-rib/bgp-rib:rib/bgp-rib:peer/bgp-rib:adj-rib-out/bgp-rib:tables/bgp-rib:routes" {
164         case ipv4-routes-case {
165             uses ipv4-routes;
166         }
167
168         case ipv6-routes-case {
169             uses ipv6-routes;
170         }
171     }
172
173     augment "/bmp-mon:bmp-monitor/bmp-mon:monitor/bmp-mon:router/bmp-mon:peer/bmp-mon:pre-policy-rib/bmp-mon:tables/bmp-mon:routes" {
174         case ipv4-routes-case {
175             uses ipv4-routes;
176         }
177
178         case ipv6-routes-case {
179             uses ipv6-routes;
180         }
181     }
182
183     augment "/bmp-mon:bmp-monitor/bmp-mon:monitor/bmp-mon:router/bmp-mon:peer/bmp-mon:post-policy-rib/bmp-mon:tables/bmp-mon:routes" {
184         case ipv4-routes-case {
185             uses ipv4-routes;
186         }
187
188         case ipv6-routes-case {
189             uses ipv6-routes;
190         }
191     }
192
193     augment "/bgp-msg:update/bgp-msg:attributes/bgp-msg:bgp-prefix-sid/bgp-msg:bgp-prefix-sid-tlvs/bgp-msg:bgp-prefix-sid-tlv" {
194         case ipv6-sid-tlv {
195             uses ipv6-bgp-prefix-sid-tlv;
196         }
197     }
198 }
199