summaryrefslogtreecommitdiffstats
path: root/yang/frr-bgp-filter.yang
blob: 199e70997f4148e4325b30e2c7c7f29e9f1faf24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
module frr-bgp-filter {
  yang-version 1.1;
  namespace "http://frrouting.org/yang/bgp-filter";
  prefix frr-bgp-filter;

  import frr-filter {
    prefix frr-filter;
  }

  import ietf-routing-types {
    prefix rt-types;
  }

  organization
    "Free Range Routing";
  contact
    "FRR Users List:       <mailto:frog@lists.frrouting.org>
     FRR Development List: <mailto:dev@lists.frrouting.org>";
  description
    "This module defines filter settings";

  revision 2020-01-15 {
    description
      "Initial revision";
  }

  typedef list-sequence {
    type uint32 {
      range "1..4294967295";
    }
    description
      "List instance priority (low number means higher priority)";
  }

  typedef list-action {
    type enumeration {
      enum "deny" {
        value 0;
        description
          "Deny an entry";
      }
      enum "permit" {
        value 1;
        description
          "Accept an entry";
      }
    }
    description
      "Return action on match";
  }

  typedef bgp-list-name {
    type string;
    description
      "List name";
  }

  typedef community-string {
    type string {
      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)";
    }
    description
      "The BGP community string";
  }

  typedef large-community-string {
    type string {
      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)";
    }
    description
      "The BGP large-community string";
  }

  augment "/frr-filter:lib" {
    list community-list {
      key "name";
      description
        "Community-list instance";
      leaf name {
        type string;
      }

      list entry {
        key "sequence";
        description
          "Community-list entry";
        leaf sequence {
          type list-sequence;
        }

        leaf action {
          type list-action;
        }

        leaf type {
          type enumeration {
            enum "community-list-standard" {
              value 0;
              description
                "Standard community-list name/identifier";
            }
            enum "community-list-extended" {
              value 1;
              description
                "Expanded community-list name/identifier";
            }
          }
          mandatory true;
          description
            "Community-list instance name/identifier";
        }

        choice community-string {
          description
            "Community string";
          case standard {
            when "./type = 'community-list-standard'";
            leaf-list standard-community-string {
              type community-string;
              description
                "Community string";
            }
          }

          case expanded {
            when "./type = 'community-list-extended'";
            leaf expanded-community-string {
              type string;
              description
                "Community string reg-ex";
            }
          }
        }
      }
    }

    list large-community-list {
      key "name";
      description
        "Large community-list instance";
      leaf name {
        type string;
      }

      list entry {
        key "sequence";
        description
          "Large community-list entry";
        leaf sequence {
          type list-sequence;
        }

        leaf action {
          type list-action;
        }

        leaf type {
          type enumeration {
            enum "large-community-list-standard-id" {
              value 0;
              description
                "Standard large-community-list identifier";
            }
            enum "large-community-list-extended-id" {
              value 1;
              description
                "Expanded large-community-list identifier";
            }
            enum "large-community-list-standard-name" {
              value 2;
              description
                "Standard large-community-list name";
            }
            enum "large-community-list-extended-name" {
              value 3;
              description
                "Expanded large-community-list name";
            }
          }
          mandatory true;
          description
            "Large community-list instance name/identifier";
        }

        choice large-community-string {
          description
            "Large community string";
          case standard {
            when "./type = 'large-community-list-standard-id' or "
               + "./type = 'large-community-list-standard-name'";
            leaf-list standard-large-community-string {
              type large-community-string;
              description
                "Large community string";
            }
          }

          case expanded {
            when "./type = 'large-community-list-extended-id' or "
               + "./type = 'large-community-list-extended-name'";
            leaf expanded-large-community-string {
              type string;
              description
                "Large community string reg-ex";
            }
          }
        }
      }
    }

    list extcommunity-list {
      key "name";
      description
        "Extcommunity-list instance";
      leaf name {
        type string;
      }

      list entry {
        key "sequence";
        description
          "Extcommunity-list entry";
        leaf sequence {
          type list-sequence;
        }

        leaf action {
          type list-action;
        }

        leaf type {
          type enumeration {
            enum "extcommunity-list-standard-id" {
              value 0;
              description
                "Standard extcommunity-list identifier";
            }
            enum "extcommunity-list-extended-id" {
              value 1;
              description
                "Expanded extcommunity-list identifier";
            }
            enum "extcommunity-list-standard-name" {
              value 2;
              description
                "Standard extcommunity-list name";
            }
            enum "extcommunity-list-extended-name" {
              value 3;
              description
                "Expanded extcommunity-list name";
            }
          }
          mandatory true;
          description
            "Extcommunity-list instance name/identifier";
        }

        choice extcommunity-string {
          description
            "Extcommunity string";
          case standard {
            when "./type = 'extcommunity-list-standard-id' or "
               + "./type = 'extcommunity-list-standard-name'";
            choice standard-extcommunity-string {
              description
                "Value of the ext-community";
              case extcommunity-rt {
                description
                  "Set BGP ext-community route-target attribute";
                leaf-list extcommunity-rt {
                  type rt-types:route-target;
                }
              }

              case extcommunity-soo {
                description
                  "Set BGP ext-community site-of-origin attribute";
                leaf-list extcommunity-soo {
                  type rt-types:route-target;
                }
              }
            }
          }

          case expanded {
            when "./type = 'extcommunity-list-extended-id' or "
               + "./type = 'extcommunity-list-extended-name'";
            leaf expanded-extcommunity-string {
              type string;
              description
                "Extcommunity string reg-ex";
            }
          }
        }
      }
    }

    list as-path-list {
      key "name";
      description
        "AS-path access-list instance";
      leaf name {
        type string;
        description
          "AS-path access-list instance name/identifier";
      }

      list entry {
        key "sequence";
        description
          "AS-path access-list entry";
        leaf sequence {
          type list-sequence;
        }

        leaf action {
          type list-action;
        }

        leaf as-path {
          type string;
          description
            "AS-path access-list string reg-ex";
        }
      }
    }
  }
}