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