yumaworks-types

Common CLI parameter types used in multiple YumaPro applications. Copyright (c) 2012 - 2022 YumaWorks, Inc. All rights reserved...

  • Version: 2022-05-01

    yumaworks-types@2022-05-01


    
      module yumaworks-types {
    
        yang-version 1;
    
        namespace
          "http://yumaworks.com/ns/yumaworks-types";
    
        prefix ywt;
    
        organization "YumaWorks, Inc.";
    
        contact
          "Support <support at yumaworks.com>";
    
        description
          "Common CLI parameter types used in multiple YumaPro
    applications.
    
    Copyright (c) 2012 - 2022 YumaWorks, Inc. All rights reserved.
    
    Redistribution and use in source and binary forms, with or
    without modification, is permitted pursuant to, and subject
    to the license terms contained in, the BSD 3-Clause License
    http://opensource.org/licenses/BSD-3-Clause";
    
        revision "2022-05-01" {
          description
            "21.10T only:
      - Add yang-sid-mode typedef and lsid-mode.";
        }
    
        revision "2021-05-15" {
          description "Add NcxNumName typedef.";
        }
    
        revision "2020-03-06" {
          description "Add NcxFileName typedef.";
        }
    
        revision "2018-05-03" {
          description
            "Add transport-type typedef.";
        }
    
        revision "2015-10-04" {
          description
            "Add encoding-type typedef.";
        }
    
        revision "2014-09-06" {
          description
            "Add server-target typedef.
    Add access-control-mode typedef.";
        }
    
        revision "2013-02-11" {
          description
            "Move some typedefs from yangcli-pro.yang to this module.";
        }
    
        revision "2012-12-05" {
          description "Initial version.";
        }
    
    
        typedef show-mode {
          type enumeration {
            enum "brief" {
              value 0;
            }
            enum "normal" {
              value 1;
            }
            enum "full" {
              value 2;
            }
          }
          description
            "The mode that a command or prompt should be displayed.
    Selects the verbosity level of the output.";
        }
    
        typedef NameMatchMode {
          type enumeration {
            enum "exact" {
              value 0;
              description
                "The name must exactly match the node name
    for all characters in both name strings.";
            }
            enum "exact-nocase" {
              value 1;
              description
                "The name must match the node name
    for all characters in both name strings.
    Strings are not case-sensitive.";
            }
            enum "one" {
              value 2;
              description
                "The name must exactly match the first N
    characters of just one node name, which
    must be the only partial name match found.";
            }
            enum "one-nocase" {
              value 3;
              description
                "The name must exactly match the first N
    characters of just one node name, which
    must be the only partial name match found.
    Strings are not case-sensitive.";
            }
            enum "first" {
              value 4;
              description
                "The name must exactly match the first N
    characters of any node name. The first one
    found will be used.";
            }
            enum "first-nocase" {
              value 5;
              description
                "The name must exactly match the first N
    characters of any node name. The first one
    found will be used. Strings are not
    case-sensitive.";
            }
          }
          description
            "Defines the search mode that should be used
    when resolving YANG node names in leafs and
    leaf-lists using the UrlPath data type.";
        }
    
        typedef AltNameMode {
          type boolean;
          description
            "Defines the alternate name search mode that
    should be used when resolving YANG node names
    in leafs or leaflists using the UrlPath data type.
    
    If 'true' then nodes with an 'alt-name' defined
    will be considered a match if the YANG name or the
    alternative name matches the search string.
    
    If 'false' then only the YANG node name will
    be used in node name searches.";
        }
    
        typedef UrlPath {
          type string {
            length "1..max";
          }
          description
            "Special URL encoded path expression.
    
    Normal Encoding Rules:
    
      - Normal content is encoded as an absolute path.
      - Keys are encoded as a path step within the URL,
        instead of a predicate expression like XPath.
      - The first character must be a forward slash '/'.
      - Each identifier or key encoded in the URL string
        is separated by a single forward slash '/' character.
      - Escaped character sequences are allowed, such
        as '%20' for the space ' ' character.
      - If any descendant nodes of a list are included,
        then all key leafs for that list must be encoded
        in the URL (or escaped with the dash '-' character
        to skip that key).
      - Only key leafs can be encoded within the URL string,
        similar to a YANG instance-identifier or
        schema-instance-identifier string.  Other leafs
        are not allowed.
    
      Example URL and XPath strings:
    
          XPath:  /foo/bar[id='fred'][id2='barney]/baz
    
        UrlPath:  /foo/bar/fred/barney/baz
    
      Example showing the 'id2' key leaf escaped:
    
          XPath:  /foo/bar[id='fred']/baz
    
        UrlPath:  /foo/bar/fred/-/baz
    
    Special Encoding Rules
    
      Since these escaped characters are usually decoded
      by the time an HTTP gateway program will get them,
      the forward slash '/' character needs to be treated
      differently.  To use this character within key leaf
      content, it must be escaped with another forward
      slash character.
    
      Example showing escaped forward slash in content:
    
        XPath: /interfaces/interface[name='1/0/22']/mtu
    
      URLPath: /interfaces/interface/1//0//22/mtu
    
    Name Matching
    
      A parameter using the 'NameMatchMode' data type
      can be used to control how name node searches
      are done for nodes using this data type.
    
    Alternate Naming
    
      A parameter using the 'AltNameMode' data type
      can be used to control whether alternative
      node names can be used when name searches
      are done for nodes using this data type.
    
    Exceptions:
    
      XML namespaces are not ignored, but if multiple
      sibling nodes have the same local-name, then
      the first node found will be used.
    
    ";
        }
    
        typedef server-target {
          type enumeration {
            enum "running" {
              value 0;
              description
                "Write to the running config and support
    the :writable-running capability.";
            }
            enum "candidate" {
              value 1;
              description
                "Write to the candidate config and support
    the :candidate and :confirmed-commit
    capabilities.";
            }
          }
          description
            "The database to use as the target of edit-config
    and copy-config operations.";
        }
    
        typedef access-control-mode {
          type enumeration {
            enum "enforcing" {
              value 0;
              description
                "All configured access control rules will be enforced.";
            }
            enum "permissive" {
              value 1;
              description
                "All configured access control rules will be
    enforced for write and execute requests.
    All read requests will be allowed, unless
    the requested object contains the
    'nacm:very-secure' extension.  In that case,
    all configured access control rules will be enforced.";
            }
            enum "disabled" {
              value 2;
              description
                "All read, write, and execute requests will be
    allowed, unless the object contains the
    'nacm:secure' or 'nacm:very-secure' extension.
    If the 'nacm:secure' extension is in effect,
    then all configured access control rules
    will be enforced for write and execute requests.
    If the 'nacm:very-secure' extension is in effect,
    then all configured access control rules
    will be enforced for all requests.
    Use this mode with caution.";
            }
            enum "off" {
              value 3;
              description
                "All access control enforcement is disabled.
    Use this mode with extreme caution.";
            }
          }
        }
    
        typedef encoding-type {
          type enumeration {
            enum "xml" {
              value 0;
              description "XML encoding";
            }
            enum "json" {
              value 1;
              description "JSON encoding";
            }
          }
          description
            "The message encoding format to use";
        }
    
        typedef transport-type {
          type enumeration {
            enum "ssh" {
              value 0;
              description "NETCONF over SSH.";
              reference
                "RFC 4742;  RFC 6242";
    
            }
            enum "tcp" {
              value 1;
              description
                "The transport is TCP. The usage depends on
    the protocol used.
    
    NETCONF over TCP: (tail-f NETCONF over TCP)
    If this enum is selected, then the default --ncport
    value is set to 2023 and the --protocols value
    is set to netconf1.0.  The --password value will
    be ignored.
    
    YANG-API or RESTCONF over HTTP/TCP:
    If this enum is selected, then the default --ncport
    value is set to 80, and the --protocols value
    will not be changed.";
              reference
                "NETCONF: tail-f conf-d RESTCONF: HTTP";
    
            }
            enum "tcp-ncx" {
              value 2;
              description
                "NETCONF over TCP.
    If this enum is selected, then the default --ncport
    value is set to 2023, and the --protocols value
    is set to netconf1.0 and netconf1.1.  The --password
    value will be ignored.";
              reference
                "YumaWorks <ncx-connect>";
    
            }
            enum "tls" {
              value 3;
              description
                "If the protocol is 'netconf' and this enum is selected,
    a NETCONF over TLS session will be attempted. If the
    protocol is 'RESTCONF' and this enum is selected
    the RESTCONF client will try to communicate with
    the server using the HTTPS protocol.";
              reference
                "RFC 2818";
    
            }
            enum "coap" {
              value 4;
              description
                "RESTCONF over CoAP.
    If this enum is selected, then the default --ncport
    value is set to 5683. The --password value will be
    ignored.";
              reference
                "YumaWorks <ncx-connect>";
    
            }
          }
          description
            "Identifies the transport protocol that should be used.";
        }
    
        typedef NcxFileName {
          type string {
            length "1..64";
            pattern
              '[0-9A-Z_a-z][-!#$%'()*+.0-;=>@-Z\[\]\^_-z}~]{0,63}';
          }
          description
            "General Purpose NCX File Name string.
    The first character can be a letter, digit, or
    underscore character. The rest of the characters can be
    printable characters except the following characters:
    
       * space ( )             ASCII 32
       * double quote          ASCII 34
       * ampersand (&)         ASCII 38
       * comma (,)             ASCII 44
       * forward slash (/)     ASCII 47
       * less-than sign (<)    ASCII 60
       * question mark (?)     ASCII 63
       * backslash (\)        ASCII 92
       * left curly brace ({)  ASCII 123
       * vertical bar (|)      ASCII 124
    
    The allowed characters are not special to the server but many
    of them would be interpreted as special characters by other
    programs. Use such characters with extreme caution.";
        }
    
        typedef NcxNumName {
          type string {
            length "1..64";
            pattern
              '[a-zA-Z0-9_][a-zA-Z0-9\-_\.]{0,63}';
          }
          description
            "General Purpose NCX Name string. This is the
    same as an NcxName except the first character
    is also allowed to be a number.";
        }
    
        typedef yang-sid-mode {
          type enumeration {
            enum "sid-file" {
              value 0;
              description
                "Use YANG SID files for SID assignments";
            }
            enum "lsid" {
              value 1;
              description
                "Use LSID SID generation mode for SID assignments.
    For publisher only.";
            }
            enum "lsid-file" {
              value 2;
              description
                "Use LSID SID file generation mode for SID assignments.
    For subscriber only.";
            }
          }
          description
            "The source of SID assignments for YANG schema items.";
        }
    
        typedef lsid-size {
          type enumeration {
            enum "lsid16" {
              value 0;
              description
                "The SID width is 16 bits.
    The maximum SID value is 15 bits (32K values)";
            }
            enum "lsid32" {
              value 1;
              description
                "The SID width is 32 bits.
    The maximum SID value is 31 bits (2G values)";
            }
            enum "lsid64" {
              value 2;
              description
                "The SID width is 64 bits.
    The maximum SID value is 63 bits (9.2 x 10^^18 values)";
            }
          }
          description
            "If the yang-sid-mode is 'lsid' or 'lsid-file' then the server
    implementation will pick a SID size at build-time.";
        }
      }  // module yumaworks-types
    

© 2023 YumaWorks, Inc. All rights reserved.