netconfcentral logo

ietf-bfd-types@2017-10-30



  module ietf-bfd-types {

    yang-version 1;

    namespace
      "urn:ietf:params:xml:ns:yang:ietf-bfd-types";

    prefix bfd-types;

    import iana-bfd-types {
      prefix iana-bfd-types;
    }
    import ietf-inet-types {
      prefix inet;
    }
    import ietf-yang-types {
      prefix yang;
    }
    import ietf-routing {
      prefix rt;
    }
    import ietf-key-chain {
      prefix kc;
    }

    organization "IETF BFD Working Group";

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

     Editors:  Reshad Rahman (rrahman@cisco.com),
               Lianshu Zheng (vero.zheng@huawei.com),
               Mahesh Jethanandani (mjethanandani@gmail.com)";

    description
      "This module contains a collection of BFD specific YANG data type
     definitions, as per RFC5880.

     Copyright (c) 2017 IETF Trust and the persons
     identified as authors of the code.  All rights reserved.

     Redistribution and use in source and binary forms, with or
     without modification, is permitted pursuant to, and subject
     to the license terms contained in, the Simplified BSD License
     set forth in Section 4.c of the IETF Trust's Legal Provisions
     Relating to IETF Documents
     (http://trustee.ietf.org/license-info).

     This version of this YANG module is part of RFC XXXX; see
     the RFC itself for full legal notices.";

    revision "2017-10-30" {
      description "Initial revision.";
      reference
        "RFC XXXX: A YANG data model for BFD";

    }


    identity bfdv1 {
      base rt:control-plane-protocol;
      description
        "BFD protocol version 1 as per RFC5880.";
    }

    typedef discriminator {
      type uint32 {
        range "1..4294967295";
      }
      description "BFD discriminator";
    }

    typedef state {
      type enumeration {
        enum "adminDown" {
          value 0;
          description "admindown";
        }
        enum "down" {
          value 1;
          description "down";
        }
        enum "init" {
          value 2;
          description "init";
        }
        enum "up" {
          value 3;
          description "up";
        }
      }
      description
        "BFD state as defined in RFC5880";
    }

    typedef multiplier {
      type uint8 {
        range "1..255";
      }
      description "Multiplier";
    }

    typedef hops {
      type uint8 {
        range "1..255";
      }
      description
        "This corresponds to Time To Live for IPv4 and corresponds to hop
       limit for IPv6";
    }

    identity path-type {
      base 
      description
        "Base identity for BFD path type. The session type indicates
       the type of path on which BFD is running";
    }

    identity path-ip-sh {
      base path-type;
      description "BFD on IP single hop";
    }

    identity path-ip-mh {
      base path-type;
      description "BFD on IP multi hop";
    }

    identity path-mpls-te {
      base path-type;
      description
        "BFD on MPLS Traffic Engineering";
    }

    identity path-mpls-lsp {
      base path-type;
      description
        "BFD on MPLS Label Switched Path";
    }

    identity path-lag {
      base path-type;
      description
        "Micro-BFD on LAG member links";
    }

    identity encap-type {
      base 
      description
        "Base identity for BFD encapsulation type.";
    }

    identity encap-ip {
      base encap-type;
      description
        "BFD with IP encapsulation.";
    }

    identity auth-replay-protection {
      base 
      description
        "Base identity for BFD authentication replay protection. "
          + "See section 6.7 of RFC5880.";
    }

    identity auth-replay-protection-non-meticulous {
      base auth-replay-protection;
      description
        "Non-meticulous (see section 6.7.3 of RFC5880)";
    }

    identity auth-replay-protection-meticulous {
      base auth-replay-protection;
      description
        "Meticulous (see section 6.7.3 of RFC5880)";
    }

    feature authentication {
      description
        "BFD authentication supported";
    }

    feature demand-mode {
      description
        "BFD demand mode supported";
    }

    feature echo-mode {
      description "BFD echo mode supported";
    }

    grouping auth-parms {
      description
        "Grouping for BFD authentication parameters
       (see section 6.7 of RFC5880).";
      container authentication-parms {
        if-feature authentication;
        presence
          "Enables BFD authentication (see section 6.7 of RFC5880).";
        description
          "Parameters for BFD authentication";
        leaf key-chain {
          type kc:key-chain-ref;
          description "Name of key-chain";
        }

        leaf replay-protection {
          type identityref {
            base auth-replay-protection;
          }
          description
            "Protection against replays";
        }
      }  // container authentication-parms
    }  // grouping auth-parms

    grouping base-cfg-parms {
      description
        "BFD grouping for base config parameters";
      leaf local-multiplier {
        type multiplier;
        default '3';
        description
          "Multiplier transmitted by local system";
      }

      choice interval-config-type {
        description
          "Two interval values or 1 value used for both tx and rx";
        case tx-rx-intervals {
          leaf desired-min-tx-interval {
            type uint32;
            units "microseconds";
            mandatory true;
            description
              "Desired minimum transmit interval of control packets";
          }

          leaf required-min-rx-interval {
            type uint32;
            units "microseconds";
            mandatory true;
            description
              "Required minimum receive interval of control packets";
          }
        }  // case tx-rx-intervals
        leaf min-interval {
          type uint32;
          units "microseconds";
          mandatory true;
          description
            "Desired minimum transmit interval and required "
              + "minimum receive interval of control packets";
        }
      }  // choice interval-config-type
    }  // grouping base-cfg-parms

    grouping client-cfg-parms {
      description
        "BFD grouping for config parameters
       used by clients of BFD, e.g. IGP or MPLS";
      leaf enable {
        type boolean;
        default 'false';
        description
          "Indicates whether the BFD is enabled.";
      }

      uses base-cfg-parms;
    }  // grouping client-cfg-parms

    grouping common-cfg-parms {
      description
        "BFD grouping for common config parameters";
      uses base-cfg-parms;

      leaf demand-enabled {
        if-feature demand-mode;
        type boolean;
        default 'false';
        description "To enable demand mode";
      }

      leaf admin-down {
        type boolean;
        default 'false';
        description
          "Is the BFD session administratively down";
      }

      uses auth-parms;
    }  // grouping common-cfg-parms

    grouping all-session {
      description
        "BFD session operational information";
      leaf path-type {
        type identityref {
          base path-type;
        }
        config false;
        description
          "BFD session type, this indicates the path type that BFD is
        running on";
      }

      leaf ip-encapsulation {
        type boolean;
        config false;
        description
          "Whether BFD encapsulation uses IP";
      }

      leaf local-discriminator {
        type discriminator;
        config false;
        description "Local discriminator";
      }

      leaf remote-discriminator {
        type discriminator;
        config false;
        description "Remote discriminator";
      }

      leaf remote-multiplier {
        type multiplier;
        config false;
        description "Remote multiplier";
      }

      leaf demand-capability {
        if-feature demand-mode;
        type boolean;
        config false;
        description
          "Local demand mode capability";
      }

      leaf source-port {
        when "../ip-encapsulation = 'true'" {
          description
            "Source port valid only when IP encapsulation is used";
        }
        type inet:port-number;
        config false;
        description "Source UDP port";
      }

      leaf dest-port {
        when "../ip-encapsulation = 'true'" {
          description
            "Destination port valid only when IP encapsulation is used";
        }
        type inet:port-number;
        config false;
        description "Destination UDP port";
      }

      container session-running {
        config false;
        description
          "BFD session running information";
        leaf session-index {
          type uint32;
          description
            "An index used to uniquely identify BFD sessions";
        }

        leaf local-state {
          type state;
          description "Local state";
        }

        leaf remote-state {
          type state;
          description "Remote state";
        }

        leaf local-diagnostic {
          type iana-bfd-types:diagnostic;
          description "Local diagnostic";
        }

        leaf remote-diagnostic {
          type iana-bfd-types:diagnostic;
          description "Remote diagnostic";
        }

        leaf remote-authenticated {
          type boolean;
          description
            "Indicates whether incoming BFD control packets are
          authenticated";
        }

        leaf remote-authentication-type {
          when
            "../remote-authenticated = 'true'" {
            description
              "Only valid when incoming BFD control packets are
             authenticated";
          }
          if-feature authentication;
          type iana-bfd-types:auth-type;
          description
            "Authentication type of incoming BFD control packets";
        }

        leaf detection-mode {
          type enumeration {
            enum "async-with-echo" {
              value 1;
              description "Async with echo";
            }
            enum "async-without-echo" {
              value 2;
              description
                "Async without echo";
            }
            enum "demand-with-echo" {
              value 3;
              description "Demand with echo";
            }
            enum "demand-without-echo" {
              value 4;
              description
                "Demand without echo";
            }
          }
          description "Detection mode";
        }

        leaf negotiated-tx-interval {
          type uint32;
          units "microseconds";
          description
            "Negotiated transmit interval";
        }

        leaf negotiated-rx-interval {
          type uint32;
          units "microseconds";
          description
            "Negotiated receive interval";
        }

        leaf detection-time {
          type uint32;
          units "microseconds";
          description "Detection time";
        }

        leaf echo-tx-interval-in-use {
          when
            "../../path-type = 'bfd-types:path-ip-sh'" {
            description
              "Echo is supported for IP single-hop only.";
          }
          if-feature echo-mode;
          type uint32;
          units "microseconds";
          description
            "Echo transmit interval in use";
        }
      }  // container session-running

      container sesssion-statistics {
        config false;
        description
          "BFD per-session statistics";
        leaf create-time {
          type yang:date-and-time;
          description
            "Time and date when session was created";
        }

        leaf last-down-time {
          type yang:date-and-time;
          description
            "Time and date of last time the session went down";
        }

        leaf last-up-time {
          type yang:date-and-time;
          description
            "Time and date of last time the session went up";
        }

        leaf down-count {
          type uint32;
          description "Session Down Count";
        }

        leaf admin-down-count {
          type uint32;
          description
            "Session Admin-Down Count";
        }

        leaf receive-packet-count {
          type uint64;
          description
            "Received Packet Count";
        }

        leaf send-packet-count {
          type uint64;
          description "Sent Packet Count";
        }

        leaf receive-bad-packet {
          type uint64;
          description
            "Received bad packet count";
        }

        leaf send-failed-packet {
          type uint64;
          description
            "Packet Failed to Send Count";
        }
      }  // container sesssion-statistics
    }  // grouping all-session

    grouping session-statistics {
      description
        "Grouping for session counters";
      container session-statistics {
        config false;
        description "BFD session counters";
        leaf session-count {
          type uint32;
          description "Number of sessions";
        }

        leaf session-up-count {
          type uint32;
          description
            "Count of sessions which are up";
        }

        leaf session-down-count {
          type uint32;
          description
            "Count of sessions which are down";
        }

        leaf session-admin-down-count {
          type uint32;
          description
            "Count of sessions which are admin-down";
        }
      }  // container session-statistics
    }  // grouping session-statistics

    grouping notification-parms {
      description
        "This group describes common parameters that will be sent "
          + "as part of BFD notification";
      leaf local-discr {
        type discriminator;
        description
          "BFD local discriminator";
      }

      leaf remote-discr {
        type discriminator;
        description
          "BFD remote discriminator";
      }

      leaf new-state {
        type state;
        description "Current BFD state";
      }

      leaf state-change-reason {
        type iana-bfd-types:diagnostic;
        description
          "BFD state change reason";
      }

      leaf time-of-last-state-change {
        type yang:date-and-time;
        description
          "Calendar time of previous state change";
      }

      leaf dest-addr {
        type inet:ip-address;
        description "BFD peer address";
      }

      leaf source-addr {
        type inet:ip-address;
        description "BFD local address";
      }

      leaf session-index {
        type uint32;
        description
          "An index used to uniquely identify BFD sessions";
      }

      leaf path-type {
        type identityref {
          base path-type;
        }
        description "BFD path type";
      }
    }  // grouping notification-parms
  }  // module ietf-bfd-types