summaryrefslogtreecommitdiffstats
path: root/yang/ietf/ietf-bgp-types.yang
blob: 9c7a6af76c52c7b059c5cf8ea5c73bcc0291c35b (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
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
module ietf-bgp-types {
  yang-version "1.1";
  namespace "urn:ietf:params:xml:ns:yang:ietf-bgp-types";

  prefix "bt";

  import ietf-inet-types {
    prefix inet;
  }

  // meta
  organization
    "IETF IDR Working Group";

  contact
    "WG Web:   <http://tools.ietf.org/wg/idr>
     WG List:  <idr@ietf.org>

     Authors: Mahesh Jethanandani (mjethanandani at gmail.com),
              Keyur Patel (keyur at arrcus.com),
              Susan Hares (shares at ndzh.com),
              Jeffrey Haas (jhaas at pfrc.org).";
  description
    "This module contains general data definitions for use in BGP
     policy. It can be imported by modules that make use of BGP
     attributes";

  revision 2019-10-03 {
    description
      "Initial Version";
    reference
      "RFC XXX, BGP Model for Service Provider Network.";
  }

  identity bgp-capability {
    description "Base identity for a BGP capability";
  }

  identity mp-bgp {
    base bgp-capability;
    description
      "Multi-protocol extensions to BGP";
    reference
      "RFC 4760";
  }

  identity route-refresh {
    base bgp-capability;
    description
      "The BGP route-refresh functionality";
    reference
      "RFC2918";
  }

  identity asn32 {
    base bgp-capability;
    description
      "4-byte (32-bit) AS number functionality";
    reference
      "RFC6793";
  }

  identity graceful-restart {
    base bgp-capability;
    description
      "Graceful restart functionality";
    reference
      "RFC4724";
  }

  identity add-paths {
    base bgp-capability;
    description
      "BGP add-paths";
    reference
      "RFC 7911.";
  }

  identity afi-safi-type {
    description
      "Base identity type for AFI,SAFI tuples for BGP-4";
    reference
      "RFC4760 - multi-protocol extensions for BGP-4";
  }

  identity ipv4-unicast {
    base afi-safi-type;
    description
      "IPv4 unicast (AFI,SAFI = 1,1)";
    reference
      "RFC4760";
  }

  identity ipv6-unicast {
    base afi-safi-type;
    description
      "IPv6 unicast (AFI,SAFI = 2,1)";
    reference
      "RFC4760";
  }

  identity ipv4-labeled-unicast {
    base afi-safi-type;
    description
      "Labeled IPv4 unicast (AFI,SAFI = 1,4)";
    reference
      "RFC3107";
  }

  identity ipv6-labeled-unicast {
    base afi-safi-type;
    description
      "Labeled IPv6 unicast (AFI,SAFI = 2,4)";
    reference
      "RFC3107";
  }

  identity l3vpn-ipv4-unicast {
    base afi-safi-type;
    description
      "Unicast IPv4 MPLS L3VPN (AFI,SAFI = 1,128)";
    reference
      "RFC4364";
  }

  identity l3vpn-ipv6-unicast {
    base afi-safi-type;
    description
      "Unicast IPv6 MPLS L3VPN (AFI,SAFI = 2,128)";
    reference
      "RFC4659";
  }

  identity l3vpn-ipv4-multicast {
    base afi-safi-type;
    description
      "Multicast IPv4 MPLS L3VPN (AFI,SAFI = 1,129)";
    reference
      "RFC6514";
  }

  identity l3vpn-ipv6-multicast {
    base afi-safi-type;
    description
      "Multicast IPv6 MPLS L3VPN (AFI,SAFI = 2,129)";
    reference
      "RFC6514";
  }

  identity l2vpn-vpls {
    base afi-safi-type;
    description
      "BGP-signalled VPLS (AFI,SAFI = 25,65)";
    reference
      "RFC4761";
  }

  identity l2vpn-evpn {
    base afi-safi-type;
    description
      "BGP MPLS Based Ethernet VPN (AFI,SAFI = 25,70)";
  }

  identity bgp-well-known-std-community {
    description
      "Base identity for reserved communities within the standard
       community space defined by RFC1997. These communities must
       fall within the range 0xFFFF0000 to 0xFFFFFFFF";
    reference
      "RFC 1997: BGP Communities Attribute.";
  }

  identity no-export {
    base bgp-well-known-std-community;
    description
      "Do not export NLRI received carrying this community outside
       the bounds of this autonomous system, or this confederation if
       the local autonomous system is a confederation member AS. This
       community has a value of 0xFFFFFF01.";
    reference
      "RFC 1997: BGP Communities Attribute.";
  }

  identity no-advertise {
    base bgp-well-known-std-community;
    description
      "All NLRI received carrying this community must not be
       advertised to other BGP peers. This community has a value of
       0xFFFFFF02.";
    reference
      "RFC 1997: BGP Communities Attribute.";
  }

  identity no-export-subconfed {
    base bgp-well-known-std-community;
    description
      "All NLRI received carrying this community must not be
       advertised to external BGP peers - including over confederation
       sub-AS boundaries. This community has a value of 0xFFFFFF03.";
    reference
      "RFC 1997: BGP Communities Attribute.";
  }

  identity no-peer {
    base bgp-well-known-std-community;
    description
      "An autonomous system receiving NLRI tagged with this community
       is advised not to re-advertise the NLRI to external bi-lateral
       peer autonomous systems. An AS may also filter received NLRI
       from bilateral peer sessions when they are tagged with this
       community value";
    reference
      "RFC 3765: NOPEER Community for BGP.";
  }
  identity as-path-segment-type {
    description
      "Base AS Path Segment Type. In [BGP-4], the path segment type
       is a 1-octet field with the following values defined.";
    reference
      "RFC 4271: A Border Gateway Protocol 4 (BGP-4), Section 4.3.";
  }

  identity as-set {
    base as-path-segment-type;
    description
      "Unordered set of autonomous systems that a route in the UPDATE
       message has traversed.";
    reference
      "RFC 4271: A Border Gateway Protocol 4 (BGP-4), Section 4.3.";
  }

  identity as-sequence {
    base as-path-segment-type;
    description
      "Ordered set of autonomous systems that a route in the UPDATE
       message has traversed.";
    reference
      "RFC 4271: A Border Gateway Protocol 4 (BGP-4), Section 4.3.";
  }

  identity as-confed-sequence {
    base as-path-segment-type;
    description
      "Ordered set of Member Autonomous Systems in the local
       confederation that the UPDATE message has traversed.";
    reference
      "RFC 5065, Autonomous System Configuration for BGP.";
  }

  identity as-confed-set {
    base as-path-segment-type;
    description
      "Unordered set of Member Autonomous Systems in the local
       confederation that the UPDATE message has traversed.";
    reference
      "RFC 5065, Autonomous System Configuration for BGP.";
  }

  /*
   * Features.
   */
  feature send-communities {
    description
      "Enable the propogation of communities.";
  }

  feature ttl-security {
    description
      "BGP Time To Live (TTL) security check support.";
    reference
      "RFC 5082, The Generalized TTL Security Mechanism (GTSM)";
  }

  feature bfd {
    description
      "Support for BFD detection of BGP neighbor reachability.";
    reference
      "RFC 5880, Bidirectional Forward Detection (BFD),
       RFC 5881, Bidirectional Forward Detection for IPv4 and IPv6
                 (Single Hop).
       RFC 5883, Bidirectional Forwarding Detection (BFD) for Multihop
                 Paths";
  }

  typedef bgp-session-direction {
    type enumeration {
      enum INBOUND {
        description
          "Refers to all NLRI received from the BGP peer";
      }
      enum OUTBOUND {
        description
          "Refers to all NLRI advertised to the BGP peer";
      }
    }
    description
      "Type to describe the direction of NLRI transmission";
  }

  typedef bgp-well-known-community-type {
    type identityref {
      base bgp-well-known-std-community;
    }
    description
      "Type definition for well-known IETF community attribute
       values";
    reference
      "IANA Border Gateway Protocol (BGP) Well Known Communities";
  }

  typedef bgp-std-community-type {
    // TODO: further refine restrictions and allowed patterns
    // 4-octet value:
    //  <as number> 2 octets
    //  <community value> 2 octets
    type union {
      type uint32 {
      // per RFC 1997, 0x00000000 - 0x0000FFFF and 0xFFFF0000 -
      // 0xFFFFFFFF are reserved
        range "65536..4294901759"; // 0x00010000..0xFFFEFFFF
      }
      type string {
        pattern '([0-9]+:[0-9]+)';
      }
    }
    description
      "Type definition for standard community attributes";
    reference
      "RFC 1997 - BGP Communities Attribute";
  }

  typedef bgp-ext-community-type {
    // TODO: needs more work to make this more precise given the
    // variability of extended community attribute specifications
    // 8-octet value:
    //  <type> 2 octects
    //  <value> 6 octets

    type union {
      type string {
        // Type 1: 2-octet global and 4-octet local
        //         (AS number)        (Integer)
        pattern '(6[0-5][0-5][0-3][0-5]|[1-5][0-9]{4}|'            +
                '[1-9][0-9]{1,4}|[0-9]):'                          +
                '(4[0-2][0-9][0-4][0-9][0-6][0-7][0-2][0-9][0-6]|' +
                '[1-3][0-9]{9}|[1-9]([0-9]{1,7})?[0-9]|[1-9])';
      }
      type string {
        // Type 2: 4-octet global and 2-octet local
        //         (ipv4-address)     (integer)
        pattern '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|'      +
                '25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|'     +
                '2[0-4][0-9]|25[0-5]):'                            +
                '(6[0-5][0-5][0-3][0-5]|[1-5][0-9]{4}|'            +
                '[1-9][0-9]{1,4}|[0-9])';
      }
      type string {
        // route-target with Type 1
        // route-target:(ASN):(local-part)
        pattern 'route\-target:(6[0-5][0-5][0-3][0-5]|'            +
                '[1-5][0-9]{4}|[1-9][0-9]{1,4}|[0-9]):'            +
                '(4[0-2][0-9][0-4][0-9][0-6][0-7][0-2][0-9][0-6]|' +
                '[1-3][0-9]{9}|[1-9]([0-9]{1,7})?[0-9]|[1-9])';
      }
      type string {
        // route-target with Type 2
        // route-target:(IPv4):(local-part)
        pattern 'route\-target:' +
                '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|'      +
                '25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|'     +
                '2[0-4][0-9]|25[0-5]):'                            +
                '(6[0-5][0-5][0-3][0-5]|[1-5][0-9]{4}|'            +
                '[1-9][0-9]{1,4}|[0-9])';
      }
      type string {
        // route-origin with Type 1
        pattern 'route\-origin:(6[0-5][0-5][0-3][0-5]|'            +
                '[1-5][0-9]{4}|[1-9][0-9]{1,4}|[0-9]):'            +
                '(4[0-2][0-9][0-4][0-9][0-6][0-7][0-2][0-9][0-6]|' +
                '[1-3][0-9]{9}|[1-9]([0-9]{1,7})?[0-9]|[1-9])';
      }
      type string {
        // route-origin with Type 2
        pattern 'route\-origin:' +
                '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|'      +
                '25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|'     +
                '2[0-4][0-9]|25[0-5]):'                            +
                '(6[0-5][0-5][0-3][0-5]|[1-5][0-9]{4}|'            +
                '[1-9][0-9]{1,4}|[0-9])';
      }
    }
    description
      "Type definition for extended community attributes";
    reference
      "RFC 4360 - BGP Extended Communities Attribute";
  }

  typedef bgp-community-regexp-type {
    // TODO: needs more work to decide what format these regexps can
    // take.
    type string;
    description
      "Type definition for communities specified as regular
       expression patterns";
  }

  typedef bgp-origin-attr-type {
    type enumeration {
      enum igp {
        description "Origin of the NLRI is internal";
      }
      enum egp {
        description "Origin of the NLRI is EGP";
      }
      enum incomplete {
        description "Origin of the NLRI is neither IGP or EGP";
      }
    }
    description
      "Type definition for standard BGP origin attribute";
    reference
      "RFC 4271 - A Border Gateway Protocol 4 (BGP-4), Sec 4.3";
  }

  typedef peer-type {
    type enumeration {
      enum internal {
        description
          "internal (iBGP) peer";
      }
      enum external {
        description
          "external (eBGP) peer";
      }
      enum confederation {
        description
        "Confederation as peer";
      }
    }
    description
      "Labels a peer or peer group as explicitly internal,
       external or confederation.";
  }

  identity REMOVE_PRIVATE_AS_OPTION {
    description
      "Base identity for options for removing private autonomous
       system numbers from the AS_PATH attribute";
  }

  identity PRIVATE_AS_REMOVE_ALL {
    base REMOVE_PRIVATE_AS_OPTION;
    description
      "Strip all private autonomous system numbers from the AS_PATH.
       This action is performed regardless of the other content of the
       AS_PATH attribute, and for all instances of private AS numbers
       within that attribute.";
  }

  identity PRIVATE_AS_REPLACE_ALL {
    base REMOVE_PRIVATE_AS_OPTION;
    description
      "Replace all instances of private autonomous system numbers in
       the AS_PATH with the local BGP speaker's autonomous system
       number. This action is performed regardless of the other
       content of the AS_PATH attribute, and for all instances of
       private AS number within that attribute.";
  }

  typedef remove-private-as-option {
    type identityref {
      base REMOVE_PRIVATE_AS_OPTION;
    }
    description
      "Set of options for configuring how private AS path numbers
       are removed from advertisements";
  }

  typedef percentage {
    type uint8 {
      range "0..100";
    }
    description
      "Integer indicating a percentage value";
  }

  typedef rr-cluster-id-type {
    type union {
      type uint32;
      type inet:ipv4-address;
    }
    description
      "Union type for route reflector cluster ids:
       option 1: 4-byte number
       option 2: IP address";
  }

  typedef community-type {
    type bits {
      bit standard {
        position 0;
        description
          "Send only standard communities.";
        reference
          "RFC 1997: BGP Communities Attribute.";
      }
      bit extended {
        description
          "Send only extended communities.";
        reference
          "RFC 4360: BGP Extended Communities Attribute.";
      }
      bit large {
        description
          "Send only large communities.";
        reference
          "RFC 8092: BGP Large Communities Attribute.";
      }
    }
    description
      "Type describing variations of community attributes.
       The community types can be combined and a value of 0
       implies 'none'";
  }
}