module openconfig-segment-routing-types {
  yang-version 1;
  namespace "http://openconfig.net/yang/segment-routing-types";
  prefix oc-srt;

  import openconfig-extensions {
    prefix oc-ext;
  }
  import openconfig-mpls-types {
    prefix oc-mplst;
  }
  import openconfig-inet-types {
    prefix oc-inet;
  }

  organization
    "OpenConfig working group";
  contact
    "OpenConfig working group
     www.openconfig.net";
  description
    "Types associated with a network instance";

  revision 2020-02-04 {
    description
      "Consistent prefix for openconfig-mpls-types.";
    reference
      "0.2.0";
  }
  revision 2019-09-24 {
    description
      "Initial revision of the SR types.";
    reference
      "0.1.0";
  }

  oc-ext:openconfig-version "0.2.0";

  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-mplst:mpls-label;
      type oc-inet:ipv6-address;
    }
    description
      "The defined value of a segment identifier.";
  }

  typedef srte-protocol-type {
    type enumeration {
      enum "PCEP" {
        value 10;
        description
          "Path Computation Element Protocol.";
      }
      enum "BGP" {
        value 20;
        description
          "BGP SR policy.";
      }
      enum "CONFIG" {
        value 30;
        description
          "Local configuration.";
      }
    }
    description
      "The component or protocol that originates or signals the
       candidate path.";
    reference
      "Section 2.3 of draft-ietf-spring-segment-routing-policy.";
  }

  typedef srte-endpoint-type {
    type oc-inet:ip-address;
    description
      "SR-TE endpoint is the policy destination which can be either an
       IPv4 or IPv6 address.";
    reference
      "draft-ietf-spring-segment-routing-policy";
  }

  typedef srte-invalid-sl-reason {
    type enumeration {
      enum "EMPTY_SL" {
        description
          "Segment-list is empty.";
      }
      enum "ZERO_WEIGHT" {
        description
          "Segment-list weight is 0.";
      }
      enum "FIRST_SID_UNRESOLVABLE" {
        description
          "The headend is unable to perform path resolution for the
           first SID into one or more outgoing interface(s) and
           next-hop(s).";
      }
      enum "OTHER_SID_UNRESOLVABLE" {
        description
          "The headend is unable to perform SID resolution for any
           non-first SID of type 3-through-11 into an MPLS label or
           an SRv6 SID.";
      }
      enum "VERIFICATION_FAIL" {
        description
          "The headend verification fails for any SID for which
           verification has been explicitly requested.";
      }
    }
    description
      "The list of segment-list invalid reasons.";
    reference
      "draft-ietf-spring-segment-routing-policy";
  }

  typedef enlp-type {
    type enumeration {
      enum "PUSH_IPV4_EXPLICIT_NULL" {
        description
          "Push an IPv4 Explicit NULL label on an unlabeled IPv4
           packet but not IPv6 one.";
      }
      enum "PUSH_IPV6_EXPLICIT_NULL" {
        description
          "Push an IPv6 Explicit NULL label on an unlabeled IPv4
           packet but not IPv4 one.";
      }
      enum "PUSH_IPV46_EXPLICIT_NULL" {
        description
          "Push an IPv4 Explicit NULL label on both unlabeled IPv4
           packet and IPv6 packet.";
      }
      enum "NO_EXPLICIT_NULL" {
        description
          "Do not push an Explicit NULL label.";
      }
    }
    description
      "The list of possible ENLP(Explicit NULL Label Policy) values.";
    reference
      "draft-ietf-idr-segment-routing-te-policy";
  }
}