cab57070ccf4fa2e6c43517289e167999c4cb65c
[bgpcep.git] / bgp / linkstate / src / main / yang / bgp-segment-routing.yang
1 module bgp-segment-routing {
2     yang-version 1;
3     namespace "urn:opendaylight:params:xml:ns:yang:bgp-segment-routing-ext";
4     prefix "bgp-sr";
5
6     import network-concepts { prefix netc; revision-date 2013-11-25; }
7     import ietf-inet-types { prefix inet; revision-date 2013-07-15; }
8
9     organization "Cisco Systems, Inc.";
10     contact "Iveta Halanova <ihalanov@cisco.com>";
11
12     description
13         "This module contains the base data concepts contained
14         in draft-gredler-idr-bgp-ls-segment-routing-ext-02.
15
16         Copyright (c)2015 Cisco Systems, Inc. All rights reserved.
17
18         This program and the accompanying materials are made available
19         under the terms of the Eclipse Public License v1.0 which
20         accompanies this distribution, and is available at
21         http://www.eclipse.org/legal/epl-v10.html";
22
23     revision "2015-10-14" {
24         description
25             "Initial revision.";
26     }
27
28     typedef algorithm {
29         reference "https://tools.ietf.org/html/draft-gredler-idr-bgp-ls-segment-routing-ext-02#section-2.1.2";
30         type enumeration {
31             enum shortest-path-first {
32                 value 0;
33             }
34             enum strict-shortest-path-first {
35                 value 1;
36             }
37         }
38     }
39
40     typedef weight {
41         reference "https://tools.ietf.org/html/draft-gredler-idr-bgp-ls-segment-routing-ext-02#section-2.2";
42         type uint8;
43     }
44
45     grouping sid-label-index {
46         reference "https://tools.ietf.org/html/draft-gredler-idr-bgp-ls-segment-routing-ext-02#section-2.3.4";
47         choice sid-label-index {
48             case local-label-case {
49                 leaf local-label {
50                     type netc:mpls-label;
51                 }
52             }
53             case ipv6-address-case {
54                 leaf ipv6-address {
55                     type inet:ipv6-address;
56                 }
57             }
58             case sid-case {
59                 leaf sid {
60                     type uint32;
61                 }
62             }
63         }
64     }
65
66     grouping sr-capabilities-tlv {
67         reference "https://tools.ietf.org/html/draft-gredler-idr-bgp-ls-segment-routing-ext-02#section-2.1.1";
68         leaf mpls-ipv4 {
69             type boolean;
70         }
71         leaf mpls-ipv6 {
72             type boolean;
73         }
74         leaf sr-ipv6 {
75             type boolean;
76         }
77         leaf range-size {
78             type uint32 {
79                 range "0..16777215";
80             }
81         }
82         uses sid-label-index;
83     }
84
85     grouping sr-algorithms-tlv {
86         leaf-list algorithms {
87             type algorithm;
88         }
89     }
90
91     grouping ospf-adj-flags {
92         reference "https://tools.ietf.org/html/draft-ietf-ospf-segment-routing-extensions-08#section-7.1";
93         leaf backup {
94             type boolean;
95         }
96         leaf set {
97             type boolean;
98         }
99     }
100
101     grouping adj-flags {
102         choice flags {
103             case ospf-adj-flags-case {
104                 uses ospf-adj-flags;
105             }
106             case isis-adj-flags-case {
107                 reference "https://tools.ietf.org/html/draft-ietf-isis-segment-routing-extensions-06#section-2.2.1";
108                 uses ospf-adj-flags;
109                 leaf address-family {
110                     type boolean;
111                 }
112             }
113         }
114     }
115
116     grouping adj-sid-tlv {
117         reference "https://tools.ietf.org/html/draft-gredler-idr-bgp-ls-segment-routing-ext-02#section-2.2.1";
118         uses adj-flags;
119         uses epe-adj-sid-tlv;
120     }
121
122     grouping epe-adj-sid-tlv {
123         leaf weight {
124             type weight;
125         }
126         uses sid-label-index;
127     }
128
129     grouping lan-adj-sid-tlv {
130         reference "https://tools.ietf.org/html/draft-gredler-idr-bgp-ls-segment-routing-ext-02#section-2.2.2";
131         uses adj-flags;
132         leaf weight {
133             type weight;
134         }
135         leaf iso-system-id {
136             type netc:iso-system-identifier;
137         }
138         leaf neighbor-id {
139             type inet:ipv4-address;
140         }
141         uses sid-label-index;
142     }
143
144     grouping prefix-flags {
145         leaf no-php {
146             type boolean;
147         }
148         leaf explicit-null {
149             type boolean;
150         }
151     }
152
153     grouping prefix-sid-tlv {
154         reference "https://tools.ietf.org/html/draft-gredler-idr-bgp-ls-segment-routing-ext-02#section-2.3.1";
155         choice flags {
156             case isis-prefix-flags-case {
157                 reference "https://tools.ietf.org/html/draft-ietf-ospf-segment-routing-extensions-08#section-5";
158                 uses prefix-flags;
159                 leaf readvertisement {
160                     type boolean;
161                 }
162                 leaf node-sid {
163                     type boolean;
164                 }
165             }
166             case ospf-prefix-flags-case {
167                 reference "https://tools.ietf.org/html/draft-ietf-ospf-segment-routing-extensions-05#section-5";
168                 uses prefix-flags;
169                 leaf mapping-server {
170                     type boolean;
171                 }
172             }
173         }
174         leaf algorithm {
175             type algorithm;
176         }
177         uses sid-label-index;
178     }
179
180     grouping ipv6-prefix-sid-tlv {
181         reference "https://tools.ietf.org/html/draft-previdi-isis-ipv6-prefix-sid-02#page-2";
182         leaf algorithm {
183             type algorithm;
184         }
185     }
186
187     grouping ero-flags {
188         leaf loose {
189             type boolean;
190         }
191     }
192
193     grouping ero-ipv4-address {
194         uses ero-flags;
195         leaf address {
196             type inet:ipv4-address;
197             mandatory true;
198         }
199     }
200
201     grouping ero-ipv6-address {
202         uses ero-flags;
203         leaf address {
204             type inet:ipv6-address;
205             mandatory true;
206         }
207     }
208
209     grouping ero-unnumbered {
210         uses ero-flags;
211         leaf router-id {
212             type uint32;
213         }
214         leaf interface-id {
215             type uint32;
216         }
217     }
218
219     grouping binding-sub-tlvs {
220         reference "https://tools.ietf.org/html/draft-gredler-idr-bgp-ls-segment-routing-ext-02#section-2.3.4";
221         choice binding-sub-tlv {
222             case prefix-sid-case {
223                 uses prefix-sid-tlv;
224             }
225             case ipv6-prefix-sid-case {
226                 uses ipv6-prefix-sid-tlv;
227             }
228             case sid-label-case {
229                 uses sid-label-index;
230             }
231             case ero-metric-case {
232                 leaf ero-metric {
233                     type netc:te-metric;
234                 }
235             }
236             case ipv4-ero-case {
237                 uses ero-ipv4-address;
238             }
239             case ipv6-ero-case {
240                 uses ero-ipv6-address;
241             }
242             case unnumbered-interface-id-ero-case {
243                 uses ero-unnumbered;
244             }
245             case ipv4-ero-backup-case {
246                 uses ero-ipv4-address;
247             }
248             case ipv6-ero-backup-case {
249                 uses ero-ipv6-address;
250             }
251             case unnumbered-interface-id-backup-ero-case {
252                 uses ero-unnumbered;
253             }
254         }
255     }
256
257     grouping isis-binding-flags {
258         reference "https://tools.ietf.org/html/draft-ietf-isis-segment-routing-extensions-06#section-2.4";
259         leaf address-family {
260             type boolean;
261         }
262         leaf mirror-context {
263             type boolean;
264         }
265         leaf spread-tlv {
266             type boolean;
267         }
268         leaf leaked-from-level-2 {
269             type boolean;
270         }
271         leaf attached-flag {
272             type boolean;
273         }
274     }
275
276     grouping ospf-binding-flags {
277         reference "https://tools.ietf.org/html/draft-ietf-ospf-segment-routing-extensions-08#section-6";
278         leaf mirroring {
279             type boolean;
280         }
281     }
282
283     grouping binding-sid-tlv {
284         reference "https://tools.ietf.org/html/draft-gredler-idr-bgp-ls-segment-routing-ext-02#section-2.3.3";
285         leaf weight {
286             type weight;
287         }
288         choice flags {
289             case isis-binding-flags-case {
290                 uses isis-binding-flags;
291             }
292             case ospf-binding-flags-case {
293                 uses ospf-binding-flags;
294             }
295         }
296         list binding-sub-tlvs {
297             uses binding-sub-tlvs;
298         }
299     }
300
301     grouping range-sub-tlvs {
302         choice range-sub-tlv {
303             case binding-sid-tlv-case {
304                 uses binding-sid-tlv;
305             }
306             case prefix-sid-tlv-case {
307                 uses prefix-sid-tlv;
308             }
309             case ipv6-prefix-sid-tlv-case {
310                 uses ipv6-prefix-sid-tlv;
311             }
312             case sid-label-tlv-case {
313                 uses sid-label-index;
314             }
315         }
316     }
317
318     grouping range-tlv {
319         reference "https://tools.ietf.org/html/draft-gredler-idr-bgp-ls-segment-routing-ext-02#section-2.3.2";
320         leaf inter-area {
321             type boolean;
322         }
323         leaf range-size {
324             type uint16;
325         }
326         list sub-tlvs {
327             uses range-sub-tlvs;
328         }
329     }
330 }