1b789ab85704dae95f22de6ab15e1ddd586a9fe2
[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";
4     prefix "bgp-sr";
5
6     import ietf-inet-types { prefix inet; revision-date 2010-09-24; }
7     import bgp-types { prefix bgp-t; revision-date 2013-09-19; }
8     import rsvp { prefix rsvp; revision-date 2013-08-20; }
9     import network-concepts { prefix netc; revision-date 2013-11-25; }
10
11     organization "Cisco Systems, Inc.";
12     contact "Dana Kutenicsova <dkutenic@cisco.com>";
13
14     description
15         "This module contains the base data concepts contained
16         in draft-ietf-isis-segment-routing-extensions.
17
18         Copyright (c)2015 Cisco Systems, Inc. All rights reserved.
19
20         This program and the accompanying materials are made available
21         under the terms of the Eclipse Public License v1.0 which
22         accompanies this distribution, and is available at
23         http://www.eclipse.org/legal/epl-v10.html";
24
25     revision "2015-02-06" {
26         description
27             "Initial revision.";
28     }
29
30     typedef adjacency-flags {
31         reference "https://tools.ietf.org/html/draft-ietf-isis-segment-routing-extensions-02#section-2.2.1";
32         type bits {
33             bit address-family {
34                 position 0;
35             }
36             bit backup {
37                 position 1;
38             }
39             bit value {
40                 position 2;
41             }
42             bit local {
43                 position 3;
44             }
45             bit set-flag {
46                 position 4;
47             }
48         }
49     }
50
51     typedef sid-label {
52         reference "https://tools.ietf.org/html/draft-ietf-isis-segment-routing-extensions-02#section-2.3";
53         type uint64;
54     }
55
56     typedef weight {
57         reference "https://tools.ietf.org/html/draft-ietf-isis-segment-routing-extensions-02#section-2.4.2";
58         type uint8;
59     }
60
61     grouping ero-ip-address {
62         leaf loose {
63             type boolean;
64             mandatory true;
65         }
66         leaf address {
67             type inet:ip-address;
68             mandatory true;
69         }
70     }
71
72     grouping ero-unnumbered {
73         leaf loose {
74             type boolean;
75             mandatory true;
76         }
77         leaf router-id {
78             type binary {
79                 length 20;
80             }
81             mandatory true;
82         }
83         leaf interface-id {
84             type uint32;
85             mandatory true;
86         }
87     }
88
89     grouping sid-sub-tlvs {
90         description "SubTlvs for SID Label Tlv";
91         reference "https://tools.ietf.org/html/draft-ietf-isis-segment-routing-extensions-02#section-2.4";
92
93         choice subtlv-type {
94             case sid-label-case {
95                 leaf sid {
96                     type sid-label;
97                 }
98             }
99             case ero-metric-case {
100                 leaf ero-metric {
101                     type netc:te-metric;
102                 }
103             }
104             case ip4-ero-case {
105                 uses ero-ip-address;
106             }
107             case ipv6-ero-case {
108                 uses ero-ip-address;
109             }
110             case unnumbered-ero-case {
111                 uses ero-unnumbered;
112             }
113             case ip4-ero-backup-case {
114                 uses ero-ip-address;
115             }
116             case ipv6-ero-backup-case {
117                 uses ero-ip-address;
118             }
119             case unnumbered-ero-backup-case {
120                 uses ero-unnumbered;
121             }
122         }
123     }
124
125     grouping sid-label-binding {
126         reference "https://tools.ietf.org/html/draft-ietf-isis-segment-routing-extensions-02#section-2.4";
127         leaf flags {
128             type bits {
129                 bit address-family {
130                     position 0;
131                 }
132                 bit mirror-context {
133                     position 1;
134                 }
135             }
136         }
137         leaf weight {
138             type weight;
139         }
140         leaf value-range {
141             type uint16;
142         }
143         leaf fec-prefix {
144             type inet:ip-prefix;
145         }
146         list sub-tlvs {
147             uses sid-sub-tlvs;
148             ordered-by user;
149         }
150     }
151
152     grouping adjacency-segment-identifier {
153         reference "https://tools.ietf.org/html/draft-ietf-isis-segment-routing-extensions-02#section-2.2.1";
154         leaf flags {
155             type adjacency-flags;
156         }
157         leaf weight {
158             type weight;
159         }
160         leaf sid {
161             type sid-label;
162         }
163     }
164
165     grouping lan-adjacency-segment-identifier {
166         reference "https://tools.ietf.org/html/draft-ietf-isis-segment-routing-extensions-02#section-2.2.2";
167         leaf flags {
168             type adjacency-flags;
169         }
170         leaf weight {
171             type weight;
172         }
173         leaf iso-system-id {
174             type netc:iso-system-identifier;
175         }
176         leaf sid {
177             type sid-label;
178         }
179     }
180
181     grouping sr-capabilities {
182         reference "https://tools.ietf.org/html/draft-ietf-isis-segment-routing-extensions-02#section-3.1";
183         leaf flags {
184             type bits {
185                 bit ipv4 {
186                     position 0;
187                 }
188                 bit ipv6 {
189                     position 1;
190                 }
191             }
192         }
193         leaf value-range {
194             type uint32 {
195                 range "0..16777215";
196             }
197         }
198         leaf sid {
199             type sid-label;
200         }
201     }
202
203     grouping sr-algorithm {
204         reference "https://tools.ietf.org/html/draft-ietf-isis-segment-routing-extensions-02#section-3.2";
205         leaf-list algorithm {
206             type uint8;
207         }
208     }
209 }