]> git.proxmox.com Git - mirror_frr.git/blob - yang/frr-filter.yang
Merge pull request #6926 from kuldeepkash/dynamic_route_leak
[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 leaf host {
158 description "Host to match";
159 type inet:ipv4-address;
160 }
161 leaf network {
162 description "Network to match";
163 type inet:ipv4-prefix;
164 }
165 leaf source-any {
166 /*
167 * Was `any`, however it conflicts with `any` leaf
168 * outside this choice.
169 */
170 description "Match any";
171 type empty;
172 }
173
174 choice extended-value {
175 description "Destination value to match";
176
177 leaf destination-host {
178 description "Host to match";
179 type inet:ipv4-address;
180 }
181 leaf destination-network {
182 description "Network to match";
183 type inet:ipv4-prefix;
184 }
185 leaf destination-any {
186 description "Match any";
187 type empty;
188 }
189 }
190 }
191 }
192 }
193 case ipv6-prefix {
194 when "../type = 'ipv6'";
195
196 leaf ipv6-prefix {
197 description "Configure IPv6 prefix to match";
198 type inet:ipv6-prefix;
199 }
200
201 leaf ipv6-exact-match {
202 description "Exact match of prefix";
203 type boolean;
204 default false;
205 }
206 }
207 case mac {
208 when "../type = 'mac'";
209
210 leaf mac {
211 description "Configure MAC address to match";
212 type yang:mac-address;
213 }
214 }
215 case any {
216 leaf any {
217 description "Match anything";
218 type empty;
219 }
220 }
221 }
222 }
223 }
224
225 list prefix-list {
226 description "Prefix list instance";
227
228 key "type name";
229
230 leaf type {
231 description "Prefix list type";
232 type enumeration {
233 enum ipv4 {
234 description "Internet Protocol address version 4";
235 value 0;
236 }
237 enum ipv6 {
238 description "Internet Protocol address version 6";
239 value 1;
240 }
241 }
242 }
243
244 leaf name {
245 description "Prefix list name";
246 type access-list-name;
247 }
248
249 leaf remark {
250 description "Prefix list user description";
251 type string;
252 }
253
254 list entry {
255 description "Prefix list entry";
256
257 key "sequence";
258
259 leaf sequence {
260 description "Access list sequence value";
261 type access-list-sequence;
262 }
263
264 leaf action {
265 description "Prefix list action on match";
266 type access-list-action;
267 mandatory true;
268 }
269
270 choice value {
271 description "Prefix list value to match";
272 mandatory true;
273
274 case ipv4-prefix {
275 when "../type = 'ipv4'";
276
277 leaf ipv4-prefix {
278 description "Configure IPv4 prefix to match";
279 type inet:ipv4-prefix;
280 }
281
282 leaf ipv4-prefix-length-greater-or-equal {
283 description
284 "Specifies if matching prefixes with length greater than
285 or equal to value";
286 type uint8 {
287 range "0..32";
288 }
289 }
290
291 leaf ipv4-prefix-length-lesser-or-equal {
292 description
293 "Specifies if matching prefixes with length lesser than
294 or equal to value";
295 type uint8 {
296 range "0..32";
297 }
298 }
299 }
300 case ipv6-prefix {
301 when "../type = 'ipv6'";
302
303 leaf ipv6-prefix {
304 description "Configure IPv6 prefix to match";
305 type inet:ipv6-prefix;
306 }
307
308 leaf ipv6-prefix-length-greater-or-equal {
309 description
310 "Specifies if matching prefixes with length greater than
311 or equal to value";
312 type uint8 {
313 range "0..128";
314 }
315 }
316
317 leaf ipv6-prefix-length-lesser-or-equal {
318 description
319 "Specifies if matching prefixes with length lesser than
320 or equal to value";
321 type uint8 {
322 range "0..128";
323 }
324 }
325 }
326 case any {
327 leaf any {
328 description "Match anything";
329 type empty;
330 }
331 }
332 }
333 }
334 }
335 }
336 }