module yangcli-pro {

    yang-version 1.1;

    namespace "http://yumaworks.com/ns/yangcli-pro";

    prefix yc;

    import ietf-origin { prefix or; }

    import ietf-yang-types { prefix yang; }

    import ietf-inet-types { prefix inet; }

    import ietf-netconf-with-defaults { prefix wd; }

    import ietf-yang-structure-ext { prefix sx; }

    import yuma-ncx { prefix ncx; }

    import yuma-app-common { prefix ncxapp; }

    import yumaworks-types { prefix ywt; }

    import yumaworks-app-common { prefix ywapp; }

    import yumaworks-extensions { prefix ywx; }

    import yuma-types { prefix nt; }

    import yuma-netconf { prefix nc; }

    import yumaworks-restconf { prefix yrc; }

    organization  "YumaWorks, Inc.";

    contact "Support <support@yumaworks.com>.";

    description
       "
        Command Line Interface for the NETCONF protocol: Client side

        Usage:
           yangcli-pro [parameters]
           yangcli-pro --help
           yangcli-pro --version

        Normal Mode:
           An interactive CLI shell with command line history.

        Autostart-mode:
           If the 'server' parameter is present, then yangcli-pro will
           attempt to connect to that server upon startup.  If the
           'user' and 'password' parameters are also present, then
           the user will not be prompted before the connection
           is attempted.  This parameter will be processed first,
           if script-mode or batch-mode is used.

        Script-mode:
           If the 'run-script' or 'run-command' parameter is present,
           then the specified script or command will be run
           automatically upon startup.

        Batch-mode:
           If the 'batch-mode' parameter is present, then either the
           'run-script' or 'run-command' parameter will be invoked, if
           present, and then the program will exit.  Any interactive
           input breaks in the script or command will be skipped.

     Copyright (c) 2010 - 2026 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 2026-04-24 {
       description
         "25.10-8:
           -  Add --with-json-metadata CLI parameter.
           -  Add YANG metadata parameters to sget* operations
         ";
     }

     revision 2025-11-24 {
       description
         "25.10-3:
           -  Add --with-yang-metadata CLI parameter.
         ";
     }

     revision 2025-06-29 {
       description
         "24.10T-11:
           -  Add --with-yanglib-cache CLI parameter.
           -  Add yanglib-cache command.
           -  Add show yanglib-cache sub-command.
         ";
     }

     revision 2025-05-30 {
       description
         "24.10T-9:
           -  Add --python-command parameter
           -  Add --custom-command parameter
         ";
     }

     revision 2025-05-17 {
       description
         "24.10T-9:
           -  Add --show-table parameter
           -  Add --show-table-force parameter
           -  Add --show-table-max-colsize parameter
         ";
     }

     revision 2025-03-07 {
       description
         "23.10-18:
           -  Add --return-status parameter copied from netconfd-pro
         ";
     }

     revision 2025-02-26 {
       description
         "24.10T-6:
          -  Change callhome-address type to ip-address-no-zone
          -  Add --collector-enabled parameter for UDP-Notif Collector
          -  Add CollectorParms grouping for UDP-Notif Collector
          -  Add collector command to start and stop at run-time
          -  Add encoding parameter to the subscribe command";
     }

     revision 2024-11-29 {
       description
         "24.10-3:
          -  Add --hide-command parameter.
          24.10T-3:
          -  Add show command control parameters
             --show-builtin
             --show-data
             --show-datastore
         ";
     }

     revision 2024-11-09 {
       description
         "24.10-2:
          -  Add --show-headers parameter.
          -  Add --warn-off-yang parameter.
         ";
     }

     revision 2024-08-01 {
       description
         "23.10T-11:
          -  Add subscribe command.
          -  Add unsubscribe command.
          -  Add show subscriptions command.";
     }

     revision 2024-07-26 {
       description
         "23.10-11:
           -  Add --match-names-exec-mode parameter.
         ";
     }

     revision 2024-06-04 {
       description
         "23.10-9:
           -  Add --ypshell-exec-ok parameter.
         ";
     }

     revision 2024-04-04 {
       description
         "23.10-8:
           -  Add --confirm-data-retries parameter.
           -  Add --ypshell-exec-ok parameter.
         ";
     }

     revision 2024-03-19 {
       description
         "23.10T-7:
          -  Add show callhome command.
          -  Add callhome-server command
          -  Add callhome-user command.";
     }

     revision 2023-12-21 {
       description
         "23.10-6: Change --help-width parameter.";
     }

     revision 2023-08-23 {
       description
         "23.10T-0: Add parameters for yangcli-gw";
     }

     revision 2023-08-04 {
       description
         "22.10T-11: Change CLI container to sx:structure";
     }

     revision 2023-03-15 {
       description
         "22.10-7: Add rawrpc command.
                   Add export case to test-suite command.";
     }

     revision 2023-03-06 {
       description
         "22.10-6: Add --tcp-connect-timeout parameter.";
     }

     revision 2023-01-06 {
       description
         "Add gotop config command.";
     }

     revision 2021-10-30 {
       description
         "Change callhome-user from leaf to leaf-list and
          support tracking failed user/server attempts
          to attempt next user if the server reconnects.";
     }

     revision 2021-10-21 {
       description
         "Add autoeventhandlers, use-event-handler,
          event-handlers-cfg, event-handler-cfg,
          saved-event-handlers.";
     }

     revision 2021-09-12 {
       description
          "Add fixed-keys to get-walk command.";
     }

     revision 2021-08-16 {
       description
          "Add allow-shell, shell-command, and run-shell.";
     }

     revision 2021-07-22 {
       description
          "Add show server-commands.";
     }

     revision 2021-06-30 {
       description
          "Add refresh-library command for yangcli-pro only.
           Add show search-path-module for yangcli-pro only";
     }

     revision 2021-04-22 {
       description
          "Add --handle-bad-reply parameter";
     }

     revision 2020-10-20 {
       description
          "Add leaflist-multi-line";
     }

     revision 2019-12-07 {
       description
          "Add plain and cli enums to pipe display parameter";
     }

     revision 2019-08-25 {
       description
          "Add sget-data and xget-data commands for NMDA support";
     }

     revision 2019-07-23 {
       description
          "Add --with-notif-commands parameter. yp-shell only";
     }

     revision 2019-07-06 {
       description
          "Add --break-key-mode parameter.
           Add prompt to user defined name for yp-shell.";
     }

     revision 2019-05-22 {
       description
          "Add use of with-term-msg parameter.
           Add with-enable-mode, enable, and
           restrict-edit-mode for yp-shell.
           Add CommentParm grouping; comment parm to saved users,
           devices, and sessions.";
     }

     revision 2019-03-30 {
       description
          "Add use of binary-display-maxlen parameter";
     }

     revision 2019-01-15 {
       description
          "Add get-walk command";
     }

     revision 2018-10-30 {
       description
          "Add enable-password to support privileged mode
           in yp-shell. It is only for yp-shell config mode.
           Add --history-file parameter";
     }

     revision 2018-08-13 {
       description
          "Add transport for saved-sessions and saved-devices.
           Add auto-discard-changes.";
     }

     revision 2018-07-14 {
       description
          "Add --optional CLI parameter to set default for
           $$optional variable.
           Add --fill-optional CLI parameter to set default
           for --optional RPC parameter";
     }

     revision 2018-06-01 {
       description
          "Add schema-server-cfg, schema-servers-cfg,
           and autoschemaserver.";
     }

     revision 2018-04-16 {
       description
          "Add module-tag parameter to sget* and xget* rpcs";
     }

     revision 2018-03-05 {
       description
          "Add insecure-ok parameter.
           Add callhome-tls-port parameter.";
     }

     revision 2018-02-16 {
       description
          "Add yangmap parameter.";
     }

     revision 2018-02-14 {
       description
          "Add help-width parameter.";
     }

     revision 2018-01-05 {
       description
          "Add config-commit-mode and config-commit.
           Add sleep command";
     }

     revision 2017-12-12 {
       description
         "Add CLI enum to display-mode.
          Add clear command.
          Add term-length parameter.
          Add terminal command.
          Add show terminal command.";
     }

     revision 2017-10-14 {
       description
         "Add action RPC.";
     }

     revision 2017-09-24 {
       description
         "Add no-aliases parameter.
          Add server-commands parameter.
          Add disable-command parameter.
          Add prompt-name parameter.";
     }

     revision 2017-09-12 {
       description
         "Add autoconfig-conf-mode parameter.";
     }

     revision 2017-08-12 {
       description
         "Add create parameter of user-cfg to create a new user.";
     }

     revision 2017-04-27 {
       description
         "Add with-ocpattern parameter.";
     }

     revision 2017-04-20 {
       description
         "Add show modules-state command.";
     }

     revision 2017-03-18 {
       description
         "Add callhome-user parameter.";
     }

     revision 2017-02-11 {
       description
         "Add RESTCONF entry-point parameter.
          Add callhome-enabled, callhome-address and callhome-port
          parameters.";
     }

     revision 2016-05-26 {
       description
         "Add auto-reconnect, auto-reconnect-interval, and
          auto-reconnect-max.";
     }

     revision 2016-03-17 {
       description
         "Add use-traceid parameter and variable.";
     }

     revision 2016-03-10 {
       description
         "Add autonvsave parameter and variable.
           Add nvsave command";
     }

     revision 2015-12-04 {
       description
         "Change target parameter to xpath1.0 to allow content-match
          expressions to be entered.
          Add device-cfg, devices-cfg, user-cfg,
          users-cfg CLI parameters.
          Add the leaf of device and userid to saved-sessions.
          Add autodevices and autousers parameter.
          Add auto-keepalive and  keepalive-interval.
          Add delete-all and remove-all operations.
          Add 'depth' parameter to sget, sget-config, xget,
          and xget-config commands.";
    }

    revision 2015-09-07 {
       description
         "Add encoding parameter to connect parameters";
    }

    revision 2015-07-07 {
       description
         "Add config-autosave CLI parameter.";
    }

    revision 2015-06-25 {
       description
         "Add transport tls parameter";
    }

    revision 2015-06-03 {
       description
         "Add value parameter to delete and remove commands";
    }

    revision 2015-01-08 {
       description
         "Add no-password leaf and make password part of
          pass choice. Add ask-password CLI parameter";
    }

    revision 2014-10-02 {
       description
         "Add select parameter to show running command.
          Add 'mandatory true' for stop-session command.";
    }

    revision 2014-09-18 {
       description
         "Add show running to show the entire configuration.
          Add show edit to display the subtree that is the current
          edit node.
          Add show diff to display the difference of the current config
          and edits that have not been applied yet.";
    }

    revision 2014-07-11 {
       description
         "Add tcp-ncx enum to the transport enumeration type.";
    }

    revision 2014-05-22 {
       description
         "Add show cache command. Add cache command.";
    }

    revision 2014-04-07 {
       description
         "Add check-output and check-replies CLI parameters.
          Add check-output-mode and check-replies-mode CLI parameters.
          Add use-session-vars CLI parameter.
          Add abstract objects for config mode help key support.
          Add session-vars and group-vars to the show command.
          Add vars struct to the saved-sessions struct.
          Add data template support.
          Add use-rawxml parameter.
          Add autoload-get, autoload-cache, autoload-save-cache
          parameters";
    }

    revision 2014-01-02 {
       description
         "Add show connected command.";
    }

    revision 2013-06-20 {
       description
         "Change defaults for --autonotif and --autoconfig
          from true to false. Add group command";
    }

    revision 2013-03-17 {
       description
         "Add message-indent parameter.
          Add config and exit commands.
          Add autoconfig CLI parameter.
          Fix bug in default sessions file name.
          Add prompt-type CLI parameter.
          Add config-edit-mode parameter.
          Add update-config command.
          Add start-session parameter to connect command.
          Add echo-notifs and echo-notif-loglevel CLI parameters.
          Add autonotif CLI parameter.
          Add session-name to connect a named session.
          Add connect-all to start all sessions in memory.
          Add record-test command.
          Move MatchParms to yumaworks-app-common.
          Add auto-test command.";
    }

    revision 2012-10-27 {
       description
          "Add run-unit-test operation
           Convert from yangcli to yangcli-pro
           Add sessions-cfg and session-cfg commands
           Added saved-sessions template for .conf file
           Added autosessions parameter
           Added start-session, stop-session commands
           Added start-rpc-timing, stop-rpc-timing commands.
           Added autotest, test-suite, session-cfg, session-cfg.";
    }

    revision 2011-10-10 {
       description
         "Add CLI parameters:
            --aliases-file
            --autoaliases
            --autouservars
            --uservars-file
            --home
          Add yangcli-pro local commands:
            alias
            aliases
            unset
            uservars
         ";
    }

    revision 2011-09-05 {
       description
         "Add 'json' to --display-mode enumerations.";
    }

    revision 2011-08-06 {
       description
         "Add --transport to ConnectParms grouping.";
    }

    revision 2011-07-19 {
       description
         "Add PublicKeyParms grouping.
          Added MatchParms (--match-names and --alt-names).
          Added --force-target parameter.
          Added show session command.
          Added --urltarget=<url> parameter to FillParms grouping
          to allow URL encoded requests to be converted to XPath
          before use.
          Added --use-xmlheader=<boolean> parameter to control
          how XML file variables are generated when written.";
    }

    revision 2011-06-05 {
       description
          "Added start-timer and stop-timer local RPC functions.
           Added --echo-replies parameter and system variable.
           Added --time-rpcs parameter and system variable
           Added remove command for base:1.1 support";
    }

    revision 2011-04-22 {
       description
          "Added --protocols parm via uses ProtocolsParm.
           Also allow setting --protocols in <connect> RPC.";
    }

    revision 2011-03-19 {
       description
          "Added 'xml-nons' display mode to display-mode parameter.
           Added 'cli' and 'system' to show command; subset of
           show vars.
           Changed history show default from -1 to 25.";
    }

    revision 2010-04-16 {
       description
          "Added eval command for XPath expression support";
    }

    revision 2010-01-14 {
       description
          "Initial published version for 0.9.9 release";
    }

    typedef LogCount {
       description
          "Number of log entries. -1 means all entries";
       type int32 {
          range "-1 | 1 .. max";
       }
    }

    typedef LogIndex {
       description
          "Index into a log buffer.";
       type uint32;
    }

    typedef TimerId {
       description
          "Identifier for a local timer to use with
           the start-timer and stop-timer commands.";
       type uint8 {
         range "0 .. 15";
       }
    }

    typedef YangcliVariableType {
      description
        "yangcli-pro user and system variable types";
      type enumeration {
        enum session {
          description "Session variable (for future use)";
        }
        enum local {
          description "Local user variable";
        }
        enum config {
          description "User configuration variable";
        }
        enum global {
          description "Global user variable";
        }
        enum system {
          description "System variable";
        }
        enum queue {
          description "System internal Queue variable";
        }
      }
    }

    typedef test-result-type {
      type enumeration {
        enum skipped {
          description "Test was skipped.";
        }
        enum pass {
          description "Test passed.";
        }
        enum fail {
          description "Test failed.";
        }
      }
      description
        "The unit test general result type.";
    }

    typedef IdentifierOrZero {
      type union {
        type nt:NcxIdentifier;
        type string { length 0; }
      }
      description
        "Indicates an identifier or empty string to use the
         schema or application defined default.";
    }

    typedef config-edit-mode-type {
      description
        "Specifies how edits will be applied in config mode.";
      type enumeration {
        enum line {
          description
            "Automatically apply a config mode edit after
             each line";
        }
        enum level {
          description
            "Automatically apply a config mode edit when
             the current level is exited.";
        }
        enum manual {
          description
            "Only apply a config mode edit manually with
             the 'apply' command.";
        }
      }
    }

    /*************************************************************
     *
     *     Groupings for parameters used in multiple commands
     *
     *************************************************************/

    grouping SelectParm {
      leaf select {
        ncx:xpath;
        type string { length "1..max"; }
        description
          "The XPath expression to use in the retrieval
           operation.  The string may only contain
           single quotes, which are required for
           string literals.  The entire string
           will be inserted into a double-quoted
           string, within the get-config PDU.
           Character entities will be inserted as
           needed to maintain well-formed XML.";
      }
    }

