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