]>
Commit | Line | Data |
---|---|---|
b702f424 SP |
1 | module frr-bgp-filter { |
2 | yang-version 1.1; | |
3 | namespace "http://frrouting.org/yang/bgp-filter"; | |
4 | prefix frr-bgp-filter; | |
5 | ||
6 | import frr-filter { | |
7 | prefix frr-filter; | |
8 | } | |
9 | ||
10 | import ietf-routing-types { | |
11 | prefix rt-types; | |
12 | } | |
13 | ||
14 | organization | |
15 | "Free Range Routing"; | |
16 | contact | |
17 | "FRR Users List: <mailto:frog@lists.frrouting.org> | |
18 | FRR Development List: <mailto:dev@lists.frrouting.org>"; | |
19 | description | |
20 | "This module defines filter settings"; | |
21 | ||
22 | revision 2020-01-15 { | |
23 | description | |
24 | "Initial revision"; | |
25 | } | |
26 | ||
27 | typedef list-sequence { | |
28 | type uint32 { | |
29 | range "1..4294967295"; | |
30 | } | |
31 | description | |
32 | "List instance priority (low number means higher priority)"; | |
33 | } | |
34 | ||
35 | typedef list-action { | |
36 | type enumeration { | |
37 | enum "deny" { | |
38 | value 0; | |
39 | description | |
40 | "Deny an entry"; | |
41 | } | |
42 | enum "permit" { | |
43 | value 1; | |
44 | description | |
45 | "Accept an entry"; | |
46 | } | |
47 | } | |
48 | description | |
49 | "Return action on match"; | |
50 | } | |
51 | ||
52 | typedef bgp-list-name { | |
53 | type string; | |
54 | description | |
55 | "List name"; | |
56 | } | |
57 | ||
58 | typedef community-string { | |
59 | type string { | |
60 | pattern "(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{0,3}|0)|((6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{0,3}|0):(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|(local-AS)|(no-advertise)|(no-export)|(internet)"; | |
61 | } | |
62 | description | |
63 | "The BGP community string"; | |
64 | } | |
65 | ||
66 | typedef large-community-string { | |
67 | type string { | |
68 | pattern "(429496729[0-5]|42949672[0-8][0-9]|4294967[01][0-9]{2}|429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|4294[0-8][0-9]{5}|429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|[1-3][0-9]{9}|[1-9][0-9]{0,8}|0)|(429496729[0-5]|42949672[0-8][0-9]|4294967[01][0-9]{2}|429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|4294[0-8][0-9]{5}|429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|[1-3][0-9]{9}|[1-9][0-9]{0,8}|0):(429496729[0-5]|42949672[0-8][0-9]|4294967[01][0-9]{2}|429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|4294[0-8][0-9]{5}|429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|[1-3][0-9]{9}|[1-9][0-9]{0,8}|0)|(429496729[0-5]|42949672[0-8][0-9]|4294967[01][0-9]{2}|429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|4294[0-8][0-9]{5}|429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|[1-3][0-9]{9}|[1-9][0-9]{0,8}|0):(429496729[0-5]|42949672[0-8][0-9]|4294967[01][0-9]{2}|429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|4294[0-8][0-9]{5}|429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|[1-3][0-9]{9}|[1-9][0-9]{0,8}|0):(429496729[0-5]|42949672[0-8][0-9]|4294967[01][0-9]{2}|429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|4294[0-8][0-9]{5}|429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|[1-3][0-9]{9}|[1-9][0-9]{0,8}|0)"; | |
69 | } | |
70 | description | |
71 | "The BGP large-community string"; | |
72 | } | |
73 | ||
74 | augment "/frr-filter:lib" { | |
75 | list community-list { | |
76 | key "name"; | |
77 | description | |
78 | "Community-list instance"; | |
79 | leaf name { | |
80 | type string; | |
81 | } | |
82 | ||
83 | list entry { | |
84 | key "sequence"; | |
85 | description | |
86 | "Community-list entry"; | |
87 | leaf sequence { | |
88 | type list-sequence; | |
89 | } | |
90 | ||
91 | leaf action { | |
92 | type list-action; | |
93 | } | |
94 | ||
95 | leaf type { | |
96 | type enumeration { | |
97 | enum "community-list-standard" { | |
98 | value 0; | |
99 | description | |
100 | "Standard community-list name/identifier"; | |
101 | } | |
102 | enum "community-list-extended" { | |
103 | value 1; | |
104 | description | |
105 | "Expanded community-list name/identifier"; | |
106 | } | |
107 | } | |
108 | mandatory true; | |
109 | description | |
110 | "Community-list instance name/identifier"; | |
111 | } | |
112 | ||
113 | choice community-string { | |
114 | description | |
115 | "Community string"; | |
116 | case standard { | |
117 | when "./type = 'community-list-standard'"; | |
118 | leaf-list standard-community-string { | |
119 | type community-string; | |
120 | description | |
121 | "Community string"; | |
122 | } | |
123 | } | |
124 | ||
125 | case expanded { | |
126 | when "./type = 'community-list-extended'"; | |
127 | leaf expanded-community-string { | |
128 | type string; | |
129 | description | |
130 | "Community string reg-ex"; | |
131 | } | |
132 | } | |
133 | } | |
134 | } | |
135 | } | |
136 | ||
137 | list large-community-list { | |
138 | key "name"; | |
139 | description | |
140 | "Large community-list instance"; | |
141 | leaf name { | |
142 | type string; | |
143 | } | |
144 | ||
145 | list entry { | |
146 | key "sequence"; | |
147 | description | |
148 | "Large community-list entry"; | |
149 | leaf sequence { | |
150 | type list-sequence; | |
151 | } | |
152 | ||
153 | leaf action { | |
154 | type list-action; | |
155 | } | |
156 | ||
157 | leaf type { | |
158 | type enumeration { | |
159 | enum "large-community-list-standard-id" { | |
160 | value 0; | |
161 | description | |
162 | "Standard large-community-list identifier"; | |
163 | } | |
164 | enum "large-community-list-extended-id" { | |
165 | value 1; | |
166 | description | |
167 | "Expanded large-community-list identifier"; | |
168 | } | |
169 | enum "large-community-list-standard-name" { | |
170 | value 2; | |
171 | description | |
172 | "Standard large-community-list name"; | |
173 | } | |
174 | enum "large-community-list-extended-name" { | |
175 | value 3; | |
176 | description | |
177 | "Expanded large-community-list name"; | |
178 | } | |
179 | } | |
180 | mandatory true; | |
181 | description | |
182 | "Large community-list instance name/identifier"; | |
183 | } | |
184 | ||
185 | choice large-community-string { | |
186 | description | |
187 | "Large community string"; | |
188 | case standard { | |
189 | when "./type = 'large-community-list-standard-id' or " | |
190 | + "./type = 'large-community-list-standard-name'"; | |
191 | leaf-list standard-large-community-string { | |
192 | type large-community-string; | |
193 | description | |
194 | "Large community string"; | |
195 | } | |
196 | } | |
197 | ||
198 | case expanded { | |
199 | when "./type = 'large-community-list-extended-id' or " | |
200 | + "./type = 'large-community-list-extended-name'"; | |
201 | leaf expanded-large-community-string { | |
202 | type string; | |
203 | description | |
204 | "Large community string reg-ex"; | |
205 | } | |
206 | } | |
207 | } | |
208 | } | |
209 | } | |
210 | ||
211 | list extcommunity-list { | |
212 | key "name"; | |
213 | description | |
214 | "Extcommunity-list instance"; | |
215 | leaf name { | |
216 | type string; | |
217 | } | |
218 | ||
219 | list entry { | |
220 | key "sequence"; | |
221 | description | |
222 | "Extcommunity-list entry"; | |
223 | leaf sequence { | |
224 | type list-sequence; | |
225 | } | |
226 | ||
227 | leaf action { | |
228 | type list-action; | |
229 | } | |
230 | ||
231 | leaf type { | |
232 | type enumeration { | |
233 | enum "extcommunity-list-standard-id" { | |
234 | value 0; | |
235 | description | |
236 | "Standard extcommunity-list identifier"; | |
237 | } | |
238 | enum "extcommunity-list-extended-id" { | |
239 | value 1; | |
240 | description | |
241 | "Expanded extcommunity-list identifier"; | |
242 | } | |
243 | enum "extcommunity-list-standard-name" { | |
244 | value 2; | |
245 | description | |
246 | "Standard extcommunity-list name"; | |
247 | } | |
248 | enum "extcommunity-list-extended-name" { | |
249 | value 3; | |
250 | description | |
251 | "Expanded extcommunity-list name"; | |
252 | } | |
253 | } | |
254 | mandatory true; | |
255 | description | |
256 | "Extcommunity-list instance name/identifier"; | |
257 | } | |
258 | ||
259 | choice extcommunity-string { | |
260 | description | |
261 | "Extcommunity string"; | |
262 | case standard { | |
263 | when "./type = 'extcommunity-list-standard-id' or " | |
264 | + "./type = 'extcommunity-list-standard-name'"; | |
265 | choice standard-extcommunity-string { | |
266 | description | |
267 | "Value of the ext-community"; | |
268 | case extcommunity-rt { | |
269 | description | |
270 | "Set BGP ext-community route-target attribute"; | |
271 | leaf-list extcommunity-rt { | |
272 | type rt-types:route-target; | |
273 | } | |
274 | } | |
275 | ||
276 | case extcommunity-soo { | |
277 | description | |
278 | "Set BGP ext-community site-of-origin attribute"; | |
279 | leaf-list extcommunity-soo { | |
280 | type rt-types:route-target; | |
281 | } | |
282 | } | |
283 | } | |
284 | } | |
285 | ||
286 | case expanded { | |
287 | when "./type = 'extcommunity-list-extended-id' or " | |
288 | + "./type = 'extcommunity-list-extended-name'"; | |
289 | leaf expanded-extcommunity-string { | |
290 | type string; | |
291 | description | |
292 | "Extcommunity string reg-ex"; | |
293 | } | |
294 | } | |
295 | } | |
296 | } | |
297 | } | |
298 | ||
299 | list as-path-list { | |
300 | key "name"; | |
301 | description | |
302 | "AS-path access-list instance"; | |
303 | leaf name { | |
304 | type string; | |
305 | description | |
306 | "AS-path access-list instance name/identifier"; | |
307 | } | |
308 | ||
309 | list entry { | |
310 | key "sequence"; | |
311 | description | |
312 | "AS-path access-list entry"; | |
313 | leaf sequence { | |
314 | type list-sequence; | |
315 | } | |
316 | ||
317 | leaf action { | |
318 | type list-action; | |
319 | } | |
320 | ||
321 | leaf as-path { | |
322 | type string; | |
323 | description | |
324 | "AS-path access-list string reg-ex"; | |
325 | } | |
326 | } | |
327 | } | |
328 | } | |
329 | } |