    grouping FillParms {
       choice target-parm {
         leaf target {
           description
             "XPath target object to fill.  If prefixes are missing
              then the first match in any namespace will be used.
              Any prefix used must be the default prefix
              assigned to the desired YANG module. Prefix usage is
              optional.";

           type yang:xpath1.0 {
             length "1..max";
           }
           mandatory true;
         }
         case urltarget-case {
           leaf urltarget {
             description
               "URL encoded target object to fill.
                Encoding Rules: TBD.";
             type ywt:UrlPath;
             mandatory true;
           }
           uses ywapp:MatchParms {
             description
              "These parameters are only supported for the
               'urltarget' parameter.";
           }
         }
       }

       leaf optional {
         description
           "If present, then prompt for nodes that are optional.
            If not, skip these objects.";
         type empty;
       }

       anyxml value {
         description
           "Contains a string representing the content
            to use for the filled variable.

            If a string is entered, then the target value being
            filled must be a leaf or leaf-list.

            If a variable is referenced, then it will
            be used as the content, if the target value being
            filled is a leaf or a leaf-list.

            If the target value is a complex object,
            then the referenced variable must also be
            a complex object of the same type. E.g.,

            The global variable 'foo' would be specified as:

                value=$$foo

            The local variable 'bar' would be specified as:

                value=$bar

            An error will be reported if the global or local
            variable does not reference the same object type
            as the target parameter.";
       }

    }

    grouping CommonPduParms {
        description
            "Common parms for some local commands that
             generate NETCONF PDUs";

        choice from {
            mandatory true;

            leaf varref {
                description
                   "Use the contents of the specified variable
                    as the content";
                type string;
            }

            case from-cli {
                uses FillParms;
            }
        }
    }

    grouping EditParms {
        description
            "Common parms for create, merge, replace commands";

        uses CommonPduParms;

        leaf timeout {
          description "Timeout to use";
          type nt:Timeout;
        }
    }

    grouping SGetParms {
        description
            "Common parms for sget and sget-config operations.";

        leaf nofill {
           description
            "If present, and the 'from-cli' option is used
             for input, then filling of mandatory nodes
             and key leafs will be skipped.  Instead, the target
             object will be treated as a terminating select node
             in the filter element.";
           type empty;
       }
       uses ncxapp:CliWithDefaultsParm;
       uses yrc:depth-parameter;
       uses ywapp:ModuleTagParm;
       uses ywapp:WithOwnersParm;
       uses ywapp:WithLastModifiedParm;
       uses ywapp:WithEtagParm;
    }

    grouping XGetParms {
        description
            "Common parms for xget and xget-config operations.";

        choice from {
            mandatory true;

            leaf varref {
                description
                   "Use the contents of the specified variable
                    as the content";
                type string;
            }

            case select {
              uses SelectParm;
            }

            leaf urltarget {
              description
                "The URL path expression to use in the retrieval
                 operation.";
              type ywt:UrlPath;
            }
        }

        leaf timeout {
          description "Timeout to use";
          type nt:Timeout;
        }

        uses ncxapp:CliWithDefaultsParm;

        uses yrc:depth-parameter;

        uses ywapp:ModuleTagParm;

        uses ywapp:WithOwnersParm;
        uses ywapp:WithLastModifiedParm;
        uses ywapp:WithEtagParm;

        uses ywapp:MatchParms {
          description
            "These parameters are ignored unless the
             'urltarget' parameter is also present.";
        }
    }

    grouping DatastoreParm {
        leaf datastore {
          description "Particular datastore to retrieve.";
          type enumeration {
            enum candidate {
              if-feature nc:candidate;
              description
                "The <candidate> datastore.";
            }
            enum running {
              description
                "The <running> datastore.";
            }
            enum intended {
              description
                "The <intended> datastore.";

            }
            enum startup {
              if-feature nc:startup;
              description
                "The <startup> datastore.";
            }
            enum operational {
              description
                "The <operational> datastore.";
            }
          }
          default operational;
        }
    }

    grouping ConfigFilterParm {
      leaf config-filter {
        type boolean;
        description
          "The <config-filter parm from ietf-netconf-nmda.yang
              - not present = all
              - true = config=true only
              - false = config=false only
          ";
      }
    }

    grouping OriginParms {
      description "Filters lifted from ietf-netconf-nmda.yang";
      reference "RFC 8526";

      choice origin-filters {
        // when 'derived-from-or-self(datastore, "ds:operational")';
        // if-feature "origin";
        description
          "The origin-choice parameter from the get-data operation.
           These parameters will be ignored unless the datastore
           is <operational>.";

        leaf-list origin-filter {
          type or:origin-ref;
          description
            "The origin-filter parameter from ietf-netconf-nmda.yang";
        }
        leaf-list negated-origin-filter {
          type or:origin-ref;
          description
            "The negated-origin-filter parameter from ietf-netconf-nmda.yang";
        }
      }
      leaf with-origin {
        // when 'derived-from-or-self(../datastore, "ds:operational")';
        // if-feature "origin";
        type empty;
        description
          "The with-origin parameter from ietf-netconf-nmda.yang";
      }
    }

    grouping EntryPointParm {
        leaf entry-point {
          type string;
          description
            "RESTCONF entry point. Use this string instead of
             retrieving the XRD from the RESTCONF server to
             discover the entry point.";
         }
    }

    grouping ConnectParms {
        description
          "Common parms for connecting to a NETCONF server.
           Used by the connect operation and if present at
           the command line invocation, then the connect
           operation will be invoked automatically.";

        leaf user {
          description
             "User name to use for NETCONF sessions.";
          type nt:NcxUserName;
        }

        leaf server {
           description
             "IP address or DNS name of the NETCONF server target.";
          type inet:host;
        }

        choice pass {
          leaf password {
            description
              "User password to use for NETCONF sessions.
               If none, then user will be prompted before connecting.";
            type string;
            ncx:password;
          }
          leaf no-password {
            description
              "Indicates that no user password is needed for
               the connection.";
            type empty;
          }
        }

        leaf ncport {
          description
            "NETCONF port number to use.  If not present, then
             port 830, followed by port 22, will be tried.";
          type uint16 {
            range "1..max";
          }
          default 830;
        }

        leaf timeout {
          description
            "Number of seconds to wait for a response
             from the server before declaring a timeout.
             Zero means do not timeout at all.";
          type nt:Timeout;
        }

        uses ywapp:SshKeyParms;

        uses ywapp:SslKeyParms;

        uses ncxapp:ProtocolsParm;

        uses EntryPointParm;

        leaf transport {
          description
            "Identifies the transport protocol that should be used.";
          type ywt:transport-type;
          default ssh;
        }

        leaf encoding {
          description
             "Identifies the desired encoding format.
              Only supported for RESTCONF and YANG-API at this time.";
          type ywt:encoding-type;
          default xml;
        }
    }

    grouping XPathParms {
        description
          "Common parameters used for XPath script constructs";

        leaf expr {
          description
            "XPath expression string to evaluate.
             Use quotes if there are any whitespace or
             special characters in the expression.";
          type yang:xpath1.0 {
            length "1..max";
          }
          mandatory true;
        }

        anyxml docroot {
          description
            "Use the contents of the specified variable or
             external XML file as the conceptual document to
             apply the expression specified in the 'expr' parameter.

             If this parameter is missing then a dummy document
             will be used.  This is only allowed if the
             expression only contains variable references
             or numeric/string constants.";
        }
    }

    grouping SessionGroupParms {
        leaf missing-ok {
          type boolean;
          default false;
          description
           "If truew, then it is OK to manage this group if 1 or
            more sessions identified in the session leaf-list
            are not found in the session list. The default is
            to require all session names to exist in the session list
            for the group to be used.";
        }

        leaf missing-connect-ok {
          type boolean;
          default false;
          description
           "If true, then it is OK to manage this group if 1 or
            more sessions identified in the session leaf-list
            cannot be established when the connect -group=name
            operation is used. The default is to require all
            sessions to connect OK for the group to be used.";
        }

        leaf lost-ok {
          type boolean;
          default false;
          description
           "If true, then it is OK to manage this group if 1 or
            more sessions are lost after connection is made.
            The default is to require all sessions to remain
            connected for the group to be used.";
        }

        leaf reconnect-tries {
          type uint32;
          default 5;
          description
           "Indicates the number of times yangcli will attempt
            to reconnect to a session if the server becomes unreachable.
            The default is 5 tries.";
        }

        leaf reconnect-interval {
          type uint32;
          default 10;
          units seconds;
          description
           "Indicates the number of seconds yangcli will wait to
            re-establish a connection if a session is dropped
            and the server becomes unreachable.
            The default is 10 seconds.";
        }
    }

    grouping CommentParm {
      leaf comment {
        type string;
        description
          "User comment saved for users, devices, and sessions";
      }
    }

    grouping ZmqApiParms {
      description
        "For use in the yangcli-gw program only.
         Not enabled in other programs.";

       leaf zmqapi-gateway-id {
         type nt:NcxName;
         default "gateway1";
         description
           "The identifier string used to name the yangcli-gw
            instance.  This string will be used for the gateway ID
            in ZMQAPI messages and logging output.";
       }

       leaf zmqapi-responder-endpoint {
         type string;  // URI for zeroMQ endpoint
         default "tcp://127.0.0.1:5555";
         description
           "ZeroMQ endpoint URI that the yangcli-gw
            will use to listen for ZMQAPI commands.
            A client is expected to connect to this endpoind
            using the 'ZMQ_REQ' socket type.

            The client can send ZMQAPI.1 REQ messages
            on this socket.

            Then yangcli-gw will respond with a ZMQAPI.1 REP
            message on this socket.";
       }

       leaf zmqapi-publisher-endpoint {
         type string;  // URI for zeroMQ endpoint
         default "tcp://127.0.0.1:5556";
         description
           "ZeroMQ endpoint URI that the yangcli-gw
            will use to publish ZMQAPI notifications.
            A client is expected to connect to this endpoind
            using the 'ZMQ_SUB' socket type.

            The client is expected to listen only on this socket.

            Then yangcli-gw will send ZMQAPI.1 PUB
            messages as needed on this socket.";
       }

    }


    grouping CallHomeParms {
      description
        "Parameters used to configure the CallHome Server.
         This can be done from the CLI parameters or the
         'callhome' command.";

      leaf callhome-address {
        description
          "Identifies the IP address that should be used to listen
           for callhome connections. Ignored if callhome-enabled
           is false.";
        type inet:ip-address-no-zone;
        //default "0.0.0.0";  applies in uses-stmt if needed
      }

      leaf callhome-port {
        type inet:port-number;
        default 4334;
        description
          "Identifies the TCP port that should be used to listen
           for NETCONF over SSH callhome connections. Ignored if
           callhome-enabled is false.";
        reference "RFC 8071";
      }

      leaf callhome-tls-port {
        type inet:port-number;
        default 4335;
        description
          "Identifies the TCP port that should be used to listen
           for NETCONF over TLS callhome connections. Ignored if
           callhome-enabled is false.";
        reference "RFC 8071";
      }
    }

    grouping CollectorParms {
      description
        "Parameters used to configure the UDP Push Collector.
         This can be done from the CLI parameters or the
         'collector' command.";

      leaf collector-address {
        description
          "Identifies the IP address that should be used to listen
           for UDP-Notif messages. Ignored if collector-enabled
           is false.";
        type inet:ip-address-no-zone;
        //default "0.0.0.0";  applies in uses-stmt if needed
      }

      leaf collector-port {
        type inet:port-number;
        default 10830;  // no standard assigned port
        description
          "Identifies the UDP port that should be used to listen
           for UDP-Notif packets. Ignored if collector-enabled is false.";
      }
    }


    /*************************************************************
     *
     *         CLI parameter set for yangcli-pro program
     *
     *************************************************************/

