<?xml version="1.0" encoding="US-ASCII"?>
<!-- This template is for creating an Internet Draft using xml2rfc,
     which is available here: http://xml.resource.org. -->
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!-- One method to get references from the online citation libraries.
     There has to be one entity for each item to be referenced.
     An alternate method (rfc include) is described in the references. -->
<!ENTITY RFC2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC6241 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6241.xml">
<!ENTITY RFC7950 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7950.xml">
<!ENTITY RFC7149 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7149.xml">
<!ENTITY RFC7426 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7426.xml">
<!ENTITY RFC8299 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8299.xml">
<!ENTITY RFC8309 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8309.xml">
<!ENTITY RFC8340 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8340.xml">
<!ENTITY RFC8453 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8453.xml">
<!ENTITY RFC8174 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8174.xml">
<!ENTITY RFC8345 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8345.xml">
]>
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<!-- used by XSLT processors -->
<!-- For a complete list and description of processing instructions (PIs),
     please see http://xml.resource.org/authoring/README.html. -->
<!-- Below are generally applicable Processing Instructions (PIs) that most I-Ds might want to use.
     (Here they are set differently than their defaults in xml2rfc v1.32) -->
<?rfc strict="yes" ?>
<!-- give errors regarding ID-nits and DTD validation -->
<!-- control the table of contents (ToC) -->
<?rfc toc="yes"?>
<!-- generate a ToC -->
<?rfc tocdepth="4"?>
<!-- the number of levels of subsections in ToC. default: 3 -->
<!-- control references -->
<?rfc symrefs="yes"?>
<!-- use symbolic references tags, i.e, [RFC2119] instead of [1] -->
<?rfc sortrefs="yes" ?>
<!-- sort the reference entries alphabetically -->
<!-- control vertical white space
     (using these PIs as follows is recommended by the RFC Editor) -->
