SPRING Working Group                                        S. Litkowski
Internet-Draft                                   Orange Business Service
Intended status: Standards Track                                   Y. Qu
Expires: May 1, September 11, 2017                                       Cisco Systems                                       Huawei
                                                               P. Sarkar
                                                             J. Tantsura
                                                              Individual
                                                        October 28, 2016
                                                          March 10, 2017

                  YANG Data Model for Segment Routing
                      draft-ietf-spring-sr-yang-05
                      draft-ietf-spring-sr-yang-06

Abstract

   This document defines a YANG data model ([RFC6020], [RFC7950]) for
   segment routing ([I-D.ietf-spring-segment-routing]) configuration and
   operation.  This YANG model is intended to be used on network
   elements to configure or operate segment routing.  This document
   defines also generic containers that SHOULD be reused by IGP protocol
   modules to support segment routing.

Requirements Language

   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
   document are to be interpreted as described in [RFC2119].

Status of This Memo

   This Internet-Draft is submitted in full conformance with the
   provisions of BCP 78 and BCP 79.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF).  Note that other groups may also distribute
   working documents as Internet-Drafts.  The list of current Internet-
   Drafts is at http://datatracker.ietf.org/drafts/current/.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   This Internet-Draft will expire on May 1, September 11, 2017.

Copyright Notice

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

   This document is subject to BCP 78 and the IETF Trust's Legal
   Provisions Relating to IETF Documents
   (http://trustee.ietf.org/license-info) in effect on the date of
   publication of this document.  Please review these documents
   carefully, as they describe your rights and restrictions with respect
   to this document.  Code Components extracted from this document must
   include Simplified BSD License text as described in Section 4.e of
   the Trust Legal Provisions and are provided without warranty as
   described in the Simplified BSD License.

Table of Contents

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   2
     1.1.  Tree diagram  . . . . . . . . . . . . . . . . . . . . . .   3
   2.  Design of the Data Model  . . . . . . . . . . . . . . . . . .   3
   3.  Configuration . . . . . . . . . . . . . . . . . . . . . . . .   5   6
   4.  IGP Control plane configuration . . . . . . . . . . . . . . .   6   7
     4.1.  IGP interface configuration . . . . . . . . . . . . . . .   7
       4.1.1.  Adjacency SID properties  . . . . . . . . . . . . . .   7   8
         4.1.1.1.  Bundling  . . . . . . . . . . . . . . . . . . . .   7   8
         4.1.1.2.  Protection  . . . . . . . . . . . . . . . . . . .   7   8
   5.  States  . . . . . . . . . . . . . . . . . . . . . . . . . . .   8   9
   6.  Notifications . . . . . . . . . . . . . . . . . . . . . . . .   8   9
   7.  YANG Module . . . . . . . . . . . . . . . . . . . . . . . . .   8   9
   8.  Security Considerations . . . . . . . . . . . . . . . . . . .  26  28
   9.  Acknowledgements  . . . . . . . . . . . . . . . . . . . . . .  26  28
   10. IANA Considerations . . . . . . . . . . . . . . . . . . . . .  26  28
   11. Normative References  . . . . . . . . . . . . . . . . . . . .  26  28
   Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . .  27  29

1.  Introduction

   This document defines a YANG data model for segment routing
   configuration and operation.  This document does not define the IGP
   extensions to support segment routing but defines generic groupings
   that SHOULD be reused by IGP extension modules.  The reason of this
   design choice is to not require implementations to support all IGP
   extensions.  For example, an implementation may support IS-IS
   extension but not OSPF.

1.1.  Tree diagram

   A simplified graphical representation of the data model is presented
   in Section 2.

   The meaning of the symbols in these diagrams is as follows:

   o  Brackets "[" and "]" enclose list keys.

   o  Curly braces "{" and "}" contain names of optional features that
      make the corresponding node conditional.

   o  Abbreviations before data node names: "rw" means configuration
      (read-write), and "ro" state data (read-only).

   o  Symbols after data node names: "?" means an optional node and "*"
      denotes a "list" or "leaf-list".

   o  Parentheses enclose choice and case nodes, and case nodes are also
      marked with a colon (":").

   o  Ellipsis ("...") stands for contents of subtrees that are not
      shown.

2.  Design of the Data Model

   As the module definition is just starting, it is expected that there
   will be changes as the module matures.

module: ietf-segment-routing
  augment /rt:routing:
    +--rw segment-routing
       +--rw transport-type?   identityref
       +--rw msd {msd}?
       |  +--rw node-msd?   uint8
       |  +--rw link-msd
       |     +--rw link-msds* [interface]
       |        +--rw interface    if:interface-ref
       |        +--rw msd?         uint8
       +--rw bindings
       |  +--rw mapping-server {mapping-server}?
       |  |  +--rw policy* [name]
       |  |     +--rw name    string
       |  |     +--rw ipv4
       |  |     |  +--rw mapping-entry* [prefix algorithm]
       |  |     |     +--rw prefix        inet:ipv4-prefix
       |  |     |     +--rw value-type?   enumeration
       |  |     |     +--rw start-sid     uint32
       |  |     |     +--rw range?        uint32
       |  |     |     +--rw algorithm     identityref
       |  |     +--rw ipv6
       |  |        +--rw mapping-entry* [prefix algorithm]
       |  |           +--rw prefix        inet:ipv6-prefix
       |  |           +--rw value-type?   enumeration
       |  |           +--rw start-sid     uint32
       |  |           +--rw range?        uint32
       |  |           +--rw algorithm     identityref
       |  +--rw connected-prefix-sid-map
       |  |  +--rw ipv4
       |  |  |  +--rw ipv4-prefix-sid* [prefix algorithm]
       |  |  |     +--rw prefix               inet:ipv4-prefix
       |  |  |     +--rw value-type?          enumeration
       |  |  |     +--rw start-sid            uint32
       |  |  |     +--rw range?               uint32
       |  |  |     +--rw algorithm            identityref
       |  |  |     +--rw last-hop-behavior?   enumeration {sid-last-hop-behavior}?
       |  |  +--rw ipv6
       |  |     +--rw ipv6-prefix-sid* [prefix algorithm]
       |  |        +--rw prefix               inet:ipv6-prefix
       |  |        +--rw value-type?          enumeration
       |  |        +--rw start-sid            uint32
       |  |        +--rw range?               uint32
       |  |        +--rw algorithm            identityref
       |  |        +--rw last-hop-behavior?   enumeration {sid-last-hop-behavior}?
       |  +--rw local-prefix-sid
       |     +--rw ipv4
       |     |  +--rw ipv4-prefix-sid-local* [prefix algorithm]
       |     |     +--rw prefix        inet:ipv4-prefix
       |     |     +--rw value-type?   enumeration
       |     |     +--rw start-sid     uint32
       |     |     +--rw range?        uint32
       |     |     +--rw algorithm     identityref
       |     +--rw ipv6
       |        +--rw ipv6-prefix-sid-local* [prefix algorithm]
       |           +--rw prefix        inet:ipv6-prefix
       |           +--rw value-type?   enumeration
       |           +--rw start-sid     uint32
       |           +--rw range?        uint32
       |           +--rw algorithm     identityref
       +--rw global-srgb
       |  +--rw srgb* [lower-bound upper-bound]
       |     +--rw lower-bound    uint32
       |     +--rw upper-bound    uint32
       +--rw srlb
          +--rw srlb* [lower-bound upper-bound]
             +--rw lower-bound    uint32
             +--rw upper-bound    uint32
  augment /rt:routing-state:
    +--ro segment-routing
       +--ro node-capabilities
       |  +--ro transport-planes* [transport-plane]
       |  |  +--ro transport-plane    identityref
       |  +--ro readable-label-stack-depth?   uint8
       +--ro msd
       |  +--ro node-msd?   uint8
       |  +--ro link-msd
       |     +--ro link-msds* [interface]
       |        +--ro interface    if:interface-ref
       |        +--ro msd?         uint8
       +--ro label-blocks*
       |  +--ro lower-bound?   uint32
       |  +--ro upper-bound?   uint32
       |  +--ro size?          uint32
       |  +--ro free?          uint32
       |  +--ro used?          uint32
       |  +--ro global-sid-list scope?         enumeration
       +--ro sid-list
          +--ro sid* [target sid source source-protocol binding-type]
             +--ro target             string
             +--ro sid                uint32
             +--ro algorithm?         uint8
             +--ro source             inet:ip-address
             +--ro used?              boolean
             +--ro source-protocol    -> /rt:routing-state/control-plane-protocols
                                         /control-plane-protocol/name
             +--ro binding-type       enumeration
             +--ro scope?             enumeration

  notifications:
    +---n segment-routing-global-srgb-collision
    |  +--ro srgb-collisions*
    |     +--ro lower-bound?          uint32
    |     +--ro upper-bound?          uint32
    |     +--ro routing-protocol?     -> /rt:routing-state/control-plane-protocols
    |                                    /control-plane-protocol/name
    |     +--ro originating-rtr-id?   router-id
    +---n segment-routing-global-sid-collision
    |  +--ro received-target?       string
    |  +--ro new-sid-rtr-id?        router-id
    |  +--ro original-target?       string
    |  +--ro original-sid-rtr-id?   router-id
    |  +--ro index?                 uint32
    |  +--ro routing-protocol?      -> /rt:routing-state/control-plane-protocols
    |                                  /control-plane-protocol/name
    +---n segment-routing-index-out-of-range
       +--ro received-target?    string
       +--ro received-index?     uint32
       +--ro routing-protocol?   -> /rt:routing-state/control-plane-protocols
                                    /control-plane-protocol/name
notifications:
   +---n segment-routing-global-srgb-collision
   |  +--ro srgb-collisions*
   |     +--ro lower-bound?          uint32
   |     +--ro upper-bound?          uint32
   |     +--ro routing-protocol?     -> /rt:routing-state/control-plane-protocols
   |                                    /control-plane-protocol/name
   |     +--ro originating-rtr-id?   router-id
   +---n segment-routing-global-sid-collision
   |  +--ro received-target?       string
   |  +--ro new-sid-rtr-id?        router-id
   |  +--ro original-target?       string
   |  +--ro original-sid-rtr-id?   router-id
   |  +--ro index?                 uint32
   |  +--ro routing-protocol?      -> /rt:routing-state/control-plane-protocols
   |                                  /control-plane-protocol/name
   +---n segment-routing-index-out-of-range
      +--ro received-target?    string
      +--ro received-index?     uint32
      +--ro routing-protocol?   -> /rt:routing-state/control-plane-protocols
                                   /control-plane-protocol/name

3.  Configuration

   This module augments the "/rt:routing:" with a segment-routing
   container.  This container defines all the configuration parameters
   related to segment-routing.

   The segment-routing configuration is split in global configuration
   and interface configuration.

   The global configuration includes :

   o  segment-routing transport type : The underlying transport type for
      segment routing.  The version of the model limits the transport
      type to an MPLS dataplane.  The transport-type is only defined
      once for a particular routing-instance and is agnostic to the
      control plane used.  Only a single transport-type is supported in
      this version of the model.

   o  bindings : Defines prefix to SID mappings.  The operator can
      control advertisement of Prefix-SID independently for IPv4 and
      IPv6.  Two types of mappings are available :

      *  Mapping-server : maps non local prefixes to a segment ID.
         Configuration of bindings does not automatically allow
         advertisement of those bindings.  Advertisement must be
         controlled by each routing-protocol instance (see Section 4).
         Multiple mapping policies may be defined.

      *  Connected prefixes : maps connected prefixes to a segment ID.
         Advertisement of the mapping will be done by IGP when enabled
         for segment routing (see Section 4).  The SID value can be
         expressed as an index (default), or an absolute value.  The
         "last-hop-behavior" configuration dictates the PHP behavior:
         "explicit-null", "php", or "non-php".

   o  SRGB (Segment Routing Global Block): Defines a list of label
      blocks represented by a pair of lower-bound/upper-bound labels.
      The SRGB is also agnostic to the control plane used.  So all
      routing-protocol instance will have to advertise the same SRGB.

   o  SRLB (Segment Routing Local Block): Defines a list of label blocks
      represented by a pair of lower-bound/upper-bound labels, reserved
      for lcoal SIDs.

4.  IGP Control plane configuration

   Support of segment-routing extensions for a particular IGP control
   plane is done by augmenting routing-protocol configuration with
   segment-routing extensions.  This augmentation SHOULD be part of
   separate YANG modules in order to not create any dependency for
   implementations to support all protocol extensions.

   This module defines groupings that SHOULD be used by IGP segment
   routing modules.

   The "controlplane-cfg" grouping defines the generic global
   configuration for the IGP.

   The "enabled" leaf enables segment-routing extensions for the
   routing-protocol instance.

   The "bindings" container controls the routing-protocol instance's
   advertisement of local bindings and the processing of received
   bindings.

4.1.  IGP interface configuration

   The interface configuration is part of the "igp-interface-cfg"
   grouping and includes Adjacency SID properties.

4.1.1.  Adjacency SID properties

4.1.1.1.  Bundling

   This section is a first proposal on how to use S-bit in Adj-SID to
   create bundles.  Authors would like to trigger discussion based on
   this first proposal.

   In case of parallel IP links between routers, an additional Adjacency
   SID may be advertised representing more than one adjacency (i.e., a
   bundle of adjacencies).  The "advertise-adj-group-sid" configuration
   controls whether or not an additional adjacency SID is advertised.

   The "advertise-adj-group-sid" would be a list of "group-id".  The
   "group-id" will permit to identify interfaces that must be bundled
   together.

           +-------+                 +------+
           |       | ------- L1 ---- |      |
           |   R1  | ------- L2 ---- |  R2  |
           |       | ------- L3 ---- |      |
           |       | ------- L4 ---- |      |
           +-------+                 +------+

   In the figure above, R1 and R2 are interconnected by four links.  A
   routing protocol adjacency is established on each link.  Operator
   would like to create segment-routing Adj-SID that represent some
   bundles of links.  We can imagine two different bundles : L1/L2 and
   L2/L3.  To achieve this behavior, the service provider will configure
   a "group-id" X for both interfaces L1 and L2 and a "group-id" Y for
   both interfaces L3 and L3.  This will result in R1 advertising an
   additional Adj-SID for each adjacency, for example a Adj-SID with S
   flag set and value of 400 will be added to L1 and L2.  A Adj-SID with
   S flag set and value of 500 will be added to L3 and L4.  As L1/L2 and
   L3/L4 does not share the same "group-id", a different SID value will
   be allocated.

4.1.1.2.  Protection

   The "advertise-protection" defines how protection for an interface is
   advertised.  It does not control the activation or deactivation of
   protection.  If the "single" option is used, a single Adj-SID will be
   advertised for the interface.  If the interface is protected, the
   B-Flag for the Adj-SID advertisement will be set.  If the "dual"
   option is used and if the interface is protected, two Adj-SIDs will
   be advertised for the interface adjacencies.  One Adj-SID will always
   have the B-Flag set and the other will have the B-Flag clear.  This
   option is intended to be used in the case of traffic engineering
   where a path must use either protected segments or non-protected
   segments.

5.  States

   The operational states contains information reflecting the usage of
   allocated SRGB labels.

   It also includes a list of all global SIDs, their associated
   bindings, and other information such as the source protocol and
   algorithm.

6.  Notifications

   The model defines the following notifications for segment-routing.

   o  segment-routing-global-srgb-collision: Rasied when a control plan
      advertised SRGB blocks have conflicts.

   o  segment-routing-global-sid-collision: Raised when a control plane
      advertised index is already associated with another target (in
      this version, the only defined targets are IPv4 and IPv6
      prefixes).

   o  segment-routing-index-out-of-range: Raised when a control plane
      advertised index fall outside the range of SRGBs configured for
      the network device.

7.  YANG Module

<CODE BEGINS> file "ietf-segment-routing-common@2016-10-28.yang" "ietf-segment-routing-common@2017-03-10.yang"
module ietf-segment-routing-common {
  namespace "urn:ietf:params:xml:ns:"
          + "yang:ietf-segment-routing-common"; "urn:ietf:params:xml:ns:yang:ietf-segment-routing-common";
  prefix sr-cmn;

  import ietf-inet-types {
    prefix "inet"; inet;
  }

  organization
    "IETF SPRING Working Group";
  contact
    "WG List:  <mailto:spring@ietf.org>

     Editor:    Stephane Litkowski
               <mailto:stephane.litkowski@orange.com>

     Author:    Acee Lindem
               <mailto:acee@cisco.com>
     Author:    Yingzhen Qu
               <mailto:yiqu@cisco.com>
               <mailto:yingzhen.qu@huawei.com>
     Author:    Pushpasis Sarkar
               <mailto:pushpasis.ietf@gmail.com>
     Author:    Jeff Tantsura
               <jefftant.ietf@gmail.com>

    ";
  description
    "The YANG module defines a collection of types and groupings for
     Segment routing.";

  revision 2017-03-10 {
    description
      "
       * Add support of SRLB
      ";
    reference "RFC XXXX: YANG Data Model for Segment Routing.";
  }
  revision 2016-10-28 {
    description
      "
       * Add support of MSD (Maximum SID Depth)
       * Update contact info
      ";
    reference "RFC XXXX: YANG Data Model for Segment Routing.";
  }
  revision 2016-10-24 {
    description
      "Initial";
    reference "RFC XXXX: YANG Data Model for Segment Routing.";
  }

  /* Identities */

  feature sid-last-hop-behavior {
    description
      "Configurable last hop behavior.";
  }

  identity segment-routing-transport {
    description
      "Base identity for segment routing transport.";
  }

  identity segment-routing-transport-mpls {
    base segment-routing-transport;
    description
      "This identity represents MPLS transport for segment
       routing.";
  }

  identity prefix-sid-algorithm {
    description
      "Base identity for prefix-sid algorithm.";
  }

  identity prefix-sid-algorithm-shortest-path {
    base prefix-sid-algorithm;
    description
      "The default behavior of prefix-sid algorithm.";
  }

  identity prefix-sid-algorithm-strict-spf {
    base prefix-sid-algorithm;
    description
      "This algorithm mandates that the packet is forwared
       according to ECMP-aware SPF algorithm.";
  }

  /* Features */

  feature sid-last-hop-behavior {
    description
      "Configurable last hop behavior.";
  }

  /* Groupings */

  grouping srgb-cfg {
    list srgb srlr {
      key "lower-bound upper-bound";
      ordered-by user;
    description
      "Grouping for SR Label Range configuration.";
    leaf lower-bound {
        type uint32;
        description
          "Lower value in the block.";
      }
    leaf upper-bound {
        type uint32;
        description
          "Upper value in the block.";
      }
  }

  grouping srgb-cfg {
    description
      "Grouping for SR Label Range configuration.";
    list srgb {
      key "lower-bound upper-bound";
      ordered-by user;
      description
        "List of global blocks to be
         advertised.";
      uses srlr;
    }

  }

  grouping srlb-cfg {
    description
      "Grouping for SRGB SR Local Block range configuration.";
    list srlb {
      key "lower-bound upper-bound";
      ordered-by user;
      description
        "List of SRLBs.";
      uses srlr;
    }
  }

  grouping sid-value-type {
    description
      "Defines how the SID value is expressed.";
    leaf value-type {
      type enumeration {
        enum index "index" {
          description
            "The value will be
             interpreted as an index.";
        }
        enum absolute "absolute" {
          description
            "The value will become
             interpreted as an absolute
             value.";
        }
      }
      default index; "index";
      description
        "This leaf defines how value
         must be interpreted.";
    }
        description
         "Defines how the SID value is expressed.";
  }

  grouping ipv4-sid-cfg {
    description
      "This grouping defines cfg of prefix SID.";
    leaf prefix {
      type inet:ipv4-prefix;
      description
        "connected prefix sid.";
    }
    uses prefix-sid-attributes;
  }
  grouping ipv6-sid-cfg {
    description
      "This grouping defines cfg of prefix SID.";
  }

  grouping ipv6-sid-cfg {
    leaf prefix {
      type inet:ipv6-prefix;
      description
        "connected prefix sid.";
    }
    uses prefix-sid-attributes;

    description
     "This grouping defines cfg of prefix SID.";
  }

  grouping last-hop-behavior {
    description
      "Defines last hop behavior";
    leaf last-hop-behavior {
      if-feature sid-last-hop-behavior; "sid-last-hop-behavior";
      type enumeration {
        enum explicit-null "explicit-null" {
          description
            "Use explicit-null for the SID.";
        }
        enum no-php "no-php" {
          description
            "Do no use PHP for the SID.";
        }
        enum php "php" {
          description
            "Use PHP for the SID.";
        }
      }
      description
        "Configure last hop behavior.";
    }
        description
         "Defines last hop behavior";
  }

  grouping node-capabilities {
    description
      "Containing SR node capabilities.";
    container node-capabilities {
      description
        "Shows the SR capability of the node.";
      list transport-planes {
        key transport-plane; "transport-plane";
        description
          "List of supported transport planes.";
        leaf transport-plane {
          type identityref {
            base segment-routing-transport;

          }
          description
            "Transport plane supported";
        }
        description
          "List of supported transport planes.";
      }
      leaf readable-label-stack-depth {
        type uint8;
        description
          "Number of MPLS labels that
           can be read in the stack.";
      }
      description
        "Shows the SR capability of the node.";
    } // node-capabilities
  } // sr-node-capabilities

  grouping prefix-sid-attributes {
    description
      "Containing SR attributes for a prefix.";
    uses sid-value-type;
    leaf start-sid {
      type uint32;
      mandatory true;
      description
        "Value associated with
         prefix. The value must
         be interpreted in the
         context of value-type.";
    }
    leaf range {
      type uint32;
      description
        "Describes how many SIDs could be
         allocated.";
    }
    leaf algorithm {
      type identityref {
        base prefix-sid-algorithm;
      }
      description
        "Prefix-sid algorithm.";
    }
  } //prefix-sid-attributes
}
<CODE ENDS>
<CODE BEGINS> file "ietf-segment-routing@2016-10-28.yang" "ietf-segment-routing@2017-03-10.yang"
module ietf-segment-routing {
  namespace "urn:ietf:params:xml:ns:"
          + "yang:ietf-segment-routing"; "urn:ietf:params:xml:ns:yang:ietf-segment-routing";
  prefix sr;
  import ietf-inet-types {
    prefix "inet"; inet;
  }
  import ietf-yang-types {
    prefix "yang"; yang;
  }
  import ietf-routing {
    prefix "rt"; rt;
  }
  import ietf-interfaces {
    prefix "if"; if;
  }
  import ietf-segment-routing-common {
    prefix "sr-cmn"; sr-cmn;
  }

  organization
    "IETF SPRING Working Group";
  contact
    "WG List:  <mailto:spring@ietf.org>

     Editor:    Stephane Litkowski
               <mailto:stephane.litkowski@orange.com>

     Author:    Acee Lindem
               <mailto:acee@cisco.com>
     Author:    Yingzhen Qu
               <mailto:yiqu@cisco.com>
               <mailto:yingzhen.qu@huawei.com>
     Author:    Pushpasis Sarkar
               <mailto:pushpasis.ietf@gmail.com>
     Author:    Jeff Tantsura
               <jefftant.ietf@gmail.com>

    ";
  description
    "The YANG module defines a generic configuration model for
     Segment routing common across all of the vendor
     implementations.";

  revision 2017-03-10 {
    description
      "
       * Change global-sid-list to sid-list and add a leaf scope
       * Added support of SRLB
       * Added support of local sids
       * fixed indentations
      ";
    reference "RFC XXXX: YANG Data Model for Segment Routing.";

  }
  revision 2016-10-28 {
    description
      "
       * Add support of MSD (Maximum SID Depth)
       * Update contact info
      ";
    reference "RFC XXXX: YANG Data Model for Segment Routing.";
  }
  revision 2016-10-24 {
    description
      "
       * Moved common SR types and groupings to a seperate module
      ";
    reference "RFC XXXX: YANG Data Model for Segment Routing.";
  }
  revision 2016-07-07 {
    description
      "
       * Add support of prefix-sid algorithm configuration
       * change routing-protocols to control-plane-protocols
      ";
    reference "RFC XXXX: YANG Data Model for Segment Routing.";
  }
  revision 2016-03-17 {
    description
      "
       * Add notification segment-routing-global-srgb-collision
       * Add router-id to segment-routing-global-sid-collision
       * Remove routing-instance
       * Add typedef router-id
      ";
    reference "RFC XXXX: YANG Data Model for Segment Routing.";
  }
  revision 2015-10-17 {
    description
      "
       * Add per-protocol SRGB config feature
       * Move SRBG config to a grouping
      ";
    reference "RFC XXXX: YANG Data Model for Segment Routing.";
  }
  revision 2015-06-22 {
    description
      "
       * Prefix SID config moved to
       connected-prefix-sid-map in global SR cfg
       rather than IGP.

      ";
    reference "draft-litkowski-spring-sr-yang-01";
  }
  revision 2015-04-23 {
    description
      "
       * Node flag deprecated from prefixSID
       * SR interface cfg moved to protocol
       * Adding multiple binding policies for SRMS
      ";
    reference "";
  }
  revision 2015-02-27 {
    description
      "Initial";
    reference "draft-litkowski-spring-sr-yang-00";
  }

  /* Features */

  feature mapping-server {
    description
      "Support of SRMS.";
  }

  feature protocol-srgb {
    description
      "Support per-protocol srgb configuration.";
  }

  feature msd {
    description
      "Support of signaling MSD (Maximum SID Depth) in IGP.";
  }

  /* Type Definitions */

  typedef system-id {
    type string {
      pattern
       '[0-9A-Fa-f]{4}\.[0-9A-Fa-f]{4}\.[0-9A-Fa-f]{4}\.00'; "[0-9A-Fa-f]{4}\\.[0-9A-Fa-f]{4}\\.[0-9A-Fa-f]{4}\\.00";
    }
    description
      "This type defines ISIS system id using pattern,
       system id looks like : 0143.0438.AeF0.00";
  }

  typedef router-id {
    type union {
      type system-id;
      type yang:dotted-quad;
    }
    description
      "OSPF/BGP router id or ISIS system ID.";
  }

  /* Groupings */

  grouping controlplane-cfg {
    description
      "Defines protocol configuration.";
    container segment-routing {
      description
        "segment routing global config.";
      leaf enabled {
        type boolean;
        default false; "false";
        description
          "Enables segment-routing
           protocol extensions.";
      }
      container bindings {
        description
          "Control of binding advertisement
           and reception.";
        container advertise {
          description
            "Authorize the advertise
             of local mappings in binding TLV.";
          leaf-list policies {
            type string;
            description
              "List of policies to be advertised.";
          }
          description
            "Authorize the advertise
             of local mappings in binding TLV.";
        }
        leaf receive {
          type boolean;
          default true; "true";
          description
            "Authorize the reception and usage
             of binding TLV.";
        }
        description
          "Control of binding advertisement
           and reception.";
      }

      description
        "segment routing global config.";
    }
    description
      "Defines protocol configuration.";
  }

  grouping igp-interface-cfg {
    description
      "Grouping for IGP interface cfg.";
    container segment-routing {
      description
        "container for SR interface cfg.";
      container adjacency-sid {
        description
          "Defines the adjacency SID properties.";
        list advertise-adj-group-sid {
          key group-id; "group-id";
          description
            "Control advertisement of S flag.
             Enable to advertise a common Adj-SID
             for parallel links.";
          leaf group-id {
            type uint32;
            description
              "The value is an internal value to identify
               a group-ID. Interfaces with the same
               group-ID will be bundled together.";
          }
          description
            "Control advertisement of S flag.
             Enable to advertise a common Adj-SID
             for parallel links.";
        }
        leaf advertise-protection {
          type enumeration {
            enum "single" {
              description
                "A single Adj-SID is associated
                 with the adjacency and reflects
                 the protection configuration.";
            }
            enum "dual" {
              description
                "Two Adj-SIDs will be associated
                 with the adjacency if interface
                 is protected. In this case
                 one will be enforced with
                 backup flag set, the other
                 will be enforced to backup flag unset.
                 In case, protection is not configured,
                 a single Adj-SID will be advertised
                 with backup flag unset.";
            }
          }
          description
            "If set, the Adj-SID refers to an
             adjacency being protected.";
        }
        description
          "Defines the adjacency SID properties.";
      }
      description
        "container for SR interface cfg.";
    }
    description
      "Grouping for IGP interface cfg.";
  }

  grouping msd-cfg {
    description
      "MSD configuration grouping.";

    leaf node-msd {
      type uint8;
      description
        "Node MSD is the lowest MSD supported by the node.";
    }
    container link-msd {
      description
        "Link MSD is a number represetns the particular link MSD value.";
      list link-msds {
        key interface; "interface";
        description
          "List of link MSDs.";
        leaf interface {
          type if:interface-ref;
          description
            "Name of the interface.";
        }
        leaf msd {
          type uint8;
          description
            "SID depth of the interface associated with the link.";
        }
        description
          "List of link MSDs.";
      }
      description
        "Link MSD is a number represetns the particular link MSD value.";
    }
    description
      "MSD configuration grouping.";
  }

  /* Cfg */

  augment "/rt:routing"

  notification segment-routing-global-srgb-collision {
    description
      "This augments routing-instance
       configuration with segment-routing.";
    container segment-routing notification is sent when received SRGB blocks from
       a router conflict.";
    list srgb-collisions {
      description
        "List of SRGB blocks that conflict.";
      leaf transport-type lower-bound {
        type identityref {
          base sr-cmn:segment-routing-transport;
        }
        default "sr-cmn:segment-routing-transport-mpls";
        description "Dataplane to be used.";
      }
      container msd {
        if-feature msd;
        uses msd-cfg; uint32;
        description
          "MSD configuration.";
          "Lower value in the block.";
      }
      container bindings {
        container mapping-server {
          if-feature mapping-server;
          list policy {
            key name;
      leaf name upper-bound {
        type string; uint32;
        description
                "Name of
          "Upper value in the mapping policy."; block.";
      }
            container ipv4
      leaf routing-protocol {
              list mapping-entry
        type leafref {
                key "prefix algorithm";
                uses sr-cmn:ipv4-sid-cfg;

                description
                  "Mapping entries.";
          path "/rt:routing-state/rt:control-plane-protocols/"
             + "rt:control-plane-protocol/rt:name";
        }
        description
                "IPv4 mapping entries.";
          "Routing protocol reference that received the event.";
      }
            container ipv6 {
              list mapping-entry
      leaf originating-rtr-id {
                key "prefix algorithm";
                uses sr-cmn:ipv6-sid-cfg;
                description
                  "Mapping entries.";
              }
              description
                "IPv6 mapping entries.";
            }
        type router-id;
        description
              "Definition
          "Originating router id of mapping policy."; this SRGB block.";
      }
          description
            "Configuration of mapping-server
             local entries.";
    }
        container connected-prefix-sid-map {
          container ipv4 {
            list ipv4-prefix-sid
  }
  notification segment-routing-global-sid-collision {
              key "prefix algorithm";
              uses sr-cmn:ipv4-sid-cfg;
              uses sr-cmn:last-hop-behavior;
    description
                "List of prefix
      "This notification is sent when a new mapping is learned
       , containing mapping
       where the SID
                 mapped to IPv4 local prefixes.";
            }
            description
              "Parameters associated is already used.
       The notification generation must be throttled with IPv4 prefix SID";
          }
          container ipv6 {
            list ipv6-prefix-sid at least
       a 5 second gap. ";
    leaf received-target {
              key "prefix algorithm";
              uses sr-cmn:ipv6-sid-cfg;
              uses sr-cmn:last-hop-behavior;
              description
                "List of prefix SID
                 mapped to IPv6 local prefixes.";
            }
            description
              "Parameters associated with IPv6 prefix SID";
          }
      type string;
      description
            "Prefix
        "Target received in the controlplane that
                           caused SID configuration.";
        }
        description
          "List of bindings."; collision.";
    }
      container global-srgb
    leaf new-sid-rtr-id {
        uses sr-cmn:srgb-cfg;
        description
          "Global SRGB configuration.";
      }
      type router-id;
      description
        "segment routing global config.";
    }
        "Router Id that advertising the conflicting SID.";
    }

  /* Operational states */

  augment "/rt:routing-state"
    leaf original-target {
      type string;
      description
     "This augments
        "Target already available in database that have the operational states
      with segment-routing.";
    container segment-routing {
      uses sr-cmn:node-capabilities;
      container msd {
        uses msd-cfg;
        description
          "MSD configuration state."; same SID
         as the received target.";
    }
      list label-blocks {
    leaf lower-bound original-sid-rtr-id {
      type uint32; router-id;
      description
           "Lower bound of
        "Original router ID that advertised the label block."; conflicting SID.";
    }
    leaf upper-bound index {
      type uint32;
      description
           "Upper bound
        "Value of the label block."; index used by two different prefixes.";
    }
    leaf size routing-protocol {
      type uint32; leafref {
        path "/rt:routing-state/rt:control-plane-protocols/"
           + "rt:control-plane-protocol/rt:name";

      }
      description
           "Number of indexes in
        "Routing protocol reference that received the block."; event.";
    }
  }
  notification segment-routing-index-out-of-range {
    description
      "This notification is sent when a binding
       is received, containing a segment index
       which is out of the local configured ranges.
       The notification generation must be throttled with at least
       a 5 second gap. ";
    leaf free received-target {
      type uint32; string;
      description
           "Number of indexes free
        "Target received in the block."; controlplane
                          that caused SID collision.";
    }
    leaf used received-index {
      type uint32;
      description
           "Number
        "Value of indexes used in the block."; index received.";
    }
    leaf routing-protocol {
      type leafref {
        path "/rt:routing-state/rt:control-plane-protocols/"
           + "rt:control-plane-protocol/rt:name";
      }
      description
         "List of labels blocks currently
         in use.";
        "Routing protocol reference that received the event.";
    }

      container global-sid-list
  }
  augment "/rt:routing" {
        list sid
    description
      "This augments routing-instance
       configuration with segment-routing.";
    container segment-routing {
          key "target sid source source-protocol binding-type";
          ordered-by system;
      description
        "segment routing global config.";
      leaf target transport-type {
        type string; identityref {
          base sr-cmn:segment-routing-transport;
        }
        default "sr-cmn:segment-routing-transport-mpls";
        description
             "Defines the target of the binding.
             It can
          "Dataplane to be a prefix or something else."; used.";
      }
          leaf sid
      container msd {
            type uint32;
        if-feature "msd";
        description
             "Index associated with the prefix.";
          "MSD configuration.";
        uses msd-cfg;
      }
          leaf algorithm
      container bindings {
            type uint8;
        description
             "Algorithm to be used for the prefix
             SID.";
          }
          leaf source
          "List of bindings.";
        container mapping-server {
            type inet:ip-address;
          if-feature "mapping-server";
          description
             "IP address
            "Configuration of the router than own
              the binding.";
          } mapping-server
             local entries.";
          list policy {
            key "name";
            description
              "Definition of mapping policy.";
            leaf used name {
              type boolean; string;
              description
             "Defines if
                "Name of the binding is used
              in forwarding plane."; mapping policy.";
            }
          leaf source-protocol
            container ipv4 {
            type leafref
              description
                "IPv4 mapping entries.";
              list mapping-entry {
              path "/rt:routing-state/rt:control-plane-protocols/"
                 + "rt:control-plane-protocol/rt:name";
                key "prefix algorithm";
                description
                  "Mapping entries.";
                uses sr-cmn:ipv4-sid-cfg;
              }
            }
            container ipv6 {
              description
             "Rtg protocol that owns the binding";
                "IPv6 mapping entries.";
              list mapping-entry {
                key "prefix algorithm";
                description
                  "Mapping entries.";
                uses sr-cmn:ipv6-sid-cfg;
              }
          leaf binding-type
            }
          }
        }
        container connected-prefix-sid-map {
            type enumeration
          description
            "Prefix SID configuration.";
          container ipv4 {
              enum prefix-sid
            description
              "Parameters associated with IPv4 prefix SID";
            list ipv4-prefix-sid {
              key "prefix algorithm";
              description
                 "Binding is learned from
                 a
                "List of prefix SID."; SID
                 mapped to IPv4 local prefixes.";
              uses sr-cmn:ipv4-sid-cfg;
              uses sr-cmn:last-hop-behavior;
            }
              enum binding-tlv
          }
          container ipv6 {
            description
                 "Binding is learned from
                 a binding TLV.";
              "Parameters associated with IPv6 prefix SID";
            list ipv6-prefix-sid {
              key "prefix algorithm";
              description
                "List of prefix SID
                 mapped to IPv6 local prefixes.";
              uses sr-cmn:ipv6-sid-cfg;
              uses sr-cmn:last-hop-behavior;
            }
          }
        }
        container local-prefix-sid {
          description
            "Local sid configuration.";
          container ipv4 {
            description
              "List of local ipv4 sids.";
            list ipv4-prefix-sid-local {
              key "prefix algorithm";
              description
                "List of local prefix-sid.";
              uses sr-cmn:ipv4-sid-cfg;
            }
          }
          container ipv6 {
            description
             "Type
              "List of binding."; local ipv6 sids.";
            list ipv6-prefix-sid-local {
              key "prefix algorithm";
              description
                "List of local prefix-sid.";
              uses sr-cmn:ipv6-sid-cfg;
            }
          }
        }

      }
      container global-srgb {
        description
            "Binding.";
          "Global SRGB configuration.";
        uses sr-cmn:srgb-cfg;
      }
      container srlb {
        description
         "List of prefix and SID associations.";
          "SR Local Block configuration.";
        uses sr-cmn:srlb-cfg;
      }
    }
  }
  augment "/rt:routing-state" {
    description
      "This augments the operational states
       with segment-routing.";
    container segment-routing {
      description
        "Segment routing operational states.";
    }
  }

  /* Notifications */

  notification segment-routing-global-srgb-collision
      uses sr-cmn:node-capabilities;
      container msd {
        description
          "MSD configuration state.";
        uses msd-cfg;
      }
      list srgb-collisions label-blocks {
        description
          "List of labels blocks currently
           in use.";
        leaf lower-bound {
          type uint32;
          description
            "Lower value in bound of the label block.";
        }
        leaf upper-bound {
          type uint32;
          description
            "Upper value in bound of the label block.";
        }
        leaf routing-protocol size {
          type leafref {
          path "/rt:routing-state/rt:control-plane-protocols/"
             + "rt:control-plane-protocol/rt:name";
        } uint32;
          description
          "Routing protocol reference that received
            "Number of indexes in the event."; block.";
        }
        leaf originating-rtr-id free {
          type router-id; uint32;
          description
          "Originating router id
            "Number of this SRGB indexes free in the block.";
        }
        leaf used {
          type uint32;
          description
        "List
            "Number of SRGB blocks that conflict."; indexes used in the block.";
        }
        leaf scope {
          type enumeration {
            enum "global" {
              description
      "This notification is sent when received SRGB blocks from
       a router conflict.";
                "Global sid.";
            }
  notification segment-routing-global-sid-collision
            enum "local" {
    leaf received-target
              description
                "Local sid.";
            }
          }
          description
            "Scope of this label block.";
        }
      }
      container sid-list {
      type string;
        description
      "Target received in the controlplane that
                         caused
          "List of prefix and SID collision.";
    } associations.";
        list sid {
          key "target sid source source-protocol binding-type";
          ordered-by system;
          description
            "Binding.";
          leaf new-sid-rtr-id target {
            type router-id; string;
            description
        "Router Id that advertising
              "Defines the conflicting SID."; target of the binding.
               It can be a prefix or something else.";
          }
          leaf original-target sid {
            type string; uint32;
            description
      "Target already available in database that have the same SID
      as
              "Index associated with the received target."; prefix.";
          }
          leaf original-sid-rtr-id algorithm {
            type router-id; uint8;
            description
        "Original router ID that advertised
              "Algorithm to be used for the conflicting prefix
               SID.";
          }
          leaf index source {
            type uint32; inet:ip-address;
            description
      "Value
              "IP address of the index router than own
               the binding.";
          }
          leaf used by two different prefixes."; {
            type boolean;
            description
              "Defines if the binding is used
               in forwarding plane.";
          }
          leaf routing-protocol source-protocol {
            type leafref {
              path "/rt:routing-state/rt:control-plane-protocols/"
                 + "rt:control-plane-protocol/rt:name";
            }
            description
       "Routing
              "Rtg protocol reference that received owns the event."; binding";
          }
          leaf binding-type {
            type enumeration {
              enum "prefix-sid" {
                description
      "This notification is sent when a new mapping
                  "Binding is learned
      , containing mapping
      where the SID is already used.
      The notification generation must be throttled with at least from
                   a 5 second gap. "; prefix SID.";
              }
  notification segment-routing-index-out-of-range {
    leaf received-target
              enum "binding-tlv" {
      type string;
                description
      "Target received in the controlplane
                        that caused SID collision.";
                  "Binding is learned from
                   a binding TLV.";
              }
            }
    leaf received-index {
      type uint32;
            description
      "Value
              "Type of the index received."; binding.";
          }
          leaf routing-protocol scope {
            type leafref enumeration {
        path "/rt:routing-state/rt:control-plane-protocols/" +
        "rt:control-plane-protocol/rt:name";
              enum "global" {
                description
                  "Global sid.";
              }
              enum "local" {
                description
       "Routing protocol reference that received the event.";
                  "Local sid.";
              }
            }
            description
      "This notification is sent when a binding
      is received, containing a segment index
      which
              "The sid is out of the local configured ranges.
      The notification generation must be throttled with at least
       a 5 second gap. "; or global.";

          }
        }
      }
    }
  }
}
<CODE ENDS>

