<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc>
<?rfc toc="yes"?>
<?rfc tocompact="yes"?>
<?rfc tocdepth="2"?>
<?rfc tocindent="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<rfc category="std" docName="draft-ietf-netconf-udp-client-server-03"
     ipr="trust200902" submissionType="IETF" consensus="true">
  <front>
    <title abbrev="udp-client-server-grouping">YANG Groupings for UDP
    Clients and UDP Servers</title>

    <author fullname="Alex Huang Feng" initials="A." surname="Huang Feng">
      <organization>INSA-Lyon</organization>

      <address>
        <postal>
          <street/>

          <city>Lyon</city>

          <region/>

          <code/>

          <country>France</country>
        </postal>

        <phone/>

        <facsimile/>

        <email>alex.huang-feng@insa-lyon.fr</email>

        <uri/>
      </address>
    </author>

    <author fullname="Pierre Francois" initials="P." surname="Francois">
      <organization>INSA-Lyon</organization>

      <address>
        <postal>
          <street/>

          <city>Lyon</city>

          <region/>

          <code/>

          <country>France</country>
        </postal>

        <phone/>

        <facsimile/>

        <email>pierre.francois@insa-lyon.fr</email>

        <uri/>
      </address>
    </author>
    <author fullname="Kent Watsen" initials="K." surname="Watsen">
      <organization>Watsen Networks</organization>
      <address>
        <email>kent+ietf@watsen.net</email>
      </address>
    </author>

    <date day="4" month="July" year="2024"/>

    <abstract>
      <t>This document defines two YANG 1.1 modules to
      support the configuration of UDP clients and UDP servers.</t>
    </abstract>

    <note 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>
    </note>
  </front>

  <middle>
    <section anchor="introduction" title="Introduction">
      <t>This document defines two YANG 1.1 <xref target="RFC7950"/> modules to support
      the configuration of UDP clients and UDP servers <xref target="RFC768"/>, either
      as standalone or in conjunction with configuration of other layers.</t>
    </section>

    <section anchor="udp-client" title='The "ietf-udp-client" Module'>
      <t>The "ietf-udp-client" YANG module defines the "udp-client-grouping"
      grouping for configuring UDP clients with remote server information.</t>

      <section anchor="udp-client-grouping" title='The "udp-client-grouping" Grouping'>
        <t>The following tree diagram <xref target="RFC8340"/> illustrates the tree
        structure of the "udp-client-grouping" grouping:</t>

          <t><figure>
              <artwork><![CDATA[
module: ietf-udp-client

  grouping udp-client-grouping:
    +-- remote-address    inet:host
    +-- remote-port?      inet:port-number
    +-- local-address?    inet:ip-address {local-binding-supported}?
    +-- local-port?       inet:port-number {local-binding-supported}?
          ]]></artwork>
            </figure>
          </t>
      </section>

      <section anchor="example-client" title="Example Usage">
        <t>This section presents an example of usage of the "udp-client-grouping"
        grouping.</t>

        <sourcecode type="xml"><![CDATA[
<!-- The outermost element below doesn't exist in the data model. -->
<!--  It simulates if the "grouping" were a "container" instead.  -->

<udp-client xmlns="urn:ietf:params:xml:ns:yang:ietf-udp-client">
  <remote-address>www.example.com</remote-address>
  <remote-port>10000</remote-port>
  <local-address>192.0.2.2</local-address>
  <local-port>12345</local-port>
</udp-client>
    ]]></sourcecode>
      </section>

      <section anchor="udp-client-ym" title="YANG Module">
        <t>This module imports types defined in <xref target="RFC6991"/>.</t>

          <t><figure>
              <artwork><![CDATA[
<CODE BEGINS> file "ietf-udp-client@2024-06-27.yang"
module ietf-udp-client {
  yang-version 1.1;
  namespace
    "urn:ietf:params:xml:ns:yang:ietf-udp-client";
  prefix udpc;
  import ietf-inet-types {
    prefix inet;
    reference
      "RFC 6991: Common YANG Data Types";
  }

  organization "IETF NETCONF (Network Configuration) Working Group";
  contact
    "WG Web:   <http:/tools.ietf.org/wg/netconf/>
     WG List:  <mailto:netconf@ietf.org>

     Authors:  Alex Huang Feng
               <mailto:alex.huang-feng@insa-lyon.fr>
               Pierre Francois
               <mailto:pierre.francois@insa-lyon.fr>";

  description
    "Defines a generic grouping for UDP-based client applications.

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

    This version of this YANG module is part of RFC-to-be; see the RFC
    itself for full legal notices.";

  revision 2024-06-27 {
    description
      "Initial revision";
    reference
      "RFC-to-be: YANG Groupings for UDP Clients and UDP Servers";
  }

  feature local-binding-supported {
    description
      "Indicates that the UDP client supports configuring local
       bindings (i.e., the local address and local port) for
       UDP clients.";
  }

  grouping udp-client-grouping {
    description
      "A reusable grouping for configuring a UDP client.
      
      Note that this grouping uses fairly typical descendant
      node names such that a stack of 'uses' statements will
      have name conflicts.  It is intended that the consuming
      data model will resolve the issue (e.g., by wrapping
      the 'uses' statement in a container called
      'udp-client-parameters').  This model purposely does
      not do this itself so as to provide maximum flexibility
      to consuming models.";

    leaf remote-address {
      type inet:host;
      mandatory true;
      description
        "The IP address or hostname of the remote UDP server.
        If a domain name is configured, then the DNS resolution should
        happen on each connection attempt. If the DNS resolution
        results in multiple IP addresses, the IP addresses
        are tried according to local preference order until
        a connection has been established or until all IP
        addresses have failed.";
    }

    leaf remote-port {
      type inet:port-number;
      description
        "The port number of the remote UDP server.";
    }

    leaf local-address {
      if-feature "local-binding-supported";
      type inet:ip-address;
      description
        "The local IP address to bind to when sending UDP
        messages to the remote server. INADDR_ANY ('0.0.0.0') or
        INADDR6_ANY ('0:0:0:0:0:0:0:0' a.k.a. '::') may be used
        so that the server can bind to any IPv4 or IPv6 address.";
    }

    leaf local-port {
      if-feature "local-binding-supported";
      type inet:port-number;
      description
        "The local port number to bind to when sending UDP
        messages to the remote server.";
    }
  }
}
<CODE ENDS>]]></artwork>
            </figure>
          </t>
      </section>
    </section>

    <section anchor="udp-server" title='The "ietf-udp-server" Module'>
      <t>The "ietf-udp-server" YANG module defines the "udp-server-grouping" grouping for
      configuring UDP servers.</t>

      <section anchor="udp-server-grouping" title='The "udp-server-grouping" Grouping'>
        <t>The following tree diagram <xref target="RFC8340"/> illustrates the structure of
        "udp-server-grouping" grouping:</t>
        
          <t><figure>
              <artwork><![CDATA[
module: ietf-udp-server

  grouping udp-server-grouping:
    +-- local-bind* [local-address]
       +-- local-address    inet:ip-address
       +-- local-port?      inet:port-number
          ]]></artwork>
            </figure>
        </t>
      </section>

      <section anchor="example-server" title="Example Usage">
        <t>This section presents two examples of usage of the "udp-server-grouping"
        grouping. This example shows an example of a server configured for listening
        to a IPv4 address:</t>

        <sourcecode type="xml"><![CDATA[
<!-- The outermost element below doesn't exist in the data model. -->
<!--  It simulates if the "grouping" were a "container" instead.  -->

<udp-server xmlns="urn:ietf:params:xml:ns:yang:ietf-udp-server">
  <local-bind>
    <local-address>192.0.2.2</local-address>
    <local-port>49152</local-port>
  </local-bind>
</udp-server>
    ]]></sourcecode>

        <t>This example shows an example of a server configured to listen to an IPv4 and
        IPv6 together:</t>

        <sourcecode type="xml"><![CDATA[
<!-- The outermost element below doesn't exist in the data model. -->
<!--  It simulates if the "grouping" were a "container" instead.  -->

<udp-server xmlns="urn:ietf:params:xml:ns:yang:ietf-udp-server">
  <local-bind>
    <local-address>192.0.2.2</local-address>
    <local-port>49152</local-port>
  </local-bind>
  <local-bind>
    <local-address>2001:db8::0</local-address>
    <local-port>49153</local-port>
  </local-bind>
</udp-server>
    ]]></sourcecode>

      </section>

      <section anchor="udp-server-ym" title="YANG Module">
        <t>The "ietf-udp-server" imports types defined in <xref target="RFC6991"/>.</t>

        <t><figure>
          <artwork><![CDATA[
<CODE BEGINS> file "ietf-udp-server@2024-06-27.yang"
module ietf-udp-server {
  yang-version 1.1;
  namespace
    "urn:ietf:params:xml:ns:yang:ietf-udp-server";
  prefix udps;
  import ietf-inet-types {
    prefix inet;
    reference
      "RFC 6991: Common YANG Data Types";
  }

  organization "IETF NETCONF (Network Configuration) Working Group";
  contact
    "WG Web:   <http:/tools.ietf.org/wg/netconf/>
     WG List:  <mailto:netconf@ietf.org>

     Authors:  Alex Huang Feng
               <mailto:alex.huang-feng@insa-lyon.fr>
               Pierre Francois
               <mailto:pierre.francois@insa-lyon.fr>";

  description
    "Defines a generic grouping for UDP-based server applications.

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

    This version of this YANG module is part of RFC-to-be; see the RFC
    itself for full legal notices.";

  revision 2024-06-27 {
    description
      "Initial revision";
    reference
      "RFC-to-be: YANG Groupings for UDP Clients and UDP Servers";
  }

  grouping udp-server-grouping {
    description
      "Provides a reusable grouping for configuring a UDP server.
      
      Note that this grouping uses fairly typical descendant
      node names such that a stack of 'uses' statements will
      have name conflicts.  It is intended that the consuming
      data model will resolve the issue (e.g., by wrapping
      the 'uses' statement in a container called
      'udp-server-parameters').  This model purposely does
      not do this itself so as to provide maximum flexibility
      to consuming models.";

    list local-bind {
      key local-address;
      min-elements 1;
      description 
        "A list of bind (listen) points for this server
        instance.  A server instance may have multiple
        bind points to support, e.g., the same port in
        different address families or different ports
        in the same address family.";

      leaf local-address {
        type inet:ip-address;
        mandatory true;
        description
          "The local IP address to listen on for incoming
          UDP messages.  To configure listening
          on all IPv4 addresses the value must be '0.0.0.0'
          (INADDR_ANY).  To configure listening on all IPv6
          addresses the value must be '::' (INADDR6_ANY).";
      }

      leaf local-port {
        type inet:port-number;
        description
          "The local port number to listen on for incoming UDP
          messages.";
      }
    }
  }
}
<CODE ENDS>]]></artwork>
            </figure>
          </t>
      </section>
    </section>

    <section anchor="security" title="Security Considerations">

      <t>This section uses the template described in Section 3.7 of
      <xref target="I-D.ietf-netmod-rfc8407bis"/>.</t>

      <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 <xref target="RFC6241"/> or RESTCONF <xref target="RFC8040"/>. These network management
        protocols are required to use a secure transport layer and mutual
        authentication, e.g., SSH <xref target="RFC6242"/> without the "none" authentication
        option, Transport Layer Security (TLS) <xref target="RFC8446"/> with mutual X.509
        authentication, and HTTPS with HTTP authentication (Section 11 of
        <xref target="RFC9110"/>).
      </t>

      <t>The Network Configuration Access Control Model (NACM) <xref target="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>

      <t>The YANG module defines a set of identities, types, and
        groupings. These nodes are intended to be reused by other YANG
        modules. The module by itself does not expose any data nodes that
        are writable, data nodes that contain read-only state, or RPCs.
        As such, there are no additional security issues related to
        the YANG module that need to be considered.
      </t>

      <t>Modules that use the groupings that are defined in this document
        should identify the corresponding security considerations. For
        example, reusing some of these groupings will expose privacy-related
        information (e.g., 'node-example').
      </t>
    </section>

    <section anchor="IANA_Considerations" title="IANA Considerations">
      <t>This document describes the URIs from IETF
      XML Registry and the registration of a two new YANG module names</t>
      <section title="URI">
        <t>IANA is requested to assign two new URIs from the <xref
        target="RFC3688">IETF XML Registry</xref>. The following two URIs are
        suggested:</t>

        <t><figure>
            <artwork align="left"><![CDATA[
URI: urn:ietf:params:xml:ns:yang:ietf-udp-client
Registrant Contact: The IESG.
XML: N/A; the requested URI is an XML namespace.]]></artwork>
          </figure></t>

        <t><figure>
            <artwork align="left"><![CDATA[
URI: urn:ietf:params:xml:ns:yang:ietf-udp-server
Registrant Contact: The IESG.
XML: N/A; the requested URI is an XML namespace.]]></artwork>
          </figure></t>
      </section>

      <section title="YANG module name">
        <t>This document also requests IANA to register the following YANG modules in the
        <xref target="RFC6020">YANG Module Names registry</xref> within the "YANG Parameters"
        registry group:</t>

        <t><figure>
            <artwork align="left"><![CDATA[
name: ietf-udp-client
namespace: urn:ietf:params:xml:ns:yang:ietf-udp-client
prefix: udpc
maintained by IANA? N
reference: RFC-to-be]]></artwork>
          </figure></t>

        <t><figure>
            <artwork align="left"><![CDATA[
name: ietf-udp-server
namespace: urn:ietf:params:xml:ns:yang:ietf-udp-server
prefix: udps
maintained by IANA? N
reference: RFC-to-be]]></artwork>
          </figure></t>
      </section>
    </section>

    <section anchor="acknowledgements" title="Acknowledgements">
      <t>The authors would like to thank Mohamed Boucadair, Benoit Claise, Qiufang Ma
      and Qin Wu for their review and valuable comments.</t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      <?rfc include="https://xml.resource.org/public/rfc/bibxml/reference.RFC.768.xml"?>
      <?rfc include="https://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml"?>
      <?rfc include="https://xml.resource.org/public/rfc/bibxml/reference.RFC.3688.xml"?>
      <?rfc include="https://xml.resource.org/public/rfc/bibxml/reference.RFC.6020.xml"?>
      <?rfc include="https://xml.resource.org/public/rfc/bibxml/reference.RFC.6241.xml"?>
      <?rfc include="https://xml.resource.org/public/rfc/bibxml/reference.RFC.6242.xml"?>
      <?rfc include="https://xml.resource.org/public/rfc/bibxml/reference.RFC.6991.xml"?>
      <?rfc include="https://xml.resource.org/public/rfc/bibxml/reference.RFC.7950.xml"?>
      <?rfc include="https://xml.resource.org/public/rfc/bibxml/reference.RFC.8341.xml"?>
      <?rfc include="https://xml.resource.org/public/rfc/bibxml/reference.RFC.8174.xml"?>
      <?rfc include="https://xml.resource.org/public/rfc/bibxml/reference.RFC.8040.xml"?>
      <?rfc include="https://xml.resource.org/public/rfc/bibxml/reference.RFC.8340.xml"?>
      <?rfc include="https://xml.resource.org/public/rfc/bibxml/reference.RFC.8446.xml"?>
      <?rfc include="https://xml.resource.org/public/rfc/bibxml/reference.RFC.9110.xml"?>
    </references>

    <references title="Informative References">
      <?rfc include="https://bib.ietf.org/public/rfc/bibxml-ids/reference.I-D.ietf-netmod-rfc8407bis.xml"?>
    </references>
  </back>
</rfc>
