module yumaworks-restconf-commit {
  namespace "urn:ietf:params:xml:ns:yang:yumaworks-restconf-commit";
  prefix "ycom";

  organization "YumaWorks, Inc.";

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

  description
    "This module contains abstract query parameter definitions
     for the RESTCONF protocol to support confirmed edit operations
     with automatic rollback or confirmation.



     This procedure is adapted from the confirmed commit procedure in
     RFC 6241.  The server requirements are exactly the same, except
     that RESTCONF provides the confirmed commit parameters as
     query parameters for edit methods.

     1) To start a confirmed commit, use the mandatory 'confirmed' query
        parameter in the edit request. The 'confirm-timeout'
        parameter can also be specified, or the default of 10 minutes
        will be used,  The 'persist' query parameter must be used or
        the confirmed commit will be immediately canceled because
        the RESTCONF 'session' has terminated. No edits will be
        accepted while the confirmation is pending, since the 'persist'
        parameter must be used.

      POST /restconf/data/ietf-interfaces:interfaces
         ?confirmed=1&persist=r3sd2e&confirm-timeout=300

      { 'ietf-interfaces:interface' : { ... } }


     2) To extend a confirmed commit with another edit, use
     the 'confirmed' query parameter in the edit request.
     The 'persist-id' query parameter must also be used,
     to extend the confirmed commit procedure.

     The 'persist' query parameter may also be used, in order
     to change the persist-id to complete the commit.  This is
     not required.

      PATCH /restconf/data/ietf-interfaces:interfaces/interface=eth0
        ?confirmed=1&persist=r3sd2e&persist-id=r3sd2e

      { 'ietf-interfaces:interface' : { ... } }


     3) To complete a confirmed commit, use the 'commit' operation.
        The 'persist-id' input parameter is required with the
        same value previously used in the confirmed commit procedure

      POST /restconf/operations/ietf-netconf:commit

      { 'ietf-netconf:input' : {
         'persist-id' : 'r3sd2e'
        }
      }


     4) To cancel a confirmed commit, use the 'cancel-commit' operation.
        The 'persist-id' input parameter is required if a 'persist' parameter
        was previously used in the confirmed commit procedure

      POST /restconf/operations/ietf-netconf:cancel-commit

      { 'ietf-netconf:input' : {
         'persist-id' : 'r3sd2e'
        }
      }

     Copyright (c) 2016 - 2021, 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 2017-03-29 {
    description
       "Update to use NETCONF by reference";
  }

  revision 2015-12-26 {
    description
       "Initial version";
  }

  grouping commit-parameters {
      description
        "RESTCONF confirmed commit parameters, taken from RFC 6241";

      leaf confirmed {
        // query parameter needs a value to be simple
        // confirmed=1 is the only accepted value
        // type empty;
        type int8 { range "1"; }
        description
          "The confirmed parameter from NETCONF";
        reference "RFC 6241, Section 8.3.4.1";
      }

      leaf confirm-timeout {
        type uint32 {
          range "1..max";
        }
        units "seconds";
        default "600";   // 10 minutes
        description
          "The timeout parameter from NETCONF";
        reference "RFC 6241, Section 8.3.4.1";
      }

      leaf persist {
        type string;
        description
          "The persist parameter from NETCONF";
        reference "RFC 6241, Section 8.3.4.1";
      }

      leaf persist-id {
        type string;
        description
          "The persist-id parameter from NETCONF";
        reference "RFC 6241, Section 8.3.4.1";
      }
  }




}
