summaryrefslogtreecommitdiffstats
path: root/src/plugins/yang/openconfig/openconfig-bfd.yang
blob: fc573e5c1c258bb5e955072403038ed4749fafe1 (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
module openconfig-bfd {

  yang-version "1";

  // namespace
  namespace "http://openconfig.net/yang/bfd";

  prefix "oc-bfd";

  // import some basic types
  import openconfig-extensions { prefix "ocext"; }
  import openconfig-types { prefix "oc-types"; }
  import openconfig-interfaces { prefix "oc-if"; }
  import openconfig-inet-types { prefix "oc-inet"; }
  import openconfig-if-types { prefix "oc-ift"; }
  import openconfig-network-instance { prefix "oc-ni"; }
  import openconfig-policy-types { prefix "oc-pol-types"; }

  // meta
  organization "OpenConfig working group";

  contact
    "OpenConfig working group
    www.openconfig.net";

  description
    "An OpenConfig model of Bi-Directional Forwarding Detection (BFD)
    configuration and operational state.";

  ocext:openconfig-version "0.1.0";

  revision "2017-11-17" {
    description
      "Update version number for initial sharing.";
    reference "0.1.0";
  }

  revision "2017-10-19" {
    description
      "Adopt OpenConfig types models, type corrections";
    reference "0.0.2";
  }

  revision "2016-06-24" {
    description
      "Initial revision";
    reference "0.0.1";
  }

  typedef bfd-session-state {
    type enumeration {
      enum UP {
        description
          "The BFD session is perceived to be up by the system.";
      }
      enum DOWN {
        description
          "The BFD session is perceived to be down by the system.";
      }
      enum ADMIN_DOWN {
        description
          "The BFD session is administratively disabled.";
      }
      enum INIT {
        description
          "The BFD session is perceived to be initialising by the
          system.";
      }
    }
    description
      "The state of the BFD session according to the system referred
      to by the context of the leaf.";
    reference
      "RFC5880 - Bidirectional Forwarding Detection, Section
      4.1";
  }

  typedef bfd-diagnostic-code {
    type enumeration {
      enum NO_DIAGNOSTIC {
        value 0;
        description
          "No diagnostic code was specified, or the session has not
          changed state.";
      }
      enum DETECTION_TIMEOUT {
        value 1;
        description
          "The control detection time expired: no BFD packet was
          received within the required period.";
      }
      enum ECHO_FAILED {
        value 2;
        description
          "The BFD echo function failed - echo packets have not been
          received for the required period of time.";
      }
      enum FORWARDING_RESET {
        value 3;
        description
          "The forwarding plane in the local system was reset - such
          that the remote system cannot rely on the forwarding state of
          the device specifying this error code.";
      }
      enum PATH_DOWN {
        value 4;
        description
          "Signalling outside of BFD specified that the path underlying
          this session has failed.";
      }
      enum CONCATENATED_PATH_DOWN {
        value 5;
        description
          "When a BFD session runs over a series of path segments, this
          error code indicates that a subsequent path segment (i.e.,
          one in the transmit path between the source and destination
          of the session) has failed.";
      }
      enum ADMIN_DOWN {
        value 6;
        description
          "The BFD session has been administratively disabled by the
          peer.";
      }
      enum REVERSE_CONCATENATED_PATH_DOWN {
        value 7;
        description
          "In the case that a BFD session is running over a series of
          path segments, this error code indicates that a path segment
          on the reverse path (i.e., in the transmit direction from the
          destination to the source of the session) has failed.";
      }
    }
    description
      "Diagnostic codes defined by BFD. These typically indicate the
      reason for a change of session state.";
    reference
      "RFC5880 - Bidirectional Forwarding Detection, Section
      4.1";
  }


  grouping bfd-interface-config {
    description
      "Top-level per-interface configuration parameters for BFD.";

    leaf id {
      type string;
      description
        "A unique identifier for the interface.";
    }

    leaf enabled {
      type boolean;
      description
        "When this leaf is set to true then the BFD session is enabled
        on the specified interface - if it is set to false, it is
        administratively disabled.";
    }

    leaf local-address {
      type oc-inet:ip-address;
      description
        "The source IP address to be used for BFD sessions over this
        interface.";
    }

    leaf desired-minimum-tx-interval {
      type uint32;
      units microseconds;
      description
        "The minimum interval between transmission of BFD control
        packets that the operator desires. This value is advertised to
        the peer, however the actual interval used is specified by
        taking the maximum of desired-minimum-tx-interval and the
        value of the remote required-minimum-receive interval value.

        This value is specified as an integer number of microseconds.";
    }

    leaf required-minimum-receive {
      type uint32;
      units microseconds;
      description
        "The minimum interval between received BFD control packets that
        this system should support. This value is advertised to the
        remote peer to indicate the maximum frequency (i.e., minimum
        inter-packet interval) between BFD control packets that is
        acceptable to the local system.";
    }

    // rjs: Could have required-minimum-echo-receive here, but this is
    // generally not configurable.

    leaf detection-multiplier {
      type uint16 {
        range "1..max";
      }
      description
        "The number of packets that must be missed to declare this
        session as down. The detection interval for the BFD session
        is calculated by multiplying the value of the negotiated
        transmission interval by this value.";
    }

    leaf enable-per-member-link {
      type boolean;
      default false;
      description
        "When this leaf is set to true - BFD will be enabled on
        each member interface of the aggregated Ethernet bundle.";

      when "/oc-if:interfaces/oc-if:interface" +
          "[name=current()/../../interface-ref/config/interface]/" +
          "oc-if:state/oc-if:type = 'oc-ift:IF_AGGREGATE'" {
        description
          "Include per-member link BFD only when the type of
          interface is a link aggregate.";
      }
    }
  }

  grouping bfd-interface-state {
    // placeholder
    description
      "Operational state parameters relating to BFD running on an
      interface.";
  }

  grouping bfd-session-state-mode-timers-common {
    description
      "Common operational state parameters that are re-used across
      both asynchronous and echo modes of BFD.";

    leaf last-packet-transmitted {
      type uint64;
      description
        "The date and time at which the last BFD packet
        was transmitted for this session, expressed as the number
        of nanoseconds since the Unix Epoch (January 1, 1970,
        00:00 UTC).";
    }

    leaf last-packet-received {
      type uint64;
      description
        "The date and time at which the last BFD packet
        was received for this session, expressed as the number
        of nanoseconds since the Unix Epoch (January 1, 1970,
        00:00 UTC).";
    }

    leaf transmitted-packets {
      // TODO: looks to be unsupported on JUNOS
      type uint64;
      description
        "The number of packets that have been transmitted
        by the local system.";
    }

    leaf received-packets {
      // TODO: looks to be unsupported on JUNOS
      type uint64;
      description
        "The number of packets that have been received by the
        local system from the remote neighbour.";
    }

    leaf up-transitions {
      // TODO: looks to only be supported in SROS
      type uint64;
      description
        "The number of times that the adjacency with the neighbor
        has transitioned into the up state.";
    }
  }

  grouping bfd-session-state-sessiondetails-common {
    description
      "Common session details for a BFD session.";

    leaf session-state {
      type bfd-session-state;
      description
        "The state of the BFD session perceived by the local system.";

    }

    leaf remote-session-state {
      type bfd-session-state;
      description
        "The reported state of the BFD session according to the remote
        system. This state reflects the last state reported in a BFD
        control packet.";
    }

    leaf last-failure-time {
      type oc-types:timeticks64;
      description
        "The time of the last transition of the BFD session out of
        the UP state, expressed as the number of nanoseconds since
        the Unix epoch.";
    }

    leaf failure-transitions {
      type uint64;
      description
        "The number of times that the BFD session has transitioned
        out of the UP state.";
    }

    leaf local-discriminator {
      type string;
      description
        "A unique identifier used by the local system to identify this
        BFD session.";
    }

    leaf remote-discriminator {
      type string;
      description
        "A unique identified used by the remote system to identify this
        BFD session.";
    }

    leaf local-diagnostic-code {
      type bfd-diagnostic-code;
      description
        "The local BFD diagnostic code indicating the most recent
        reason for failure of this BFD session.";
    }

    leaf remote-diagnostic-code {
      type bfd-diagnostic-code;
      description
        "The remote BFD diagnostic code indicating the remote system's
        reason for failure of the BFD session";
    }

    leaf remote-minimum-receive-interval {
      type uint32;
      description
        "The value of the minimum receive interval that was specified
        in the most recent BFD control packet received from the peer.";
    }

    leaf demand-mode-requested {
      type boolean;
      description
        "This leaf is set to true when the remote system has requested
        demand mode be run for this session.";
    }

    leaf remote-authentication-enabled {
      type boolean;
      description
        "This leaf is set to true when the remote system has specified
        that authentication is present for the BFD session.";
    }

    leaf remote-control-plane-independent {
      type boolean;
      description
        "This leaf is set to true when the remote system has specified
        that the hardware implementing this BFD session is independent
        of the control plane's liveliness.";
    }
  }


  grouping bfd-session-state-async-common {
    description
      "Common parameters for asynchronous BFD sessions";

    container async {
      description
        "Operational state parameters specifically relating to
        asynchronous mode of BFD.";

      uses bfd-session-state-mode-timers-common;
    }
  }

  grouping bfd-session-state-echo-common {
    description
      "Common parameters for echo-mode BFD sessions.";

    container echo {
      description
        "Operational state parameters specifically relating to the
        echo mode of BFD.";

      leaf active {
        type boolean;
        description
          "This leaf is set to true when echo mode is running between
          the local and remote system. When it is set to false, solely
          asynchronous mode is active.";
      }

      uses bfd-session-state-mode-timers-common;
    }
  }


  grouping bfd-session-state-common {
    description
      "Common operational state parameters that may be re-used across
      multiple BFD session contexts.";

    leaf local-address {
      type oc-inet:ip-address;
      description
        "The IP address used by the local system for this BFD session.";
    }

    leaf remote-address {
      type oc-inet:ip-address;
      description
        "The IP address used by the remote system for this BFD session.";
    }

    leaf-list subscribed-protocols {
      type identityref {
        base "oc-pol-types:INSTALL_PROTOCOL_TYPE";
      }
      description
        "Indicates the set of protocols that currently use
        this BFD session for liveliness detection.";
    }

    uses bfd-session-state-sessiondetails-common;
    uses bfd-session-state-echo-common;
    uses bfd-session-state-async-common;
  }

  grouping bfd-session-microbfd-common {
    description
      "BFD session parameters utilised only for micro-BFD sessions.";

    uses bfd-session-state-sessiondetails-common;
    uses bfd-session-state-async-common;
  }

  grouping bfd-interface-peer-state {
    description
      "Per-peer, per-interface operational state parameters for BFD.";

    uses bfd-session-state-common;
  }

  grouping bfd-interface-microbfd-config {
    description
      "Configuration parameters for a microBFD session on an
      interface.";

    leaf local-address {
      type oc-inet:ip-address;
      description
        "The local IP address used by the system for the micro-BFD session
        specified.";
    }

    leaf remote-address {
      type oc-inet:ip-address;
      description
        "The remote IP destination that should be used by the system for
        the micro-BFD session specified.";
    }

    leaf member-interface {
      type leafref {
        path "/oc-if:interfaces/" +
          "oc-if:interface/oc-if:config/oc-if:name";
      }
      // rjs: Note that this does not restrict to only interfaces that
      // are part of the current LAG. An implementation should return
      // NOK if such an interface is specified.
      description
        "Reference to a member link of the aggregate interface being
        described.";
    }
  }

  grouping bfd-interface-microbfd-state {
    description
      "Operational state parameters relating to a micro-BFD session on
      an interface.";

    uses bfd-session-microbfd-common;
  }

  grouping bfd-interface-microbfd-structural {
    description
      "Structural grouping for micro-bfd configuration and state
      parameters.";

    container micro-bfd-sessions {
      description
        "Parameters relating to micro-BFD sessions associated
        with the interface.";

      list micro-bfd-session {
        description
          "This list contains configuration and state parameters
          relating to micro-BFD session.";
        reference
          "RFC7130 - Bidirectional Forwarding Detection (BFD)
          on Link Aggregation Group (LAG) Interfaces.";

        key "member-interface";

        leaf member-interface {
          type leafref {
            path "../config/member-interface";
          }
          description
            "A reference to the member interface of the link
            aggregate.";
        }

        container config {
          description
            "Configuration parameters for the micro-BFD session.";
          uses bfd-interface-microbfd-config;
        }

        container state {
          config false;
          description
            "Operational state parameters for the micro-BFD session.";
          uses bfd-interface-microbfd-config;
          uses bfd-interface-microbfd-state;
        }
      }
      when "/oc-if:interfaces/oc-if:interface" +
          "[name=current()/../interface-ref/config/interface]/" +
          "oc-if:state/oc-if:type = 'oc-ift:IF_AGGREGATE'" {
        description
          "Include per-member link BFD only when the type of
          interface is a link aggregate.";
      }
    }
  }

  grouping bfd-interface-peer-structural {
    description
      "Structural grouping for BFD peers (in the context of an interface).";

    container peers {
      description
        "Parameters relating to the BFD peers which are seen
        over this interface.";

      list peer {
        key "local-discriminator";
        config false;

        description
          "Parameters relating to the BFD peer specified by the
          remote address.";

        leaf local-discriminator {
          type leafref {
            path "../state/local-discriminator";
          }
          description
            "The local discriminator, which is unique for the
            session on the system.";
        }

        container state {
          config false;
          description
            "Operational state parameters for the BFD session.";

          uses bfd-interface-peer-state;
        }
      }
    }
  }

  grouping bfd-top {
    description
      "Structural grouping for Bidirectional Forwarding Detection (BFD).";

    container bfd {
      description
        "Configuration and operational state parameters for BFD.";
      reference "RFC5880, RFC5881";

      container interfaces {
        description
          "Interfaces on which BFD sessions are to be enabled.";

        list interface {
          key "id";

          description
            "Per-interface configuration and state parameters for BFD.";

          leaf id {
            type leafref {
              path "../config/id";
            }
            description
              "A reference to an identifier for the interface on which
              BFD is enabled.";
          }

          container config {
            description
              "Configuration parameters for BFD on the specified
              interface.";
            uses bfd-interface-config;
          }

          container state {
            config false;
            description
              "Operational state parameters for BFD on the specified
              interface.";
            uses bfd-interface-config;
            uses bfd-interface-state;
          }

          uses oc-if:interface-ref;

          uses bfd-interface-microbfd-structural;
          uses bfd-interface-peer-structural;
        }
      }
    }
  }

  grouping enable-bfd-config {
    description
      "Configuration parameters relating to enabling BFD.";

    leaf enabled {
      type boolean;
      description
        "When this leaf is set to true, BFD is used to detect the
        liveliness of the remote peer or next-hop.";
    }
  }

  grouping enable-bfd-state {
    description
      "Operational state parameters relating to enabling BFD.";

    leaf associated-session {
      // TODO: this is a leafref to something unique, but seems
      // like it might be expensive for the NMS to find out since
      // it will need to cycle through all interfaces looking for
      // the associated local-discriminator.
      type leafref {
        path "/bfd/interfaces/interface/peers/peer/local-discriminator";
      }
      description
        "A reference to the BFD session that is tracking the liveliness
        of the remote entity.";
    }

    //
    // A fix to the above is to have the following leaf to show which
    // interface is associated.
    //
    // leaf associated-interface {
    //   type leafref {
    //     path "/bfd/interfaces/interface/config/id";
    //   }
    // }
  }

  grouping bfd-enable {
    description
      "Grouping which can be included in a protocol wishing to enable
      BFD.";

    container enable-bfd {
      description
        "Enable BFD for liveliness detection to the next-hop or
        neighbour.";

      container config {
        description
          "Configuration parameters relating to enabling BFD.";

        uses enable-bfd-config;
      }

      container state {
        config false;
        description
          "Operational state parameters relating to enabing BFD.";

        uses enable-bfd-config;
        uses enable-bfd-state;
      }
    }
  }

  // rjs - TODO - should these be specified within each model? The
  // answer here is probably yes, since otherwise openconfig
  // network-instance ends up with a circular reference.
  augment "/oc-ni:network-instances/oc-ni:network-instance/" +
          "oc-ni:protocols/oc-ni:protocol/oc-ni:bgp/" +
          "oc-ni:neighbors/oc-ni:neighbor" {
    description
      "Augment the BGP routing protocol to add a link to BFD for
      neighbour detection.";

    uses bfd-enable;
  }

  augment "/oc-ni:network-instances/oc-ni:network-instance/" +
          "oc-ni:protocols/oc-ni:protocol/oc-ni:bgp/" +
          "oc-ni:peer-groups/oc-ni:peer-group" {
    description
      "Augment the BGP routing protocol to add a link to BFD for
      neighbor detection when specified within a peer-group.";

    uses bfd-enable;
  }

  augment "/oc-ni:network-instances/oc-ni:network-instance/" +
          "oc-ni:protocols/oc-ni:protocol/oc-ni:static-routes/" +
          "oc-ni:static/oc-ni:next-hops/oc-ni:next-hop" {
    description
      "Augment the static route configuration to allow a next-hop
      to be tracked by BFD.";

    uses bfd-enable;
  }

  uses bfd-top;
}