]> git.proxmox.com Git - mirror_frr.git/blob - yang/frr-nexthop.yang
Merge pull request #9292 from mobash-rasool/ospfv3-bug2
[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 length "0";
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
164 leaf gateway {
165 type frr-nexthop:optional-ip-address;
166 description
167 "The nexthop gateway address.";
168 }
169
170 leaf interface {
171 type frr-interface:interface-ref;
172 description
173 "The nexthop egress interface.";
174 }
175
176 leaf bh-type {
177 type blackhole-type;
178 description
179 "A blackhole sub-type, if the nexthop is a blackhole type.";
180 }
181
182 leaf onlink {
183 type boolean;
184 default "false";
185 description
186 "Nexthop is directly connected.";
187 }
188
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
199 uses rt-types:mpls-label-stack {
200 description
201 "Nexthop's MPLS label stack.";
202 }
203 }
204
205 /*
206 * operational common attributes for nexthop
207 */
208 grouping frr-nexthop-operational {
209 leaf duplicate {
210 type empty;
211 config false;
212 description
213 "Duplicate nexthop";
214 }
215
216 leaf recursive {
217 type empty;
218 config false;
219 description
220 "Nexthop resolved through another gateway.";
221 }
222
223 leaf active {
224 type empty;
225 config false;
226 description
227 "Nexthop is active.";
228 }
229
230 leaf fib {
231 type empty;
232 config false;
233 description
234 "Nexthop is installed in fib.";
235 }
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 }
243 }
244
245 grouping nexthop-grouping {
246 list nexthop {
247 key "nh-type vrf gateway interface";
248 min-elements 1;
249 description
250 "A list of nexthop objects.";
251 uses frr-nexthop-attributes;
252 }
253 }
254
255 /*
256 * Single nexthop grouping.
257 */
258 grouping frr-nexthop {
259 container frr-nexthops {
260 description
261 "FRR nexthop object.";
262 uses nexthop-grouping;
263 }
264 }
265
266
267 /*
268 * Container for FRR nexthop group.
269 */
270 grouping frr-nexthop-grouping {
271 list nexthop-groups {
272 key "name";
273 description
274 "List of nexthop groups, each contains group of nexthops";
275 leaf name {
276 type string;
277 description
278 "The nexthop-group name.";
279 }
280
281 uses frr-nexthop;
282 }
283 }
284
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
300 container frr-nexthop-group {
301 description
302 "A nexthop-group, represented as a list of nexthop objects.";
303 uses frr-nexthop-grouping;
304 }
305
306 /*
307 * Augment weight attributes to nexthop group.
308 */
309 augment "/frr-nexthop-group/nexthop-groups/frr-nexthops/nexthop" {
310 leaf weight {
311 type uint8;
312 description
313 "Weight to be used by the nexthop for purposes of ECMP";
314 }
315 }
316 }