Bump versions to 0.21.8-SNAPSHOT
[bgpcep.git] / bgp / extensions / mvpn / src / main / yang / bgp-mvpn.yang
1 module bgp-mvpn {
2     yang-version 1;
3     namespace "urn:opendaylight:params:xml:ns:yang:bgp:mvpn";
4     prefix "bgp-mvpn";
5
6     import bgp-types { prefix bgp-t; revision-date 2020-01-20; }
7     import ietf-inet-types { prefix inet; revision-date 2013-07-15; }
8     import pmsi-tunnel { prefix pmsi; revision-date 2020-01-20; }
9     import yang-ext { prefix ext; revision-date "2013-07-09"; }
10     import network-concepts { prefix netc; revision-date 2013-11-25; }
11
12     organization "AT&T Services, Inc.";
13
14     contact "Claudio D. Gasparini <claudio.gasparini@pantheon.tech>";
15
16     description
17         "This module contains the base data model of a BGP message.
18         It rolls up the definitions contained in RFC6513, RFC6514, RFC6515.
19
20         Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
21
22         This program and the accompanying materials are made available
23         under the terms of the Eclipse Public License v1.0 which
24         accompanies this distribution, and is available at
25         http://www.eclipse.org/legal/epl-v10.html";
26
27     revision 2020-01-20 {
28         description "Update to use -no-zone-adresses";
29     }
30
31     revision 2018-04-17 {
32         description "Initial version";
33     }
34
35     identity mcast-vpn-subsequent-address-family {
36         description "SAFI 5 MCAST-VPN";
37         reference "https://www.iana.org/assignments/safi-namespace/safi-namespace.xhtml";
38
39         base bgp-t:subsequent-address-family;
40     }
41
42     typedef nlri-type {
43         reference "https://tools.ietf.org/html/rfc6514#section-4";
44         type enumeration {
45             enum intra-as-i-pmsi-a-d {
46                 value 1;
47             }
48             enum inter-as-i-pmsi-a-d {
49                 value 2;
50             }
51             enum s-pmsi-a-d {
52                 value 3;
53             }
54             enum leaf-a-d {
55                 value 4;
56             }
57             enum source-active-a-d {
58                 value 5;
59             }
60             enum shared-tree-join {
61                 value 6;
62             }
63             enum source-tree-join {
64                 value 7;
65             }
66         }
67     }
68
69     grouping source-as-grouping {
70         leaf source-as {
71             type inet:as-number;
72             mandatory true;
73         }
74     }
75
76     grouping multicast-source-rd-grouping {
77         uses bgp-t:route-distinguisher-grouping;
78
79         leaf multicast-source {
80             type inet:ip-address-no-zone;
81             mandatory true;
82         }
83     }
84
85     grouping multicast-group-opaque-grouping {
86         choice multicast-group {
87             case c-g-address-case {
88                 leaf c-g-address {
89                     type inet:ip-address-no-zone;
90                 }
91             }
92
93             case ldp-mp-opaque-value-case {
94                 container ldp-mp-opaque-value {
95                     uses pmsi:opaque;
96                 }
97             }
98         }
99     }
100
101     grouping intra-as-i-pmsi-a-d-grouping {
102         container intra-as-i-pmsi-a-d {
103
104             description "https://tools.ietf.org/html/rfc6514#section-4.1";
105
106             uses bgp-t:route-distinguisher-grouping;
107             uses bgp-t:orig-route-ip-grouping;
108         }
109     }
110
111     grouping inter-as-i-pmsi-a-d-grouping {
112         container inter-as-i-pmsi-a-d {
113             description "https://tools.ietf.org/html/rfc6514#section-4.2";
114
115             uses bgp-t:route-distinguisher-grouping;
116             uses source-as-grouping;
117         }
118     }
119
120     grouping s-pmsi-a-d-grouping {
121         container s-pmsi-a-d {
122             description "https://tools.ietf.org/html/rfc6514#section-4.3";
123
124             uses multicast-source-rd-grouping;
125             uses multicast-group-opaque-grouping;
126             uses bgp-t:orig-route-ip-grouping;
127         }
128     }
129
130     grouping leaf-a-d-grouping {
131         container leaf-a-d {
132             description "https://tools.ietf.org/html/rfc6514#section-4.4";
133
134             choice leaf-a-d-route-key {
135                 case inter-as-i-pmsi-a-d-case {
136                     uses inter-as-i-pmsi-a-d-grouping;
137                 }
138                 case s-pmsi-a-d-case {
139                     uses s-pmsi-a-d-grouping;
140                 }
141                 mandatory true;
142             }
143             uses bgp-t:orig-route-ip-grouping;
144         }
145     }
146
147     grouping source-active-a-d-grouping {
148         container source-active-a-d {
149             description "https://tools.ietf.org/html/rfc6514#section-4.5";
150
151             uses multicast-source-rd-grouping;
152             leaf multicast-group {
153                 type inet:ip-address-no-zone;
154                 mandatory true;
155             }
156         }
157     }
158
159     grouping c-multicast-grouping {
160         container c-multicast {
161             description "https://tools.ietf.org/html/rfc6514#section-4.6";
162
163             uses multicast-source-rd-grouping;
164             uses source-as-grouping;
165             uses multicast-group-opaque-grouping;
166         }
167     }
168
169     grouping mvpn {
170         reference "https://tools.ietf.org/html/rfc6514#section-4";
171         description "The MCAST-VPN NLRI is carried in BGP [RFC4271] using BGP
172             Multiprotocol Extensions [RFC4760] with an Address Family Identifier
173             (AFI) of 1 or 2 and a Subsequent AFI (SAFI) of MCAST-VPN.";
174
175         choice mvpn-choice {
176             case intra-as-i-pmsi-a-d-case {
177                 uses intra-as-i-pmsi-a-d-grouping;
178             }
179             case inter-as-i-pmsi-a-d-case {
180                 uses inter-as-i-pmsi-a-d-grouping;
181             }
182             case s-pmsi-a-d-case {
183                 uses s-pmsi-a-d-grouping;
184             }
185             case leaf-a-d-case {
186                 uses leaf-a-d-grouping;
187             }
188             case source-active-a-d-case {
189                 uses source-active-a-d-grouping;
190             }
191             case shared-tree-join-case {
192                 container shared-tree-join {
193                     uses c-multicast-grouping;
194                 }
195             }
196             case source-tree-join-case {
197                 container source-tree-join {
198                     uses c-multicast-grouping;
199                 }
200             }
201             mandatory true;
202         }
203     }
204
205     grouping pe-distinguisher-labels-attribute {
206         container pe-distinguisher-labels-attribute {
207             list pe-distinguisher-label-attribute {
208                 leaf pe-address  {
209                     type inet:ip-address-no-zone;
210                     mandatory true;
211                 }
212                 leaf mpls-label {
213                     type netc:mpls-label;
214                     mandatory true;
215                 }
216             }
217         }
218     }
219
220     grouping bgp-rib-route {
221         uses pmsi:bgp-rib-route {
222             augment "attributes" {
223                 ext:augment-identifier pe-distinguisher-labels-attribute-augmentation;
224                 uses pe-distinguisher-labels-attribute;
225             }
226         }
227     }
228
229     grouping mvpn-bgp-rib-route {
230         uses mvpn;
231         uses bgp-rib-route;
232     }
233
234     grouping mvpn-routes {
235         list mvpn-route {
236             key "route-key path-id";
237             uses mvpn-bgp-rib-route;
238         }
239     }
240 }