module Cisco-IOS-XR-types {

  namespace "http://cisco.com/ns/yang/cisco-xr-types";
  prefix "xr";

  organization "Cisco Systems, Inc.";

  contact 
    "Cisco Systems, Inc.
     Customer Service

     Postal: 170 W Tasman Drive
     San Jose, CA 95134

     Tel: +1 1800 553-NETS

     E-mail: cs-yang@cisco.com";


  description       
    "This module contains a collection of IOS-XR derived YANG data 
     types.
    
     Copyright (c) 2013-2015 by Cisco Systems, Inc.
     All rights reserved.";

  revision "2015-01-19" {
    description
     "This revision adds the following new data types:
      - Bgp-ipv4-flowspec-address
      - Bgp-ipv6-flowspec-address";
  }

  extension xr-cli-map {
    argument "cli-command";
    description "The xr-cli-map statement takes as an argument
                 relevant CLI configuration command.";
  }
  
  extension xr-xml-map {
    argument "xr-xml-node";
    description "The xr-xml-map statement takes as an argument
                 relevant Cisco XML Schema node name.";
  }
  
  typedef Route-dist {
    type string {
      pattern "[a-fA-F0-9]{16}";
    }
    description "Route distinguisher in hexadecimal notation.";
  }

  typedef Bgp-l2vpn-evpn-addrs {
    type string {
      pattern "[a-fA-F0-9]{58}";
    }
    description "L2VPN EVPN Address in hexadecimal notation.";
  }

  typedef Bgp-ls-addr {
    type string {
      pattern "[a-fA-F0-9]+";
    }
    description "BGP link state unicast address in hexadecimal
                 notation.";
  }

  typedef Bgp-ipv6-mvpn-addr {
    type string {
      pattern "[a-fA-F0-9]{104}";
    }
    description "An IPV6 MVPN address in hexadecimal notation.";
  }

  typedef Bgp-ipv4-mvpn-addr {
    type string {
      pattern "[a-fA-F0-9]{56}";
    }
    description "An IPV4 MVPN address in hexadecimal notation.";
  }

  typedef Bgp-rt-constrt-addr {
    type string {
      pattern "[a-fA-F0-9]{24}";
    }
    description 
      "An IPV4 RTConstraint address in hexadecimal notation.";
  }

  typedef Bgp-ipv4-mdt-addr {
    type string {
      pattern "(([a-f0-9]{16}-)(([1-9]?[0-9]|1[0-9][0-9]|2[0-4]"+
        "[0-9]|25[0-5])\.){3}([1-9]?[0-9]|1[0-9][0-9]|2[0-4][0-9]"+
        "|25[0-5]))";
    }
    description "An IPV4 MDT address in dotted decimal notation.
                 An IPv4 MDT address should be of the form 
                 0000006400000065-129.29.83.45. This datatype 
                 restricts the value of each field 16 digits in 
                 hexadecimal for RD field and between 0 and 255
                 for IPv4 address field, i.e. 
                 [0000000000000000-ffffffffffffffff]-
                 [0-255].[0-255].[0-255].[0-255].";
  }

  typedef Bgp-ipv4-tunnel-addr {
    type string {
      pattern "((0:|[1-9][0-9]{0,4}:)"+
        "(([1-9]?[0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}"+
        "([1-9]?[0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]))";
    }
    description "An IPV4 tunnel address in dotted decimal notation.
                 An IPv4 tunnel address should be of the form 
                 65535:129.29.83.45. This datatype restricts the 
                 value of each field between 0 and 65535 for prefix
                 field and 0 and 255 for IPv4 address field, i.e.
                 [0-65535]:[0-255].[0-255].[0-255].[0-255]";
  }

  typedef Cisco-ios-xr-port-number {
    type uint16 {
      range "1..65535";
    }
    description "Port number of range from 1 to 65535";
  }