8.  Security Considerations

   TBD.

9.  Acknowledgements

   Authors would like to thank Derek Yeung, Acee Lindem, Greg Hankins,
   Hannes Gredler, Uma Chunduri, Jeffrey Zhang, Shradda Hedge Hedge, Les
   Ginsberg for their contributions.

10.  IANA Considerations

   TBD.

11.  Normative References

   [I-D.ietf-spring-segment-routing]
              Filsfils, C., Previdi, S., Decraene, B., Litkowski, S.,
              and R. Shakir, "Segment Routing Architecture", draft-ietf-
              spring-segment-routing-09 (work in progress), July 2016.

   [I-D.tantsura-isis-segment-routing-msd]

   [I-D.ietf-isis-segment-routing-msd]
              Tantsura, J. and U. J., Chunduri, U., Aldrin, S., and L. Ginsberg,
              "Signaling MSD (Maximum SID Depth) using IS-IS", draft-tantsura-isis-segment-routing-
              msd-02 draft-
              ietf-isis-segment-routing-msd-02 (work in progress), September 2016.

   [I-D.tantsura-ospf-segment-routing-msd] March
              2017.

   [I-D.ietf-ospf-segment-routing-msd]
              Tantsura, J. and U. J., Chunduri, U., Aldrin, S., and P. Psenak,
              "Signaling MSD (Maximum SID Depth) using OSPF", draft-tantsura-ospf-segment-routing-
              msd-01 draft-
              ietf-ospf-segment-routing-msd-02 (work in progress), September 2016. March
              2017.

   [I-D.ietf-spring-segment-routing]
              Filsfils, C., Previdi, S., Decraene, B., Litkowski, S.,
              and R. Shakir, "Segment Routing Architecture", draft-ietf-
              spring-segment-routing-11 (work in progress), February
              2017.

   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119, March 1997.

   [RFC6020]  Bjorklund, M., "YANG - A Data Modeling Language for the
              Network Configuration Protocol (NETCONF)", RFC 6020,
              October 2010.

   [RFC7950]  Bjorklund, M., "The YANG 1.1 Data Modeling Language",
              RFC 7950, August 2016.

Authors' Addresses

   Stephane Litkowski
   Orange Business Service

   Email: stephane.litkowski@orange.com

   Yingzhen Qu
   Cisco Systems
   Huawei

   Email: yiqu@cisco.com yingzhen.qu@huawei.com

   Pushpasis Sarkar
   Individual

   Email: pushpasis.ietf@gmail.com

   Jeff Tantsura
   Individual

   Email: jefftant.ietf@gmail.com