]> git.proxmox.com Git - mirror_frr.git/blob - yang/frr-filter.yang
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / yang / frr-filter.yang
1 // SPDX-License-Identifier: BSD-2-Clause
2 module frr-filter {
3 yang-version 1.1;
4 namespace "http://frrouting.org/yang/filter";
5 prefix frr-filter;
6
7 import ietf-inet-types {
8 prefix inet;
9 }
10 import ietf-yang-types {
11 prefix yang;
12 }
13
14 organization "FRRouting";
15 contact
16 "FRR Users List: <mailto:frog@lists.frrouting.org>
17 FRR Development List: <mailto:dev@lists.frrouting.org>";
18 description
19 "This module defines filter settings
20
21 Copyright 2020 FRRouting
22
23 Redistribution and use in source and binary forms, with or without
24 modification, are permitted provided that the following conditions
25 are met:
26
27 1. Redistributions of source code must retain the above copyright notice,
28 this list of conditions and the following disclaimer.
29
30 2. Redistributions in binary form must reproduce the above copyright
31 notice, this list of conditions and the following disclaimer in the
32 documentation and/or other materials provided with the distribution.
33
34 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
35 \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
36 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
37 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
38 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
39 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
40 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
41 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
42 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
43 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
44 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.";
45
46 revision 2019-07-04 {
47 description "Initial revision";
48 }
49
50 /*
51 * Types.
52 */
53 typedef access-list-name {
54 description "Access list name formatting";
55 type string {
56 length 1..128;
57 }
58 }
59
60 typedef access-list-sequence {
61 description "Access list sequence number";
62 type uint32 {
63 range "1..4294967295";
64 }
65 }
66
67 typedef access-list-action {
68 description "Access list return action on match";
69 type enumeration {
70 enum deny {
71 description "Deny an entry";
72 value 0;
73 }
74 enum permit {
75 description "Accept an entry";
76 value 1;
77 }
78 }
79 }
80
81 /*
82 * Configuration data.
83 */
84 container lib {
85 list access-list {
86 description "Access list instance";
87
88 key "type name";
89
90 leaf type {
91 description "Access list content type";
92 type enumeration {
93 enum ipv4 {
94 description "Internet Protocol address version 4";
95 value 0;
96 }
97 enum ipv6 {
98 description "Internet Protocol address version 6";
99 value 1;
100 }
101 enum mac {
102 description "Media Access Control address";
103 value 2;
104 }
105 }
106 }
107
108 leaf name {
109 description "Access list name";
110 type access-list-name;
111 }
112
113 leaf remark {
114 description "Access list remark";
115 type string;
116 }
117
118 list entry {
119 description "Access list entry";
120
121 key "sequence";
122
123 leaf sequence {
124 description "Access list sequence value";
125 type access-list-sequence;
126 }
127
128 leaf action {
129 description "Access list action on match";
130 type access-list-action;
131 mandatory true;
132 }
133
134 choice value {
135 description "Access list value to match";
136 mandatory true;
137
138 case ipv4-prefix {
139 when "../type = 'ipv4'";
140
141 choice style {
142 description "Access list entry style selection: zebra or cisco.";
143 mandatory true;
144
145 case zebra {
146 leaf ipv4-prefix {
147 description "Configure IPv4 prefix to match";
148 type inet:ipv4-prefix;
149 mandatory true;
150 }
151
152 leaf ipv4-exact-match {
153 description "Exact match of prefix";
154 type boolean;
155 default false;
156 }
157 }
158 case cisco {
159 choice standard-value {
160 description "Source value to match";
161
162 leaf host {
163 description "Host to match";
164 type inet:ipv4-address;
165 }
166 container network {
167 leaf address {
168 mandatory true;
169 description "Network address part.";
170 type inet:ipv4-address;
171 }
172 leaf mask {
173 mandatory true;
174 description "Network mask/wildcard part.";
175 type inet:ipv4-address;
176 }
177 }
178 leaf source-any {
179 /*
180 * Was `any`, however it conflicts with `any` leaf
181 * outside this choice.
182 */
183 description "Match any";
184 type empty;
185 }
186 }
187
188 choice extended-value {
189 description "Destination value to match";
190
191 leaf destination-host {
192 description "Host to match";
193 type inet:ipv4-address;
194 }
195 container destination-network {
196 leaf address {
197 mandatory true;
198 description "Network address part.";
199 type inet:ipv4-address;
200 }
201 leaf mask {
202 mandatory true;
203 description "Network mask/wildcard part.";
204 type inet:ipv4-address;
205 }
206 }
207 leaf destination-any {
208 description "Match any";
209 type empty;
210 }
211 }
212 }
213 }
214 }
215 case ipv6-prefix {
216 when "../type = 'ipv6'";
217
218 leaf ipv6-prefix {
219 description "Configure IPv6 prefix to match";
220 type inet:ipv6-prefix;
221 mandatory true;
222 }
223
224 leaf ipv6-exact-match {
225 description "Exact match of prefix";
226 type boolean;
227 default false;
228 }
229 }
230 case mac {
231 when "../type = 'mac'";
232
233 leaf mac {
234 description "Configure MAC address to match";
235 type yang:mac-address;
236 }
237 }
238 case any {
239 leaf any {
240 description "Match anything";
241 type empty;
242 }
243 }
244 }
245 }
246 }
247
248 list prefix-list {
249 description "Prefix list instance";
250
251 key "type name";
252
253 leaf type {
254 description "Prefix list type";
255 type enumeration {
256 enum ipv4 {
257 description "Internet Protocol address version 4";
258 value 0;
259 }
260 enum ipv6 {
261 description "Internet Protocol address version 6";
262 value 1;
263 }
264 }
265 }
266
267 leaf name {
268 description "Prefix list name";
269 type access-list-name;
270 }
271
272 leaf remark {
273 description "Prefix list user description";
274 type string;
275 }
276
277 list entry {
278 description "Prefix list entry";
279
280 key "sequence";
281
282 leaf sequence {
283 description "Prefix list sequence value";
284 type access-list-sequence;
285 }
286
287 leaf action {
288 description "Prefix list action on match";
289 type access-list-action;
290 mandatory true;
291 }
292
293 choice value {
294 description "Prefix list value to match";
295 mandatory true;
296
297 case ipv4-prefix {
298 leaf ipv4-prefix {
299 description "Configure IPv4 prefix to match";
300 type inet:ipv4-prefix;
301 mandatory true;
302 }
303
304 leaf ipv4-prefix-length-greater-or-equal {
305 description
306 "Specifies if matching prefixes with length greater than
307 or equal to value";
308 type uint8 {
309 range "0..32";
310 }
311 }
312
313 leaf ipv4-prefix-length-lesser-or-equal {
314 description
315 "Specifies if matching prefixes with length lesser than
316 or equal to value";
317 type uint8 {
318 range "0..32";
319 }
320 }
321 }
322 case ipv6-prefix {
323 leaf ipv6-prefix {
324 description "Configure IPv6 prefix to match";
325 type inet:ipv6-prefix;
326 mandatory true;
327 }
328
329 leaf ipv6-prefix-length-greater-or-equal {
330 description
331 "Specifies if matching prefixes with length greater than
332 or equal to value";
333 type uint8 {
334 range "0..128";
335 }
336 }
337
338 leaf ipv6-prefix-length-lesser-or-equal {
339 description
340 "Specifies if matching prefixes with length lesser than
341 or equal to value";
342 type uint8 {
343 range "0..128";
344 }
345 }
346 }
347 case any {
348 leaf any {
349 description "Match anything";
350 type empty;
351 }
352 }
353 }
354 }
355 }
356 }
357 }