]> git.proxmox.com Git - mirror_frr.git/blob - yang/frr-nexthop.yang
Merge pull request #7210 from idryzhov/route-types-disable-daemon
[mirror_frr.git] / yang / frr-nexthop.yang
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 }
13
14 import frr-interface {
15 prefix frr-interface;
16 }
17
18 import frr-vrf {
19 prefix frr-vrf;
20 }
21
22 organization
23 "FRRouting";
24 contact
25 "FRR Users List: <mailto:frog@lists.frrouting.org>
26 FRR Development List: <mailto:dev@lists.frrouting.org>";
27 description
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.";
54
55 revision 2019-08-15 {
56 description
57 "Initial revision.";
58 }
59
60 typedef optional-ip-address {
61 type union {
62 type inet:ip-address;
63 type string {
64 pattern '';
65 }
66 }
67 }
68
69 /*
70 * Nexthop types.
71 */
72 typedef nexthop-type {
73 type enumeration {
74 enum "ifindex" {
75 value 1;
76 description
77 "Specific interface.";
78 }
79 enum "ip4" {
80 value 2;
81 description
82 "IPv4 address.";
83 }
84 enum "ip4-ifindex" {
85 value 3;
86 description
87 "IPv4 address and interface.";
88 }
89 enum "ip6" {
90 value 4;
91 description
92 "IPv6 address.";
93 }
94 enum "ip6-ifindex" {
95 value 5;
96 description
97 "IPv6 address and interface.";
98 }
99 enum "blackhole" {
100 value 6;
101 description
102 "Unreachable or prohibited.";
103 }
104 }
105 description
106 "Nexthop types.";
107 }
108
109 /*
110 * Blockhole nexthop type.
111 */
112 typedef blackhole-type {
113 type enumeration {
114 enum "unspec" {
115 value 0;
116 description
117 "Generic unreachable.";
118 }
119 enum "null" {
120 value 1;
121 description
122 "Null type.";
123 }
124 enum "reject" {
125 value 2;
126 description
127 "ICMP unreachable.";
128 }
129 enum "prohibited" {
130 value 3;
131 description
132 "ICMP admin-prohibited.";
133 }
134 }
135 default "null";
136 description
137 "Nexthop blackhole types.";
138 }
139
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
147 /*
148 * Common nexthop attributes grouping.
149 */
150 grouping frr-nexthop-attributes {
151 leaf nh-type {
152 type nexthop-type;
153 mandatory true;
154 description
155 "The nexthop type.";
156 }
157
158 leaf vrf {
159 type frr-vrf:vrf-ref;
160 description
161 "The nexthop vrf name, if different from the route.";
162 }
163 leaf gateway {
164 type frr-nexthop:optional-ip-address;
165 description
166 "The nexthop gateway address.";
167 }
168
169 leaf interface {
170 type frr-interface:interface-ref;
171 description
172 "The nexthop egress interface.";
173 }
174
175 leaf bh-type {
176 when "../nh-type = 'blackhole'";
177 type blackhole-type;
178 description
179 "A blackhole sub-type, if the nexthop is a blackhole type.";
180 }
181
182 leaf onlink {
183 when "../nh-type = 'ip4-ifindex' or
184 ../nh-type = 'ip6-ifindex'";
185 type boolean;
186 default "false";
187 description
188 "Nexthop is directly connected.";
189 }
190
191 leaf srte-color {
192 when "../nh-type = 'ip4' or
193 ../nh-type = 'ip6' or
194 ../nh-type = 'ip4-ifindex' or
195 ../nh-type = 'ip6-ifindex'";
196 type uint32;
197 description
198 "The nexthop SR-TE color";
199 }
200
201 uses rt-types:mpls-label-stack {
202 description
203 "Nexthop's MPLS label stack.";
204 }
205 }
206
207 /*
208 * operational common attributes for nexthop
209 */
210 grouping frr-nexthop-operational {
211 leaf duplicate {
212 type empty;
213 config false;
214 description
215 "Duplicate nexthop";
216 }
217
218 leaf recursive {
219 type empty;
220 config false;
221 description
222 "Nexthop resolved through another gateway.";
223 }
224
225 leaf active {
226 type empty;
227 config false;
228 description
229 "Nexthop is active.";
230 }
231
232 leaf fib {
233 type empty;
234 config false;
235 description
236 "Nexthop is installed in fib.";
237 }
238
239 leaf weight {
240 type uint8;
241 config false;
242 description
243 "Weight to be used by the nexthop for purposes of ECMP";
244 }
245 }
246
247 grouping nexthop-grouping {
248 list nexthop {
249 key "nh-type vrf gateway interface";
250 min-elements 1;
251 description
252 "A list of nexthop objects.";
253 uses frr-nexthop-attributes;
254 }
255 }
256
257 /*
258 * Single nexthop grouping.
259 */
260 grouping frr-nexthop {
261 container frr-nexthops {
262 description
263 "FRR nexthop object.";
264 uses nexthop-grouping;
265 }
266 }
267
268
269 /*
270 * Container for FRR nexthop group.
271 */
272 grouping frr-nexthop-grouping {
273 list nexthop-groups {
274 key "name";
275 description
276 "List of nexthop groups, each contains group of nexthops";
277 leaf name {
278 type string;
279 description
280 "The nexthop-group name.";
281 }
282
283 uses frr-nexthop;
284 }
285 }
286
287 /* Operational nexthop-group */
288 grouping frr-nexthop-group-operational {
289 container nexthop-group {
290 description
291 "A group of nexthops.";
292 leaf id {
293 type uint32;
294 description
295 "The nexthop-group id.";
296 }
297
298 uses nexthop-grouping;
299 }
300 }
301
302 container frr-nexthop-group {
303 description
304 "A nexthop-group, represented as a list of nexthop objects.";
305 uses frr-nexthop-grouping;
306 }
307
308 /*
309 * Augment weight attributes to nexthop group.
310 */
311 augment "/frr-nexthop-group/nexthop-groups/frr-nexthops/nexthop" {
312 leaf weight {
313 type uint8;
314 description
315 "Weight to be used by the nexthop for purposes of ECMP";
316 }
317 }
318 }