  typedef Interface-name {
    type string {
      pattern "(([a-zA-Z0-9_]*\d+/){3}\d+)|"+
              "(([a-zA-Z0-9_]*\d+/){4}\d+)|"+
              "(([a-zA-Z0-9_]*\d+/){3}\d+\.\d+)|"+
              "(([a-zA-Z0-9_]*\d+/){2}([a-zA-Z0-9_]*\d+))|"+
              "([a-zA-Z0-9_-]*\d+)|"+
              "([a-zA-Z0-9_-]*\d+\.\d+)|"+
              "(mpls)|(dwdm)";
    }
    description "An interface name specifying an interface type and 
                 instance.
                 Interface represents a string defining an interface
                 type and instance, e.g. MgmtEth0/4/CPU1/0 or
                 TenGigE0/2/0/0.2 or Bundle-Ether9 or 
                 Bundle-Ether9.98";
  }
  
  typedef Cisco-ios-xr-string {
    type string {
      pattern "[\w\-\.:,_@#%$\+=\|;]+";
    }
    description "Special characters are not allowed.";
  }

  typedef Ipv4-prefix-length {
    type uint8 {
      range "0..32";
    }
    description "An IPv4 address prefix length. 
                 Must lie between 0 and 32 inclusive.";
  }
  
  typedef Ipv6-prefix-length {
    type uint8 {
      range "0..128";
    }
    description "An IPv6 address prefix length. 
                 Must lie between 0 and 32 inclusive.";
  }
  
  typedef Rack-id {
    type string {
      pattern "[a-zA-Z0-9_]*\d+";
    }
    description "Names the rack portion of a NodeID 
                 Rack/Slot/Instance triple";
  }
  
  typedef Slot-id {
    type string {
      pattern "[a-zA-Z0-9_]*\d+";
    }
    description "Names the slot portion of a NodeID 
                 Rack/Slot/Instance triple";
  }
  
  typedef Instance-id {
    type string {
      pattern "[a-zA-Z0-9_]*\d+";
    }
    description "Names the instance portion of a NodeID 
                 Rack/Slot/Instance triple";
  }
  
  typedef Sub-instance-id {
    type string {
      pattern "[a-zA-Z0-9_]*\d+";
    }
    description "Names the sub-instance portion of an extended
                 NodeID Rack/Slot/Instance/SubInstance";
  }
  
  typedef Encryption-type {
    type enumeration {
      enum none {
        value "0";
        description "The password string is clear text.";
      }
      enum md5 {
        value "1";
        description "The password is encrypted to an MD5 digest.";
      }
      enum proprietary {
        value "2";
        description "The password is encrypted using Cisco type 7 
                     password encryption.";
      }
    }
    description "The type of encryption used on a password string.";
  
  }
  
  typedef Hex-integer {
    type string {
      pattern "[0-9a-fA-F]{1,8}";
    }
    description "An unsigned 32-bit integer represented in
                 hexadecimal format.";
  }
  
  typedef Osi-system-id {
    type string {
      pattern "[a-fA-F0-9]{4}(\.[a-fA-F0-9]{4}){2}";
    }
    description "An OSI system ID should be of the form 
                 0123.4567.89ab. This data type restricts each
                 character to a hex character.";
  }
  
  typedef Osi-area-address {
    type string {
      pattern "[a-fA-F0-9]{2}(\.[a-fA-F0-9]{4}){0,6}";
    }
    description "An OSI area address should consist of an odd number
                 of octets, and be of the form 01 or 01.2345 etc up
                 to 01.2345.6789.abcd.ef01.2345.6789. This data type
                 restricts each character to a hex character.";
  }
  
  typedef Isis-node-id {
    type string {
      pattern "[a-fA-F0-9]{4}(\.[a-fA-F0-9]{4}){2}\.[a-fA-F0-9]{2}";
    }
    description "An ISIS node ID should be of the form 
                 0123.4567.89ab.cd. This data type restricts each
                 character to a hex character.";
  }
  
  typedef Isis-snpa {
    type string {
      pattern "[a-fA-F0-9]{4}(\.[a-fA-F0-9]{4}){2}";
    }
    description "String representation of a SNPA, 802.2 MAC address
                 in canonical format, e.g. 0123.4567.89ab";
  }
  
