Adding OpenConfig YANG models.

Change-Id: I0a2fdd5826e80933cf4b9ae939ff3051acec02aa
diff --git a/models/openconfig/src/main/yang/segment-routing/openconfig-rsvp-sr-ext.yang b/models/openconfig/src/main/yang/segment-routing/openconfig-rsvp-sr-ext.yang
new file mode 100644
index 0000000..6b3ddc1
--- /dev/null
+++ b/models/openconfig/src/main/yang/segment-routing/openconfig-rsvp-sr-ext.yang
@@ -0,0 +1,389 @@
+module openconfig-rsvp-sr-ext {
+  yang-version "1";
+
+  namespace "http://openconfig.net/yang/rsvp-sr-ext";
+  prefix "oc-sr-rsvp-ext";
+
+  import openconfig-extensions { prefix "oc-ext"; }
+  import openconfig-types { prefix "oc-types"; }
+  import openconfig-network-instance { prefix "oc-ni"; }
+
+  organization
+    "OpenConfig working group";
+
+  contact
+    "OpenConfig working group
+    www.openconfig.net";
+
+  description
+    "This module adds extensions to the OpenConfig MPLS models to
+    provide extensions which allow the coexistence of RSVP-TE and
+    Segment Routing (SR) within the same network. It augments the
+    existing OpenConfig segment routing (SR) and RSVP-TE models
+    where required.";
+
+  oc-ext:openconfig-version "0.1.0";
+
+  revision 2017-03-06 {
+    description
+      "Initial revision.";
+    reference "0.1.0";
+  }
+
+  grouping bandwidth-measurement-global-state {
+    description
+      "Operational state parameters for bandwidth measurement which
+      apply globally to the device.";
+
+    leaf effective-adjustment-interval {
+      type uint32;
+      units "seconds";
+      description
+        "The effective adjustment interval that is being used by
+        the system. In the case that the adjustment-interval leaf
+        is set to a non-integer multiple of the collection-interval,
+        and the system does not support this, the value of this leaf
+        should reflect the effective value of the adjustment interval
+        that it has selected. In the case where no rounding of the
+        adjustment interval has occurred, this value should have the
+        same value as the adjustment-inerval leaf.";
+    }
+  }
+
+  grouping bandwidth-measurement-global-config {
+    description
+      "Configuration parameters for bandwidth measurement which apply
+      globally to the device.";
+
+    leaf measure-sr-traffic {
+      type boolean;
+      description
+        "When this leaf is set to true, the local system should
+        measure the bandwidth utilisation of SR traffic on interfaces
+        for which TED entries are being generated.
+
+        In the case that this functionality is enabled, traffic
+        forwarded using LFIB entries that correspond to MPLS
+        labels which correspond to SR SIDs should be accounted
+        for.";
+      reference
+        "draft-sitaraman-sr-rsvp-coexistence-rec-01";
+    }
+
+    // TODO(robjs): For future extension, traffic accounting for
+    // non-SR, non-RSVP traffic could be added here. e.g., LDP,
+    // BGP-LU etc.
+
+    leaf collection-interval {
+      type uint32;
+      units "seconds";
+      description
+        "The interval at which the collection of interface
+        statistics relating to non-RSVP-TE traffic should be
+        performed";
+      reference
+        "draft-sitaraman-sr-rsvp-coexistence-rec-01";
+    }
+
+    leaf adjustment-interval {
+      type uint32;
+      units "seconds";
+      description
+        "The interval after which an adjustment to the utilised
+        bandwidth on the interface is made. This value must be
+        greater than, or equal to, the collection interval for
+        statistics.  This value is referred to as N in
+        draft-sitaraman-sr-rsvp-coexistence-rec-01.
+
+        After N seconds have expired, the
+        arithmetic mean of the samples is taken, and this is
+        considered as the non-RSVP-TE utilisation of the
+        interface. In the case that the adjustment interval is
+        an integer >1 multiple of the collection interval, this
+        serves to provide smoothing of the collected bandwidth
+        statistics.";
+      reference
+        "draft-sitaraman-sr-rsvp-coexistence-rec-01";
+    }
+
+    leaf bandwidth-multiplier {
+      type decimal64 {
+        fraction-digits 4;
+      }
+      default 1.0000;
+      description
+        "A multiplier applied to the sampled bandwidth which
+        determines the value that is propagated to the IGP TED.
+        By default this value is 1.0000, and hence the actual
+        sampled value is flooded.";
+    }
+  }
+
+  grouping bandwidth-measurement-update-config {
+    description
+      "Configuration parameters related to when the bandwidth
+      measurement information is used to update the IGP TED.";
+
+    leaf update-trigger {
+      type enumeration {
+        enum ADJUSTED_MAX_RESERVABLE_PCT {
+          description
+            "Update of a new maximum reservable bandwidth IGP
+            TLV is based on the value changing >= X% of
+            the currently flooded adjusted-absolute-subscription-bw.
+            The percentage of this value that is used is specified
+            by the adjusted-max-reservable-bw-pct leaf.";
+        }
+        enum SR_TRAFFIC_PCT {
+          description
+            "Update of the new maximum reservable bandwidth IGP
+            TLV is based on the value changing >= X% of the last
+            calculated segment routing traffic utilisation for the
+            interface. The percentage delta of this value is
+            specified by the sr-traffic-pct leaf.";
+        }
+      }
+      description
+        "The trigger that should be used to determine when the IGP
+        TED is updated with new information as to the effective
+        maximum reservable bandwidth
+        (adjusted-absolute-subscription-bw)";
+    }
+
+    leaf adjusted-max-reservable-bw-pct {
+      when "../update-trigger = 'ADJUSTED_MAX_RESERVABLE_PCT'" {
+        description
+          "Only allow the adjusted-max-reservable-bw update trigger
+          to be specified when the update-trigger mode is specified
+          to be a percentage of the currently flooded value.";
+      }
+      type oc-types:percentage;
+      description
+        "The delta in the adjusted-max-reservable-bandwidth that
+        should trigger an update in the value which is flooded
+        through the IGP TED.
+        The delta is measured as a percentage of the
+        current adjusted value of the maximum reservable bandwidth
+        of the interface, as specified by the
+        adjusted-absolute-subscription-bw RSVP-TE leaf.";
+      reference
+        "draft-sitaraman-sr-rsvp-coexistence-rec-01";
+    }
+
+    leaf sr-traffic-pct {
+      when "../update-trigger = 'SR_TRAFFIC_PCT'" {
+        description
+          "Only allow the SR traffic percentage trigger to be
+          specified when the update trigger is defined to be a
+          percentage of the last calculated SR traffic value.";
+      }
+      type oc-types:percentage;
+      description
+        "The change in the calculated SR traffic on the interface
+        that should trigger an update in the value of the
+        maximum reservable bandwidth flooded through the IGP TED.
+        The value is specified as a percentage of the
+        last-calculated-sr-traffic state leaf.";
+    }
+  }
+
+  grouping bandwidth-measurement-global-structural {
+    description
+      "Structural grouping for the measurement of segment routing
+      traffic, and its advertisement into the IGP TED.";
+
+    container bandwidth-measurement {
+      description
+        "Configuration and operational state parameters related to
+        how bandwidth utilisation is measured and flooded into the
+        IGP.";
+
+      container config {
+        description
+          "Configuration parameters relating to bandwidth
+          measurement.";
+
+        uses bandwidth-measurement-global-config;
+      }
+
+      container state {
+        config false;
+        description
+          "Operational state parameters relating to bandwidth
+          measurement";
+
+        uses bandwidth-measurement-global-config;
+        uses bandwidth-measurement-global-state;
+      }
+
+      container update-trigger {
+        description
+          "Configuration and operational state parameters related
+          to the update trigger for flooding new bandwidth
+          information into the IGP.";
+
+        container config {
+          description
+            "Configuration parameters related to the bandwidth
+            measurement update trigger.";
+
+          uses bandwidth-measurement-update-config;
+        }
+
+        container state {
+          config false;
+          description
+            "Operational state parameters related to the bandwidth
+            measurement update trigger.";
+
+          uses bandwidth-measurement-update-config;
+        }
+      }
+    }
+  }
+
+  augment "/oc-ni:network-instances/oc-ni:network-instance/" +
+          "oc-ni:mpls/oc-ni:te-global-attributes" {
+    description
+      "Add the bandwidth measurement parameters to MPLS global
+      traffic engineering hierarchy.";
+
+    uses bandwidth-measurement-global-structural;
+  }
+
+  grouping bandwidth-measurement-rsvp-te-adjusted-state {
+    description
+      "Logical grouping augmented into the RSVP-TE hierarchy to
+      provide an operational state value which reflects the
+      adjusted RSVP-TE available bandwidth.";
+
+    leaf adjusted-absolute-subscription-bw {
+      type uint64;
+      units "kbps";
+      description
+        "The adjusted absolute value (in kbps) of the
+        bandwidth which is reservable to RSVP-TE on the
+        local system. In the case that the bandwidth-measurement
+        configuration does not account for non-RSVP-TE traffic
+        then this value is equal to the
+        calculated-absolute-subscription-bw, in the case that
+        non-RSVP-TE traffic is being accounted for, it is lower
+        such that calculated-absolute-subscription-bw -
+        adjusted-absolute-subscription-bw = the current calculated
+        non-RSVP-TE traffic.
+
+        This value reflects the last flooded value of the maximum
+        reservable bandwidth, or subscription.";
+    }
+  }
+
+  augment "/oc-ni:network-instances/oc-ni:network-instance/" +
+    "oc-ni:mpls/oc-ni:signaling-protocols/oc-ni:rsvp-te/" +
+    "oc-ni:interface-attributes/oc-ni:interface/" +
+    "oc-ni:subscription/oc-ni:state" {
+
+    description
+      "Augmentation to add the adjusted RSVP-TE available bandwidth
+      state to the RSVP-TE signaling protocol.";
+
+    uses bandwidth-measurement-rsvp-te-adjusted-state;
+  }
+
+  grouping bandwidth-measurement-intf-structural {
+    description
+      "Structural grouping containing interface bandwidth
+      measurement configuration and operational state
+      parameters.";
+
+    container bandwidth-measurement {
+      description
+        "Configuration and operational state parameters relating to
+        per-interface bandwidth measurement. These parameters are
+        used in the case that RSVP-TE coexists with other MPLS
+        signaling protocols on an interface.";
+
+      container state {
+        config false;
+        description
+          "Operational state parameters relating to the containing
+          interface's bandwidth measurement.";
+
+        uses bandwidth-measurement-intf-state;
+      }
+    }
+  }
+
+  grouping bandwidth-measurement-intf-state {
+    description
+      "Operational state parameters per-interface for the measured
+      bandwidth on an interface";
+
+    leaf last-sample-time {
+      type oc-types:timeticks64;
+      description
+        "The time at which the last sample of bandwidth utilisation
+        for both RSVP-TE and non-RSVP-TE traffic was taken. This value
+        is represented in nanoseconds since the Unix epoch.";
+    }
+
+    leaf last-sample-measured-rsvp-util {
+      type uint64;
+      units "kbps";
+      description
+        "The measured RSVP-TE bandwidth utilisation at the last sample
+        (whose time is indicated in last-sample-time). This value is
+        expressed as a 64-bit unsigned integer representing the number
+        of kilobits per second that RSVP-TE traffic is consuming on
+        the interface.";
+    }
+
+    leaf last-sample-measured-sr-util {
+      type uint64;
+      units "kbps";
+      description
+        "The measured Segment Routing bandwidth utilisation at the
+        last sample (whose time is indicated in last-sample-time).
+        This value is expressed as a 64-bit unsigned integer
+        representing the number of kilobits per second that Segment
+        Routing traffic is consuming on the interface.";
+    }
+
+    leaf last-calculated-time {
+      type oc-types:timeticks64;
+      description
+        "The time at which the last calculated value for bandwidth
+        utilisation was performed.";
+    }
+
+    leaf last-calculated-sr-utilisation {
+      type uint64;
+      description
+        "The last calculated value of the Segment Routing  utilisation
+        (taken post any averaging or adjustment that occurs). This
+        value is updated regardless of whether the value was flooded
+        or not.";
+    }
+
+    leaf last-flooded-time {
+      type oc-types:timeticks64;
+      description
+        "The time, expressed in nanoseconds since the epoch, at which
+        the bandwidth utilisation of non-RSVP-TE traffic resulted in
+        the value being flooded in the IGP. If the configuration of the
+        local system specifies a 0% change requires flooding, this leaf
+        will always reflect the value of the last-calculated-time. In
+        systems that have suppression due to a >0% delta being required
+        then it indicates the last time that the percentage threshold
+        was exceeded.";
+    }
+  }
+
+  augment "/oc-ni:network-instances/oc-ni:network-instance/oc-ni:mpls" +
+          "/oc-ni:te-interface-attributes/oc-ni:interface" {
+    description
+      "Augment the per-interface bandwidth measurement parameters into the
+      MPLS hierarchy of network instance.";
+
+    uses bandwidth-measurement-intf-structural;
+  }
+}
diff --git a/models/openconfig/src/main/yang/segment-routing/openconfig-segment-routing.yang b/models/openconfig/src/main/yang/segment-routing/openconfig-segment-routing.yang
new file mode 100644
index 0000000..f19b2d8
--- /dev/null
+++ b/models/openconfig/src/main/yang/segment-routing/openconfig-segment-routing.yang
@@ -0,0 +1,780 @@
+module openconfig-segment-routing {
+
+  yang-version "1";
+
+  // namespace
+  namespace "http://openconfig.net/yang/sr";
+  prefix "oc-sr";
+
+  // import some basic types
+  import openconfig-extensions { prefix "oc-ext"; }
+  import openconfig-mpls-types { prefix "oc-mpls-t"; }
+  import openconfig-interfaces { prefix "oc-if"; }
+  import ietf-inet-types { prefix "inet"; }
+  import ietf-yang-types { prefix "yang"; }
+
+  // meta
+  organization "OpenConfig working group";
+
+  contact
+    "OpenConfig working group
+    netopenconfig@googlegroups.com";
+
+  description
+    "Configuration and operational state parameters relating to the
+    segment routing. This module defines a number of elements which are
+    instantiated in multiple places throughout the OpenConfig collection
+    of models.
+
+    Particularly:
+      - SRGB+LB dataplane instances - directly instantied by SR.
+      - SRGB+LB dataplane reservations - instantiated within MPLS and future SR
+                                      dataplanes.
+      - SR SID advertisements - instantiated within the relevant IGP.
+      - SR-specific counters - instantied within the relevant dataplane.";
+
+  oc-ext:openconfig-version "0.0.3";
+
+  revision "2017-01-12" {
+    description
+      "Minor compliance fixes.";
+    reference "0.0.3";
+  }
+
+  revision "2016-12-15" {
+    description
+      "Updated revision of SR module.";
+    reference "0.0.2";
+  }
+
+  revision "2016-07-28" {
+    description
+      "Initial revision of SR module.";
+    reference "0.0.1";
+  }
+
+  typedef sr-dataplane-type {
+    type enumeration {
+      enum MPLS {
+        description
+          "The entity uses MPLS labels as Segment Identifiers.";
+      }
+      enum IPV6 {
+        description
+          "The entity uses IPv6 prefixes as Segment Identifiers.";
+      }
+    }
+    description
+      "Types of data plane that can be used to instantiate a Segment
+      Routing block of SIDs.";
+  }
+
+  typedef sr-sid-type {
+    type union {
+      type oc-mpls-t:mpls-label;
+      type inet:ipv6-address-no-zone;
+    }
+    description
+      "The defined value of a segment identifier.";
+  }
+
+  grouping srgb-config {
+    description
+      "Configuration parameters relating to the SRGB.";
+
+    leaf local-id {
+      type string;
+      description
+        "Unique identifier for the segment routing global block on
+        the local system.";
+    }
+
+    leaf dataplane-type {
+      type sr-dataplane-type;
+      description
+        "The dataplane being used to instantiate the SRGB. When MPLS is specified
+        the set of MPLS label blocks that are defined in the mpls-label-blocks
+        list are used to make up the SRGB. When IPv6 is specified, the set of IPv6
+        prefixes specified in the ipv6-prefixes list are used.";
+    }
+
+    leaf-list mpls-label-blocks {
+      when "../dataplane-type = 'MPLS'" {
+        description
+          "Allow the MPLS label block to be specified only for SRGBs that are
+          using the MPLS dataplane.";
+      }
+      type leafref {
+        // We are at /network-instances/network-instance/segment-routing/
+        // srgbs/srgb/config/mpls-label-blocks
+        path "../../../../../mpls/global/reserved-label-blocks/" +
+             "reserved-label-block/config/local-id";
+      }
+      description
+        "A list of refences to the label blocks that are used to make
+        up the SRGB.";
+    }
+
+    leaf-list ipv6-prefixes {
+      when "../dataplane-type = 'IPV6'" {
+        description
+          "Allow IPv6 prefixes to be specified only when the dataplane
+          realisation of the SRGB is IPv6.";
+      }
+      type inet:ipv6-prefix;
+      description
+        "A list of IPv6 prefixes which are to be used for segment routing using
+        the IPv6 dataplane.";
+    }
+  }
+
+  grouping srgb-state {
+    description
+      "Operational state parameters relating to the SRGB.";
+
+    leaf size {
+      type uint32;
+      description
+        "The total number of SRGB entries that are available within the SRGB.";
+    }
+
+    leaf used {
+      type uint32;
+      description
+        "The total number of SRGB entries that have already been alocated by
+        protocols referencing the SRGB.";
+    }
+  }
+
+  grouping srlb-config {
+    description
+      "Configuration parameters relating to an SRLB.";
+
+    leaf local-id {
+      type string;
+      description
+        "A unique local identifier used for the Segment Routing Local Block.
+        The identifier is used when referencing the SRLB within other
+        contexts.";
+    }
+
+    leaf dataplane-type {
+      type sr-dataplane-type;
+      description
+        "The dataplane that is to be used for the Segment Routing Local Block.
+        When MPLS is specified, the local block corresponds to a block of MPLS
+        labels; when IPv6 is specified it corresponds to an IPv6 prefix.";
+    }
+
+    leaf mpls-label-block {
+      when "../dataplane-type = 'MPLS'" {
+        description
+          "Allow the MPLS label block to be specified only for SRLBs that are
+          using the MPLS dataplane.";
+      }
+      type leafref {
+        path "../../../../../mpls/global/reserved-label-blocks/" +
+             "reserved-label-block/config/local-id";
+      }
+      description
+        "A reference to the MPLS label block that is used to contain the
+        SIDs of the SRLB.";
+    }
+
+    leaf ipv6-prefix {
+      when "../dataplane-type = 'IPV6'" {
+        description
+          "Allow IPv6 prefixes to be specified only when the dataplane
+          realisation of the SRGB is IPv6.";
+      }
+      type inet:ipv6-prefix;
+      description
+        "The IPv6 prefix that is used for the SRLB.";
+    }
+  }
+
+  grouping sr-structural {
+    description
+      "Top-level structural grouping defining Segment Routing Global Blocks.";
+
+    container srgbs {
+      description
+        "Configuration and operational state parameters relating to the
+        SRGBs defined for the system.";
+
+      list srgb {
+        key "local-id";
+
+        description
+          "A single definition of an SRGB which may comprise of multiple
+          sets of dataplane addresses (IPv6 addresses, or MPLS labels).";
+
+        leaf local-id {
+          type leafref {
+            path "../config/local-id";
+          }
+          description
+            "A reference to the identifier for the SRGB.";
+        }
+
+        container config {
+          description
+            "Configuration parameters relating to the SRGB.";
+          uses srgb-config;
+        }
+
+        container state {
+          config false;
+          description
+            "State parameters relating to the SRGB.";
+          uses srgb-config;
+          uses srgb-state;
+        }
+      }
+    }
+
+    container srlbs {
+      description
+        "Configuration and operational state parameters relating to the
+        Segment Routing Local Blocks (SRLBs) defined for the system.";
+
+      list srlb {
+        key "local-id";
+
+        description
+          "A definition of a Segment Routing Local Block, defined to be
+          a set of Segment Identifiers (specified as MPLS labels or
+          IPv6 addreses) that are defined for local allocation by the
+          system. A block may optionally be advertised into an IGP.";
+
+        leaf local-id {
+          type leafref {
+            path "../config/local-id";
+          }
+          description
+            "Reference to the local identifier used for the SRLB.";
+        }
+
+        container config {
+          description
+            "Configuration parameters relating to the SRLB.";
+          uses srlb-config;
+        }
+
+        container state {
+          config false;
+          description
+            "Operational state parmeters relating to the SRLB.";
+          uses srlb-config;
+        }
+      }
+    }
+  }
+
+  grouping sr-mpls-top {
+    description
+      "Structural grouping defining SR definition within MPLS.";
+
+    container segment-routing {
+      description
+        "MPLS-specific Segment Routing configuration and operational state
+        parameters";
+
+      container aggregate-sid-counters {
+        description
+          "Per-SID counters aggregated across all interfaces on the local system";
+
+        list aggregate-sid-counter {
+          key "mpls-label";
+          config false;
+
+          description
+            "Counters aggregated across all of the interfaces of the local
+            system corresponding to traffic received or forwarded with a
+            particular SID";
+
+          leaf mpls-label {
+            type leafref {
+              path "../state/mpls-label";
+            }
+            description
+              "The MPLS label representing the segment identifier";
+          }
+
+          container state {
+            config false;
+            description
+              "State parameters for per-SID statistics";
+            uses sr-mpls-sid-counters-state;
+            uses sr-mpls-common-counters;
+          }
+        }
+      }
+
+      container interfaces {
+        description
+          "Interface related Segment Routing parameters.";
+
+        list interface {
+          key "interface-id";
+
+          description
+            "Parameters and MPLS-specific configuration relating to Segment
+            Routing on an interface.";
+
+          leaf interface-id {
+            type leafref {
+              path "../config/interface-id";
+            }
+            description
+              "A reference to the ID for the interface for which SR is
+              configured";
+          }
+
+          container config {
+            description
+              "MPLS-specific Segment Routing configuration parameters
+              related to an interface.";
+            uses sr-mpls-interface-config;
+          }
+
+          container state {
+            config false;
+            description
+              "MPLS-specific Segment Routing operational state parameters
+              related to an interface.";
+            uses sr-mpls-interface-config;
+            uses sr-mpls-interface-state;
+          }
+
+          container sid-counters {
+            description
+              "Per-SID statistics for MPLS";
+
+            list sid-counter {
+              key "mpls-label";
+              config false;
+
+              description
+                "Per segment identifier counters for the MPLS dataplane.";
+
+              leaf mpls-label {
+                type leafref {
+                  path "../state/mpls-label";
+                }
+                description
+                  "The MPLS label representing the segment identifier";
+              }
+
+              container state {
+                config false;
+                description
+                  "State parameters for per-SID statistics";
+                uses sr-mpls-sid-counters-state;
+                uses sr-mpls-common-counters;
+              }
+
+              container forwarding-classes {
+                description
+                  "Per-SID per-forwarding class counters for Segment Routing.";
+
+                list forwarding-class {
+                  key "exp";
+                  config false;
+
+                  description
+                    "SID entries for the forwarding class associated with the
+                    referenced MPLS EXP.";
+
+                  leaf exp {
+                    type leafref {
+                      path "../state/exp";
+                    }
+                    description
+                      "Reference to the value of the EXP bits of the segment
+                      identifier.";
+                  }
+
+                  container state {
+                    config false;
+                    description
+                      "Per-SID, per forwarding class counters for Segment Routing
+                      with the MPLS dataplane";
+
+                    uses sr-mpls-interface-sid-fc-state;
+                    uses sr-mpls-common-counters;
+                  }
+                }
+              }
+            }
+          }
+          uses oc-if:interface-ref;
+        }
+      }
+    }
+  }
+
+  grouping sr-mpls-interface-config {
+    description
+      "MPLS-specific Segment Routing configuration for an interface";
+
+    leaf interface-id {
+      type string;
+      description
+        "A unique identifier for the interface.";
+    }
+  }
+
+  grouping sr-mpls-interface-state {
+    description
+      "MPLS-specific Segment Routing operational state parameters for an
+      interface";
+
+    uses sr-mpls-common-counters;
+  }
+
+  grouping sr-mpls-interface-sid-fc-state {
+    description
+      "Per-SID per forwarding class statistics for SR with the MPLS dataplane";
+
+    leaf exp {
+      type uint8 {
+        range "0..7";
+      }
+      description
+        "The value of the MPLS EXP (experimental) or Traffic Class bits that the
+        SID statistics relate to. Packets received with a MPLS label value
+        equal to the SID's MPLS label and EXP bits equal to the this value
+        should be counted towards the associated ingress statistics. Packets
+        that are forwarded to the destination MPLS label corresponding to the
+        SID should be counted towards this value. In the egress direction, where
+        forwarding follows a SID value that requires PHP at the local node,
+        packets should still be counted towards the egress counters.";
+    }
+  }
+
+  grouping sr-mpls-sid-counters-state {
+    description
+      "Per-SID statistics leaves";
+
+    leaf mpls-label {
+      type oc-mpls-t:mpls-label;
+      description
+        "The MPLS label used for the segment identifier";
+    }
+  }
+
+  grouping sr-mpls-common-counters {
+    description
+      "Per segment identifier counters used in the model";
+
+      leaf in-pkts {
+        type yang:counter64;
+        description
+          "A cumulative counter of the packets received within the context
+          which have matched a label corresponding to an SR Segment Identifier.";
+      }
+
+      leaf in-octets {
+        type yang:counter64;
+        description
+          "The cumulative counter of the total bytes received within the context
+          which have matched a label corresponding to an SR Segment Identifier";
+      }
+
+      leaf out-pkts {
+        type yang:counter64;
+        description
+          "A cumulative counter of the total number of packets transmitted by
+          the local system within the context which have a label imposed that
+          corresponds to an Segment Identifier.";
+      }
+
+      leaf out-octets {
+        type yang:counter64;
+        description
+          "A cumulative counter of the total bytes transmitted by the local
+          system within the context which have a label imported that
+          corresponds to an SR Segment Identifier.";
+      }
+  }
+
+  grouping sr-igp-config {
+    description
+      "Configuration parameters relating to segment routing within an
+      IGP.";
+
+    leaf enabled {
+      type boolean;
+      description
+        "When this leaf is set to true, the segment routing extensions are
+        utilised within the IGP.";
+    }
+
+    leaf srgb {
+      type leafref {
+        path "../../../../../../../segment-routing/srgbs/srgb/config/local-id";
+      }
+      description
+        "A reference to the Segment Routing Global Block (SRGB) that is
+        to be used by this IGP instance.";
+    }
+
+    leaf srlb {
+      // Leaf is defined at
+      // /network-instances/network-instance/protocols/protocol/<igp>/global/
+      // segment-routing/config
+      type leafref {
+        path "../../../../../../../segment-routing/srlbs/srlb/config/local-id";
+      }
+      description
+        "A reference to the Segment Routing Local Block (SRLB) that is to
+        be advertised by the IGP instance.";
+    }
+  }
+
+  grouping sr-igp-top {
+    description
+      "Per-instance configuration and state parameters for Segment Routing
+      in an IGP.";
+
+    container segment-routing {
+      description
+        "Configuration and operational state relating to segment routing.";
+
+      container config {
+        description
+          "Configuration parameters relating to the configuration of segment
+          routing for the IGP instance.";
+        uses sr-igp-config;
+      }
+
+      container state {
+        config false;
+        description
+          "Operational state parameters relating to segment routing for the
+          IGP instance.";
+        uses sr-igp-config;
+      }
+    }
+  }
+
+  grouping sr-igp-interface-prefix-sid-config {
+    description
+      "Configuration parameters relating to an IGP prefix SID advertisement";
+
+    leaf prefix {
+      type inet:ip-prefix;
+      description
+        "The IP prefix for which the IGP prefix SID should be advertised. The
+        value specified is a local prefix on the interface which is advertised
+        into the IGP.";
+    }
+
+    leaf sid-id {
+      type sr-sid-type;
+      description
+        "The Segment Identifier to be used when advertising the IGP Prefix SID.";
+    }
+
+    leaf label-options {
+      type enumeration {
+        enum NO_PHP {
+          description
+            "When this value is specified, the penultimate hop must not pop
+            the Prefix-SID label before forwarding it to the local system.";
+        }
+        enum EXPLICIT_NULL {
+          description
+            "When set, the penultimate hop must swap the prefix SID for the
+            relevant explicit null label before forwarding the packet.";
+        }
+      }
+      description
+        "The options associated with the IGP prefix SID for MPLS. The value
+        of this leaf specifies the option that the SID should be advertised
+        into the IGP with.";
+    }
+  }
+
+  grouping sr-igp-interface-adjsid-config {
+    description
+      "Configuration parameters relating to an Adj-SID on an interface";
+
+    leaf sid-id {
+      type union {
+        type sr-sid-type;
+        type enumeration {
+            enum DYNAMIC {
+              description
+                "The SID chosen for the Adjacency SID should be dynamically
+                allocated from the system's dynamic range of Segment
+                Identifiers. For MPLS, this range should be considered to be
+                those labels that do not fall within a reserved label block.";
+            }
+        }
+      }
+      description
+        "The value of the Adj-SID to be advertised. Where a static SID
+        identifier is specified, this should be advertised directly by the
+        system. Where the DYNAMIC value is specified, this should be treated
+        as a dynamically allocated value. When the MPLS data plane is in use
+        the dynamic value should not fall within a reserved-label-block.";
+    }
+
+    leaf protection-eligible {
+      type boolean;
+      default true;
+      description
+        "Whether the Adj-SID should be considered to be eligible for protection
+        using IP or MPLS FRR during a network failure. When this value is set to
+        true, the B-flag of the Adj-SID is set to 1, and the local system should
+        provide FRR paths for the associated label forwarding entry. When it is
+        set to false, the local system must not provide FRR for the specified
+        LFIB entry.";
+    }
+
+    leaf group {
+      type boolean;
+      default false;
+      description
+        "When set to true, the Adj-SID is indicated to be part of a group, and
+        the G flag is set to 1 in the corresponding advertisement in the IGP.";
+    }
+
+    leaf neighbor {
+      type inet:ip-address;
+      description
+        "The remote system on the interface with which the Adj-SID is
+        associated.";
+    }
+  }
+
+  grouping sr-igp-interface-adjsid-state {
+    description
+      "Operational state parameters relating to the adjacency SID for an
+      interface";
+
+    leaf allocated-dynamic-local {
+      type sr-sid-type;
+      description
+        "Where an Adjacency SID with a dynamic value is to be allocated by
+        the system, this leaf reports to the value of the Adj-SID allocated
+        to this interface.";
+    }
+  }
+
+  grouping sr-igp-interface-top {
+    description
+      "Per-interface configuration and operational state relating to an
+      interface within the IGP.";
+
+    container segment-routing {
+      description
+        "Configuration and operatioanl state parameters relating to segment
+        routing for an interface within the IGP.";
+
+      container prefix-sids {
+        description
+          "Configuration and operational state parameters relating to
+          the advertisement of a segment routing IGP-Prefix SID for this
+          interface.";
+
+        list prefix-sid {
+          key "prefix";
+
+          description
+            "An IGP prefix that should have a segment routing IGP-Prefix SID
+            allocated to it. The value of the SID is specified by the SID ID,
+            as an absolute value. If the absolute value falls within the SRGB,
+            the Global flag should be advertised by the system.";
+
+          leaf prefix {
+            type leafref {
+              path "../config/prefix";
+            }
+            description
+              "Reference to the prefix for which the IGP-Prefix SID is to be
+              advertised";
+          }
+
+          container config {
+            description
+              "Configuration parameters for the IGP Prefix SID.";
+            uses sr-igp-interface-prefix-sid-config;
+          }
+
+          container state {
+            config false;
+            description
+              "Operational state parameters for the IGP-Prefix SID.";
+            uses sr-igp-interface-prefix-sid-config;
+          }
+        }
+      }
+
+      container adjacency-sids {
+        description
+          "Configuration and operational state parameters relating to
+          the advertisement of a segment routing adjacency SID for this
+          interface.";
+
+        list adjacency-sid {
+          key "neighbor sid-id";
+
+          description
+            "An Adjacency SID to be advertised for the specified interface.
+            The Adj-SID's identifier (the SID ID) must be unique, with flags
+            specified indicating the parameters that should be set for the SID.
+            Where a SID value is specified that is allocated from the SRGB, the
+            global flag must be set by the system.";
+
+          leaf sid-id {
+            type leafref {
+              path "../config/sid-id";
+            }
+            description
+              "Reference to the segment identifier to be used by the local
+              system.";
+          }
+
+          leaf neighbor {
+            type leafref {
+              path "../config/neighbor";
+            }
+            description
+              "Reference to the neighbor with which the Adjacency SID is
+              associated.";
+          }
+
+          container config {
+            description
+              "Configuraton parameters relating to the AdjSID.";
+            uses sr-igp-interface-adjsid-config;
+          }
+
+          container state {
+            config false;
+            description
+              "Operational state parameters relating to the AdjSID.";
+            uses sr-igp-interface-adjsid-config;
+            uses sr-igp-interface-adjsid-state;
+          }
+        }
+      }
+    }
+  }
+
+  grouping sr-top {
+    description
+      "Top level grouping for Segment Routing";
+
+    container segment-routing {
+      description
+        "Configuration and operational state parameters relating to
+        segment routing.";
+
+      uses sr-structural;
+    }
+  }
+}