summaryrefslogtreecommitdiffhomepage
path: root/tools/pyang_plugins/gobgp.yang
blob: 5b3702b5dc7fd78bd2a022d09296e6ffaa4400c5 (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
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
module gobgp {

  yang-version "1";

  // namespace
  namespace "https://github.com/osrg/gobgp";

  prefix "gobgp";

  // import some basic types
  import openconfig-bgp { prefix bgp; }
  import openconfig-bgp-types { prefix bgp-types; }
  import openconfig-bgp-multiprotocol { prefix bgp-mp; }
  import openconfig-routing-policy {prefix rpol; }
  import openconfig-policy-types {prefix ptypes; }
  import openconfig-bgp-policy {prefix bgp-pol; }
  import ietf-inet-types { prefix inet; }
  import ietf-yang-types { prefix yang; }

  // meta
  organization
    "GoBGP";

  contact
    "GoBGP http://osrg.github.io/gobgp/";

  description
    "This module contains definitions for GoBGP-specific configuration.
    It augments bgp modules with GoBGP-specific options.";

  revision "2015-08-10" {
    description
      "Updated model to augment base bgp modules";
    reference "TBD";
  }

  typedef bmp-route-monitoring-policy-type {
    type enumeration {
      enum PRE-POLICY {
        value 0;
        description "send pre-policy routes";
      }
      enum POST-POLICY {
        value 1;
        description "send post-policy routes";
      }
      enum BOTH {
        value 2;
        description "send both pre and post-policy routes";
      }
    }
  }

  identity eq {
      base ptypes:attribute-comparison;
  }

  identity ge {
      base ptypes:attribute-comparison;
  }

  identity le {
      base ptypes:attribute-comparison;
  }

  identity IPV4-MULTICAST {
    base bgp-types:afi-safi-type;
    description
      "IPv4 multicast (AFI,SAFI = 1,2)";
    reference "RFC4760";
  }

  identity IPV6-MULTICAST {
    base bgp-types:afi-safi-type;
    description
      "IPv4 multicast (AFI,SAFI = 1,2)";
    reference "RFC4760";
  }

  identity RTC {
    base bgp-types:afi-safi-type;
    description
      "Route target membership (AFI,SAFI = 1,132)";
    reference "RFC4684";
  }

  identity ENCAP {
    base bgp-types:afi-safi-type;
    description
      "Encapsulation (AFI,SAFI = 1,7)";
    reference "RFC5512";
  }

  identity IPV4-FLOWSPEC {
    base bgp-types:afi-safi-type;
    description
      "IPv4 flowspec (AFI,SAFI = 1,133)";
    reference "RFC5575";
  }

  identity L3VPN-IPV4-FLOWSPEC {
    base bgp-types:afi-safi-type;
    description
      "L3VPN IPv4 flowspec (AFI,SAFI = 1,134)";
    reference "RFC5575";
  }

  identity IPV6-FLOWSPEC {
    base bgp-types:afi-safi-type;
    description
      "IPv6 flowspec (AFI,SAFI = 1,133)";
    reference "RFC5575";
  }

  identity L3VPN-IPV6-FLOWSPEC {
    base bgp-types:afi-safi-type;
    description
      "L3VPN IPv6 flowspec (AFI,SAFI = 1,134)";
    reference "RFC5575";
  }

  identity L2VPN-FLOWSPEC {
    base bgp-types:afi-safi-type;
    description
      "L2VPN flowspec (AFI,SAFI = 25,134)";
    reference "draft-ietf-idr-flowspec-l2vpn-03";
  }

  identity OPAQUE {
    base bgp-types:afi-safi-type;
    description
      "Opaque (AFI,SAFI = 16397,241)";
    reference "https://tools.ietf.org/html/draft-lapukhov-bgp-opaque-signaling-01";
  }

  grouping gobgp-message-counter {
    description
      "Counters for all BGPMessage types";

    leaf OPEN {
      type uint64;
      description
        "Number of BGP open messages announcing, withdrawing
        or modifying paths exchanged.";
    }

    leaf REFRESH {
      type uint64;
      description
        "Number of BGP Route-Refresh messages indicating an
        error condition has occurred exchanged.";
    }

    leaf KEEPALIVE {
      type uint64;
      description
        "Number of BGP Keepalive messages indicating an
        error condition has occurred exchanged.";
    }

    leaf DYNAMIC-CAP {
      type uint64;
      description
        "Number of BGP dynamic-cap messages indicating an
        error condition has occurred exchanged.";
    }

    leaf DISCARDED {
      type uint64;
      description
        "Number of discarded messages indicating an
        error condition has occurred exchanged.";
    }

    leaf TOTAL {
      type uint64;
      description
        "Number of total messages indicating an
        error condition has occurred exchanged.";
    }
  }


  grouping gobgp-timer {
    description "additional timer";

    leaf idle-hold-time-after-reset {
      type decimal64 {
        fraction-digits 2;
      }
      default 30;
      description
        "Time interval in seconds that a BGP session will be
        in idle state after neighbor reset operation.";
    }
  }


  grouping gobgp-neighbor-timer {
    description "additional timer";

    leaf downtime {
      type yang:timeticks;
      description
        "This timer determines the amount of time since the
        BGP last transitioned out of the Established state";
    }

    leaf update-recv-time {
      type int64;
      description
        "The number of seconds elasped since January 1, 1970 UTC
        last time the BGP session received an UPDATE message";
    }
  }


  grouping gobgp-in-policy {
    description
      "additional policy";

    leaf-list in-policy {
      type leafref {
        path "/rpol:routing-policy/rpol:policy-definitions/" +
            "rpol:policy-definition/rpol:name";
        //require-instance true;
      }
      description
        "list of policy names in sequence to be applied on
        sending a routing update in the current context, e.g.,
        for the current other route server clients.";
    }

    leaf default-in-policy {
      type rpol:default-policy-type;
      default REJECT-ROUTE;
      description
        "explicitly set a default policy if no policy definition
        in the in-policy chain is satisfied.";
    }
  }

  grouping gobgp-route-server-config {
    description
      "Configuration parameter specifying whether
      the neighbor is route server client or not.";

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

  grouping gobgp-route-server-config-set {
     description
        "set of configurations for route server client.";

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

      container config {
      description
        "Configuration parameters relating to route server
        client(s) used for the BGP neighbor";
      uses gobgp-route-server-config;
      }
      container state {
      config false;
      description
        "State information relating to route server
        client(s) used for the BGP neighbor";
      uses gobgp-route-server-config;
      }
    }
  }

   typedef rpki-validation-result-type {
    type enumeration {
      enum NONE {
        description "RPKI disabled";
      }
      enum NOT-FOUND {
        description "If the origin AS, prefix, maximum prefix length
        does not exist in the range of ROA";
      }
      enum VALID {
        description "If the origin AS, prefix, maximum prefix length is
        exist in the range of ROA";
      }
      enum INVALID {
        description "if the origin AS is different when prefix,
        maximum prefix length is exist in the range of ROA";
      }
    }
    description
      "indicate the validation result of RPKI based on ROA";
  }

  grouping gobgp-rpki-validation-result {
    description "additional rpki";

    leaf rpki-validation-result {
      type rpki-validation-result-type;
      default NOT-FOUND;
      description
        "specify the validation result of RPKI based on ROA as conditions";
    }
  }

  grouping gobgp-rpki-server-messages-sent {
    description "additional RPKI sent messages";

    leaf serial-query {
      type int64;
      description
        "Number of serial query message sent to RPKI server";
    }
    leaf reset-query {
      type int64;
      description
        "Number of reset query message sent to RPKI server";
    }
    leaf error {
      type int64;
      description
        "Number of error message sent to RPKI server";
    }
  }

  grouping gobgp-rpki-server-messages-received {
    description "additional RPKI receive messages";

    leaf serial-notify {
      type int64;
      description
        "Number of serial notify message received from RPKI server";
    }
    leaf cache-reset {
      type int64;
      description
        "Number of cache reset message received from RPKI server";
    }
    leaf cache-response {
      type int64;
      description
        "Number of cache response message received from RPKI server";
    }
    leaf ipv4-prefix {
      type int64;
      description
        "Number of ipv4 prefix message received from RPKI server";
    }
    leaf ipv6-prefix {
      type int64;
      description
        "Number of ipv6 prefix message received from RPKI server";
    }
    leaf end-of-data {
      type int64;
      description
        "Number of end of data message received from RPKI server";
    }
    leaf error {
      type int64;
      description
        "Number of error message received from RPKI server";
    }
  }

  grouping gobgp-rpki-server-messages {
    description "additional RPKI messages";

    container rpki-sent {
      description
        "Counters for transmission RPKI Message types";
      uses gobgp-rpki-server-messages-sent;
    }
    container rpki-received {
      description
        "Counters for reception RPKI Message types";
      uses gobgp-rpki-server-messages-received;
    }
  }

  grouping gobgp-rpki-server-state {
    description "additional RPKI state";

    leaf uptime {
      type int64;
      description
        "This timer determines the amount of time since the
         RPKI last transitioned in of the Established state";
    }
    leaf downtime {
      type int64;
      description
        "This timer determines the amount of time since the
         RPKI last transitioned out of the Established state";
    }
    leaf last-pdu-recv-time {
      type int64;
      description
        "last time the received an pdu message from RPKI server";
    }
    container rpki-messages {
      description
        "Counters for transmission and reception RPKI Message types";
      uses gobgp-rpki-server-messages;
    }
  }

  grouping gobgp-rpki-server-config {
    description "additional RPKI config";

    leaf address {
      type inet:ip-address;
      description
        "Reference to the address of the RPKI server used as
         a key in the RPKI server list";
    }
    leaf port {
      type uint32;
      description
        "Reference to the port of the RPKI server";
    }
    leaf refresh-time {
      type int64;
      description
        "Check interval for a configured RPKI server.";
    }
    leaf hold-time {
      type int64;
      description
        "Specify the length of time in seconds that the session between
        the router and RPKI server is to be considered operational
        without any activity";
    }
    leaf record-lifetime {
      type int64;
      description
        "Indicate the expiration date of the route validation recode
        received from RPKI server";
    }
    leaf preference {
      type uint8;
      description
        "RPKI server has a static preference.
        Higher the preference values indicates a higher priority RPKI server";
    }
  }

  grouping gobgp-rpki-server-set {
    description "additional RPKI configuration and state";

    container config {
      description
        "Configuration parameters relating to RPKI server";
      uses gobgp-rpki-server-config;
    }
    container state {
      description
        "State information relating to RPKI server";
      uses gobgp-rpki-server-state;
    }
  }

  grouping gobgp-rpki-servers {
    description "additional RPKI structure";

    container rpki-servers {
      list rpki-server {
        key "address";
        description
          "List of RPKI servers configured on the local system";
        leaf address {
          type leafref {
            path "../config/address";
          }
        }
        uses gobgp-rpki-server-set;
      }
    }
  }

  grouping gobgp-bmp-server-config {
    description "additional BMP config";

    leaf address {
      type inet:ip-address;
      description
        "Reference to the address of the BMP server used as
         a key in the BMP server list";
    }
    leaf port {
      type uint32;
      description
        "Reference to the port of the BMP server";
    }
    leaf route-monitoring-policy {
      type bmp-route-monitoring-policy-type;
      default PRE-POLICY;
    }
  }

  grouping gobgp-bmp-server-state {
    description "additional BMP state";
  }

  grouping gobgp-bmp-server-set {
    description "additional BMP configuration and state";

    container config {
      description
        "Configuration parameters relating to BMP server";
      uses gobgp-bmp-server-config;
    }

    container state {
      description
        "Configuration parameters relating to BMP server";
      uses gobgp-bmp-server-state;
    }
  }

  grouping gobgp-bmp-servers {
    description "BGP Monitoring Protocol servers";

    container bmp-servers {
      list bmp-server {
        key "address";
        description
          "List of BMP servers configured on the local system";
        leaf address {
          type leafref {
            path "../config/address";
          }
        }
        uses gobgp-bmp-server-set;
      }
    }
  }

  // augment statements
  augment "/bgp:bgp/bgp:neighbors/bgp:neighbor/bgp:state/bgp:messages/bgp:sent" {
    description "additional counters";
    uses gobgp-message-counter;
  }

  augment "/bgp:bgp/bgp:neighbors/bgp:neighbor/bgp:state/bgp:messages/bgp:received" {
    description "additional counters";
    uses gobgp-message-counter;
  }

  augment "/bgp:bgp/bgp:neighbors/bgp:neighbor/bgp:state" {
    description "additional state elements";

    leaf admin-down {
      type boolean;
      description
        "The state of administrative operation. If the state is true, it indicates the neighbor is disabled by the administrator";
    }

    leaf established-count {
      type uint32;
      description
        "The number of how many the peer became established state";
    }

     leaf flops {
      type uint32;
      description
        "The number of flip-flops";
    }


  }

  augment "/bgp:bgp/bgp:neighbors/bgp:neighbor/bgp:config" {
    leaf neighbor-port-number {
      type inet:port-number;
    }
  }

  augment "/bgp:bgp/bgp:neighbors/bgp:neighbor/bgp:timers/bgp:config" {
    description "additional timer";
    uses gobgp-timer;
   }

  augment "/bgp:bgp/bgp:neighbors/bgp:neighbor/bgp:timers/bgp:state" {
    description "additional timers";
    uses gobgp-timer;
    uses gobgp-neighbor-timer;
   }

  augment "/bgp:bgp/bgp:neighbors/bgp:neighbor/bgp:afi-safis/bgp:afi-safi/bgp:graceful-restart/bgp:state" {
    description "additional graceful-restart status";
    leaf end-of-rib-received {
      type boolean;
    }
    leaf end-of-rib-sent {
      type boolean;
    }
  }

  augment "/bgp:bgp/bgp:neighbors/bgp:neighbor/bgp:graceful-restart/bgp:config" {
    description "additional graceful-restart status";
    leaf deferral-time {
      type uint16;
    }
  }

  augment "/bgp:bgp/bgp:neighbors/bgp:neighbor/bgp:graceful-restart/bgp:state" {
    description "additional graceful-restart status";
    leaf deferral-time {
      type uint16;
    }
  }

  augment "/bgp:bgp/bgp:peer-groups/bgp:peer-group" {
    description "route server configuration for peer-group";
    uses gobgp-route-server-config-set;
  }

  augment "/bgp:bgp/bgp:neighbors/bgp:neighbor" {
    description "route server configuration for neighbor";
    uses gobgp-route-server-config-set;
  }

  augment "/bgp:bgp/bgp:global/bgp:apply-policy/bgp:config" {
    description "addtional policy";
    uses gobgp-in-policy;

  }

  augment "/bgp:bgp/bgp:global/bgp:apply-policy/bgp:state" {
    description "additional policy";
    uses gobgp-in-policy;

  }

  augment "/rpol:routing-policy/rpol:policy-definitions/" +
    "rpol:policy-definition/rpol:statements/rpol:statement/" +
    "rpol:actions/bgp-pol:bgp-actions/bgp-pol:set-as-path-prepend" {
    description "as number used for aspath prepend";

       leaf as {
         type union {
           type inet:as-number;
           type string {
             pattern "last-as";
           }
         }
         description
           "autonomous system number or 'last-as' which means
           the leftmost as number in the AS-path to be prepended";
       }
  }

  augment "/rpol:routing-policy/rpol:defined-sets/rpol:neighbor-sets/rpol:neighbor-set" {
    description "alternative for the existing neighbor element";

    leaf-list neighbor-info {
      description
            "neighbor ip address";
      type inet:ip-address;
    }
  }

  augment "/rpol:routing-policy/rpol:defined-sets/" +
    "bgp-pol:bgp-defined-sets/bgp-pol:community-sets/bgp-pol:community-set" {
    description "alternative for the existing community-member";

    leaf-list community {
      description
        "community set member";
      type string;
    }
  }

  augment "/rpol:routing-policy/rpol:defined-sets/" +
    "bgp-pol:bgp-defined-sets/bgp-pol:ext-community-sets/bgp-pol:ext-community-set" {
    description "alternative for the existing ext-community-member";

    leaf-list ext-community {
      type string;
      description
        "extended community set member";
    }
  }

  augment "/rpol:routing-policy/rpol:defined-sets/" +
    "bgp-pol:bgp-defined-sets/bgp-pol:as-path-sets/bgp-pol:as-path-set" {
    description "alternative for the existing as-path-set-member";

    leaf-list as-path {
      type string;
      description
        "AS path expression";
    }
  }

  augment "/rpol:routing-policy/rpol:policy-definitions/" +
    "rpol:policy-definition/rpol:statements/rpol:statement/" +
    "rpol:conditions/bgp-pol:bgp-conditions" {
    description "additional rpki condition";
    uses gobgp-rpki-validation-result;
  }

  augment "/bgp:bgp" {
    description "additional rpki configuration and state";
    uses gobgp-rpki-servers;
  }

  augment "/bgp:bgp/bgp:global" {
    description "route collector mode";
    container collector {
      leaf enabled {
        type boolean;
         description
          "Configure enabling route-collector mode.";
      }
    }
  }

  augment "/bgp:bgp" {
    description "additional bmp configuration";
    uses gobgp-bmp-servers;
  }

  typedef mrt-type {
    type enumeration {
      enum UPDATES {
        description "RPKI disabled";
      }
      enum TABLE {
        description "If the origin AS, prefix, maximum prefix length is
        exist in the range of ROA";
      }
    }
  }

  grouping gobgp-mrt {
    description "additional mrt configuration";
    container mrt-dump {
      list mrt {
        key "dump-type";
        description
          "Configure dump bgp messages in the mrt format";
        leaf dump-type {
          type mrt-type;
        }
        leaf file-name {
          type string;
          description
            "Configures a file name to be written.";
        }
        leaf interval {
          type uint64;
        }
      }
    }
  }

  augment "/bgp:bgp" {
    description "additional mrt configuration";
    uses gobgp-mrt;
  }

  augment "/bgp:bgp/bgp:global" {
    description "zebra configuration";
    container zebra {
       description
         "Configure connection to zebra";
      leaf enabled {
        type boolean;
        description
          "Configure enabling to connect to zebra.";
      }
      leaf url {
        type string;
        description
          "Configure url for zebra.";
      }
      leaf-list redistribute-route-type {
        type identityref {
          base ptypes:install-protocol-type;
        }
      }
    }
  }

  augment "/bgp:bgp/bgp:global" {
    container mpls-label-range {
      description "mpls labal range";

      leaf min-label {
          type uint32;
      }
      leaf max-label {
          type uint32;
      }
    }
  }

  augment "/bgp:bgp/bgp:global" {
    container listen-config {
        leaf port {
            type int32;
        }
        leaf-list local-address {
            type string;
        }
    }
  }

  augment "/bgp:bgp/bgp:global/bgp:afi-safis/bgp:afi-safi" {
      uses bgp-mp:all-afi-safi-common;
  }
}