  typedef Isis-lsp-id {
    type string {
      pattern "[a-fA-F0-9]{4}(\.[a-fA-F0-9]{4}){2}\.[a-fA-F0-9]{2}"+
               "\-[a-fA-F0-9]{2}";
    }
    description "An ISIS LSP ID should be of the form 
                 0123.4567.89ab.cd-ef. This data type restricts each
                 character to a hex character.";
  }
  
  typedef Osi-net {
    type string {
      pattern 
        "[a-fA-F0-9]{2}(\.[a-fA-F0-9]{4}){3,9}\.[a-fA-F0-9]{2}";
    }
    description "An OSI NET should consist of an even number of 
                 octets, and be of the form 01.2345.6789.abcd.ef etc
                 up to 
                 01.2345.6789.abcd.ef01.2345.6789.abcd.ef01.2345.67.
                 This data type restricts each character to a hex
                 character.";
  }
  
  typedef String-identifier {
    type string {
      pattern "[a-zA-Z][\w\-]*";
    }
    description "A string for specifying identifier.";
  }

  typedef Extended-node-id {
    type string {
      pattern "([a-zA-Z0-9_]*\d+/){3}([a-zA-Z0-9_]*\d+)";
    }
    description "A location used as value information and specified
                 as a Rack/Slot/Instance/SubInstance, e.g. 
                 0/1/CPU0/NPU0";
  }
  
  typedef Node-id {
    type string {
      pattern "([a-zA-Z0-9_]*\d+/){2}([a-zA-Z0-9_]*\d+)";
    }
    description "A location used as value information and specified
                 as a Rack/Slot/Instance triple, e.g. F0/SC1/0.";
  }

  typedef Pq-node-id {
    type string {
      pattern "((([a-zA-Z0-9_]*\d+)|(\*))/){2}(([a-zA-Z0-9_]*\d+)"+
              "|(\*))";
    }
    description "Partially qualified location which is used for 
                 wildcarding location specifications, e.g. 1/*/*";
  }  
  
  typedef Md5-password {
    type string {
      pattern "(!.+)|([^!].+)";
    }
    description 
      "The Md5-password type is used to store password using the MD5
       hash function.
       When a clear text value is set to a leaf of this type, the
       server calculates a password hash and stores the result
       in the datastore. The password is never stored in clear text.

       When a leaf of this type is read, the stored password hash is
       returned.

       A value of this type matches one of the forms:

         !<clear text password>
         <password hash>
         
       The '!' prefix signals that the value is clear text. When
       such a value is received by the server, a hash value is
       calculated. This value is stored in the configuration data 
       store.

       If a value starting without '!' is received, the server knows 
       that the value already represents a hashed value, and stores 
       it as is in the data store.";
  }
  
  typedef Proprietary-password {
    type string {
      pattern "(!.+)|([^!].+)";
    }
    description 
      "The Proprietary-password type is used to store password 
       using the Cisco proprietary hash function.
       When a clear text value is set to a leaf of this type, the
       server calculates a password hash and stores the result
       in the datastore. The password is never stored in clear text.

       When a leaf of this type is read, the stored password hash is
       returned.

       A value of this type matches one of the forms:

         !<clear text password>
         <password hash>
         
       The '!' prefix signals that the value is clear text. When
       such a value is received by the server, a hash value is
       calculated. This value is stored in the configuration data 
       store.

       If a value starting without '!' is received, the server knows 
       that the value already represents a hashed value, and stores 
       it as is in the data store.";
  }
  
  typedef Bgp-ipv4-flowspec-address {
    type string {
      pattern "[a-fA-F0-9]{4096}";
    }
    description "An IPV4 Flowspec address in hexadecimal notation.";
  }

  typedef Bgp-ipv6-flowspec-address {
    type string {
      pattern "[a-fA-F0-9]{4096}";
    }
    description "An IPV6 Flowspec address in hexadecimal notation.";
  }
}