]> git.proxmox.com Git - mirror_frr.git/blame - yang/frr-nexthop.yang
Merge commit '97cfd5d207e46a027809125cfb356fd301af0cf5'
[mirror_frr.git] / yang / frr-nexthop.yang
CommitLineData
fdd5c6e8
MS
1module 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
28 "This module defines a model for managing FRR nexthop information.";
29
30 revision 2019-08-15 {
31 description
32 "Initial revision.";
33 }
34
f8614910 35 typedef optional-ip-address {
d9d6232f
CS
36 type union {
37 type inet:ip-address;
38 type string {
39 pattern '';
40 }
41 }
fdd5c6e8
MS
42 }
43
f8614910
S
44 /*
45 * Nexthop types.
46 */
fdd5c6e8
MS
47 typedef nexthop-type {
48 type enumeration {
49 enum "ifindex" {
3d2ab385
CS
50 value 1;
51 description
52 "Specific interface.";
fdd5c6e8
MS
53 }
54 enum "ip4" {
3d2ab385
CS
55 value 2;
56 description
57 "IPv4 address.";
fdd5c6e8
MS
58 }
59 enum "ip4-ifindex" {
3d2ab385
CS
60 value 3;
61 description
62 "IPv4 address and interface.";
fdd5c6e8
MS
63 }
64 enum "ip6" {
3d2ab385
CS
65 value 4;
66 description
67 "IPv6 address.";
fdd5c6e8
MS
68 }
69 enum "ip6-ifindex" {
3d2ab385
CS
70 value 5;
71 description
72 "IPv6 address and interface.";
fdd5c6e8
MS
73 }
74 enum "blackhole" {
3d2ab385
CS
75 value 6;
76 description
77 "Unreachable or prohibited.";
fdd5c6e8
MS
78 }
79 }
80 description
81 "Nexthop types.";
82 }
83
f8614910
S
84 /*
85 * Blockhole nexthop type.
86 */
fdd5c6e8
MS
87 typedef blackhole-type {
88 type enumeration {
89 enum "unspec" {
3d2ab385
CS
90 value 0;
91 description
92 "Generic unreachable.";
fdd5c6e8
MS
93 }
94 enum "null" {
3d2ab385
CS
95 value 1;
96 description
97 "Null type.";
fdd5c6e8
MS
98 }
99 enum "reject" {
3d2ab385
CS
100 value 2;
101 description
102 "ICMP unreachable.";
fdd5c6e8
MS
103 }
104 enum "prohibited" {
3d2ab385
CS
105 value 3;
106 description
107 "ICMP admin-prohibited.";
fdd5c6e8
MS
108 }
109 }
110 default "null";
111 description
112 "Nexthop blackhole types.";
113 }
114
115 /*
f8614910 116 * Common nexthop attributes grouping.
fdd5c6e8 117 */
f8614910 118 grouping frr-nexthop-attributes {
fdd5c6e8
MS
119 leaf nh-type {
120 type nexthop-type;
121 mandatory true;
122 description
3d2ab385 123 "The nexthop type.";
fdd5c6e8 124 }
fdd5c6e8 125 leaf vrf {
f8614910 126 type frr-vrf:vrf-ref;
fdd5c6e8 127 description
3d2ab385 128 "The nexthop vrf name, if different from the route.";
fdd5c6e8 129 }
f8614910
S
130 leaf gateway {
131 type frr-nexthop:optional-ip-address;
132 description
133 "The nexthop gateway address.";
134 }
fdd5c6e8 135 leaf interface {
1b9468cc 136 type frr-interface:interface-ref;
fdd5c6e8 137 description
3d2ab385 138 "The nexthop egress interface.";
fdd5c6e8 139 }
fdd5c6e8 140 leaf bh-type {
f8614910 141 when "../nh-type = 'blackhole'";
fdd5c6e8
MS
142 type blackhole-type;
143 description
3d2ab385 144 "A blackhole sub-type, if the nexthop is a blackhole type.";
fdd5c6e8 145 }
f8614910
S
146 leaf onlink {
147 when "../nh-type = 'ip4-ifindex' or
148 ../nh-type = 'ip6-ifindex'";
149 type boolean;
d9d6232f 150 default "false";
fdd5c6e8 151 description
f8614910 152 "Nexthop is directly connected.";
fdd5c6e8 153 }
d9d6232f 154
f8614910 155 uses rt-types:mpls-label-stack {
fdd5c6e8 156 description
f8614910 157 "Nexthop's MPLS label stack.";
fdd5c6e8 158 }
f8614910 159 }
3d2ab385 160
f8614910
S
161 /*
162 * operational common attributes for nexthop
163 */
164 grouping frr-nexthop-operational {
165 leaf duplicate {
fdd5c6e8 166 type empty;
d9d6232f 167 config false;
fdd5c6e8 168 description
f8614910 169 "Duplicate nexthop";
fdd5c6e8 170 }
d9d6232f 171
f8614910 172 leaf recursive {
fdd5c6e8 173 type empty;
d9d6232f 174 config false;
fdd5c6e8 175 description
f8614910 176 "Nexthop resolved through another gateway.";
fdd5c6e8 177 }
d9d6232f 178
f8614910 179 leaf active {
fdd5c6e8 180 type empty;
d9d6232f 181 config false;
fdd5c6e8 182 description
3d2ab385 183 "Nexthop is active.";
fdd5c6e8 184 }
d9d6232f 185
f8614910 186 leaf fib {
f8614910 187 type empty;
d9d6232f 188 config false;
fdd5c6e8 189 description
f8614910 190 "Nexthop is installed in fib.";
fdd5c6e8 191 }
d9d6232f
CS
192
193 leaf weight {
194 type uint8;
195 config false;
196 description
197 "Weight to be used by the nexthop for purposes of ECMP";
198 }
f8614910 199 }
fdd5c6e8 200
f8614910
S
201 /*
202 * Single nexthop grouping.
203 */
204 grouping frr-nexthop {
205 container frr-nexthops {
fdd5c6e8 206 description
f8614910
S
207 "FRR nexthop object.";
208 list nexthop {
209 key "nh-type gateway interface";
210 description
211 "A list of nexthop objects.";
f8614910
S
212 uses frr-nexthop-attributes;
213 }
fdd5c6e8 214 }
3d2ab385 215 }
fdd5c6e8 216
f8614910 217
fdd5c6e8 218 /*
f8614910 219 * Container for FRR nexthop group.
fdd5c6e8 220 */
f8614910
S
221 grouping frr-nexthop-grouping {
222 list nexthop-group {
223 key "name";
fdd5c6e8 224 description
f8614910 225 "A group of nexthops.";
fdd5c6e8 226
f8614910
S
227 leaf name {
228 type string;
fdd5c6e8 229 description
f8614910 230 "The nexthop-group name.";
fdd5c6e8
MS
231 }
232
233 uses frr-nexthop;
fdd5c6e8 234 }
3d2ab385 235 }
fdd5c6e8 236
f8614910
S
237 container frr-nexthop-group {
238 description
239 "A nexthop-group, represented as a list of nexthop objects.";
f8614910
S
240 uses frr-nexthop-grouping;
241 }
242
d9d6232f
CS
243 typedef nexthop-group-ref {
244 type leafref {
245 require-instance false;
246 path "/frr-nexthop:frr-nexthop-group/frr-nexthop:nexthop-group/frr-nexthop:name";
247 }
248 }
249
f8614910 250 /*
d9d6232f 251 * Augment weight attributes to nexthop group.
f8614910
S
252 */
253 augment "/frr-nexthop-group/nexthop-group/frr-nexthops/nexthop" {
254 leaf weight {
255 type uint8;
256 description
257 "Weight to be used by the nexthop for purposes of ECMP";
258 }
259 }
fdd5c6e8 260}