Mass-convert all compontents to use -no-zone addresses
[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 2018-03-29; }
7     import ietf-inet-types { prefix inet; revision-date 2013-07-15; }
8     import pmsi-tunnel { prefix pmsi; revision-date 2018-03-29; }
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 2018-04-17 {
28         description "Initial version";
29     }
30
31     identity mcast-vpn-subsequent-address-family {
32         description "SAFI 5 MCAST-VPN";
33         reference "https://www.iana.org/assignments/safi-namespace/safi-namespace.xhtml";
34
35         base bgp-t:subsequent-address-family;
36     }
37
38     typedef nlri-type {
39         reference "https://tools.ietf.org/html/rfc6514#section-4";
40         type enumeration {
41             enum intra-as-i-pmsi-a-d {
42                 value 1;
43             }
44             enum inter-as-i-pmsi-a-d {
45                 value 2;
46             }
47             enum s-pmsi-a-d {
48                 value 3;
49             }
50             enum leaf-a-d {
51                 value 4;
52             }
53             enum source-active-a-d {
54                 value 5;
55             }
56             enum shared-tree-join {
57                 value 6;
58             }
59             enum source-tree-join {
60                 value 7;
61             }
62         }
63     }
64
65     grouping source-as-grouping {
66         leaf source-as {
67             type inet:as-number;
68             mandatory true;
69         }
70     }
71
72     grouping multicast-source-rd-grouping {
73         uses bgp-t:route-distinguisher-grouping;
74
75         leaf multicast-source {
76             type inet:ip-address-no-zone;
77             mandatory true;
78         }
79     }
80
81     grouping multicast-group-opaque-grouping {
82         choice multicast-group {
83             case c-g-address-case {
84                 leaf c-g-address {
85                     type inet:ip-address-no-zone;
86                 }
87             }
88
89             case ldp-mp-opaque-value-case {
90                 container ldp-mp-opaque-value {
91                     uses pmsi:opaque;
92                 }
93             }
94         }
95     }
96
97     grouping intra-as-i-pmsi-a-d-grouping {
98         container intra-as-i-pmsi-a-d {
99
100             description "https://tools.ietf.org/html/rfc6514#section-4.1";
101
102             uses bgp-t:route-distinguisher-grouping;
103             uses bgp-t:orig-route-ip-grouping;
104         }
105     }
106
107     grouping inter-as-i-pmsi-a-d-grouping {
108         container inter-as-i-pmsi-a-d {
109             description "https://tools.ietf.org/html/rfc6514#section-4.2";
110
111             uses bgp-t:route-distinguisher-grouping;
112             uses source-as-grouping;
113         }
114     }
115
116     grouping s-pmsi-a-d-grouping {
117         container s-pmsi-a-d {
118             description "https://tools.ietf.org/html/rfc6514#section-4.3";
119
120             uses multicast-source-rd-grouping;
121             uses multicast-group-opaque-grouping;
122             uses bgp-t:orig-route-ip-grouping;
123         }
124     }
125
126     grouping leaf-a-d-grouping {
127         container leaf-a-d {
128             description "https://tools.ietf.org/html/rfc6514#section-4.4";
129
130             choice leaf-a-d-route-key {
131                 case inter-as-i-pmsi-a-d-case {
132                     uses inter-as-i-pmsi-a-d-grouping;
133                 }
134                 case s-pmsi-a-d-case {
135                     uses s-pmsi-a-d-grouping;
136                 }
137                 mandatory true;
138             }
139             uses bgp-t:orig-route-ip-grouping;
140         }
141     }
142
143     grouping source-active-a-d-grouping {
144         container source-active-a-d {
145             description "https://tools.ietf.org/html/rfc6514#section-4.5";
146
147             uses multicast-source-rd-grouping;
148             leaf multicast-group {
149                 type inet:ip-address-no-zone;
150                 mandatory true;
151             }
152         }
153     }
154
155     grouping c-multicast-grouping {
156         container c-multicast {
157             description "https://tools.ietf.org/html/rfc6514#section-4.6";
158
159             uses multicast-source-rd-grouping;
160             uses source-as-grouping;
161             uses multicast-group-opaque-grouping;
162         }
163     }
164
165     grouping mvpn {
166         reference "https://tools.ietf.org/html/rfc6514#section-4";
167         description "The MCAST-VPN NLRI is carried in BGP [RFC4271] using BGP
168             Multiprotocol Extensions [RFC4760] with an Address Family Identifier
169             (AFI) of 1 or 2 and a Subsequent AFI (SAFI) of MCAST-VPN.";
170
171         choice mvpn-choice {
172             case intra-as-i-pmsi-a-d-case {
173                 uses intra-as-i-pmsi-a-d-grouping;
174             }
175             case inter-as-i-pmsi-a-d-case {
176                 uses inter-as-i-pmsi-a-d-grouping;
177             }
178             case s-pmsi-a-d-case {
179                 uses s-pmsi-a-d-grouping;
180             }
181             case leaf-a-d-case {
182                 uses leaf-a-d-grouping;
183             }
184             case source-active-a-d-case {
185                 uses source-active-a-d-grouping;
186             }
187             case shared-tree-join-case {
188                 container shared-tree-join {
189                     uses c-multicast-grouping;
190                 }
191             }
192             case source-tree-join-case {
193                 container source-tree-join {
194                     uses c-multicast-grouping;
195                 }
196             }
197             mandatory true;
198         }
199     }
200
201     grouping pe-distinguisher-labels-attribute {
202         container pe-distinguisher-labels-attribute {
203             list pe-distinguisher-label-attribute {
204                 leaf pe-address  {
205                     type inet:ip-address-no-zone;
206                     mandatory true;
207                 }
208                 leaf mpls-label {
209                     type netc:mpls-label;
210                     mandatory true;
211                 }
212             }
213         }
214     }
215
216     grouping bgp-rib-route {
217         uses pmsi:bgp-rib-route {
218             augment "attributes" {
219                 ext:augment-identifier pe-distinguisher-labels-attribute-augmentation;
220                 uses pe-distinguisher-labels-attribute;
221             }
222         }
223     }
224
225     grouping mvpn-bgp-rib-route {
226         uses mvpn;
227         uses bgp-rib-route;
228     }
229
230     grouping mvpn-routes {
231         list mvpn-route {
232             key "route-key path-id";
233             uses mvpn-bgp-rib-route;
234         }
235     }
236 }