]>
Commit | Line | Data |
---|---|---|
fdd5c6e8 MS |
1 | module frr-nexthop { |
2 | yang-version 1.1; | |
3 | namespace "http://frrouting.org/yang/nexthop"; | |
4 | prefix frr-nexthop; | |
5 | ||
6 | import ietf-inet-types { | |
7 | prefix inet; | |
8 | } | |
9 | ||
10 | import ietf-routing-types { | |
11 | prefix rt-types; | |
12 | } | |
f8614910 | 13 | |
1b9468cc CS |
14 | import frr-interface { |
15 | prefix frr-interface; | |
16 | } | |
fdd5c6e8 | 17 | |
f8614910 | 18 | import frr-vrf { |
d9d6232f | 19 | prefix frr-vrf; |
f8614910 S |
20 | } |
21 | ||
fdd5c6e8 | 22 | organization |
8678d638 | 23 | "FRRouting"; |
fdd5c6e8 MS |
24 | contact |
25 | "FRR Users List: <mailto:frog@lists.frrouting.org> | |
26 | FRR Development List: <mailto:dev@lists.frrouting.org>"; | |
27 | description | |
fe3b629a RW |
28 | "This module defines a model for managing FRR nexthop information. |
29 | ||
30 | Copyright 2020 FRRouting | |
31 | ||
32 | Redistribution and use in source and binary forms, with or without | |
33 | modification, are permitted provided that the following conditions | |
34 | are met: | |
35 | ||
36 | 1. Redistributions of source code must retain the above copyright notice, | |
37 | this list of conditions and the following disclaimer. | |
38 | ||
39 | 2. Redistributions in binary form must reproduce the above copyright | |
40 | notice, this list of conditions and the following disclaimer in the | |
41 | documentation and/or other materials provided with the distribution. | |
42 | ||
43 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
44 | \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
45 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
46 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
47 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
48 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
49 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
50 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
51 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
52 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
53 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."; | |
fdd5c6e8 MS |
54 | |
55 | revision 2019-08-15 { | |
56 | description | |
57 | "Initial revision."; | |
58 | } | |
59 | ||
f8614910 | 60 | typedef optional-ip-address { |
d9d6232f CS |
61 | type union { |
62 | type inet:ip-address; | |
63 | type string { | |
405ebe45 | 64 | length "0"; |
d9d6232f CS |
65 | } |
66 | } | |
fdd5c6e8 MS |
67 | } |
68 | ||
f8614910 S |
69 | /* |
70 | * Nexthop types. | |
71 | */ | |
fdd5c6e8 MS |
72 | typedef nexthop-type { |
73 | type enumeration { | |
74 | enum "ifindex" { | |
3d2ab385 CS |
75 | value 1; |
76 | description | |
77 | "Specific interface."; | |
fdd5c6e8 MS |
78 | } |
79 | enum "ip4" { | |
3d2ab385 CS |
80 | value 2; |
81 | description | |
82 | "IPv4 address."; | |
fdd5c6e8 MS |
83 | } |
84 | enum "ip4-ifindex" { | |
3d2ab385 CS |
85 | value 3; |
86 | description | |
87 | "IPv4 address and interface."; | |
fdd5c6e8 MS |
88 | } |
89 | enum "ip6" { | |
3d2ab385 CS |
90 | value 4; |
91 | description | |
92 | "IPv6 address."; | |
fdd5c6e8 MS |
93 | } |
94 | enum "ip6-ifindex" { | |
3d2ab385 CS |
95 | value 5; |
96 | description | |
97 | "IPv6 address and interface."; | |
fdd5c6e8 MS |
98 | } |
99 | enum "blackhole" { | |
3d2ab385 CS |
100 | value 6; |
101 | description | |
102 | "Unreachable or prohibited."; | |
fdd5c6e8 MS |
103 | } |
104 | } | |
105 | description | |
106 | "Nexthop types."; | |
107 | } | |
108 | ||
f8614910 S |
109 | /* |
110 | * Blockhole nexthop type. | |
111 | */ | |
fdd5c6e8 MS |
112 | typedef blackhole-type { |
113 | type enumeration { | |
114 | enum "unspec" { | |
3d2ab385 CS |
115 | value 0; |
116 | description | |
117 | "Generic unreachable."; | |
fdd5c6e8 MS |
118 | } |
119 | enum "null" { | |
3d2ab385 CS |
120 | value 1; |
121 | description | |
122 | "Null type."; | |
fdd5c6e8 MS |
123 | } |
124 | enum "reject" { | |
3d2ab385 CS |
125 | value 2; |
126 | description | |
127 | "ICMP unreachable."; | |
fdd5c6e8 MS |
128 | } |
129 | enum "prohibited" { | |
3d2ab385 CS |
130 | value 3; |
131 | description | |
132 | "ICMP admin-prohibited."; | |
fdd5c6e8 MS |
133 | } |
134 | } | |
135 | default "null"; | |
136 | description | |
137 | "Nexthop blackhole types."; | |
138 | } | |
139 | ||
9670b0b3 CS |
140 | typedef nexthop-group-ref { |
141 | type leafref { | |
142 | path "/frr-nexthop:frr-nexthop-group/frr-nexthop:nexthop-groups/frr-nexthop:name"; | |
143 | require-instance false; | |
144 | } | |
145 | } | |
146 | ||
fdd5c6e8 | 147 | /* |
f8614910 | 148 | * Common nexthop attributes grouping. |
fdd5c6e8 | 149 | */ |
f8614910 | 150 | grouping frr-nexthop-attributes { |
fdd5c6e8 MS |
151 | leaf nh-type { |
152 | type nexthop-type; | |
153 | mandatory true; | |
154 | description | |
3d2ab385 | 155 | "The nexthop type."; |
fdd5c6e8 | 156 | } |
9670b0b3 | 157 | |
fdd5c6e8 | 158 | leaf vrf { |
806defc8 | 159 | type frr-vrf:vrf-ref; |
fdd5c6e8 | 160 | description |
3d2ab385 | 161 | "The nexthop vrf name, if different from the route."; |
fdd5c6e8 | 162 | } |
dc40d337 | 163 | |
f8614910 S |
164 | leaf gateway { |
165 | type frr-nexthop:optional-ip-address; | |
166 | description | |
167 | "The nexthop gateway address."; | |
168 | } | |
9670b0b3 | 169 | |
fdd5c6e8 | 170 | leaf interface { |
806defc8 | 171 | type frr-interface:interface-ref; |
fdd5c6e8 | 172 | description |
3d2ab385 | 173 | "The nexthop egress interface."; |
fdd5c6e8 | 174 | } |
9670b0b3 | 175 | |
fdd5c6e8 MS |
176 | leaf bh-type { |
177 | type blackhole-type; | |
178 | description | |
3d2ab385 | 179 | "A blackhole sub-type, if the nexthop is a blackhole type."; |
fdd5c6e8 | 180 | } |
9670b0b3 | 181 | |
f8614910 | 182 | leaf onlink { |
f8614910 | 183 | type boolean; |
d9d6232f | 184 | default "false"; |
fdd5c6e8 | 185 | description |
f8614910 | 186 | "Nexthop is directly connected."; |
fdd5c6e8 | 187 | } |
d9d6232f | 188 | |
065276ae SM |
189 | leaf srte-color { |
190 | when "../nh-type = 'ip4' or | |
191 | ../nh-type = 'ip6' or | |
192 | ../nh-type = 'ip4-ifindex' or | |
193 | ../nh-type = 'ip6-ifindex'"; | |
194 | type uint32; | |
195 | description | |
196 | "The nexthop SR-TE color"; | |
197 | } | |
198 | ||
f8614910 | 199 | uses rt-types:mpls-label-stack { |
fdd5c6e8 | 200 | description |
f8614910 | 201 | "Nexthop's MPLS label stack."; |
fdd5c6e8 | 202 | } |
f8614910 | 203 | } |
3d2ab385 | 204 | |
f8614910 S |
205 | /* |
206 | * operational common attributes for nexthop | |
207 | */ | |
208 | grouping frr-nexthop-operational { | |
209 | leaf duplicate { | |
fdd5c6e8 | 210 | type empty; |
d9d6232f | 211 | config false; |
fdd5c6e8 | 212 | description |
f8614910 | 213 | "Duplicate nexthop"; |
fdd5c6e8 | 214 | } |
d9d6232f | 215 | |
f8614910 | 216 | leaf recursive { |
fdd5c6e8 | 217 | type empty; |
d9d6232f | 218 | config false; |
fdd5c6e8 | 219 | description |
f8614910 | 220 | "Nexthop resolved through another gateway."; |
fdd5c6e8 | 221 | } |
d9d6232f | 222 | |
f8614910 | 223 | leaf active { |
fdd5c6e8 | 224 | type empty; |
d9d6232f | 225 | config false; |
fdd5c6e8 | 226 | description |
3d2ab385 | 227 | "Nexthop is active."; |
fdd5c6e8 | 228 | } |
d9d6232f | 229 | |
f8614910 | 230 | leaf fib { |
f8614910 | 231 | type empty; |
d9d6232f | 232 | config false; |
fdd5c6e8 | 233 | description |
f8614910 | 234 | "Nexthop is installed in fib."; |
fdd5c6e8 | 235 | } |
d9d6232f CS |
236 | |
237 | leaf weight { | |
238 | type uint8; | |
239 | config false; | |
240 | description | |
241 | "Weight to be used by the nexthop for purposes of ECMP"; | |
242 | } | |
f8614910 | 243 | } |
fdd5c6e8 | 244 | |
9670b0b3 CS |
245 | grouping nexthop-grouping { |
246 | list nexthop { | |
eac8547a | 247 | key "nh-type vrf gateway interface"; |
248 | min-elements 1; | |
9670b0b3 CS |
249 | description |
250 | "A list of nexthop objects."; | |
251 | uses frr-nexthop-attributes; | |
252 | } | |
253 | } | |
254 | ||
f8614910 S |
255 | /* |
256 | * Single nexthop grouping. | |
257 | */ | |
258 | grouping frr-nexthop { | |
259 | container frr-nexthops { | |
fdd5c6e8 | 260 | description |
f8614910 | 261 | "FRR nexthop object."; |
9670b0b3 | 262 | uses nexthop-grouping; |
fdd5c6e8 | 263 | } |
3d2ab385 | 264 | } |
fdd5c6e8 | 265 | |
f8614910 | 266 | |
fdd5c6e8 | 267 | /* |
f8614910 | 268 | * Container for FRR nexthop group. |
fdd5c6e8 | 269 | */ |
f8614910 | 270 | grouping frr-nexthop-grouping { |
9670b0b3 | 271 | list nexthop-groups { |
f8614910 | 272 | key "name"; |
fdd5c6e8 | 273 | description |
9670b0b3 | 274 | "List of nexthop groups, each contains group of nexthops"; |
f8614910 | 275 | leaf name { |
d6160c0a | 276 | type string; |
fdd5c6e8 | 277 | description |
f8614910 | 278 | "The nexthop-group name."; |
fdd5c6e8 MS |
279 | } |
280 | ||
281 | uses frr-nexthop; | |
fdd5c6e8 | 282 | } |
3d2ab385 | 283 | } |
fdd5c6e8 | 284 | |
9670b0b3 CS |
285 | /* Operational nexthop-group */ |
286 | grouping frr-nexthop-group-operational { | |
287 | container nexthop-group { | |
288 | description | |
289 | "A group of nexthops."; | |
290 | leaf id { | |
291 | type uint32; | |
292 | description | |
293 | "The nexthop-group id."; | |
294 | } | |
295 | ||
296 | uses nexthop-grouping; | |
297 | } | |
298 | } | |
299 | ||
f8614910 S |
300 | container frr-nexthop-group { |
301 | description | |
302 | "A nexthop-group, represented as a list of nexthop objects."; | |
f8614910 S |
303 | uses frr-nexthop-grouping; |
304 | } | |
305 | ||
306 | /* | |
d9d6232f | 307 | * Augment weight attributes to nexthop group. |
f8614910 | 308 | */ |
9670b0b3 | 309 | augment "/frr-nexthop-group/nexthop-groups/frr-nexthops/nexthop" { |
f8614910 S |
310 | leaf weight { |
311 | type uint8; | |
312 | description | |
313 | "Weight to be used by the nexthop for purposes of ECMP"; | |
314 | } | |
315 | } | |
fdd5c6e8 | 316 | } |