summaryrefslogtreecommitdiffhomepage
path: root/tools/yang/bgp.yang
blob: c6257b5eedd93a2a1a10716fc384b6f426b0788e (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
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
 module bgp {

     yang-version "1";

     // namespace
     // TODO: change to an ietf or other more generic namespace
     namespace "http://google.com/yang/google-bgp-protocol-cfg";

     prefix "bgp";

     // import some basic inet types
     import ietf-inet-types { prefix inet; }
     import bgp-multiprotocol { prefix bgp-mp; }
     import bgp-policy { prefix bgp-pol; }
     import bgp-operational { prefix bgp-op; }

     // meta
     organization
       "Google, AT&T, BT, Microsoft";

     contact
       "Google, Inc.
       1600 Amphitheatre Way
       Mountain View, CA  94043

       AT&T Labs
       200 S. Laurel Avenue
       Middletown, NJ  07748

       BT
       pp. C3L, BT Centre
       81, Newgate Street
       London  EC1A 7AJ
       UK

       Microsoft
       205 108th Ave. NE, Suite 400
       Bellevue, WA 98004";

     description
       "This module describes a YANG model for BGP protocol
       configuration.It is a limited subset of all of the configuration
       parameters available in the variety of vendor implementations,
       hence it is expected that it would be augmented with vendor-
       specific configuration data as needed.Additional modules or
       submodules to handle other aspects of BGP configuration,
       including policy, VRFs, VPNs, and additional address families
       are also expected.

       This model supports the following BGP configuration level
       hierarchy:

         BGP
           |
           +-> [ global BGP configuration ]
           +-> AFI / SAFI (address family)
             +-> [AFI-specific config ]
           +-> peer group
             +-> [ peer group config ]
             +-> AFI / SAFI [ per-AFI overrides ]
             +-> neighbor
               +-> [ per-neighbor overrides ]
               +-> AFI / SAFI [ per-AFI overrides ]
           +-> neighbor
             +-> [ neighbor config ]
             +-> AFI / SAFI [ per-AFI overrides ]";

     revision "2014-09-30" {
         description
           "Initial revision";
         reference "TBD";
     }

     typedef peer-type {
       type enumeration {
         enum INTERNAL {
           description "internal (iBGP) peer";
         }
         enum EXTERNAL {
           description "external (eBGP) peer";
         }
       }
       description
         "labels a peer or peer group as explicitly internal or
         external";
     }

     typedef remove-private-as-option {
       type enumeration {
         enum ALL {
           description "remove all private ASes in the path";
         }
         enum REPLACE {
           description "replace private ASes with local AS";
         }
       }
       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";
     }

     grouping bgp-common-configuration {
       description "Common configuration available at all hierarchy
       levels, global, AFI, groups, neighbors, etc.";

       leaf description {
         type string;
         description
           "An optional textual description (intended primarily for use
           with a peer or group";
       }

       container route-selection-options {
           // TODO: consider moving this container to AFI/SAFI level
           // config
           description
             "Set of configuration options that govern best
             path selection.";
           leaf always-compare-med {
             type boolean;
             default "false";
             description
               "Compare multi-exit discriminator (MED) value from
               different ASes when selecting the best route.  The
               default behavior is to only compare MEDs for paths
               received from the same AS.";
           }

           leaf ignore-as-path-length {
             type boolean;
             default "false";
             description
               "Ignore the AS path length when selecting the best path.
               The default is to use the AS path length and prefer paths
               with shorter length.";
           }

           leaf external-compare-router-id {
             type boolean;
             default "true";
             description
               "When comparing similar routes received from external
               BGP peers, use the router-id as a criterion to select
               the active path.";
           }

           leaf advertise-inactive-routes {
             type boolean;
             default "false";
             description
               "Advertise inactive routes to external peers.  The
               default is to only advertise active routes.";
           }

           leaf enable-aigp {
             type empty;
             description
               "Flag to enable sending / receiving accumulated IGP
               attribute in routing updates";
           }
       }

       container use-multiple-paths {

         presence
           "Presence of this container indicates that multipath
            is enabled for both eBGP and iBGP, absence indicates
            that multi-path is not used";

         description
           "Configuration of BGP multi-path for iBGP and eBGP";

         container ebgp {
           description
             "Configuration of BGP multipath to enable load sharing
             across multiple paths to eBGP peers";

           leaf allow-multiple-as {
            type boolean;
            default "false";
            description
             "Allow multipath to use paths from different neighbouring
             ASes.  The default is to only consider multiple paths from
             the same neighbouring AS.";
           }

           leaf maximum-paths {
            type uint32;
            default 1;
            description
             "Maximum number of parallel paths to consider when using
             BGP multipath. The default is use a single path.";
           }
         }

         container ibgp {
           description
             "Configuration of BGP multipath to enable load-sharing
             across multiple paths to iBGP peers";

           leaf maximum-paths {
             type uint32;
             default 1;
             description
               "Maximum number of parallel paths to consider when using
               iBGP multipath. The default is to use a single path";
           }
         }

         container eibgp {
           description
             "Configuration of BGP multipath to enable load-sharing
             across multiple paths to external confederation sub-ASes";
           leaf maximum-paths {
             type uint32;
             default 1;
             description
               "Maximum number of parallel paths to consider when using
               eiBGP multipath. The default is to use a single path";
           }

         }
       }

       container graceful-restart {
         // TODO: most impls seem to require this at the global level
         // in order to specify at neighbor or other levels
         presence "Presence of this item indicates that BGP graceful
         restart is enabled.";

         description
           "Configures BGP graceful restart, which is a negotiated
           option that indicates that a BGP speaker is able to retain
           forwarding state when a BGP session restarts";

         reference "RFC 4724: Graceful Restart Mechanism for BGP";

         leaf restart-time {
           type uint16 {
             range 0..4096;
           }
           description
             "Estimated time in seconds for the BGP session to be
             re-established after a restart.  This is a 12-bit value
             advertised by the router to peers.  Per RFC 4724, the
             suggested default value is <= the hold-time value";
         }

         leaf stale-routes-time {
           type decimal64 {
             fraction-digits 2;
           }
           description
             "Sets an upper bound on the time in seconds that stale
             routes will be retained by the router after a session is
             restarted";
         }
       }

       uses bgp-pol:apply-policy-group;
     }

     grouping  bgp-global-configuration {
         description
           "Grouping for global level configuration items";

         leaf as {
           type inet:as-number;
           mandatory "true";
           description
             "Local autonomous system number of the router.  Uses
             the 32-bit as-number type from the model in RFC 6991";
         }
         leaf router-id {
           type inet:ipv4-address;
           description
             "Router id of the router, expressed as an
             32-bit value, IPv4 address.";
         }

         container default-route-distance {
           description
             "Administrative distance (or preference) assigned to
             routes received from different sources
             (external, internal, and local).";
           leaf external-route-distance {
             type uint8 {
               range "1..255";
             }
             description
               "Administrative distance for routes learned from external
               BGP (eBGP).";
           }
           leaf internal-route-distance {
             type uint8 {
               range "1..255";
             }
             description
               "Administrative distance for routes learned from internal
               BGP (iBGP).";
           }
         }

         container confederation {

           presence "Presence of this node indicates that the local AS
             is part of a confederation";
           description
             "Configuration for a BGP confederation consisting of a
             confed id and member sub-AS list";

           leaf identifier {
             type inet:as-number;
             description
               "Confederation identifier for the autonomous system";
           }

           leaf-list member-as {
             type inet:as-number;
             description
               "Remote autonomous systems that are to be treated
               as part of the local confederation.";
           }
         }

     }

     grouping bgp-group-common-configuration {
       description "Configuration items that are applied at the peer
       group level";

       // currently a placeholder in case we identify config that is
       // really only applicable at the group level
     }

     grouping bgp-group-neighbor-common-configuration {
       description "Configuration items that are applied at the peer
       or peer group levels";

       leaf auth-password {
         type string;
         description
           "Configures an MD5 authentication password for use with
           neighboring devices.";
       }

       leaf peer-type {
           type peer-type;
           description
             "Explicitly designate the peer or peer group as internal
             (iBGP) or external (eBGP).";
       }

       container timers {
         description "Configuration of various BGP timers";
         leaf connect-retry {
           type decimal64 {
             fraction-digits 2;
           }
           default 30;
           description
             "Time interval in seconds between attempts to establish a
             session with the peer.";
         }

         leaf hold-time {
           type decimal64 {
             fraction-digits 2;
           }
           default 90;
           description
             "Time interval in seconds that a BGP session will be
             considered active in the absence of keepalive or other
             messages from the peer.  The hold-time is typically
             set to 3x the keepalive-interval.";
           reference
             "RFC 4271 - A Border Gateway Protocol 4, Sec. 10";
         }

         leaf keepalive-interval {
           type decimal64 {
             fraction-digits 2;
           }
           default 30;
           description
             "Time interval in seconds between transmission of keepalive
             messages to the neighbor.  Typically set to 1/3 the
             hold-time.";
         }

         leaf minimum-advertisement-interval {
           type decimal64 {
             fraction-digits 2;
           }
           default 30;
           description
             "Mininum time interval in seconds between transmission
             of BGP updates to neighbors";
           reference
             "RFC 4271 - A Border Gateway Protocol 4, Sec 10";
         }

         leaf send-update-delay {
           type decimal64 {
             fraction-digits 2;
           }
           description
             "Time interval between routes changing in the routing
             table and corresponding updates sent to neighbors --
             serves to batch updates";
         }

       }

       container ebgp-multihop {
         description
           "Configure multihop BGP for peers that are not directly
           connected";

         leaf multihop-ttl {
           type uint8;
           default 1;
           description
             "Time-to-live for multihop BGP sessions.  The default
             value of 1 is for directly connected peers (i.e.,
             multihop disabled";

         }

       }

       container route-reflector {
         description
           "Configure the local router as a route-reflector
           server";

         leaf route-reflector-cluster-id {
           type rr-cluster-id-type;
           description
             "route-reflector cluster id to use when local router is
             configured as a route reflector.  Commonly set at the group
             level, but allows a different cluster
             id to be set for each neighbor.";
         }

         leaf route-reflector-client {
           type boolean;
           default "false";
           description
             "Configure the neighbor as a route reflector client.";
         }
       }

       leaf remove-private-as {
         // could also make this a container with a flag to enable
         // remove-private and separate option.  here, option implies
         // remove-private is enabled.
         type remove-private-as-option;
         description
           "Remove private AS numbers from updates sent to peers.";
       }

       container bgp-logging-options {
         description
           "Configure various tracing/logging options for BGP peers
           or groups.  Expected that additional vendor-specific log
           options would augment this container.";

         leaf log-neighbor-state-changes {
           type boolean;
           default "true";
           description
             "Configure logging of peer state changes.  Default is
             to enable logging of peer state changes.";
         }
       }

       container transport-options {
         description
           "Transport protocol options for BGP sessions";

           leaf tcp-mss {
             type uint16;
             description
               "Sets the max segment size for BGP TCP sessions.";
           }

           leaf mtu-discovery {
             type boolean;
             description
               "Turns path mtu discovery for BGP TCP sessions on (true)
               or off (false)";
           }

           leaf passive-mode {
             type boolean;
             description
               "Wait for peers to issue requests to open a BGP session,
               rather than initiating sessions from the local router.";
           }
       }

       leaf local-address {
         type inet:ip-address;
         description
           "Set the local IP (either IPv4 or IPv6) address to use for
           the session when sending BGP update messages.";
       }

       leaf route-flap-damping {
         type boolean;
         description
           "Enable route flap damping.";
       }
     }

     grouping bgp-neighbor-configuration {
       description
         "Neighbor-level configuration items";

       list neighbor {
         key "neighbor-address";
         description
           "List of BGP peers, uniquely identified by neighbor
           address.";
         leaf neighbor-address {
           type inet:ip-address;
           description
             "Address of the BGP peer, either IPv4 or IPv6.";
         }

         leaf peer-as {
           type inet:as-number;
           mandatory "true";
           description
             "AS number of the peer.";

         }
         uses bgp-common-configuration;
         uses bgp-mp:address-family-configuration;
         uses bgp-group-neighbor-common-configuration;
         uses bgp-op:bgp-op-neighbor-group;
       }
     }

     container bgp {
       description "Top-level configuration data for the BGP router";

       container global {
         description
           "Top-level bgp protocol options applied at the global level
           in the hierarchy -- these apply across peer-groups,
           neighbors, and address families";

         uses bgp-global-configuration;

         // attach global level operational data
         uses bgp-op:bgp-op-global-group;
       }

       // top level AF configuration
       uses bgp-mp:address-family-configuration;

       list peer-group {
         key "group-name";
         description
           "List of peer-groups, uniquely identified by the peer group
           name.";
         leaf group-name {
           type string;
           description "Name of the peer group.";
         }
         uses bgp-op:bgp-op-peergroup-group;
         uses bgp-common-configuration;
         uses bgp-mp:address-family-configuration;
         uses bgp-group-neighbor-common-configuration;

         // list of configurations for neighbors in this peer group
         uses bgp-neighbor-configuration;
       }

       // top level neighbor configuration
       uses bgp-neighbor-configuration;

       // hook for top-level policy definitions
       uses bgp-pol:policy-definition-group;
     }
   }