    sx:structure yangcli-pro {
      ncx:cli;

      description
        "CLI Parameter Set for the NETCONF Client Application.";

      uses ncxapp:NcxAppCommon;

      uses ncxapp:NewConfigParm;

      uses ywapp:LoggingCommonParms;

      uses ywapp:MessageIndentParm;

      uses ywapp:YumaproHomeParm;

      uses ywapp:DataTemplateParms;

      uses ywapp:UseSessionVarsParm;

      uses ywapp:SaveSessionVarsParm;

      uses ywapp:TcpConnectParms;

      uses ncxapp:CommonFeatureParms;

      uses ncxapp:SubdirsParm;

      uses ncxapp:HomeParm;

      uses ConnectParms;

      uses ywapp:OcPatternParm;

      uses ywapp:BinaryDisplayMaxlenParm;

      uses ywapp:MatchParms {
        refine match-names {
          default one-nocase;
          /* This parameter only affects config mode. */
        }
        refine alt-names {
          default true;
        }
        refine wildcard-keys {
          default false;
        }
      }

      leaf match-names-exec-mode {
        type ywt:NameMatchMode;
        default exact;
        description
          "Match mode to use for UrlPath name searches
           in exec mode.

           This only affect XPath name matches and
           not command and parameter name matches.";
      }

      uses ywapp:WithTermMsgParm;

      leaf ask-password {
        description
          "Specifies whether the user will be required and
           prompted to provide a password parameter for the
           connect command.

           This parameter is intended to support servers
           that use keys for authentication instead of passwords.

           If 'true' then the connect command will expect
           that a password is needed.  If 'false' the connect
           command will no require a password, but it will
           use the password parameter if it is set.";
        type boolean;
        default true;
      }

      leaf aliases-file {
        description
          "Specifies the yangcli-pro command aliases file to use.";
        type string;
        default "~/.yumapro/.yangcli_pro_aliases";
      }

      leaf allow-shell {
        type boolean;
        default false;
        description
          "Enable or disable run-shell operation.";
      }


      leaf autocomp {
        description
          "Controls whether partial keywords will be
           checked for interactive or script commands.
           By default, the first match for a partial keyword
           will be used if no definition is found for
           a command name or parameter name.";
        type boolean;
        default true;
      }

      leaf autoconfig {
        description
          "Controls whether the running configuration
           will be retrieved automatically for active sessions.
           By default, the running config will not be retrieved
           and maintained. This option must be set to true to
           support value-node command tab completion.";
        type boolean;
        default false;
      }

      leaf autoconfig-conf-mode {
        description
          "Controls whether the running configuration
           will be retrieved automatically for active sessions
           in config-mode.

           If autoconfig == TRUE then autoconfig-conf-mode is ignored
           and autoconfig will be done for config mode.

           If autoconfig == FALSE then autoconfig-conf-mode is checked
           and only set if autoconf-conf-mode == TRUE
           If false, the requests after each update will not be done.
           The current config will not be available to assist tab
           completion.";
        type boolean;
        default true;
      }

      leaf autoaliases {
        description
          "Controls whether the yangcli-pro command aliases will
           be saved at exit and loaded at startup.
           If true, the 'aliases-file' parameter will be used if it is set,
           or else the default aliases file will be used
           (~/.yumapro/.yangcli_pro_aliases), for loading
           and saving the yangcli-pro command aliases.
           If false, the yangcli-pro command aliases will only be stored
           and loaded manually with the aliases command.";
        type boolean;
        default true;
      }

      leaf autoload {
        description
          "Controls whether any modules (except this one)
           will be automatically loaded upon startup or
           upon session startup with a server. If false,
           the 'mgrload' command must be used to
           explicitly load all the desired YANG modules.";
        type boolean;
        default true;
      }

      leaf autoload-get {
        description
          "Controls whether the <get> operation will be used
           to retrieve the /netconf-state/schemas sub-tree.

           If 'true', then the schema list will be used instead
           of the <hello> message module capabilities, if the
           server supports the 'ietf-netconf-monitoring' module.

           If 'false', then just the <hello> message module
           list will be used to retrieve YANG modules with
           the <get-schema> operation.

           This option is needed to autoload sub-modules
           that are not available to yangcli-pro, since
           YANG submodules are not advertised in the <hello>
           message.";
        type boolean;
        default true;
      }

      leaf autoload-cache {
        description
          "Controls whether the modules retrieved with the
           <get-schema> operation are cached for use by the
           running instance of yangcli-pro.

           If true, then the YANG modules that are retrieved
           with the <get-schema> operation will be cached.
           A cached module will be used by yangcli-pro instead
           of calling <get-schema>, if that module revision
           is requested again.

           If false, then the YANG modules that are retrieved
           with the <get-schema> operation will not be cached.";
        type boolean;
        default true;
      }

      leaf autoload-save-cache {
        description
          "Controls whether the modules held in the YANG module
           cache (retrieved with the <get-schema> operation)
           are saved when yangcli-pro exits.

           If true, then the YANG modules that are cached
           will not be deleted when yangcli-pro exit.

           If false, then the YANG modules that are cached
           will be deleted when yangcli-pro exits.";
        type boolean;
        default true;
      }

      leaf auto-discard-changes {
        description
          "Controls whether discard-change will be automatically
           sent on the errors of the edit and save mode.
           If true, discard-change will be automatically sent.
           If false, discard-change will not be automatically sent.";
        type boolean;
        default false;
      }

      leaf auto-keepalive {
        description
          "Controls whether keepalive messages will be automatically
           sent on a connected session.
           If true, keepalive message is sent every keepalive-interval.
           If false, keepalive message will not be sent.";
        type boolean;
        default false;
      }

       leaf auto-reconnect {
         description
           "Controls whether yangcli will try to reconnect to
            the server If the session gets dropped by the server.
            If true, yangcli-pro will try to reconnect to the server.
            If false, yangcli-pro will not try to reconnect to
            the server.";
         type boolean;
         default true;
      }

      leaf auto-reconnect-interval {
        description
          "Number of seconds to wait after first retry.
           The first retry will be done right away.";
        type uint16 { range "1 .. 3600"; }
        units seconds;
        default 10;
      }

      leaf auto-reconnect-max {
        description
          "Number of times to retry the connection.
           Zero means no limit, otherwise re-connect attempts
           will stop after this number of failures.";
        type uint16;
        default 5;
      }

      leaf autodevices {
        description
          "Controls whether the saved devices will be loaded
           into memory at startup and saved to file at exit.
           If true, the default device-cfg file will be used
           (~/.yumapro/.yangcli_pro_devices.conf) for loading
           and saving the configured devices in memory.
           If false, the configured devices will only be stored
           and loaded manually with the devices-cfg command.";
        type boolean;
        default true;
      }

      leaf autohistory {
        description
          "Controls whether the command line history buffer will
           be saved at exit and loaded at startup.
           If true, the history-file parameter will be checked
           and used if set. Otherwise the default history file
           will be used (~/.yumapro/.yangcli_pro_history) for
           loading and saving the history buffer.
           If false, the history buffer will only be stored
           and loaded manually with the history command.";
        type boolean;
        default true;
      }

      leaf autonotif {
        description
          "Controls whether notifications will automatically
           be enabled when a session starts.
           By default, notifications will not be enabled.
           If enabled, a <create-subscription> operation will
           be performed when the session starts, and notification
           events for the sesion will be monitored.

           This parameter does not affect echoing of
           notification messages. The --echo-notifs and
           --echo-notif-loglevel parameters need to be set
           appropriately to echo received notification messages.";

        type boolean;
        default false;
      }

      leaf autonvsave {
        description
          "Controls whether the 'save' and 'apply' commands
           will NV-save the configuration changes or not.
           If the server advertises the :startup capability
           and this variable is set to 'false', then the
           final step to save running to startup will not
           be done.  The 'nvsave' command can be used to
           manually save the running datastore to non-volatile
           memory.";
        type boolean;
        default true;
      }

      leaf autoschemaservers {
        description
          "Controls whether the saved schema servers will be loaded
           into memory at startup and saved to file at exit.
           If true, the default schemaserver-cfg file will be used
           (~/.yumapro/.yangcli_pro_schemaservers.conf) for loading
           and saving the configured devices in memory.
           If false, the configured devices will only be stored
           and loaded manually with the schemaservers-cfg command.";
        type boolean;
        default true;
      }

      leaf autosessions {
        description
          "Controls whether the saved sessions will be loaded
           into memory at startup and saved to file at exit.
           If true, the default session-cfg file will be used
           (~/.yumapro/.yangcli_pro_sessions.conf) for loading
           and saving the configured sessions in memory.
           If false, the configured sessions will only be stored
           and loaded manually with the sessions-cfg command.";
        type boolean;
        default true;
      }

      leaf autotest {
        description
          "Controls whether the saved test suites will be loaded
           into memory at startup and saved to file at exit.
           If true, the default test-suite-cfg file will be used
           (~/.yumapro/yangcli_pro_tests.conf) for loading
           and saving the configured test-suites in memory.
           If false, the configured test-suites will only be stored
           and loaded manually with the test-suite command.";
        type boolean;
        default true;
      }

      leaf autousers {
        description
          "Controls whether the saved users will be loaded
           into memory at startup and saved to file at exit.
           If true, the default user-cfg file will be used
           (~/.yumapro/.yangcli_pro_users.conf) for loading
           and saving the configured users in memory.
           If false, the configured users will only be stored
           and loaded manually with the users-cfg command.";
        type boolean;
        default true;
      }

      leaf autoeventhandlers {
        description
          "Controls whether the saved event_handlers will be loaded
           into memory at startup and saved to file at exit.
           If true, the default event-handler-cfg file will be used
           (~/.yumapro/.yangcli_pro_event_handlers.conf) for loading
           and saving the configured event-handlers in memory.
           If false, the configured event-handlers will only be stored
           and loaded manually with the event-handlers-cfg command.";
        type boolean;
        default true;
      }


      leaf autouservars {
        description
          "Controls whether the yangcli-pro user variables will
           be saved at exit and loaded at startup.
           If true, the 'uservars-file' parameter will be used if set,
           or else the default user variables file will be used
           (~/.yumapro/yangcli_pro_uservars.xml), for loading
           and saving the yangcli-pro user variables.
           If false, the yangcli-pro user variables will only be stored
           and loaded manually with the uservars command.";
        type boolean;
        default true;
      }

      leaf bad-data {
        description
          "Specifies how invalid user input from the CLI
           will be handled when filling PDUs for remote
           operations.";

        type enumeration {
          enum ignore {
            description
              "Silently accept invalid PDU and data model
               parameters.  Intended for advanced server
               testing mode only.";
          }
          enum warn {
            description
              "Warn, but accept invalid PDU and data model
               parameters.";
          }
          enum check {
            description
              "Prompt the user to keep the invalid value
               or re-enter the value.";
          }
          enum error {
            description
              "Prompt the user to re-enter the invalid value.";
          }
        }
        default "check";
      }

      leaf batch-mode {
        description
          "If present, the interactive CLI will not be used.
           A script should be provided with the 'run-script'
           parameter, or a command provided with the 'run-command'
           parameter, or else the program will simply exit.
           If the auto-connect mode is enabled, then this will mode
           simply test if a NETCONF session can be established,
           then exit.";
         type empty;
      }

      leaf break-key-mode {
        description
          "Specifies the bahavior when the break key is pressed
           during a command. The default mode is 'program' to
           maintain backward compatibility.";
         type enumeration {
           enum program {
             description
               "Break key will cause the program to exit no
                matter what mode or state the program is in
                at the moment.";
           }
           enum command {
             description
               "Break key will cause the current command in
                the current session to be terminated. If no
                commnd is in progress, or currently in config mode
                or enable mode, then the break key will have no affect.";
           }
         }
         default program;
      }

      uses CallHomeParms {
        refine callhome-address {
          default "0.0.0.0";
        }
      }


      leaf callhome-enabled {
        description
          "If true, then yangcli-pro will listen for SSH CallHome
           connections on the socket identified by the
           callhome-address and callhome-port parameters.";
        type boolean;
        default false;
      }


      leaf-list callhome-user {
        type nt:NcxUserName;
        ordered-by user;
        description
          "Specifies the name of a configured user entry that
           should be used as the default user for callhome
           sessions, if no saved session entry is found matching
           the server IP address.  Will be ignored if the user
           is not currently configured.

           If a callhome session is attempted with an entry
           and that connection fails, then that callhome-user
           will not be attempted for the specific server address
           until yangcli-pro is restarted. This only applies
           if there are multiple callhome-user entries.

           If only one callhome-user entry exists then it will
           be used every time, to be backward-compatible with
           previous releases.

           If used in yp-client then it is possible an application
           callback will pick the callhome-user for a specific address.
           It that case, the ordered-by user property will be
           ignored.  Otherwise the callhome-user entries are attempted
           in the order they are processed from the CLI or configuration
           file.";
      }

      leaf check-output {
        description
          "If true, then yangcli-pro will validate remote commands
           against the YANG definition for the rpc/input node.
           This checks the operation parameters about to be sent to
           a server session. Validation of the contents of a <config>
           element are not done.  Also the $$check-output global
           parameter.";
        type boolean;
        default true;
      }

      leaf check-output-error {
        description
          "If 'true', then errors found during the check-output
          validation tests will be treated as errors, causing
          the <rpc> about to be sent to fail.
          If 'false', then errors found during the check-output
          validation tests will be treated as warnings.
          Also the $$check-output-error global parameter.";
        type boolean;
        default false;
      }

      leaf check-replies {
        description
          "If true, then yangcli-pro will validate responses for
           remote commands against the YANG definition for
           the rpc/output node. This checks the parameters
           in the <rpc-reply> sent from a server session.
           If the 'output' section is missing or empty, then
           the <rpc-reply> will be checked to make sure it
           contains either <ok> or 1 or more <rpc-error> elements.
           Also the $$check-replies global parm.";
        type boolean;
        default true;
      }

      leaf check-replies-error {
        description
          "If 'false', then errors found during the check-replies
          validation tests will be treated as warnings.
          If 'true', then errors found during the check-replies
          validation tests will be treated as errors, causing
          the <rpc-reply> about to be processed to be rejected.";
        type boolean;
        default false;
      }

      uses CollectorParms {
        refine collector-address {
          default "0.0.0.0";
        }
      }

      leaf collector-enabled {
        description
          "If true, then yangcli-pro will listen for UDP-Notif
           messages on the UDP socket identified by the
           collector-address and collector-port parameters.";
        type boolean;
        default false;
      }

      leaf config-edit-mode {
        description
          "Controls how edits are applied during config mode.";
        type config-edit-mode-type;
        default level;
      }

      leaf config-commit-mode {
        description
          "If 'true' then edits done in config mode will be made to
           the candidate datastore if possible. The edits will not
           be committed to the running datastore automatically.
           Instead, <config-commit> command in config mode, or <commit>
           operation in normal mode is required to activate the edits
           in the server. If 'false' then edits done in config mode
           will be committed to the running datastore after each
           'apply' or 'exit' command in config mode.";
        type boolean;
        default false;
      }

      leaf config-autosave {
        description
             "Controls how edits in config term mode are saved to
              NV-storage if the server supports the :startup capability.
              If 'true', automatically copy running to startup when
              an edit is applied. If 'false', no automatically copy
              from running to startup when an edit is applied.
              The user will enter 'save' or 'copy-config'
              manually once config term mode is exited.";
           type boolean;
           default true;
      }

      leaf confirm-data-retries {
        description
          "Controls how many retry attempts will be given to the
           user to correctly re-enter a parameter value that
           has the 'ywx:confirm-data' extension.

           The command in progress will be cancelled unless the
           data node is properly connfirmed or skipped.";
        type uint8 {
          range "1 .. 10";
        }
        default 3;
      }

      leaf-list custom-command {
        description
          "Specifies the module and name of a custom command
           that should be added to the command parser.

           This string is structured. It has 3 fields:

              module-name ':' rpc-name [ '/' scope-id ]

           Refer to the 'Custom Commands section of the user
           manual for complete details.

           Examples:

              example-mymod:*/S

              Load all RPC statements found in example-mymod
              as top-level commands.


              example-command1:set-retry-interval/T
              example-command1:test-retry-interval/S

              Load set-retry-interval in example-command1
              as a top-level command. Load test-retry-interval
              in example-command1 as a session-level command.

           Run-time Example:

              If the command test-retry-interval is entered,
              then the command parser will check for a script
              as follows:

                1) Python: Find 'test-retry-interval.py'
                2) Bash: Find 'test-retry-interval.sh'
                2) yangcli: Find 'test-retry-interval'

          ";

        type string;
      }


      leaf with-enable-mode {
        description
          "Controls whether an 'enable mode' will be supported
           for yp-shell.

           If 'true', the user must enter the 'enable' command
           to enter enable mode. If the 'enable password' has been
           configured then this password must be provided by the
           user in order to enter enable mode. Within enable mode,
           the 'config term' command can be used to enter
           configuration mode.

           If 'false', then enable mode will not be used and
           the 'enable' and 'enable password' will not be present.";
        type boolean;
        default false;
      }

      leaf default-module {
        description
           "Default module name string to use before 'yuma-netconf'
            and 'yangcli-pro' are tried.  The module prefix may need to be
            used for other modules.";
         type nt:NcxName;
      }

      leaf-list disable-command {
        description
           "Specifies a top-level command that should be disabled
            and not visible or available to a user. If the value
            does not contain a module name prefix, then the command
            will be disabled in all modules.

            For example, to disable the NETCONF <delete-config>
            operation:

               disable-command nc:delete-config

            If the RPC name is unique then the module name prefix
            is not required:

               disable-command delete-config
            ";
         type nt:NcxIdentifier;
      }

      leaf display-mode {
        description
           "Controls how values are displayed during output
            to STDOUT or a log file.

            This typedef matches the ncx_display_mode_t enum
            for text based encoding formats.
            The 'cbor' enumeration is not included in this parameter.";

         type enumeration {
           enum plain {
             description
                 "Plain identifier without any prefix format.";
           }
           enum prefix {
             description
                "Plain text with XML prefix added format.";
           }
           enum module {
             description
                "Plain text with module name as prefix added format.";
           }
           enum xml {
             description
                "XML format.";
           }
           enum xml-nons {
             description
                "XML format, but no namespace (xmlns) attributes
                 will be generated.";
           }
           enum json {
             description
                "JSON format.";
           }
           enum cli {
             description
                "CLI format.";
           }
        }
        default plain;
      }

      leaf echo-notif-loglevel {
        description
          "Specifies the log-level value that must be active before
           notifications will be echoed to the log or STDOUT.
           This parameter has no affect if 'echo-notifs' is false.
           The $$echo-notif-loglevel system variable is derived from
           this parameter.

           The default is different on yp-shell (debug) and
           yangcli-pro (info). The YANG default is not used
           correctly.";
        type nt:NcDebugType;
        default debug;
      }

      leaf echo-notifs {
        description
          "Allow notifications to be echoed to the log or STDOUT

           If 'true', <notification> messages will be output
            to the log, if log-level is set to the value
            specified by the echo-notif-loglevel or higher.

           If 'false', <notifications> messages will not be
           output to the log.

           The $$echo-notifs system variable is derived from
           this parameter.

           If --autonotif=true then this parameter will also
           be set to true.

           The default is different on yp-shell (false) than
           yangcli-pro (true). The YANG default is not used
           correctly.";
        type boolean;
        default true;
      }

      leaf echo-replies {
        description
          "Allow RPC replies to be echoed to the log or STDOUT

           If 'true', <rpc-reply> messages containing data
           will be output to the log, if log-level is
           'info' or higher.

           If 'false', <rpc-reply> messages containing data
           will not be output to the log, regardless of
           the value of log-level.

           The $$echo-replies system variable is derived from
           this parameter.";
        type boolean;
        default true;
      }

      leaf fixorder {
        description
          "Controls whether PDU parameters will be
           automatically sent to the server in the
           correct order.  If false, the specified order
           will be used. If true, then canonical order will
           be used";
        type boolean;
        default true;
      }

      leaf force-target {
        description
          "Controls whether the candidate or running
           configuration datastore will be used as
           the default edit target, when both are supported
           by the server.";
        type enumeration {
          enum candidate {
            description
              "Force default edit target to be candidate.";
          }
          enum running {
            description
              "Force default edit target to be running.";
          }
        }
        default candidate;
      }

      uses ncxapp:ModuleParm;

      uses ncxapp:DeviationParm;

      uses ncxapp:DatapathParm;

      uses ncxapp:RunpathParm;

      leaf handle-bad-reply {
        description
          "Controls the behavior of the XML parser and dictates
           how a bad RPC reply will be handled, whether the bad
           node(s) will be pruned or the value will be adapted
           and the client will try to convert it to an acceptable
           type.";
        type enumeration {
          enum adapt {
            description
              " - Leaf or leaf-list: convert bad value to a string value
                  and try to keep it if possible or prune if not.
                - Container or list: leave in the data if
                  possible or prune if not.";
          }
          enum prune {
            description
              "Prune failing node(s).";
          }
          enum error {
            description
              "Do not attempt to prune or modify nodes. Report an error.";
          }
        }
        default error;
      }

      leaf help-width {
        description
          "The line width to use when displaying help text for the
           help key '?' within config term mode.

           This help mode aligns the description to the right
           of the widest object node name being displayed.

           If the 'help' extension is used, then that text is
           displayed in its entirety. Otherwise the total line
           width will be limited to this help-width value.

           Starting in the 23.10-6 release:

           *  The help output is not limited to a single line.
           *  Multiple lines will be output until the help-width total
              has been reached.
           *  The screen dimensions will be used to determine the
              total width for a single line .
           *  Blank lines and indentation in the description will
              be preserved in the help output.
           *  This parameter is used to determine the total number
              of help characters to be displayed per object.
           *  The value '0' indicates that the complete help text
              should be displayed for each object, instead of a
              specified limit.
           *  The default value is '80' for backward compatibility.
           *  The old limit of '511' has been extended to '65535'
         ";
        type uint16 {
          range "0 | 80 .. max";
        }
        default 80;
      }

      leaf-list hide-command {
        description
           "Specifies a top-level command that should be hidden
            from the tab key, help key and help command.

            If the value does not contain a module name prefix, then
            the command will be disabled in all modules.

            -  It will still be enabled but not visible to the user.
            -  If a hidden command is used in a script or directly
               from the command line it will be accepted.
            -  This parameter is ignored if the same command
               is also listed in a 'disable-command' parameter.

            For example, to hide the NETCONF <delete-config>
            operation:

               hide-command nc:delete-config

            For example, to hide the internal 'else' command:

               hide-command yc:else

            ";
         type nt:NcxIdentifier;
      }

      leaf history-file {
        description
          "Specifies the file location for the libtecla command
           line history file used if autohistory is 'true'. This
           file will be created if it does not exist and the
           autohistory parameter is 'true'.";
        type string;
        default "~/.yumapro/.yangcli_pro_history";
      }

      uses ywapp:InsecureOkParm;

      leaf keepalive-interval {
        type uint32 {
          range "1 .. 3600";
        }
        units "seconds";
        default '4';
        description
          "Specifies the time interval, in seconds, between keepalive
           messages sent from a session. This value is only used
           if 'auto-keepalive' is true.";
      }

      leaf no-aliases {
        description
          "Disables the alias substitution feature.
           The alias file will not be read.
           The aliases and alias commands will be disabled.";
        type empty;
      }

      leaf fill-optional {
        description
          "Sets the default for the --optional parameter that can
           be passed to many interactive commands such as 'fill'
           or 'create'.

           If 'true' then the user will be prompted to enter
           optional nodes while filling YANG datastore content.

           If 'false' then the user will not be prompted to enter
           optional nodes while filling YANG datastore content.";
        type boolean;
        default false;
      }

      leaf optional {
        description
          "Sets the default for the $$optional global variable.
           If 'true' then the user will be prompted to enter
           optional nodes for all input.

           If 'false' then the user will not be prompted to enter
           optional nodes for all input.

           This parameter affects all YANG input and should normally
           not be used. The fill-optional parameter should be used
           instead.";
        type boolean;
        default false;
      }

      leaf prompt {
         description
           "Set the prompt to the user defined value.
            This parameter is supported only for yp-shell.
            The prompt can also be set using the $$prompt variable
            at any time.  If the --prompt CLI parameter is set
            then that value will be used as the prompt when yp-shell starts.
            If prompt is used, prompt-name and prompt-type will be ignored.";
         type string {
             length "1 .. 512";
         }
      }

      leaf prompt-name {
         description
           "Customize a prompt name for yp-shell.";
         type string {
             length "1 .. 512";
         }
      }

      leaf prompt-type {
        description
          "Selects the type of prompt string that will be used
           in interactive mode.";
        type ywt:show-mode;
        default normal;
      }

      leaf python-command {
        type string;
        default "/usr/bin/python";
        description
          "The Python program to invoke when a Python script
           is invoked.";
      }

      leaf restrict-edit-mode {
        type boolean;
        default false;
        description
          "If true then the yp-shell editing commands (create, merge,
           replace, delete, remove, insert, delete-all, remove-all, nvsave)
           will not be available to the user. Also, the NETCONF edit-config,
           copy-config, delete-config, commit, cancel-commit, discard-changes
           commands will not be available to the user.

           If true then only the config mode will be available for
           editing configuration data on the server.

           This parameter can be used instead of specifying individual
           disable-command parameters for the editing commands.";
      }

      leaf return-status {
        description
          "Controls whether the program will return the status code
           or return zero, when it exits.

           If 'true' then the program will return the 'status_t'
           enumeration number for the error that occurred
           or zero if no error occurred.

           If 'false' then the program will always return zero.";
        type boolean;
        default false;
      }

      choice run-startup-mode {
        leaf run-script {
          description
            "The specified script will be invoked upon startup.
             If the auto-connect parameters are provided, then
             a session will be established before running the
             script.  If a quoted string is used, then any parameters
             after the script name will be passed to the script.";
           type string {
             length "1 .. 4095";
           }
        }

        leaf run-command {
          description
            "The specified command will be invoked upon startup.
             If the auto-connect parameters are provided, then
             a session will be established before running the
             command.";
           type string {
             length "1 .. 4095";
           }
        }
      }

      leaf script-input {
        description
          "Specifies whether scripts run in interactive mode should
           attempt to fill in missing command parameters from the
           CLI command line or not.
           If not, then script commands will be attempted with
           whatever parameters are present in the script.";
        type boolean;
        default true;
      }

      leaf server-commands {
        description
          "Specifies whether RPC operations learned from server
           YANG modules will be added as a command available to
           the user.

           The module ietf-netconf is exempt from this parameter.
           Use the disable-command parameter to disable individual
           NETCONF operations.";
        type boolean;
        default true;
      }

      leaf shell-command {
        type string;
        default "/bin/bash";
        description
          "The shell program to invoke with the 'run-shell' command,
           in case the default cannot be used.";
      }

      leaf show-builtin {
        type boolean;
        default true;
        description
          "Controls how the 'show' command functions at all times.
           If false, the show command will not check if the command line
           represents a built-in show command. In this case
           all built-in show commands are disabled.

           If true, the show command will check if the command line
           represents parameters for the built-in show command.

           The '$$show-builtin' system variable can be used
           to change this parameter at runtime.

           Introduced 24.10T-3.
          ";
      }

      leaf show-data {
        type boolean;
        default true;
        description
          "Controls how the 'show' command functions if the
           current session is connected to a server.

           If false, the show command will not check if the
           command line represents server datastore data at all.

           If true, the show command will check if the command line
           represents server datastore data after checking
           if the command line contains parameters for
           the built-in show command.

           The 'match-names' parameter is used to control how
           matches are determined for the data node names.

           The '$$show-data' system variable can be used
           to change this parameter at runtime.

           Introduced 24.10T-3.
          ";
      }

      leaf show-datastore {
        type boolean;
        default true;
        description
          "Controls how the 'show' command functions if the
           current session is connected to a server.

           This parameter is ignored unless the 'show-data'
           parameter is set to 'true.

           If false, the show command will not check if the
           first command line parameter represents a datastore name.

           If true, the show command will check if the first command
           line parameter represents server a datastore name.
           If so, then the rest of the command line represents
           data nodes within that datastore to retrieve.

           The '$$show-datastore' system variable can be used
           to change this parameter at runtime.

           The 'match-names' parameter is used to control how
           matches are determined for the datastore name.

           If a datastore other than 'operational' is epecified
           then the allowed data nodes will be restricted to
           configuration data nodes.

           The datastore name must be at least 3 characters long
           or the string will not be treated as a datastore name.
           Name Natch Example:
              - match-names = one-nocase (default)
              - 'show run' will be treated as 'show running'
              - 'show ru' will be interpreted as 'show ru'

           Datastore names supported depends on the current session
           -  'running' is always enabled
           -  'candidate' is enabled if the :candidate capability is
              supported by the server
           -  'startup' is enabled if the :startup capability is
              supported by the server
           -  'intended' is enabled if NMDA is supported by the server
           -  'operational' is enabled if NMDA is supported by the server

           Introduced 24.10T-3.
          ";
      }

      leaf show-headers {
        type boolean;
        default true;
        description
          "If 'false' show the top-most data node if possible,
           when displaying server responses.  The 'rpc-reply' container
           and 'data' container will not be shown in this case.
           Using this setting may cause regression tests to fail
           which match the entire text response.

           This is not done if there are multiple child nodes returned.
           A header is only removed if there is exactly one child
           node within it.

           The '$$show-headers' system variable can be used
           to change this parameter at runtime.

           If 'true' the entire response message is shown.
           This is current behavior. Introduced 24.10-2";
      }

      leaf show-table {
        type boolean;
        default true;
        description
          "If 'true' show eligible data in tabular format.

           If 'false' then do not display any data in tabular format.

           The '$$show-table' system variable can be used
           to change this parameter at runtime.

           Refer to the user manual for details.";
      }

      leaf show-table-force {
        type enumeration {
          enum off {
            description
              "Do not force table display at all.";
          }
          enum skipped {
            description
              "Allow columns to be skipped that cannot be displayed
               in the table, such as choices, containers, and
               leaf-lists.";
          }
          enum width {
            description
              "Allow table to be displayed even if too wide.
               Also allows skipped nodes";
          }
        }
        default "skipped";
        description
          "Controls how table display is forced in show data mode.

           This parameter is ignored if the 'show-data' or 'show-table'
           parameter is false.

           If the 'cli-suppress-table' YANG extension is in affect
           for the targeted list object then the table output is
           not used and this parameter is ignored.

           If the 'cli-enforce-table' YANG extension is in affect
           for the targeted list object then the table output is
           used and this parameter is ignored.

           The '$$show-table-force' system variable can be used
           to change this parameter at runtime.

           Refer to the user manual for details.";
      }

      leaf show-table-max-colsize {
        type uint8 {
           range "12 .. max";
        }
        default 30;
        description
          "Sets the maximum width to display for a column.
           Data will be truncated within a table cell if the length
           is greater than this amount.

           The actual column width is determined by the width required
           by the header and all the data in the server response
           for a given leaf.

           If the column width is not wide enough for the header line then
           the header name will be truncated the same as a table cell.

           If the output is truncated because the column width is not
           large enough then the last character printed for that
           table cell will be the '*' character.

           The '$$show-table-max-colsize' system variable can be used
           to change this parameter at runtime.

           Refer to the user manual for details.";
      }

      leaf term-length {
        description
          "Specifies the length of the terminal to use for page
           mode output with the -More- prompt. This parameter
           is ignored in batch mode. It is only used if the
           output session is operating in interactive mode.

           If the value 0 is used then the 'More' prompt will
           be disabled. Otherwise this value represents the
           number of lines to output for each screen in pagination
           output mode.";
        type uint16 {
          range "0 .. 511";
        }
        default 0;
      }

      leaf test-suite-file {
        description
          "Specifies the yangcli-pro test suite config
           file to use.";
        type string;
        default "~/.yumapro/yangcli_pro_tests.conf";
      }

      leaf time-rpcs {
        description
         "Measure the round-trip time of each <rpc> request and
          <rpc-reply> at the session level.
          Echo the elapsed time value to screen if in
          interactive mode, as well as the log if the
          log is a file instead of stdout.
          The $$time-rpcs system variable is derived from this
          parameter.";
        type boolean;
        default false;
      }

      leaf time-rpcs-stats {
        description
         "Save rpc statistics to the default statistics file
          if the time-rpcs variable is also true.
          The $$time-rpcs-stats system variable is derived
          from this parameter.";
        type boolean;
        default false;
      }

      leaf time-rpcs-stats-file {
        description
         "The default filename to use for saving RPC timing statistics.
          if the time-rpcs and time-rpc-stats variables are true.
          The $$time-rpcs-stats-file system variable is derived
          from this parameter.";
        type string {
          length "1 .. max";
        }
        default "~/yangcli_pro_rpc_stats.txt";
      }

      leaf uservars-file {
        description
          "Specifies the yangcli-pro user variables file to use.";
        type string;
        default "~/.yumapro/yangcli_pro_uservars.xml";
      }

      leaf use-rawxml {
        description
          "Specifies how file result variables will be read
           for XML files.  Controls whether the XML will be
           parsed against the target YANG object (the default)
           or injected into a variable or request message from
           the raw XML text in the file.";
        type boolean;
        default false;
      }

      leaf use-traceid {
        description
          "Controls whether the 'trace-id' attribute will
           be set in the RPC requests or not.
           By default, 'trace-id' will be disabled.";
        type boolean;
        default false;
      }

      leaf use-xmlheader {
        description
          "Specifies how file result variables will be written
           for XML files.  Controls whether the XML preamble
           header will be written or not.";
        type boolean;
        default true;
      }

      uses ywapp:WarnOffYangParm;

      uses ywapp:WithJsonMetadataParm;

      leaf with-notif-commands {
        description
          "Specifies that yp-shell should include the
           create-subscription and cancel-subscription commands.
           This parameter does not affect yp-shell echoing of
           notification messages. The --echo-notifs and
           --echo-notif-loglevel parameters need to be set
           appropriately to echo received notification messages.";
        type boolean;
        default false;
      }

      uses ywapp:WithYangMetadataParm;

      leaf with-yanglib-cache {
        type boolean;
        description
          "If 'true' then relevant YANG library information
           from a NETCONF session will be cached to disk so that
           it can be reused (if possible) when a session to that
           server is started again.

           If 'false' then the YANG library information will not
            be saved to disk when a session is started (and the
            cache entry does not exist).

           This parameter is required to simplify UDP-Notif
           Collector configuration.";
        default true;
     }

      leaf-list yangmap {
        description
          "Specifies a yangmap XML file that should be loaded
           into the program. See yumaworks-yangmap.yang for
           details on using YANG mappings in config term mode.";
        type string;   // filespec
      }

     leaf leaflist-multi-line {
        description
          "Controls how the leaflist can be edited in config-mode.
           If true, multiple leaf-lists can be configured at the
           same line. If false, only one leaf-list can be configured
           and it must be configured at the end of the line.";
        type boolean;
        default false;
      }

      uses ZmqApiParms;

      leaf ypshell-exec-ok {
         description
            "Specifies if the yp-shell program can have access
             to the exec type of commands such as the 'run' and
             'run-shell' commands. Only applies to yp-shell.

             If 'true' then yp-shell witll allow the user session
             to use the following commands:
             - cd
             - elif
             - else
             - end
             - eval
             - fill
             - get-locks
             - if
             - list
             - log-debug
             - log-error
             - log-info
             - log-warn
             - pwd
             - release-locks
             - run
             - run-shell
             - sleep
             - start-rpc-timing
             - start-timer
             - stop-rpc-timing
             - stop-timer
             - while

           If 'false' then these commands will not be enabled
           in the yp-shell program.

           This parameter cannot be changed at run-time with a
           system variable.

           The '--allow-shell' parameter must also be set to 'true'
           for the 'run-shell' command to be enabled.
          ";
         type boolean;
         default false;
      }

    }  // end sx:structure yangcli-pro

    /*************************************************************
     *
     *  RPC methods for local commands within yangcli-pro
     *
     *  NOTE TO DEVELOPERS:
     *   When adding a global command that can be used even if there
     *   is no connected session, then you MUST add the command name
     *   to the yangcli_util:is_top_command function
     *
     *   When adding a command that can be used with the config mode
     *   'do' command, then you MUST add the command name
     *   to the yangcli_util:is_do_command function
     *************************************************************/

    rpc action {
      description
        "Invoke a YANG action.
         The target of the action must identify a YANG action
         statement, which is not a real node in the server data
         tree.";
      input {
        ncx:default-parm target;
        uses CommonPduParms;
        leaf timeout {
          description "Timeout to use";
          type nt:Timeout;
        }
      }
    }

    rpc alias {
      description
        "Show or set a specific yangcli-pro command alias.

         * Show all aliases in memory (same as aliases):

           yangcli-pro>  alias

         * Show one alias 'foo':

           yangcli-pro>  alias foo

         * Set one alias; make sure there is no whitespace
           between the '=' char and either string.  If the value
           has whitespace, it must be quoted. If the equals sign
           is present, then a valid value string must be present.

           Quotes will be preserved if used:
             * Single quotes can appear within doubled-quoted
               strings but not any double quotes.
             * Double quotes can appear within single-quoted strings
               but not any single quotes.

           The first token in a plain command or the first token
           in the right-hand-side expression in an assignment
           statement can be an alias.

           The alias name must exact match the token.
           A new command line will be constructed replacing
           the alias name with its value.  The new command
           line will then be parsed as usual.

           yangcli-pro>  alias s=show
           yangcli-pro>  alias getfoo='sget-config source=running /top/foo'

        * Aliases can override real commands, so be careful
          not to unintentionally alter real commands.

           yangcli-pro>  alias get-config='get-config source=running'
       ";
      input {
        ncx:default-parm var;
        ncx:default-parm-equals-ok;

        leaf var {
          description "The alias command string.";
          type string { length "1 .. max"; }
        }
      }
    }

    rpc aliases {
      description "Manage the yangcli-pro command aliases";
      input {

        choice alias-action {
          default show;

          leaf show {
            description
              "Show all the yangcli-pro command aliases.";
            type empty;
          }

          leaf clear {
            description
              "Delete all the yangcli-pro aliases from memory.";
            type empty;
          }

          leaf load {
            description
              "Load the yangcli-pro command aliases from the
               specified file spec.  The default aliases
               file will be loaded automatically at startup
               if the '--autoaliases' parameter is present.";
            type string;
            default "~/.yumapro/.yangcli_pro_aliases";
          }

          leaf save {
            description
              "Save the yangcli-pro command aliases to the
               specified filespec. The default aliases
               file will be saved automatically at shutdown
               if the '--autoaliases' parameter is present.";
            type string;
            default "~/.yumapro/.yangcli_pro_aliases";
          }
        }
      }
    }

    rpc auto-test {
      description
         "Run automatic edit testing on the specified object";
      input {
        ncx:default-parm target;

        leaf target {
          type string;
          ncx:schema-instance;
          mandatory true;
          description
            "Schema-instance identifier string indicating the
              node which is going to be tested.";
        }
        leaf session-name {
          type nt:NcxIdentifier;
          description
            "Named session to use for the testing.  If missing the
             current session will be used.";
        }
        /* TBD: not implemented yet
        leaf count {
          type uint32 {
            range "1..max";
          }
          default 1;
          description
            "Number of instances to create in each commit";
        }
        */
        leaf iterations {
          type uint32 {
            range "1..max";
          }
          default 1;
          description
            "Number of commits to make.";
        }
      }
    }

    rpc cache {
      description
        "Clear 1 or all entries from the YANG module cache.
         There are 3 forms of this command:
           cache clear
           cache delete foo
           cache delete=foo revision=2014-05-22";

      input {
        choice cache-input {
          mandatory true;
          leaf clear {
             description
                "Clear the YANG module cache on disk.";
             type empty;
          }
          case delete-cache {
            leaf delete {
              mandatory true;
              description
                "Name of the module to delete from the YANG
                 module cache.";
              type nt:NcxIdentifier;
            }
            leaf revision {
              description
                "Revision date of the module to delete from the
                 YANG module cache. OIf missing then all revisions
                 will be deleted from the cache.";
              type nt:Date;
            }
          }  // case delete-cache
        }  // choice cache-input
      }
    }

    rpc callhome-server {
       description
         "Access and control the CallHome server.
           - callhome-server start
           - callhome-server stop
         ";
       input {
         choice callhome-server-input {
           mandatory true;
           case start {
             leaf start {
               mandatory true;
               type empty;
               description
                 "Create and start the CallHome server.
                  If it already exists then an error will be returned
                  unless the 'restart-ok' parameter is also present.";
             }
             uses CallHomeParms {
               description
                 "If the parameter is set then it is used,
                  otherwise the global CLI parameter value
                  is used";
             }
             leaf restart-ok {
               type empty;
               description
                 "If present, then it is OK to stop the CallHome server
                  if running, and restart it.  Otherwise it will
                  be an error to start the CallHome server if it is
                  already running.

                  This does not affect any callhome sessions
                  already in progress.";
             }
           }
           case stop {
             leaf stop {
               mandatory true;
               type empty;
               description
                 "Stop and delete the CallHome server.
                  This does not affect any callhome sessions
                  already in progress.";
             }
           }
         }
       }
    }

    rpc callhome-user {
       description
         "Access and configure the CallHome Users.
          -  Entries can be added and deleted at run-time.
          -  These entries do not persist across a reboot.
          -  New entries are added last.
          -  TBD: Support ordered-by user insert modes.";

       input {
         choice callhome-user-input {
           mandatory true;
           case add {
             leaf add {
               mandatory true;
               type nt:NcxIdentifier;
               description
                 "Create the CallHome User if it does not already exist.";
             }
           }
           case remove {
             leaf remove {
               mandatory true;
               type nt:NcxIdentifier;
               description
                 "Remove the CallHome User if it exists.
                  This does not affect any callhome sessions
                  already in progress.";
             }
           }
         }
       }
    }

    rpc cd {
      description "Change the current working directory.";
      input {
        ncx:default-parm dir;

        leaf dir {
           description "Directory path to use.";
           type string;
           mandatory true;
        }
      }
    }

    rpc clear {
      description "Clear the screen in interactive mode.";
    }

    rpc config {
      description
        "Enter the configuration mode for the current session.
         There must be a current active session or this command
         will fail.";
      input {
        choice config-source {
          default term;
          leaf term {
             description
               "Use the terminal for configuration input.";
           type empty;
          }
        }
      }
    }

    rpc collector {
       description
         "Access and control the UDP-Notif Collector.
           - collector start
           - collector stop
         ";
       input {
         choice collector-input {
           mandatory true;
           case start {
             leaf start {
               mandatory true;
               type empty;
               description
                 "Create and start the UDP-Notif server.
                  If it already exists then an error will be returned
                  unless the 'restart-ok' parameter is also present.";
             }
             uses CollectorParms {
               description
                 "If the parameter is set then it is used,
                  otherwise the global CLI parameter value
                  is used";
             }
             leaf restart-ok {
               type empty;
               description
                 "If present, then it is OK to stop the UDP-Notif server
                  if running, and restart it.  Otherwise it will
                  be an error to start the CallHome server if it is
                  already running.";
             }
           }
           case status {
             leaf status {
               mandatory true;
               type empty;
               description
                 "Show the status of the UDP Notif Collector.";
             }
           }
           case stop {
             leaf stop {
               mandatory true;
               type empty;
               description
                 "Stop the UDP-Notif Collector.";
             }
           }
         }
       }
    }


    rpc connect {
      description "Connect to a NETCONF server.";
      input {
        ncx:default-parm server;

        uses ConnectParms {
          refine user {
            mandatory true;
          }
          refine server {
            mandatory true;
          }
          refine pass {
            mandatory true;
          }
        }

        leaf session-name {
          type nt:NcxIdentifier;
          description
            "Create a new session configuration record
             using this new session name.";
        }
      }
    }

    rpc create {
      description
       "Create some NETCONF config data with the edit-config operation";
      input {
        ncx:default-parm  target;
        uses EditParms;
      }
    }

    rpc delete {
      description
       "Delete some NETCONF config data with the edit-config operation";
      input {
        ncx:default-parm  target;
        choice delete-target {
          mandatory true;
          leaf target {
            description
             "Xpath expression indicating the node which is going
              to be deleted.";
            type string;
          }
          leaf urltarget {
            description
              "The URL path expression to use in the delete
               operation.";
            type ywt:UrlPath;
          }
        }
        anyxml value {
         description
           "Contains a string representing the content
            to use for the variable.  Only applies if the
            delete-target is a leaf-list node.";
        }
      }
    }

    rpc delete-all {
      description
       "Delete some NETCONF config data with the edit-config operation.
        Delete all instances of a leaf-list or list object.  At least
        one instance must exist or the server will return an error.";
      input {
        ncx:default-parm  target;
        choice delete-target {
          mandatory true;
          leaf target {
            description
             "Xpath expression indicating the list or leaf-list nodes
              which are going to be deleted.";
            type string;
          }
          leaf urltarget {
            description
              "The URL path expression to use in the delete
               operation.";
            type ywt:UrlPath;
          }
        }
      }
    }


    rpc elif {
      ywx:help
        "Start an intermediate block in a conditional statement";
      description
        "Evaluate an XPath expression locally on the manager.
         and execute the block of commands that follow
         if the expression is true.  The block ends
         when a matching 'elif', 'else', or 'end' command is reached.
         This may only be used after an 'if' or 'elif' command
         or an error (no matching if command) will occur.
        ";
      input {
        ncx:default-parm expr;
        uses XPathParms;
      }
    }

    rpc else {
      ywx:help
        "Start the last block in a conditional statement";

      description
        "End an 'if' or 'elif' command block, and start a new
         command block that must end with an 'end' command.
         If no 'if' or 'elif' block is in progress then an error
         will occur.
        ";
    }

    rpc enable {
      description
        "Use 'enable' to enter enable mode for yp-shell.
         Use 'enable password' to configure the password.
         Use 'enable no-password' to remove the password.

         If a password has been set, then it will be required to
         enter enable mode.";
      input {
      choice pass {
         leaf password {
         type string;
         description
           "Configure the password.";
            ncx:password;
         }

         leaf no-password {
         type empty;
         description
           "Remove the password.";
           }
         }
       }
    }

    rpc enable-password {
      description
      "Use <enable-password> to config the password in
       the config mode for yp-shell.";
    input {
    leaf password {
    type string;
    description
       "Use <enable-password> to enable the privileged mode
       and use <no enable-password> to disable the privileged
       mode in config mode for yp-shell.";
    ncx:password;
    mandatory true;
            }
        }
    }

    rpc end {
      description
        "End an 'if' command block or a 'while' command block.
         If no block is in progress then an error will occur.
        ";
    }

    rpc eval {
      description
        "Evaluate an XPath expression locally on the manager.
         All local variables will be available to the session
         context, in the following precedence:
            1) current script run level
            2) global variable

         When the result of an eval command is saved
         to a user variable, it may be altered as follows:

           Convert to string:
            - <data> is a simple type
            - <data> contains 1 node that is a simple type

           Remove the <data> container:
            - <data> contains a single complex element

           Retain the <data> container:
            - <data> contains multiple elements

         Usage Examples:

         > $x = 5
             x = '5'
         > $x = eval '$x + 10'
             x = '15'
         > $y = xget /system
             y = data {
                   system { ... }
                 }
         > $z = eval '//sysname' docroot=$y
             z = 'Linux'
         > $w = eval '/system/uname' docroot=$y
             w = uname {
                   sysname 'Linux'
                   ...
                 }
        ";

      input {
        ncx:default-parm expr;
        uses XPathParms;
      }

      output {
        anyxml data {
          description
            "The XPath result, returned in a data element.

             The content will be a simple string for boolean, string,
             and number result types.

             The content will be zero or more child elements,
             in their proper namespaces, if the result is a node-set.
             Only the requested node(s) will be returned,
             not their entire path to the document root,
             like the get and get-config operations.

             An empty 'data' element will be returned if the result
             is an empty node-set.";
          mandatory true;
        }
      }
    }

    rpc eventlog {
      description "Access the notification event log";
      input {
        ncx:default-parm show;

        choice eventlog-action {
          default show-case;

          case show-case {
            leaf show {
              description
                "Show the specified number of event log
                 buffer entries. -1 means show all entries.
                 If the --full or --brief help-mode parameters
                 are entered, then the output will be altered.";
              type LogCount;
              default -1;
            }

            leaf start {
              description
                "Start at the specified event index number instead of
                 the beginning of the event log.";
              type LogIndex;
            }

            uses ncxapp:HelpMode;
          }

          leaf clear {
            description
              "Clear the specified number of notification
               event log entries.  The value -1 means
               clear all the entries.";
            type LogCount;
            default 25;
          }
        }
      }
    }

    rpc exit {
      description
        "Exit the currrent configuration level for the current session.
         There must be a current active session or this command
         will fail. The current session must also be in the
         configuration mode. Any pending edits will be applied
         if the edit-config-mode is set to 'level'.";
    }

    rpc fill {
      description
       "Fill a value for reuse in a NETCONF PDU or other operation.

        Used in an assignment statement to create a variable
        for later use:

            $foo = fill --target=/t:foo-con/bar-list";
       input {
         ncx:default-parm  target;
         uses FillParms;
       }
       output {
         anyxml data {
           description
             "The result of the fill operation.

              The name of the value node may not really
              be 'data'. If the 'target' or 'current-value'
              input parameters are used, then the name
              of the result node will be copied instead.

              The data type will be inherited from the 'target'
              or 'current_value' parameters, and not really be
              an 'anyxml' structure.  YANG does have a data
              type that supports this feature.";
         }
       }
    }

    rpc get-locks {
       description
          "Get a lock for the running configuration
           and the candidate and startup configurations,
           if needed.  If all the locks cannot be obtained,
           then release all of them (all-or-nothing).
           The entire operation must be completed within
           the lock timeout interval, if it is set.";
       input {

         leaf lock-timeout {
           description
             "Total time to wait to retrieve all the locks needed
              to complete the get-locks command.  A value of zero
              means to wait forever and not use a timeout value.";
           type nt:Timeout;
           default 120;
         }

         leaf retry-interval {
           description
             "Retry interval to use if a lock is temporarily
              unavailable.  The client will wait this number of
              seconds before attempting to get the current lock.";
           units seconds;
           type uint32 { range "1 .. 300"; }
           default 2;
         }

         leaf cleanup {
           description
             "Indicates whether the locks obtained should be
              automatically released if an RPC operation
              fails (after the get-locks succeeds).";
           type boolean;
           default true;
         }
       }
    }


    rpc get-walk {
      description
        "Walk the entries of a YANG list using the netconfd-pro
         <get-bulk> operation. This command will send <get-bulk>
         requests to the server until the entire list has been
         retrieved or the user quits the walk.

         If the yumaworks-getbulk YANG module is not supported by
         the server then this command will not be attempted.

         If the program is in interactive mode, then after each
         retrieval, the user will be prompted to continue or quit
         the walk. In batch mode the entries will be displayed
         until the walk terminates.

         The server will wait the normal 'timeout' period after
         each request. It will display each response and check it
         for 'last-keys' data.  If present, these values will
         be used for the 'last-keys' parameter in the next request.
         If not present, then the walk will end.

         The walk will be done on the YANG list specified by
         the 'list-target' parameter. Each retrieval will request
         1 or more entries, based on the 'count' parameter. The
         data returned can be filtered according to the 'content',
         'depth', 'with-defaults', and 'list-test' parameters,
         which as passed to the <get-bulk> operation each time.";


      input {
        leaf datastore {
          type enumeration {
            enum candidate;
            enum running;
            enum startup;
          }
          default "running";
          description
            "Identifies the datastore source for the retrieval,
             if the list-object is a configuration data node.
             If not a configuration node, then this object
             will be ignored if present.";
        }

        leaf list-target {
          type string;
          mandatory true;
          description
            "Identifies the list object that is being retrieved.
             This must be a path expression used to represent
             a list data node.  It is formated like a RESTCONF
             path expression, except module names are not mandatory
             if they are unique.";
        }

        leaf count {
          type uint32 {
            range "1 .. max";
          }
          default 1;
          description
            "The maximum number of list entries to return.";
        }

        uses yrc:content-parameter {
          description
            "The content parameter is used as defined in the
             RESTCONF protocol. This parameter will be ignored
             if the list-target is a nonconfig node. In that case
             only nonconfig data nodes will be returned.";
          refine content {
            default all;
          }
        }

        uses yrc:depth-parameter {
          description
            "The depth parameter is used as defined in the
             RESTCONF protocol. The value '1' is associated
             with the list-object node itself.  This value
             can be used to simply test for the existence
             of any instances of the list-object.";
        }

        uses wd:with-defaults-parameters {
          description
            "The with-defaults parameter is used as defined in the
             NETCONF protocol.";
        }

        leaf list-test {
          type yang:xpath1.0;
          description
            "Specifies an XPath boolean expression that will
             be used to determine if a list entry specified
             by the list target should be included in the
             response.

             The document root and the context node for the
             XPath evaluation will be each list-target instance.
             If the list-test expression is invalid, then an
             error will be returned. If the expression evaluates
             successfully then the function boolean(result)
             will be used to determine if the list instance
             should be included in the response.

             For example, if the list-target is /interfaces/interface
             then the expression type = 'ethernetCsmacd' will select
             only interface entries with the specified type leaf value.
            ";
        }

        anydata fixed-keys {
          description
            "If the server supports the fixed-keys parameter
             then this parameter can be passed as a parameter
             to the <get-bulk> operation.

             This parameter is only relevant if the list-target
             has multiple key leafs defined. It allows the get-walk
             to only select 'next' entries for the unfixed key values.

             This filter can be used instead of 'list-test' to
             optimize the internal server callbacks to get list entries.
             The unwanted entries can be pruned more efficiently
             if the fixed keys are known to the server.

             Each child entry represents a key leaf value
             that should be treated as a fixed key leaf.
             The namespace is not important as the server
             will attempt to apply the list-target template to
             the child nodes of this node.";
         }

      }

    }  // rpc get-walk


    rpc group {
      description
      "Manage the yangcli-pro session groups.
       A group name is not allowed to have the same name as any
       session name.  This allows the 'session set-current' command
       to select a group or an individual session.";

      input {
        ncx:default-parm session;
        choice groupcmd {
          mandatory true;
          case connect {
            leaf connect {
              type nt:NcxIdentifier;
              description
                "Connect to all sessions in the specified group.";
            }
            uses SessionGroupParms;
          }
          case create-case {
            leaf create {
              type nt:NcxIdentifier;
              description
                "Name of the group to create.  The 'session' parameter
                 must also be present";
            }
          }
          case delete-case {
            leaf delete {
              type nt:NcxIdentifier;
              description "Name of the group to delete";
            }
          }
          case add-case {
            leaf add {
              type nt:NcxIdentifier;
              description
                "Name of the group to add some sessions.  The 'session'
                 parameter must also be present.";
            }
          }
          case remove-case {
            leaf remove {
              type nt:NcxIdentifier;
              description
                "Name of the group to remove some sessions.  The
                 'session' parameter must also be present.";
            }
          }
          case show-case {
            leaf show {
              type nt:NcxIdentifier;
              description "Name of the group to show";
            }
          }
          case list-case {
            leaf list {
              type empty;
              description "List the names of all the groups";
            }
          }
        }
        leaf-list session {
          when "../create or ../add or ../remove";
          min-elements 1;
          type nt:NcxIdentifier;
          description
            "Name of a session that is being added to the group.";
        }
      }
    }

    rpc help {
      description "Print the yangcli-pro help text";
      input {
        ncx:default-parm command;

        choice helptype {
          leaf command {
            description "Show help for the specified command,
                         also called an RPC method";
            type nt:NcxIdentifier;
          }
          leaf commands {
            description "Show info for all local commands";
            type empty;
          }
          leaf notification {
            description "Show help for the specified notification";
            type nt:NcxIdentifier;
          }
          leaf object {
            description "Show help for the specified object";
            type union {
              type nt:NcxIdentifier;
              type ywt:UrlPath;
            }
          }
          leaf type {
            description "Show help for the specified type";
            type nt:NcxIdentifier;
          }
        }
        uses ncxapp:HelpMode;
      }
    }

    rpc history {
      description "Access the command line history buffer";
      input {
        ncx:default-parm show;

        choice history-action {
          default show-case;

          case show-case {
            leaf show {
              description
                "Show the specified number of history
                 buffer entries. -1 means show all entries.";
              type LogCount;
              default 25;
            }
            uses ncxapp:HelpMode;
          }

          leaf clear {
            description
              "Clear all the history buffer entries.";
            type empty;
          }

          leaf load {
            description
              "Load the command history buffer from the
               specified file spec.";
            type string;
            default "~/.yumapro/.yangcli_pro_history";
          }

          leaf save {
            description
              "Save the command history buffer in the
               specified filespec.";
            type string;
            default "~/.yumapro/.yangcli_pro_history";
          }
        }
      }
    }

    rpc if {
      description
        "Evaluate an XPath expression locally on the manager.
         and execute the block of commands that follow
         if the expression is true.  The block ends
         when a matching 'elif', 'else', or 'end' command is reached.
        ";
      input {
        ncx:default-parm expr;
        uses XPathParms;
      }
    }

    rpc insert {
      description
       "Insert some NETCONF config data with the edit-config operation";
      input {
        ncx:default-parm  target;

        uses EditParms;

        leaf order {
          description
            "The insert order that should be used.
             If the values 'before' or 'after' are selected,
             then the edit-target parameter must also be present.";
          type enumeration {
            enum first;
            enum last;
            enum before;
            enum after;
          }
          default last;
        }

        leaf operation {
          description "The edit-config operation that should be used.";
          type enumeration {
            enum create;
            enum merge;
            enum replace;
          }
          default merge;
        }

        leaf edit-target {
          description
            "The value or key clause that should be used.
             This parameter should only be present if the
             order selected is 'before' or 'after'.

             For a leaf-list, the edit-target contains the
             value of the target leaf-list node within the
             configuration being edited.  The new config
             will be inserted before or after this leaf-list
             node, depending on the order selected.
             E.g., edit-target='some leaf content'.

             For a list, the edit-target contains the
             key values of the target list node within the
             configuration being edited.  The new config
             will be inserted before or after this list
             node, depending on the order selected.
             E.g., edit-target=[name='fred'][zipcode=90210].";

          type string;
        }
      }
    }

    rpc list {
      description "List some NETCONF info.";
      input {
        choice listtype {
          mandatory true;

          leaf commands {
            description "List all local and remote commands";
            type empty;
          }

          leaf files {
            description
               "List all available data files.";
            type empty;
          }

          leaf objects {
            description "List all available top-level object names.";
            type empty;
          }

          leaf oids {
            description "List all available object identifiers.";
            type empty;
          }

          leaf modules {
            description
              "List all available local YANG files.";
            type empty;
          }

          leaf scripts {
            description
               "List all available script files.";
            type empty;
          }
        }

        leaf module {
          description "List only from this module, if specified.";
          type nt:NcxIdentifier;
        }

        uses ncxapp:HelpMode;
      }
    }

    rpc log-debug {
      description
       "Write a message to the output log if the log-level
        is greater or equal to 'debug'.";
      input {
        ncx:default-parm msg;
        leaf msg {
          description
            "The formatted text string to write to the log.";
          type string;
          mandatory true;
        }
      }
    }

    rpc log-info {
      description
       "Write a message to the output log if the log-level
        is greater or equal to 'info'.";
      input {
        ncx:default-parm msg;
        leaf msg {
          description
            "The formatted text string to write to the log.";
          type string;
          mandatory true;
        }
      }
    }

    rpc log-error {
      description
       "Write a message to the output log if the log-level
        is greater or equal to 'error'.";
      input {
        ncx:default-parm msg;
        leaf msg {
          description
            "The formatted text string to write to the log.";
          type string;
          mandatory true;
        }
      }
    }

    rpc log-warn {
      description
       "Write a message to the output log if the log-level
        is greater or equal to 'warn'.";
      input {
        ncx:default-parm msg;
        leaf msg {
          description
            "The formatted text string to write to the log.";
          type string;
          mandatory true;
        }
      }
    }

    rpc merge {
      description
       "Merge some NETCONF config data with the edit-config operation";
      input {
        ncx:default-parm target;
        uses EditParms;
      }
    }

    rpc mgrload {
      description
        "Load a module or other file into the client.
         Use the 'load' command to load a module into
         the server.";
      input {
        ncx:default-parm module;
        leaf module {
          description
             "Module name to load";
          type nt:NcxName;
          mandatory true;
        }
        leaf revision {
          description
             "Module revision to load.";
          type nt:Date;
        }
        uses ncxapp:DeviationParm;
      }
    }

    rpc pwd {
      description "Print the current working directory.";
    }

    rpc nvsave {
      description
         "Save the running datastore to the startup datastore.";
    }

    rpc quit {
      description "Quit the yangcli-pro application";
    }

    rpc rawrpc {
       description
         "Added 22.10-7:
          Provide low-level command to send complete RPC request
          message as an <rpc> request to the server.

          Cannot have an output section or OK is not allowed.
          RPC methods with output may cause a warning when the
          response is received.

          There are 3 forms of this command allowed:

            - rawrpc @somefile.xml
            - rawrpc rpc=@somefile.xml
            - rawrpc rpc=<inline XML>
         ";

      input {
        anydata rpc {
          mandatory true;
          description
            "Represents the <rpc> container node for the RPC request.

             The entire 'rpc' container is expected, not the children.
             The message will be sent to the server as-is.
             No usual logging and processing will be possible for
             this operation.

             The XML (from file or inline XML) is sent to the server
             'as-is', without converting it to an internal data
             structure first.";
        }
      }
    }

    rpc recall {
       description
         "Recall the specified command line history
          buffer entry into the current command line.";

       input {
         ncx:default-parm index;

         leaf index {
           description
             "Index [0..N] of the command line
              history entry to recall.";
           type LogIndex;
           mandatory true;
         }
      }
    }

    rpc refresh-library {
       description
          "If the YANG modules available on disk changes while
           the program is running, then this command can be
           used to refresh the module version list used
           to determine the 'best-match' for imports.";
    }

    rpc release-locks {
       description
         "Unlock all the server databases that were
          previously locked with the get-locks command.";
    }

    rpc replace {
      description
       "Create some NETCONF config data with the edit-config operation";
      input {
        ncx:default-parm target;
        uses EditParms;
      }
    }

    rpc remove {
      description
       "Remove some NETCONF config data with the edit-config operation";
      input {
        ncx:default-parm  target;
        leaf target {
          description
           "Xpath expression indicating the node which is going
            to be deleted.";
          type string;
          mandatory true;
        }
        anyxml value {
         description
           "Contains a string representing the content
            to use for the variable.  Only applies if the
            target is a leaf-list node.";
        }
      }
    }

    rpc remove-all {
      description
       "Remove some NETCONF config data with the edit-config operation.
        Remove all instances of a leaf-list or list object.";
      input {
        ncx:default-parm  target;
        choice delete-target {
          mandatory true;
          leaf target {
            description
             "Xpath expression indicating the list or leaf-list nodes
              which are going to be removed.";
            type string;
          }
          leaf urltarget {
            description
              "The URL path expression to use in the remove
               operation.";
            type ywt:UrlPath;
          }
        }
      }
    }

    rpc run {
      description "Internal command to run a script.";
      input {
        ncx:default-parm script;

        leaf script {
           description "script filespec to run";
           type string;
           mandatory true;
        }

        // hardwired parameter names required at this time
        // just allow 9 parameter/value pairs
        // P0 is reserved for the name of the called script

        leaf P1 {
           description "script parameter $1";
           type string;
        }
        leaf P2 {
           description "script parameter $2";
           type string;
        }
        leaf P3 {
           description "script parameter $3";
           type string;
        }
        leaf P4 {
           description "script parameter $4";
           type string;
        }
        leaf P5 {
           description "script parameter $5";
           type string;
        }
        leaf P6 {
           description "script parameter $6";
           type string;
        }
        leaf P7 {
           description "script parameter $7";
           type string;
        }
        leaf P8 {
           description "script parameter $8";
           type string;
        }
        leaf P9 {
           description "script parameter $9";
           type string;
        }
      }
    }

     rpc run-shell {
      description
         "Internal command to run a shell script.

          The parameters P1 .. P9 will be converted to dollar parameters
          $0 to $N, where N is the number of 'Pn' parameters provided.
          The parameters will be added to the command line in named order
          P1 through P9.

          Example:  run-script test1.sh P3=foo P6=bar P1=baz
          This script will be invoked with parameters $1=baz $2=foo $3=bar

          Environment variables are not used for script parameters since
          they could have naming conflicts, especially for recursive scripts.";

      input {
        ncx:default-parm script;

        leaf script {
           description "Run shell command if --allow-shell=true";
           type string;
           mandatory true;
        }

        // hardwired parameter names required at this time
        // just allow 9 parameter/value pairs
        // P0 is reserved for the name of the called script

        leaf P1 {
           description "script parameter $1";
           type string;
        }
        leaf P2 {
           description "script parameter $2";
           type string;
        }
        leaf P3 {
           description "script parameter $3";
           type string;
        }
        leaf P4 {
           description "script parameter $4";
           type string;
        }
        leaf P5 {
           description "script parameter $5";
           type string;
        }
        leaf P6 {
           description "script parameter $6";
           type string;
        }
        leaf P7 {
           description "script parameter $7";
           type string;
        }
        leaf P8 {
           description "script parameter $8";
           type string;
        }
        leaf P9 {
           description "script parameter $9";
           type string;
        }
      }
    }

    rpc save {
      description "Meta command to save configuration edits.";
    }

    rpc sleep {
      description
        "Pause for a number of seconds. Intended for use
         in yangcli scripts.";
      input {
        leaf seconds {
          mandatory true;
          type uint16 {
            range "1 .. 3600";
          }
          units "seconds";
          description "Number of seconds to sleep.";
        }
      }
    }

    rpc subscribe {
      description
        "Subscribe to a server event stream or datastore data

         - subscribe stream NETCONF
         - subscribe stream my-stream1
         - subscribe data /interfaces-state
         - subscribe data /interfaces-state refresh-rate=500
        ";
      input {
        choice subscribe-choice {
          mandatory true;
          case stream {
            leaf stream {
              mandatory true;
              type ywt:admin-string;
              description
                "Name of an event stream for the subscription";
            }
            leaf filter {
              type string;
              description
                "Filter path string or named filter name";
            }
          }
          case datastore {
            leaf data {
              type string;
              mandatory true;
              description
                "Contains a RESTCONF style path string for
                 the data for this subscription.

                 - The module name should appear in the first segment
                   but if not then first match will be used.
                ";
            }

            leaf datastore {
              type string;
              default "operational";
              description
                "Contains the datastore for this subscription.
                 Supported values:

                   - candidate
                   - running
                   - intended
                   - operational

                ";
            }

            leaf refresh-rate {
              type uint16 {
                range "1 .. max";
              }
              units "centiseconds";
              default 1000;   // 10 seconds
              description
                "Requested refresh rate for this subscription.
                 For an on-change subscription this is the
                 dampening-period.";
            }

            leaf on-change {
              type boolean;
              default true;
              description
                "If true, then use an on-change subscription,
                 if available on the server. If not available then use
                 a periodic subscription instead.

                 If false, then do not use an on-change subscription,
                 even if it is available on the server.
                 Use 'periodic' instead.";
            }
          }
        }

        leaf encoding {
          type enumeration {
            enum xml {
              description "Use XML encoding";
            }
            enum json {
              description "Use JSON encoding";
            }
            enum cbor {
              description "Use CBOR encoding";
            }
          }
          default xml;
          description
            "The desired message encoding.
             The subscribe request will be rejected if the value is
             not supported by the server.";
        }

        leaf description {
          type string;
          description
            "Administrative description for this subscription";
        }
      }
    }

    rpc unsubscribe {
      description
        "Unsubscribe 1 of:
          - unsubscribe stream my-stream1
          - unsubscribe data /interfaces-state
          - unsubscribe id 17
         ";
      input {
        choice unsubscribe-choice {
          mandatory true;
          case stream {
            leaf stream {
              type ywt:admin-string;
              mandatory true;
              description
                "Unsubscribe from this event stream";
            }
            leaf filter {
              type string;
              description
                "Filter string used in the subscribe if any was used";
            }
          }
          case datastore {
            leaf datastore {
              type string;
              default "operational";
              description
                "Unsubscribe the subscription for this datastore.";
            }
            leaf data {
              type string;
              mandatory true;
              description
                "Unsubscribe the subscription for this path string or
                 filter name.";
            }
          }
          leaf id {
            // subscription-id from ietf-subscribed-notification
            type uint32;
            mandatory true;
            description
              "The subscription id  to be unsubscribed.";
          }
        }
      }
    }

    rpc device-cfg {
      description "Access a device configuration";
      input {
        choice device-action {
          default show-case;

          case show-case {
            leaf show {
              type IdentifierOrZero;
              default "";
              description
                "Show the specified device or the current device
                 if an empty string is entered.";
            }
            uses ncxapp:HelpMode;
          }

          leaf delete {
            type nt:NcxIdentifier;
            description
              "Delete the specified device from the saved
               devices in memory.";
          }

          leaf save {
            type nt:NcxIdentifier;
            description
              "Save the specified device to the
               saved devices in memory.";
          }

        case create {
           leaf create {
             type nt:NcxName;
             mandatory true;
             description
             "An device id to use to create a new device.";
            }

           leaf server {
             type inet:host;
               mandatory true;
               description
               "IP address or DNS name of the NETCONF server target.";
            }

            leaf ncport {
              type uint16 {
                range "1..max";
              }
              default 830;
              description
                "NETCONF port number to use.  If not present, then
                 port 830, followed by port 22, will be tried.";
            }

            uses EntryPointParm;

            uses ncxapp:ProtocolsParm;
          }  // case creat
        }
      }
    }

   rpc devices-cfg {
      description "Controls access to the saved devices file";
      input {
      choice devices-action {
          default show-case;

          case show-case {
            leaf show {
              type empty;
              description
                "Show all saved devices in memory";
            }
            uses ncxapp:HelpMode;
          }

          leaf clear {
            type empty;
            description
              "Clear all the saved sessions in memory.
               Use 'devices-cfg load' to restore the saved devices.
               Use 'devices-cfg save' to clear the saved devices
               file.";
          }

          leaf load {
            description
              "Load the saved devices in memory from the
               specified file spec.";
            type string;
            default "~/.yumapro/.yangcli_pro_devices.conf";
          }

         leaf save {
            description
              "Save the current saved devices in memory to the
               specified saved devices filespec.";
            type string;
            default "~/.yumapro/.yangcli_pro_devices.conf";
          }
        }
      }
    }

    rpc session {
      description "Access an active session";
      input {
        leaf set-current {
          mandatory true;
          type nt:NcxIdentifier;
          description
            "Set the specified session or group as the current session.
             The named session or group must already be loaded in memory.";
        }
      }
    }

    rpc session-cfg {
      description "Access a session configuration";
      input {
        choice session-action {
          default show-case;

          case show-case {
            leaf show {
              type IdentifierOrZero;
              default "";
              description
                "Show the specified session or the current session
                 if an empty string is entered.";
            }
            uses ncxapp:HelpMode;
          }

          leaf delete {
            type nt:NcxIdentifier;
            description
              "Delete the specified session from the saved
               sessions in memory.";
          }

          leaf save {
            type nt:NcxIdentifier;
            description
              "Save the specified session to the
               saved sessions in memory.";
          }

          leaf-list use-event-handler {
           type nt:NcxIdentifier;
           description
             "Name of an event-handler to use within this session.
              When notification delivery for this session is started
              the event handler will be installed. A warning will be
              printed if no event-handler with this name is found.";
          }
        }
      }
    }

   rpc user-cfg {
      description "Access a user configuration";
      input {
        choice user-action {
          default show-case;

          case show-case {
            leaf show {
              type IdentifierOrZero;
              default "";
              description
                "Show the specified user or the current user
                 if an empty string is entered.";
            }
            uses ncxapp:HelpMode;
          }

          leaf delete {
            type nt:NcxIdentifier;
            description
              "Delete the specified user from the saved
               users in memory.";
          }

          leaf save {
            type nt:NcxIdentifier;
            description
              "Save the specified user to the
               saved users in memory.";
          }

          case create {
            leaf create {
             type nt:NcxName;
             mandatory true;
             description
             "An user id to use to create a new user.";
            }

            leaf user-name {
              type nt:NcxName;
              mandatory true;
              description
              "An user name to use to create a new user.";
            }

            leaf password {
              type string;
              ncx:password;
              mandatory true;
              description
                "An user password to use to create a new user.";
            }
          }  // case create
        }
      }
    }

   rpc users-cfg {
      description "Controls access to the saved users file";
      input {
      choice users-action {
          default show-case;

          case show-case {
            leaf show {
              type empty;
              description
                "Show all saved users in memory";
            }
            uses ncxapp:HelpMode;
          }

          leaf clear {
            type empty;
            description
              "Clear all the saved users in memory.
               Use 'users-cfg load' to restore the saved users.
               Use 'users-cfg save' to clear the saved users
               file.";
          }
          leaf load {
            description
              "Load the saved users in memory from the
               specified file spec.";
            type string;
            default "~/.yumapro/.yangcli_pro_users.conf";
          }

          leaf save {
            description
              "Save the current saved users in memory to the
               specified saved users filespec.";
            type string;
            default "~/.yumapro/.yangcli_pro_users.conf";
          }
        }
      }
    }

   rpc schema-server-cfg {
      description "Access a schema-server configuration";
      input {
        choice schema-server-action {

          default show-case;
            case show-case {
            leaf show {
              type IdentifierOrZero;
              default "";
              description
                "Show the specified schema-server.";
            }
            uses ncxapp:HelpMode;
          }

          leaf delete {
            type nt:NcxIdentifier;
            description
              "Delete the specified schema-server from the saved
               schema-server in memory.";
          }

         case create {
            leaf create {
             type nt:NcxName;
             mandatory true;
             description
             "An schema-server id to use to create a new schema server.";
            }

            leaf user-id {
              type nt:NcxName;
              mandatory true;
              description
              "The id of the saved user to create a schema-server.";
            }

            leaf device-id {
              type nt:NcxName;
              description
              "The id of the saved device to create a schema-server.";
            }
          }  // case create
        }
      }
    }

   rpc schema-servers-cfg {
      description "Controls access to the saved schema-servers file";
      input {
      choice schema-servers-action {
          default show-case;

          case show-case {
            leaf show {
              type empty;
              description
                "Show all saved schema servers in memory";
            }
            uses ncxapp:HelpMode;
          }

          leaf clear {
            type empty;
            description
              "Clear all the saved schema servers in memory.
               Use 'schema-servers-cfg load' to restore the saved schema servers.
               Use 'scheam-servers-cfg clear' to clear the saved schema servers.
               file.";
          }
          leaf load {
            description
              "Load the saved schema servers in memory from the
               specified file spec.";
            type string;
            default "~/.yumapro/.yangcli_pro_schema_servers.conf";
          }

          leaf save {
            description
              "Save the current saved schema servers in memory to the
               specified saved schema servers filespec.";
            type string;
            default "~/.yumapro/.yangcli_pro_schema_servers.conf";
          }
        }
      }
    }

    rpc sessions-cfg {
      description "Controls access to the saved sessions file";
      input {
        choice sessions-action {
          default show-case;

          case show-case {
            leaf show {
              type empty;
              description
                "Show all saved sessions in memory";
            }
            uses ncxapp:HelpMode;
          }

          leaf clear {
            type empty;
            description
              "Clear all the saved sessions in memory.
               Use 'sessions load' to restore the saved sessions.
               Use 'sessions save' to clear the saved sessions
               file.";
          }

          leaf load {
            description
              "Load the saved sessions in memory from the
               specified file spec.";
            type string;
            default "~/.yumapro/.yangcli_pro_sessions.conf";
          }

          leaf save {
            description
              "Save the current saved sessions in memory to the
               specified saved sessions filespec.";
            type string;
            default "~/.yumapro/.yangcli_pro_sessions.conf";
          }
        }
      }
    }

    rpc sget {
      description
       "Get some NETCONF running config or state data with the get
        operation, using an optional subtree filter.";
      input {
        ncx:default-parm target;
        uses CommonPduParms;
        uses SGetParms;
      }
      output {
        anyxml data {
          description
            "The data resulting from the retrieval operation.";
        }
      }
    }

    rpc sget-config {
      description
       "Get some NETCONF config data with the get-config
        operation, using an optional subtree filter.";
      input {
        ncx:default-parm target;
        uses CommonPduParms;
        uses SGetParms;
        container source {
          description "Particular configuration to retrieve.";

          choice config-source {
            mandatory true;

            leaf candidate {
              if-feature nc:candidate;
              description
                "Only available if 'candidate' capability supported.";
              type empty;
            }
            leaf running {
              type empty;
            }
            leaf startup {
              if-feature nc:startup;
              description
                "Only available if 'startup' capability supported.";
              type empty;
            }
            leaf url {
              if-feature nc:url;
              description
                "URL pointing to config data. Only available
                 if 'url' capability supported.";
             type nc:ConfigURIType;
            }
          }
        }
      }
      output {
        anyxml data {
          description
            "The data resulting from the retrieval operation.";
        }
      }
    }

    rpc sget-data {
      description
       "Get some NETCONF datastore data with the <get-data>
        operation, using an optional subtree filter.
        The server must support the <get-data> operation
        from the ietf-netconf-nmda module.";
      input {
        ncx:default-parm target;
        uses DatastoreParm;
        uses CommonPduParms;
        uses SGetParms;
        uses ConfigFilterParm;
        uses OriginParms;
      }
      output {
        anyxml data {
          description
            "The data resulting from the retrieval operation.";
        }
      }
    }

    rpc show {
      description
        "Local show command for yangcli-pro session info.";
      input {
        choice showtype {
          mandatory true;

          leaf cache {
            description
              "Show the yangcli-pro YANG module cache.";
            type empty;
          }

          leaf callhome {
            description
              "Show the yangcli-pro CallHome Server status.";
            type empty;
          }

          leaf cli {
            description
              "Show the yangcli-pro CLI parameters.";
            type empty;
          }

          leaf diff {
            description
              "Show the differences between current config
               and the edits that have not been applied yet.";
            type empty;
          }

          leaf edit {
            description
              "Show the subtree that is the current node which
               is from the current edit, not the stored config.";
            type empty;
          }

          leaf connected {
            description
              "Show all connected sessions.";
            type empty;
          }

          leaf module {
            description
              "Show full info for one module loaded
               within the current session.";
            type nt:NcxIdentifier;
          }

          leaf modules {
            description
              "Show info for all modules loaded within the
               current session.";
            type empty;
          }

          leaf modules-state {
            description
              "Show info for cached modules-state for each server.";
            type empty;
          }

          leaf local {
            description
              "Show info for one local user variable.";
            type nt:NcxName;
          }

          leaf locals {
            description
              "Show info for all local user variables.";
            type empty;
          }

          leaf global {
            description
              "Show full info for one global user variable.";
            type nt:NcxName;
          }

          leaf globals {
            description
              "Show info for all global user variables.";
            type empty;
          }

          leaf group-vars {
            description
              "Show the group-specific user variables for the
               named group. A zero-length string means show
               the variables for the group of the current session.";
            type IdentifierOrZero;
          }

          leaf objects {
            description
              "Show config database objects loaded within the
               current session.";
            type empty;
          }

          case running {
            leaf running {
              description
                "Show entire config for the current session
                 error if there is no current session.";
              type empty;
              mandatory true;
            }
            uses SelectParm;
          }

          leaf search-path-module {
            description
              "Display the YANG module search path in use.";
            type empty;
          }

          leaf server-commands {
            description
              "Display server commands (not in config mode).
               It is top-level only and only relevant if session is connected.";
            type empty;
          }

          leaf session {
            description
              "Show the current session info, including the initial
               server capabilities for the session.";
            type empty;
          }

          leaf session-vars {
            description
              "Show the session-specific user variables for the
               named session. An empty string means show the
               variables for the current session.";
            type IdentifierOrZero;
          }

          leaf subscriptions {
            description
              "Show the current subscriptions for the current session.";
            type empty;
          }

          leaf system {
            description
              "Show the read-only system environment variables
               and the read-write yangcli-pro program variables.";
            type empty;
          }

          leaf terminal {
            description
              "Show the terminal settings.";
            type empty;
          }

          leaf var {
            description
              "Show info for one local or global variable.";
            type nt:NcxName;
          }

          leaf vars {
            description
              "Show truncated info for all program variables";
            type empty;
          }

          leaf version {
            description
              "Show yangcli-pro version info.";
            type empty;
          }

          leaf yanglib-cache {
            description
              "Show YANG library cache info.";
            type empty;
          }
        }  // end choice
        uses ncxapp:HelpMode;
      }
    }

    rpc start-rpc-timing {
      description
        "Start collecting RPC timing statistics for the current session.
         Will set $$echo-replies to false and $$time-rpcs to true
         WIll record stats to output file if specified.";
      input {
        ncx:default-parm statfile;
        leaf statfile {
          type string {
            length "1 .. max";
          }
          description
            "The file specification for the timing statistics.";
        }
      }
    }

    rpc start-session {
      description
        "Start an active session from the specified configured
         session.";
      input {
        ncx:default-parm name;
        leaf name {
          type nt:NcxIdentifier;
          description
            "The name of the session to start.";
        }
      }
    }

    rpc start-timer {
      description
        "Start a timer to do simple performance measurements.";
      input {
        ncx:default-parm id;
        leaf id {
          description
            "The timer ID to use.";
          type TimerId;
          default 0;
        }
        leaf restart-ok {
          description
            "Indicates whether the timer will be used if
             it is already running.  If 'true', the timer
             will be restarted if it is already running.
             If 'false', an error will occur if the timer
             is already running.";
          type boolean;
          default true;
        }
      }
    }

    rpc stop-rpc-timing {
      description
        "Stop collecting RPC timing statistics for the current session.
         Will set session $$echo-replies to true and
         $$time-rpcs-state to false. Will close the stats file,
         if opened.";
    }

    rpc stop-session {
      description
        "Terminate an active session.";
      input {
        ncx:default-parm name;
        leaf name {
          type nt:NcxIdentifier;
          mandatory true;
          description
            "The name of the session to stop.";
        }
      }
    }

    rpc stop-timer {
      description
        "Stop a timer and output the delta value.";
      input {
        ncx:default-parm id;
        leaf id {
          description
            "The timer ID to use.";
          type TimerId;
          default 0;
        }
        leaf echo {
          description
            "Echo the elapsed time value to screen if in
             interactive mode, as well as the log if the
             log is a file instead of stdout.";
          type boolean;
          default true;
        }
      }
      output {
        // yangcli-pro local RPC commands can return 1 value of any type
        // as an output parameter.  No extra parameters will be
        // processed in assignment statements
        leaf delta {
          description
            "The elapsed time since the timer started.";
          type decimal64 {
            fraction-digits 6;  // microseconds
          }
          units seconds;
        }
      }
    }

    rpc record-test {
      description
        "Use the unit test-suite automatic test recording feature.
         Only one test can be recorded at a time. Either cancel
         or finish a test in progress in order to start recording
         a new test.";
      input {
        choice record-test-action {
          mandatory true;
          description
            "The recording action to perform.";
          leaf cancel {
            type empty;
            description
              "Stop recording for the specified test in progress,
               and discard the recorded results.";
          }
          case start-case {
            leaf start {
              type empty;
              //mandatory true;
              description
                "Start recording for the specified test.";
            }
            leaf suite-name {
              type nt:NcxIdentifier;
              mandatory true;
              description
               "The name of the test-suite that contains the test
                being recorded.";
            }
            leaf test-name {
              type nt:NcxIdentifier;
              mandatory true;
              description
                "The name of the test being recorded.";
            }
          }
          leaf finish {
            type empty;
            description
              "Finish recording for the specified test in progress
               and save the recorded results in the test-suite.";
          }
          leaf pause {
            type empty;
            description
              "Pause recording for the specified test in progress.";
          }
          leaf resume {
            type empty;
            description
              "Resume recording for the specified test in progress.";
          }
        }
      }
    }



    rpc terminal {
      description "Configure the terminal settings";
      input {
        leaf length {
          type uint16 {
            range "0 .. 511";
          }
          mandatory true;
          description
            "Specifies the length of the terminal to use for page
             mode output with the -More- prompt. This parameter
             is ignored in batch mode. It is only used if the
             output session is operating in interactive mode.

             If the value 0 is used then the 'More' prompt will
             be disabled. Otherwise this value represents the
             number of lines to output for each screen in pagination
             output mode.";
        }
      }
    }

    rpc test-suite {
      description "Use the unit test-suite feature.";
      input {
        leaf suite-name {
          type nt:NcxIdentifier;
          must "../delete or ../delete-test" +
               " or ../export or ../export-file";
          description
            "The name of the test-suite that contains the test
             being recorded. Used for start, delete, and
             delete-test sub-commands only.";
        }

        leaf log {
          type string;
          must "../start or ../run-all";
          description
            "The file pathspec of the test suite result file
             to use, or an empty string to use STDOUT.";
        }

        choice test-suite-action {
          default show-case;

          leaf delete {
            must "../suite-name";
            type empty;
            description
              "Delete the specified test-suite.  The suite-name
               parameter must also be present.";
          }

          case delete-test-case {
            leaf delete-test {
              must "../suite-name";
              type empty;
              description
                "Delete the specified test.  The suite-name
                 and test-name parameters must also be present.";
            }
            leaf test-name {
              type nt:NcxIdentifier;
              mandatory true;
              description
                "The name of the test being recorded.";
            }
          }

          case show-case {
            leaf show {
              type IdentifierOrZero;
              default "";
              description
                "Show the specified test-suite or all
                 test-suites if an empty string is entered.";
            }
            uses ncxapp:HelpMode;
          }

          leaf load {
            type string;
            default "~/.yumapro/yangcli_pro_tests.conf";
            description
              "The file pathspec of the test suite config file
               to load.";
          }

          leaf run-all {
            description
              "Run all the test-suites defined in the test suite
               config file.";
            type empty;
          }

          leaf start {
            type nt:NcxIdentifier;
            description
             "Start running the specified test-suite";
          }

          leaf save {
            type string;
            default "~/.yumapro/yangcli_pro_tests.conf";
            description
              "Save the current test-suite configuration to the
               specified (or default) config file.";
          }

          case export-case {
            leaf export {
              type empty;
              description
                "If the 'export-file' parameter is not present
                 then export to the default file name.";
            }
            leaf export-file {
              type string;
              description
                "Export the specified test-suite configuration
                 and data for use in a different test tool.
                 The 'test-suite' paramer must be present.

                 This parameter specifies the output filespec
                 for the exported test-suite.

                 Currently the only format is the proprietary
                 'yangcli' format.  Added to 22.10-7";
            }

            // TBD: export-format leaf
          }

        }
      }
    }

    rpc update-config {
      description
        "Update the configuration cache for the current session.
         The current session must be connected and the
         $$autoconfig system variable must be 'true',
         or an error will be returned.";
    }

    rpc unset {
      description
        "Delete a specific yangcli-pro command alias.

         * Delete one alias 'foo':
           yangcli-pro>  unset foo
       ";
      input {
        leaf name {
          description
            "Name of the yangcli-pro command alias to delete.";
          type nt:NcxName;
          mandatory true;
        }
      }
    }

    rpc uservars {
      description "Manage the yangcli-pro user variables";
      input {

        choice uservars-action {
          mandatory true;

          leaf clear {
            description
              "Delete all the yangcli-pro user variables from memory.";
            type empty;
          }

          leaf load {
            description
              "Load the yangcli-pro user variables from the
               specified XML file spec.  The default user variables
               file will be loaded automatically at startup
               if the '--autouservars' parameter is present.
               The container 'vars' data structure represents
               the format of the XML file expected.";
            type string;
            default "~/.yumapro/yangcli_pro_uservars.xml";
          }

          leaf save {
            description
              "Save the yangcli-pro user variables to the
               specified filespec. The default user variables
               file will be saved automatically at shutdown
               if the '--autouservars' parameter is present.
               The container 'vars' data structure represents
               the format of the XML file that will be written.";
            type string;
            default "~/.yumapro/yangcli_pro_uservars.xml";
          }
        }
      }
    }

    rpc while {
      description
        "Evaluate an XPath expression locally on the manager.
         and execute the block of commands that follow
         while the expression is true.  The block ends
         when a matching 'end' command is reached.
        ";
      input {
        ncx:default-parm expr;
        uses XPathParms;
        leaf maxloops {
          description
            "Set a maximum number of loops that can be
             iterated for this while command.
             The value zero means that no maximum will be
             enforced.  Use this mode with caution.";
          type uint32;
          default 65535;
        }
      }
    }

    rpc xget {
      description
       "Get some NETCONF running config or state data with the get
        operation, using an optional XPath filter.";
      input {
        ncx:default-parm select;
        uses XGetParms;
      }
      output {
        anyxml data {
          description
            "The data resulting from the retrieval operation.";
        }
      }
    }

    rpc xget-config {
      description
       "Get some NETCONF config data with the get-config
        operation, using an optional XPath filter.";
      input {
        ncx:default-parm select;
        uses XGetParms;

        container source {
          description "Particular configuration to retrieve.";

          choice config-source {
            mandatory true;

            leaf candidate {
              if-feature nc:candidate;
              description
                "Only available if 'candidate' capability supported.";
              type empty;
            }
            leaf running {
              type empty;
            }
            leaf startup {
              if-feature nc:startup;
              description
                "Only available if 'startup' capability supported.";
              type empty;
            }
            leaf url {
              if-feature nc:url;
              description
                "URL pointing to config data. Only available
                 if 'url' capability supported.";
             type nc:ConfigURIType;
            }
          }
        }
      }
      output {
        anyxml data {
          description
            "The data resulting from the retrieval operation.";
        }
      }
    }

    rpc xget-data {
      description
       "Get some NETCONF datastore data with the <get-data>
        operation, using an optional XPath filter.
        The server must support the <get-data> operation
        from the ietf-netconf-nmda module.";
      input {
        ncx:default-parm select;
        uses DatastoreParm;
        uses XGetParms;
        uses ConfigFilterParm;
        uses OriginParms;
      }
      output {
        anyxml data {
          description
            "The data resulting from the retrieval operation.";
        }
      }
    }

    rpc event-handlers-cfg {
      description "Controls access to the saved event-handlers file";
      input {
      choice event-handlers-action {
          default show-case;

          case show-case {
            leaf show {
              type empty;
              description
                "Show all saved event-handlers in memory";
            }
            uses ncxapp:HelpMode;
          }

          leaf clear {
            type empty;
            description
              "Clear all the saved event-handlers in memory.
               Use 'event-handlers-cfg load' to restore the saved event-handlers.
               Use 'event-handlers-cfg save' to clear the saved event-handlers
               file.";
          }
          leaf load {
            description
              "Load the saved event-handlers in memory from the
               specified file spec.";
            type string;
            default "~/.yumapro/.yangcli_pro_event-handlers.conf";
          }

          leaf save {
            description
              "Save the current saved event-handlers in memory to the
               specified saved event-handlers filespec.";
            type string;
            default "~/.yumapro/.yangcli_pro_event-handlers.conf";
          }
        }
      }
    }

   rpc event-handler-cfg {
      description "Access an event handler mapping configuration.";
      input {
        choice user-action {
          default show-case;

          case show-case {
            leaf show {
              type IdentifierOrZero;
              default "";
              description
                "Show the specified event-handler or the current
                 event-handler if an empty string is entered.";
            }
            uses ncxapp:HelpMode;
          }

          leaf delete {
            type nt:NcxIdentifier;
            description
              "Delete the specified event-handler from the saved
               event handlers in memory.";
          }

          leaf save {
            type nt:NcxIdentifier;
            description
              "Save the specified event handler to the
               saved event handlers in memory.";
          }

          case create {
            leaf create {
             type nt:NcxName;
             mandatory true;
             description
             "An event-handler name to use to create a new event handler.";
            }

            leaf module-name {
              type nt:NcxName;
              description
              "The module name for the event handler. If specified then only
               events from this YANG module will cause the event handler to be
               invoked.  If this leaf is not present then all modules will
               be considered for event handler processing.";
            }

            leaf event-name {
              type nt:NcxName;
              description
              "The event name for the event handler. If specified then only
               this event name will cause the event handler to be invoked.
               If this leaf is not present then all event names will be
               considered for event handler processing.";
            }

            choice script-type {
              mandatory true;
              description
                "The yangcli or shell script to run as the event handler.
                 This script should follow the Event Handler Callback
                 template described in the user documentation.

                 The script MUST be non-interactive. It will be invoked
                 in batch mode and no commands that expect to prompt
                 and wait for user keyboard input will work.

                 The shell-script is supported. yangcli script is not
                 supported.

                 The script file path is set in ncxmod:

                   * 1) current directory or absolute path
                   * 2) YUMAPRO_RUNPATH environment var
                        (or set by runpath CLI var)
                   * 3) HOME/scripts directory
                   * 4) YUMAPRO_HOME/scripts directory
                   * 5) YUMAPRO_INSTALL/scripts directory
                   * 6) start-dir/scripts
                ";

              leaf script {
                type string;
                description
                  "The yangcli script name to use for the event handler.";
              }
              leaf shell-script {
                type string;
                description
                  "The shell script name to use for the event handler.";
              }
            }

          }  // case create
        }
      }
    }

    rpc yanglib-cache {
      description
        "Clear or show 1 or all entries from the YANG Library cache.
         There are 4 forms of this command:
           yanglib-cache clear
           yanglib-cache delete somehost.830
        ";

      input {
        choice yanglib-cache-input {
          mandatory true;
          leaf clear {
             description
                "Delete all stored YANG cache directories.";
             type empty;
          }
          leaf delete {
             description
                "Delete one stored YANG cache directory.";
             type string;
          }
        }  // choice yanglib-cache-input
      }
    }


    /*************************************************************
     *
     * Config file templates for uservars and sessions-cfg commands
     *
     *************************************************************/

    grouping VarsContainer {
    container vars {
      //ncx:abstract;
      ncx:hidden;
      description
        "Represents all saved yangcli-pro user variables";
      list var {
        description
          "Data structure to save one yangcli-pro user variable";
        key name;
        leaf name {
          type nt:NcxName;
          description "Name of the user variable";
        }
        leaf target {
          //need to treat as string in case referenced modules
          //are not loaded when yangcli-pro starts
          //ncx:schema-instance;
          type string;
          description
            "Target variable if variable represents a node
             from a datastore.";
        }
        leaf vartype {
          type YangcliVariableType;
          description
            "User variable type; only 'global' variables can
             be saved in the yangcli-pro uservars file.";
          default global;
        }
        anyxml value {
          description
            "Node value renamed to 'value' since YANG requires
             each node to have a consistent name.";
        }
      }
    }
    }

    uses VarsContainer;

    sx:structure saved-devices {
       ncx:abstract;
       description
         "Represents all the saved devices in
         the ~/.yumapro/yangcli_pro_devices file.
         Use the 'devices' command to access this file.
         Edit by hand only if you follow this YANG definition.";

       list device {
         description
          "The list of devices to use during this test-suite.";

         key name;

        leaf name {
          type nt:NcxName;
          description
           "The name of the saved device.
            The 'device save' command will use the
            string <user>@<server-address> as the default.";
        }

        leaf devicetype {
              type string;
              description
                "Device type for NETCONF devices.";
        }

       leaf server {
          type inet:host;
          mandatory true;
          description
             "IP address or DNS name of the NETCONF server target.";

        }

        leaf ncport {
          type uint16 {
            range "1..max";
          }
          default 830;
          description
            "NETCONF port number to use.  If not present, then
             port 830, followed by port 22, will be tried.";
        }

        uses EntryPointParm;

        uses ncxapp:ProtocolsParm;

        leaf transport {
          description
            "Identifies the transport protocol that should be used.";
          type ywt:transport-type;
          default ssh;
        }

        uses CommentParm;
       }
    }


    sx:structure saved-sessions {
      ncx:abstract;
      description
        "Represents all the saved sessions in
         the ~/.yumapro/yangcli_pro_sessions file.
         Use the 'sessions' command to access this file.
         Edit by hand only if you follow this YANG definition.";

      list session {
        description
          "The list of sessions to use during this test-suite.";

        key name;

        leaf name {
          type nt:NcxName;
          description
           "The name of the saved session.
            The 'session save' command will use the
            string <user>@<server-address> as the default.";
        }

        leaf-list use-event-handler {
           type nt:NcxIdentifier;
           description
             "Name of an event-handler to use within this session.
              When notification delivery for this session is started
              the event handler will be installed. A warning will be
              printed if no event-handler with this name is found.";
        }

        leaf device {
          type nt:NcxDeviceName;
          mandatory true;
          description
             "Device name of the NETCONF server target.";
        }

        leaf userid {
          type nt:NcxName;
          mandatory true;
          description
             "User Id of the NETCONF user.";
        }

        leaf user {
          type nt:NcxName;
          mandatory true;
          description
           "The user name of the session.";
        }


        choice pass {
          mandatory true;

          leaf password {
            type string;
            ncx:password;
            description
              "User password to use for NETCONF sessions.
               If none, then user will be prompted before connecting.";
          }
          leaf no-password { type empty; }
        }

        uses ywapp:SshKeyParms;

        uses ywapp:SslKeyParms;

        leaf server {
          type inet:host;
          mandatory true;
          description
             "IP address or DNS name of the NETCONF server target.";

        }

        leaf ncport {
          type uint16 {
            range "1..max";
          }
          default 830;
          description
            "NETCONF port number to use.  If not present, then
             port 830, followed by port 22, will be tried.";
        }

        uses EntryPointParm;

        uses ncxapp:ProtocolsParm;

        leaf transport {
          description
            "Identifies the transport protocol that should be used.";
          type ywt:transport-type;
          default ssh;
        }

        container start-commands {
          ywx:cli-text-block;
          description
            "An optional block of yangcli commands to run
             after the session is successfully started.";
        }

        uses VarsContainer;

        uses CommentParm;
      }

      list group {
        description
          "A list of groups of sessions to manage at once.";

        key name;

        leaf name {
          type nt:NcxName;
          description
           "The name of the saved group. This name must not conflict
            with any session name.";
        }

        leaf-list session {
          type nt:NcxName;
          description
           "The name of a session that belongs to this group.";
        }

        uses SessionGroupParms;
        uses VarsContainer;
      }
    }

    sx:structure saved-schema-servers {
      ncx:abstract;
      description
      "Represents all the saved schema-servers in
        the ~/.yumapro/yangcli_pro_schema_server file.
        Use the 'schema-server' command to access this file.
        Edit by hand only if you follow this YANG definition.";

       list schema-server-id {
         description
          "The list of schema-servers to use.";
         key name;

         leaf name  {
           type nt:NcxName;
           description
           "The id of the saved server.";
         }

         leaf user-id {
           type nt:NcxName;
           description
           "The id of the saved user.";
         }

         leaf device-id {
           type nt:NcxName;
           description
           "The id of the saved device.";
        }

       }
    }

    sx:structure saved-event-handlers {
     ncx:abstract;
     description
       "Represents all the saved event-handlers in
        the ~/.yumapro/yangcli_event_handlers file.
        Use the 'event-handlers' command to access this file.
        Edit by hand only if you follow this YANG definition.";

       list eventid {
         description
          "The list of event-handlers to use.";

         key name;

         leaf name {
           type nt:NcxName;
           description
           "The id of the saved event.";
         }

         leaf module-name {
          type nt:NcxName;
          mandatory true;
          description
           "The module name.";
         }

         leaf event-name {
          type nt:NcxName;
          mandatory true;
          description
           "The event name.";
         }

         leaf script {
          type string;
          description
          "The yangcli script name to use for the event handler.";
         }

         leaf shell-script {
          type string;
          description
          "The shell script name to use for the event handler.";
         }
      }
    }

    sx:structure saved-users {
     ncx:abstract;
     description
       "Represents all the saved users in
        the ~/.yumapro/yangcli_pro_users file.
        Use the 'users' command to access this file.
        Edit by hand only if you follow this YANG definition.";

       list userid {
         description
          "The list of users to use.";

         key name;

         leaf name {
           type nt:NcxName;
           description
           "The id of the saved user.";
         }

         leaf user {
          type nt:NcxName;
          mandatory true;
          description
           "The user name of the session.";
         }

         choice pass {
          mandatory true;
          leaf password {
            type string;
            ncx:password;
            description
              "User password to use for NETCONF users.
               If none, then user will be prompted before connecting.";
          }
          leaf no-password { type empty; }
        }
        uses ywapp:SshKeyParms;
        uses ywapp:SslKeyParms;
        uses CommentParm;
      }
    }


    /*** Abstract Objects For Internal Use Only ***/

    leaf do {
      ncx:abstract;
      ncx:hidden;
      type string;
      description
        "Do <command>, Execute a normal mode command in config mode";
    }

    leaf no {
      ncx:abstract;
      ncx:hidden;
      type string;
      description
        "No <command>, Delete or negate a command in config mode";
    }

    leaf apply {
      ncx:abstract;
      ncx:hidden;
      type empty;
      description
        "Apply the pending edits in config mode";
    }

    leaf gotop {
      ncx:abstract;
      ncx:hidden;
      type empty;
      description
        "Exit all config sub-modes until the top level config mode
        is reached.";
    }

    leaf return {
      ncx:abstract;
      ncx:hidden;
      type empty;
      description
        "Exit all config sub-modes and discard any pending edits";
    }

    leaf config-commit {
      ncx:abstract;
      ncx:hidden;
      type empty;
      description
        "Use <config-commit> to commit the candidate datastore
         to the running datastore in config mode.";
    }

    sx:structure pipe {
      ncx:abstract;
      ncx:hidden;

      description
        "Pipe command sub-commands.
         The 'begin', 'include', and 'exclude' parameters are used
         to filter command output. If these parameters contain
         any pattern meta-characters, then they will be treated
         as a YANG pattern string.  If a plain string is found
         instead, then this string must be found in the line
         to be considered a match.

         Each output line is processed in the following manner:
           1) if begin set and not triggered yet, then test
              the line. If a match then disable this step
              for future lines and continue testing output,
              else skip this line.
           2) check each exclude parameter. If any match then
              skip this line.
           3) check each include parameter. If any match then
              include this line, else skip this line.
           4) include the line in the output.

         If the 'redirect' parameter is present then the filtered
         output will be sent to a file instead of the session.

         If the 'display'parameter is present then the specifed
         display format will be used for the output and the
         filtering format. By default, the current display-mode
         is used for both filtering and output formats.";

      leaf begin {
        ywx:help "Begin output after the string is found";
        type string;
        description
          "Specifies the pipe begin line pattern.";
      }

      leaf-list include {
        ywx:help "Include output if the string is found";
        type string;
        description
          "Specifies a pipe include line pattern.
           Multiple parameters are treated as a logical-OR
           expression.";
      }

      leaf-list exclude {
        ywx:help "Exclude output if the string is found";
        type string;
        description
          "Specifies a pipe exclude line pattern.
           Multiple parameters are treated as a logical-OR
           expression.";
      }

      leaf redirect {
        ywx:help "Redirect output to a file";
        type string;
        description
          "Specifies the pipe output redirect filespec.
           If this filespec already exists then output
           will be appended to the file.";
      }

      leaf display {
        ywx:help "Display output in XML or JSON format";
        type enumeration {
          enum xml {
            description "Display output in XML format";
          }
          enum json {
            description "Display output in JSON format";
          }
          enum curmode {
            description
              "Display output is the current $$display-mode format";
          }
          enum plain {
            description "Display output in plain format";
          }
          enum cli {
            description "Display output in CLI format";
          }
        }
        default "curmode";
        description
          "Specifies the pipe output display format.";
      }
    }

    // dummy leafs for help output only
    leaf xml {
      ncx:abstract;
      ncx:hidden;
      description "Display output in XML format";
      type string;
    }
    leaf json {
      ncx:abstract;
      ncx:hidden;
      description "Display output in JSON format";
      type string;
    }

}
