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