module yuma-types {

    yang-version 1;
    namespace "http://netconfcentral.org/ns/yuma-types";
    prefix "yt";

    organization "Netconf Central";

    contact
        "Andy Bierman <andy at netconfcentral.org>";

    description "Yuma Common Data Types";

    revision 2012-06-01 {
       description 
         "Added new NcDebugType enum (sysLogLevel).
          Added yang-identifier data type.";
    }

    revision 2011-12-18 {
       description 
         "Added TransactionId data type.";
    }

    revision 2010-11-28 {
       description 
         "Change default indent from 3 to 2.";
    }

    revision 2010-01-25 {
       description 
          "Adjust name lengths in ranges and patterns.";
    }

    revision 2008-11-21 {
       description 
          "Renamed ncxtypes to yuma-types.";
    }

    revision 2008-07-20 {
       description 
          "Converted from ncxtypes.ncx.";
    }

    // typedef any removed

    typedef int {
      description "Changed int base type to int32 for YANG";
      type int32;
    }

    typedef uint {
      description "Changed uint base type to uint32 for YANG";
      type uint32;
    }

    typedef long {
      description "Changed long base type to int64 for YANG";
      type int64;
    }

    typedef ulong {
      description "Changed ulong base type to uint64 for YANG";
      type uint64;
    }

    typedef ustring {
      description "Changed ustring base type to binary for YANG";
      type binary;
    }

    typedef NcxName {
        description "General Purpose NCX Name string.";
        type string {
            length "1..64";
            pattern '[a-z,A-Z,_][a-z,A-Z,0-9,\-,_,\.]{0,63}';
        }
    }

    typedef NcxQName {
        description 
            "Qualified Name:
              module-name:NcxName OR owner-name:NcxName.";
        type string {
            length "1..129";
            pattern '(([a-z,A-Z,_][a-z,A-Z,0-9,\-,_,\.]{0,63}):)' +
               '?([a-z,A-Z][a-z,A-Z,0-9,\-,_,\.]{0,63})';
        }
    }

    typedef NcxIdentifier {
        description "Union of all the Identifier types.";
        type union { 
            type NcxName;
            type NcxQName;
        }
    }

    typedef yang-identifier {
      description "YANG identifier string.";
      type string {
        length "1..max";
        pattern '[a-z,A-Z,_][a-z,A-Z,0-9,\-,_,\.]*';
      }
    }

    typedef NcxSessionId {
        description "NCX Session ID number";
        type uint32 {
            range "1..max";
        }
    }

    typedef NcxLineLength {
        description "Requested Maximum Line Length";
        type uint32 {
            range "32..65535";
        }
    }

    typedef NcxUserName {
        description "NCX User Name string.";
        type NcxName; 
    }

    typedef NcxGroupName {
        description "NCX Group Name string.";
        type NcxName;
    }

    // typedef NcxModuleList removed

    // typedef NcxLockList removed 

    typedef NcAccessControlType {
      description 
        "NCX System access control mode.";
      type enumeration {
         enum open {
            description "no access control checking enforced";
         }
         enum loose {
            description 
               "any RPC method in the netconf namespace can
                be invoked;  read-only data allowed for all";
         }
         enum strict {
            description 
              "RPC entry must be present to invoke
               an RPC method; ncxacl Data entry must be present
               to access any data. (Except for user == 'root'.)";
         }
      }
      default "strict";
    }

    typedef NcxRpcType {
        description "NCX RPC Type Classifications";
        type enumeration {
            enum other;
            enum config;
            enum exec;
            enum monitor;
            enum debug;
        }
    }

    // typedef NcxRpcTypeList removed

    typedef NcDebugType {
        description 
          "NCX Session debug logging control enumeration.
           Each successive value includes all the previous
           messages from lower value enumeration values,
           plus the messages for the specified value.

           off == no logging is done
           write == log write  messages (NOT SUPPORTED IN YUMA)
           dev0 == log developer level 0 messages (NOT SUPPORTED
                     IN YUMA)
           error == log error messages
           warn == log warning messages
           info == log info messages 
           dev1    == log developer level 1 messages (NOT SUPPORTED
                      IN YUMA)
           debug  == log debug level 1 messages
           debug2 == log debug level 2 messages
           debug3 == log debug level 3 messages
           debug4 == log debug level 4 messages";
        type enumeration { 
             enum off;
             enum write;   // yumapro only
             enum dev0;    // yumapro only
             enum error; 
             enum warn;
             enum info;
             enum dev1;    // yumapro only
             enum debug;
             enum debug2;
             enum debug3;
             enum debug4;
        }
        default "info";
    }

    typedef NcPortNumber { 
        description "Transport layer port number.";
        type uint32 {
            range "1 .. 65535";
        }
    }

    typedef NcIndex { 
        description "Non-negative index value";
        type uint32 {
            range "1..max";
        }
    }

    typedef NcPathList {
      description 
        "PATHSPEC formatted string indicating the machine-dependent
         search path for the NCX programs to use.  Parameters
         with this data type can be used to override the
         default search order, and insert special work
         directories in the search path.

         Each component in the string is an absolute or
         relative directory path specification.
         The colon char ':' is used to separate the path strings.
         Whitespace is not allowed in the string at all.

         For example, the following string contains 3 paths
         that would be used in the order given:

         /home/users/testbed1/yang:/home/users/yang:/usr/share/yang";
      type string {
        length "1 .. max";
      }
    }

    typedef NcModuleSpec {
      description 
        "A string which specifies a module name, or a filespec
         which represents a module, with an optional revision date.

               If this string represents a filespec, 
               containing any path separation characters, and/or
               ending with the '.yang' or '.yin' extension,
	       then only that file location will be checked.

               If this string represents a module name, then
               the module search path will be checked for
               a file with the module name and the '.yang'
               or '.yin.' extension.

               If this string contains a module name
               followed by an 'at sign' character (@), 
               followed by a revision string (e.g., foo@2010-01-01),
               then that specific version of the module will be used.

               If this string begins with a '~' character,
               then a username is expected to follow or
               a directory separator character.  If it begins
               with a '$' character, then an environment variable
               name is expected to follow.

               ~/some/path ==> <my-home-dir>/some/path

               ~fred/some/path ==> <fred-home-dir>/some/path

               $workdir/some/path ==> <workdir-env-var>/some/path
            ";
      type string {
         length "1 .. 4095";
      }
    }

    typedef NcPathSpec {
      description 
        "A string which specifies a directory name.";
      type string {
         length "1 .. 4095";
      }
    }

    typedef IndentType {
        description 
           "Requested indent amount.
            Only a limited range of line indent values are allowed.";
        type uint32 {
            range "0..9"; 
        }
        default "2";
    }

    typedef Timeout {
	description
	  "Number of seconds to wait for a response
	   from the NETCONF peer before declaring a timeout.
           Zero means no timeout at all.";
        type uint32;
        units seconds;
        default 30;
    }

    typedef Date {
       type string {
         pattern '\d{4}-\d{2}-\d{2}';
       }
       description
        "Represents a specific date in YYYY-MM-DD format.";
    }

    typedef FeatureSpec {
      description
        "Represents a feature specifier, which consists
         of a module-name, colon character ':' and then
         a feature name (e.g., 'foo:bar')";
      type NcxQName;
    }

    typedef TransactionId {
      description
        "Database edit transaction identifier.
         This is not a permanent identifier, and should only
         be used for 'equal or not-equal' comparison tests.
         The value will wrap after the maximum value is reached.";
      type uint64 {
        range "1 .. max";
      }
    }
}