<?rfc compact="yes" ?>
<!-- do not start each main section on a new page -->
<?rfc subcompact="no" ?>
<!-- keep one blank line between list items -->
<!-- end of list of popular I-D processing instructions -->
<rfc category="std" docName="draft-ma-netconf-with-system-02"
     ipr="trust200902">
  <!-- category values: std, bcp, info, exp, and historic
     ipr values: full3667, noModification3667, noDerivatives3667
     you can add the attributes updates="NNNN" and obsoletes="NNNN"
     they will automatically be output with "(if approved)" -->

  <!-- ***** FRONT MATTER ***** -->

  <front>
    <!-- The abbreviated title is used in the page header - it is only necessary if the
         full title is longer than 39 characters -->

    <title abbrev="System Configuration Data Handling">System Configuration
    Data Handling Behavior</title>

    <author fullname="Feng Chong" initials="C." surname="Feng">
      <organization>Huawei</organization>

      <address>
        <postal>
          <street>101 Software Avenue, Yuhua District</street>

          <city>Nanjing</city>

          <region>Jiangsu</region>

          <code>210012</code>

          <country>China</country>
        </postal>

        <email>frank.fengchong@huawei.com</email>
      </address>
    </author>

    <author fullname="Qiufang Ma" initials="Q." surname="Ma">
      <organization>Huawei</organization>

      <address>
        <postal>
          <street>101 Software Avenue, Yuhua District</street>

          <city>Nanjing</city>

          <region>Jiangsu</region>

          <code>210012</code>

          <country>China</country>
        </postal>

        <email>maqiufang1@huawei.com</email>
      </address>
    </author>

    <author fullname="Chongfeng Xie" initials="C" surname="Xie">
      <organization>China Telecom</organization>

      <address>
        <postal>
          <street/>

          <city>Beijing</city>

          <country>China</country>
        </postal>

        <email>xiechf@chinatelecom.cn</email>
      </address>
    </author>

    <date year="2021"/>

    <!-- Meta-data Declarations -->

    <area>ops</area>

    <workgroup>NETCONF</workgroup>

    <!-- WG name at the upperleft corner of the doc,
         IETF is fine for individual submissions.
         If this element is not present, the default is "Network Working Group",
         which is used by the RFC Editor as a nod to the history of the IETF. -->

    <keyword>With System NETCONF</keyword>

    <!-- Keywords will be incorporated into HTML output
         files in a meta tag but they have no effect on text or nroff
         output. If you submit your draft to the RFC Editor, the
         keywords will be used for the search engine. -->

    <abstract>
      <t>This document defines an optional "system" datastore to allow clients
      populate the system configuration into running datastore in the device.
      It also defines a capability-based extension to the NETCONF protocol
      that helps the NETCONF client identify how system configuration are
      processed by the server.</t>
    </abstract>
  </front>

  <middle>
    <section anchor="Introduction" title="Introduction">
      <t>The NETCONF protocol [RFC6241] defines ways to read configuration and
      state data from a NETCONF server.</t>

      <t>In some cases, a client-configured data item refers to a system
      generated data item (e.g., the auto-created interfaces "eth1"), which is
      only present in the &lt;operational&gt; datastore [RFC8342]. In order
      for it being referenced, the duplicated system configured data item
      needs to be retrieved from &lt;operational&gt; and overridden by the
      client.</t>

      <t>In some other cases, a system generated configured data item is in
      the when/must statement, the similar operation should also be performed
      to make sure a successful validation, which is cumbersome.</t>

      <t>Furthmore, when the system generated data item gets updated, there is
      no way to synchronize the update into &lt;running&gt; and the client
      can't detect the update automatically.</t>

      <t>This document defines a "system" datastore to hold all the
      configurations provided by the system itself. It also defines a
      capability-based extension to the NETCONF protocol that allows the
      configuration synchronization between &lt;system&gt; and &lt;running&gt;
      both automatically and explicitly.</t>

      <section anchor="terminology" title="Terminology">
        <t>This document assumes that the reader is familiar with the contents
        of <xref target="RFC6241"/>, <xref target="RFC7950"/>, <xref
        target="RFC8342"/>, <xref target="RFC8407"/>, and <xref
        target="RFC8525"/> and uses terminologies from those documents.</t>

        <t>The following terms are defined in this document as follows:<list
            style="hanging">
            <t hangText="System configuration: ">Configuration that is
            provided by the system itself [RFC8342]. <vspace
            blankLines="1"/></t>

            <t hangText="System configuration datastore: ">A configuration
            datastore holding the complete configuration provided by the
            system iteself. This datastore is referred to as
            "&lt;system&gt;".</t>

            <t
            hangText="physical resource independent system configuration:">When
            the device is powered on, the pre-provisioned configuration will
            be activated and provided, irrespective of physical resource
            present or not, sometimes the pre-provisioned configuration will
            be provided without must/when statement constraint (e.g., loop
            back interface activation), sometimes not, e.g., only provided
            when a special functionality is enabled. <vspace
            blankLines="1"/></t>

            <t
            hangText="Physical resource dependent system configuration:">When
            the device is powered on and the physical resource is present
            (e.g., insert interface card), the system will automatically
            detect it and load pre-provisioned configuration; when the
            physical resource is not present( remove interface card), the
            system configuration will be automatically cleared. <vspace
            blankLines="1"/></t>
          </list></t>
      </section>

      <section title="Requirements Language">
        <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
        "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
        "OPTIONAL" in this document are to be interpreted as described in BCP
        14 <xref target="RFC2119"/> <xref target="RFC8174"/> when, and only
        when, they appear in all capitals, as shown here.</t>
      </section>
    </section>

    <!-- Possibly a 'Contributors' section ... -->

    <section title="System Configuration Datastore">
      <t>Following guidelines for defining Datastores in the appendix A of
      [RFC8342], this document introduces a new datastore resource named
      'system' that represents the system configuration.</t>

      <t><list style="symbols">
          <t>Name: "system"</t>

          <t>YANG modules: all</t>

          <t>YANG nodes: all "config true" data nodes</t>

          <t>Management operations: The content of the datastore is set by the
          server in an implementation dependent manner. The content can not be
          changed by management operations via NETCONF, RESTCONF,the CLI, etc
          unless specialized, dedicated operations are provided. The datastore
          can be read using the standard NETCONF/RESTCONF protocol
          operations.</t>

          <t>Origin: This document does not define any new origin identity
          when it interacts with &lt;operational&gt; datastore. The system
          origin Metadata Annotation is used to indicate the origin of a data
          item.</t>

          <t>Protocols: RESTCONF, NETCONF and other management protocol.</t>

          <t>Defining YANG module: "ietf-netconf-with-system".</t>
        </list></t>

      <t>The datastore content is usually defined by the device vendor. It is
      static at most of time and MAY change e.g., depending on external
      factors like HW available or during device upgrade. &lt;system&gt; does
      not persist across reboots. It will be automatically loaded when the
      device is powered on or the physical resource is present.</t>

      <section title="Life Cycle of the system configuration management">
        <t>When the device is powered on, physical resource independent system
        configuration will be created in &lt;system&gt; automatically by the
        system if there is no when/must statement constraint associated with
        system configuration data or provided only when a special
        functionality is enabled.</t>

        <t>When the device is powered on and the physical resource is inserted
        into the device, physical resource dependent system configuration will
        be automatically loaded into &lt;system&gt;;</t>

        <t>When the physical resource is removed from the device, the physical
        resource dependent system configuration will be automatically removed
        from &lt;system&gt;;</t>
      </section>

      <section title="&quot;Factory-Reset&quot; RPC Impact on System Configuration Datastore">
        <t><xref target="RFC8808"/>defines a "factory-reset" RPC to allow
        clients to reset a server back to its factory-default condition. Upon
        receiving the RPC, all supported conventional read-write configuration
        datastore(i.e.,&lt;running&gt;, &lt;startup&gt; and &lt;candidate&gt;)
        are reset to the contents of &lt;factory-default&gt;. &lt;system&gt;
        should also immediately reset to its factory default state. That's to
        say, any system configurations generated due to system upgrading or
        client-enabled functionality should be discarded. System configuration
        which is generated at the first time when it boots after being shipped
        from factory should be retained.</t>

        <t/>
      </section>
    </section>

    <section anchor="basic"
             title="System Configuration data handling Basic Modes">
      <t>Not all server implementations treat system configuration data in the
      same way. Instead of forcing a single implementation strategy, this
      document allows a server advertise a particular style of system
      configuration data handling, and the client can adjust behavior
      accordingly.</t>

      <t>This document specifies two standard system configuration handling
      basic modes that a server implementor may choose from:<list
          style="symbols">
          <t>auto-populate</t>

          <t>no-populate</t>
        </list></t>

      <t>A server that uses the 'auto-populate' basic mode MUST automatically
      <list style="symbols">
          <t>Update &lt;running&gt; with the system configuration change,
          after the "system" configuration has been altered as a consequence
          of a plug and play operation or device powering on operation.
          However the configurations in &lt;running&gt; can not be removed
          automatically when configuration data nodes in &lt;system&gt; is
          deleted since those configurations in &lt;running&gt; are likely to
          have already been modified or referenced.</t>

          <t>The system configuration doesn't need to be explicitly set by the
          client first before the system configuration needs to be updated
          with client set configuration or referenced by client set
          configuration.</t>
        </list></t>

      <t>A server that uses the 'no-populate' basic mode <list style="symbols">
          <t>MUST not update &lt;running&gt; with the system
          configuration.</t>

          <t>The system configuration MUST be explicitly set by the client
          first before the system configuration needs to be updated with
          client set configuration or referenced by client set
          configuration.</t>
        </list></t>

      <section title="'auto-populate' Initialization During Reboot">
        <t>The contents of &lt;system&gt; don't have to be persist across
        reboots, even in the presence of non-volatile storage.</t>

        <t>For the NETCONF server which implements the &lt;factory-default&gt;
        datastore [RFC8808], it may load &lt;factory-default&gt; at the first
        time when it boots after being shipped from factory or reset to its
        factory default condition. Then it's just like each normal boot time,
        the device generates system configurations and saves into
        &lt;system&gt;. Then the device loads the saved startup
        configuration(if &lt;startup&gt; exists) into &lt;running&gt;. Lastly,
        the device loads &lt;system&gt; into &lt;running&gt;. If there exists
        any conflict, the configuration in the &lt;running&gt; should
        succeed.</t>
      </section>

      <section title="'auto-populate' &lt;edit-config&gt; Behavior towards &lt;running&gt;">
        <t>For a data node that is loaded from &lt;system&gt; automatically,
        the server MUST consider it to exist.<list style="symbols">
            <t>A valid 'create' operation attribute for a data node that is
            loaded from &lt;system&gt; and set by the server MUST fail with a
            'data-exists' error-tag;</t>

            <t>A valid 'delete' operation attribute for a data node that is
            loaded from &lt;system&gt; and set by the server MUST succeed. The
            deleted system configuration MUST be reloaded into &lt;running&gt;
            immediately if the system configuration is still present in the
            &lt;system&gt;;</t>

            <t>A valid 'merge' operation attribute for a data node that is
            loaded from &lt;system&gt; and set by the server MUST succeed.</t>
          </list></t>
      </section>

      <section title="'no-populate' &lt;edit-config&gt; Behavior towards &lt;running&gt;">
        <t>The server MUST NOT consider any system configuration data node to
        exist in &lt;running&gt; configuration datastore, except those
        explicitly set by the client.<list style="symbols">
            <t>A valid 'create' operation attribute for a data node that is
            set by the server MUST succeed since the system configuration data
            is not present in the &lt;running&gt; configuration datastore.</t>

            <t>A valid 'merge' operation attribute for a data node that is set
            by the server MUST succeed even though the name of data node in
            &lt;system&gt; is same as name of data node explicitly set by the
            client.</t>

            <t>A valid 'delete' operation attribute for a data node that is
            set by the client MUST succeed even though the name of data node
            in &lt;system&gt; is same as name of data node explicitly set by
            the client. A valid 'delete' operation attribute for a data node
            that is not explicitly set by the client MUST fail since system
            configuration is not loaded into &lt;running&gt;.</t>
          </list></t>
      </section>
    </section>

    <section title="Retrieval of System Configuration Data">
      <t>TBD</t>
    </section>

    <section title="With System Capability">
      <section title="Overview">
        <t>The :with-system capability indicates which system-data-handling
        basic mode is supported by the server. These basic modes allow a
        NETCONF client to control whether system configuration data is
        returned by the server. Sending of system configuration data is
        controlled for each individual operation separately.</t>

        <t>A NETCONF server implementing the :with-system capability: <list
            style="symbols">
            <t>MUST indicate its basic mode behavior by including the
            'basic-mode' parameter in the capability URI;</t>

            <t>MUST support the YANG module defined in <xref target="module"/>
            for the system configuration data handling mode indicated by the
            'basic-mode' parameter.</t>
          </list></t>
      </section>

      <section anchor="cap" title="Capability Identifier">
        <t>urn:ietf:params:netconf:capability:with-system:1.0</t>

        <t>The identifier MUST have a parameter: "basic-mode". This indicates
        how the server will treat system configuration data, as defined in
        <xref target="basic"/>. The allowed values of this parameter are
        'auto-populate', and 'no-populate', as defined in <xref
        target="basic"/>.</t>

        <t>urn:ietf:params:netconf:capability:with-system:1.0?basic-mode=no-populate</t>
      </section>

      <section title="Modifications to Existing Operations ">
        <section title="&lt;get-data&gt; Operations">
          <t>As defined in <xref target="module"/>, retrieval of system
          configuration in &lt;system&gt; can be used through &lt;get-data&gt;
          operation with the "datastore" parameter set to "system".</t>
        </section>

        <section title="&lt;edit-config&gt; Operation  ">
          <t>The &lt;edit-config&gt; operation has several editing modes. The
          'create', and 'delete' editing operations are affected by the system
          configuration data handling basic mode. The other enumeration values
          for the NETCONF operation attribute are not affected.</t>

          <t>If the operation attribute contains the value 'create', and the
          data node already exists in the target configuration datastore, then
          the server MUST return an &lt;rpc-error&gt; response with a
          'invalid-value' error-tag.</t>

          <t>If the client sets a data node that is explicitly set by the
          server, the server MUST accept the request if it is valid. The
          server MUST keep or discard the new value based on its system
          configuration data handling basic mode.</t>
        </section>
      </section>
    </section>

    <section anchor="module" title="YANG Module">
      <t>This YANG module uses the "datastore" identity [RFC8342]. Every
      NETCONF server which supports :with-system capability MUST implement
      this YANG module.</t>

      <figure>
        <artwork> &lt;CODE BEGINS&gt; file="ietf-netconf-with-system@2021-05-14.yang"
 module ietf-netconf-with-system {
    yang-version 1.1;
    namespace "urn:ietf:params:xml:ns:yang:ietf-netconf-with-system";
    prefix ncws;

    import ietf-datastores {
    prefix ds;
    reference
      "RFC 8342: Network Management Datastore Architecture(NMDA)";
    }

    organization
     "IETF NETCONF (Network Configuration Protocol) Working Group";

    contact
     "WG Web:   &lt;http://tools.ietf.org/wg/netconf/&gt;
      WG List:  &lt;mailto:netconf@ietf.org&gt;
      WG Chair: 
      Editor: 
                                                 ";
    description
     "This module defines an extension to the NETCONF protocol
      that allows the NETCONF client to control how system configuration 
      data are handled by the server in particular NETCONF operations.

      Copyright (c) 2010 IETF Trust and the persons identified as
      the document authors.  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 Simplified BSD License
      set forth in Section 4.c of the IETF Trust's Legal Provisions
      Relating to IETF Documents
      (http://trustee.ietf.org/license-info).

      This version of this YANG module is part of RFC XXXX; see
      the RFC itself for full legal notices.";
    // RFC Ed.: replace XXXX with actual RFC number and remove this note

    revision 2021-05-14 {
      description
        "Initial version.";
      reference
       "RFC XXXX: With-system capability for NETCONF";
    }

    feature system-datastore {
      description
        "Indicates that the system configuration is available as a datastore.";
    }
  
    identity system {
      if-feature "system-datastore";
      base ds:datastore;
      description
        "This read-only datastore contains the system configuration for the 
         device that will be loaded into &lt;running&gt; automatically in the 
         "auto-populate" basic mode.";
    }   
 }
 &lt;CODE ENDS&gt;</artwork>
      </figure>
    </section>

    <section anchor="IANA" title="IANA Considerations">
      <t>This document registers the following capability identifier URN in
      the 'Network Configuration Protocol Capability URNs registry':<figure>
          <artwork>urn:ietf:params:netconf:capability:with-system:1.0</artwork>
        </figure></t>

      <t>This document registers two XML namespace URNs in the 'IETF XML
      registry', following the format defined in [RFC3688].<figure>
          <artwork>      URI: urn:ietf:params:xml:ns:netconf:system:1.0
      URI: urn:ietf:params:xml:ns:yang:ietf-netconf-with-system

   Registrant Contact: The NETCONF WG of the IETF.

   XML: N/A, the requested URIs are XML namespaces.</artwork>
        </figure></t>

      <t>This document registers one module name in the 'YANG Module Names'
      registry, defined in [RFC6020] .<figure>
          <artwork>      name: ietf-netconf-with-system
      prefix: ncws
      namespace: urn:ietf:params:xml:ns:yang:ietf-netconf-with-system
      RFC: XXXX // RFC Ed.: replace XXXX and remove this comment</artwork>
        </figure></t>
    </section>

    <section anchor="scecurity" title="Security Considerations">
      <t>The YANG module specified in this document defines a schema for data
      that is designed to be accessed via network management protocols such as
      NETCONF [RFC6241] or RESTCONF [RFC8040]. The lowest NETCONF layer is the
      secure transport layer, and the mandatory-to-implement secure transport
      is Secure Shell (SSH) [RFC6242]. The lowest RESTCONF layer is HTTPS, and
      the mandatory-to-implement secure transport is TLS [RFC8446].</t>

      <t>The Network Configuration Access Control Model (NACM) [RFC8341]
      provides the means to restrict access for particular NETCONF or RESTCONF
      users to a preconfigured subset of all available NETCONF or RESTCONF
      protocol operations and content.</t>
    </section>

    <section anchor="Acknowledgements" title="Acknowledgements">
      <t>Thanks to Robert Wilton, Kent Watsen, Balazs Lengyel, Timothy Carey
      for reviewing, and providing important input to, this document.</t>
    </section>
  </middle>

  <!--  *****BACK MATTER ***** -->

  <back>
    <!-- References split into informative and normative -->

    <!-- There are 2 ways to insert reference entries from the citation libraries:
     1. define an ENTITY at the top, and use "ampersand character"RFC2629; here (as shown)
     2. simply use a PI "less than character"?rfc include="reference.RFC.2119.xml"?> here
        (for I-Ds: include="reference.I-D.narten-iana-considerations-rfc2434bis.xml")

     Both are cited textually in the same manner: by using xref elements.
     If you use the PI option, xml2rfc will, by default, try to find included files in the same
     directory as the including file. You can also define the XML_LIBRARY environment variable
     with a value containing a set of directories to search.  These can be either in the local
     filing system or remote ones accessed by http (http://domain/dir/... ).-->

    <references title="Normative References">
      <!--?rfc include="http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml"?-->

      <?rfc include="reference.RFC.2119.xml"?>
    </references>

    <references title="Informative References">
      <!-- Here we use entities that we defined at the beginning. -->

      <?rfc include="reference.RFC.6241.xml"?>

      <?rfc include="reference.RFC.7950.xml"?>

      <?rfc include="reference.RFC.8407.xml"?>

      <?rfc include="reference.RFC.8525.xml"?>

      <?rfc include="reference.RFC.8174.xml"?>

      <?rfc include="reference.RFC.8342.xml"?>

      <?rfc include="reference.RFC.8808.xml"?>

      <!-- A reference written by by an organization not a person. -->
    </references>

    <section title="Changes between Revisions">
      <t>v01 - v02<list style="symbols">
          <t>Remove System configuration data retrieval behavior in the
          mainbody and examples in the appendix.</t>

          <t>Remove &lt;get&gt; operation and &lt;get-config&gt; operation
          extension from the YANG data model.</t>

          <t>Change basic mode values into auto-populate, no-populate.</t>

          <t>Consider &lt;factory-default&gt; to work together with
          &lt;system&gt;.</t>
        </list></t>
    </section>

    <section title="Open Issues tracking">
      <t><list style="symbols">
          <t>Do we need to define RPC to allow the server loads &lt;system&gt;
          configuration data into &lt;running&gt;?</t>

          <t>Can we introduce better terminology?</t>

          <t>Should we define a standard operation of system configuration
          retrieval?</t>
        </list></t>
    </section>

    <!-- Change Log
v00 2019-12-12  Authors   Initial version-->
  </back>
</rfc>
