module yumaworks-mgr-common {
    yang-version 1.1;
    namespace "http://yumaworks.com/ns/yumaworks-mgr-common";
    prefix "ymcmn";

    import yuma-types { prefix nt; }

    organization "YumaWorks, Inc.";

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

    description
       "yp-controller common typedefs and groupings

     Copyright (c) 2018 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 2018-07-11 {
        description
          "Initial version";
    }

    grouping session-name-config {
      description
        "Represents one session name specifier parameter";
      leaf-list session-name {
        type union {
          type string {
            pattern '\*';
          }
          type nt:NcxName;
        }
        min-elements 1;
        description
          "The name of a session or callhome-session entry.";
      }
    }

    grouping session-name-oper {
      leaf session-name {
        type nt:NcxName;
        description
          "The name of the session that the RPC operation
           was attempted. This name identifies an entry in the
           /sesmgr/sessions/session list or the
           /sesmgr/sessions/callhome-session list.";
      }
    }

    grouping output-cmn {
      choice output-choice {
        leaf async-mode-started {
          type empty;
          description
            "Indicates the async mode was used and the
             operation was started successfully on at least
             one session.";
        }
        list session-output {
          description
            "One entry represents the output from one session.
             If the operation was not attempted because the input
             parameter values (e.g., stop-time before start-time)
             then no entries will exist in this list and the
             operation will return an empty rpc-reply element
             instead.";

          key session-name;
          uses session-name-oper;
          choice cmd-result {
            leaf timeout-error {
              type empty;
              description
                "The operation reply was not received before
                 the timeout.";
            }
            leaf other-error {
              type string;
              description
                "The error string for some other error that occurred
                 sending the request. This case is not used if a
                  valid response was received,";
            }
            container data {
              description
                "The output data from the operation.
                 The RPC operation using this grouping
                 will augment this container with the data
                 that is expected for that message.
                 There will be one or more child nodes present,
                 depending on the operation.";
            }
          }
        }
      }
    }

}
