<?xml version="1.0" encoding="UTF-8"?>
<!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-08"
     ipr="trust200902" submissionType="IETF" consensus="true"
     xmlns:xi="http://www.w3.org/2001/XInclude">
  <front>
    <title abbrev="Groupings for UDP Clients and Servers">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="10" month="October" year="2025"/>

    <abstract>
      <t>This document defines two YANG 1.1 modules with reusable
      groupings for managing UDP clients and UDP servers.</t>
    </abstract>
  </front>

  <middle>
    <section anchor="introduction" title="Introduction">
      <t>This document defines two YANG 1.1 <xref target="RFC7950"/> modules with reusable groupings
      for managing UDP clients and UDP servers <xref target="RFC768"/>.
      These modules may be used directly (e.g., define
      a specific UDP client or UDP server) or in conjunction with the configuration defined
      for higher level protocols that depend on UDP.</t>

      <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 title="Adherence to the NMDA">
        <t>This document is compliant with the Network Management Datastore
        Architecture (NMDA) <xref target="RFC8342"/>. It does not define
        any protocol accessible nodes that are "config false".</t>
      </section>

      <section title="Conventions">
        <t>Various examples in this document use the XML <xref target="W3C.REC-xml-20081126"/>
        encoding. Other encodings, such as JSON <xref target="RFC8259"/>, could alternatively be used.</t>
      </section>
    </section>

    <section anchor="udp-client" title='The "ietf-udp-client" Module'>
      <t>This section defines a YANG 1.1 module called "ietf-udp-client".
      This YANG module defines the "udp-client"
      grouping for providing UDP clients with remote server information.</t>
      
      <t><xref target="udp-client-overview"/> provides the overview of the
      YANG module. An example of usage is illustrated
      in <xref target="example-client"/>, while <xref target="udp-client-ym"/> defines the
      YANG module itself.</t>

      <section anchor="udp-client-overview" title='Data Model Overview'>
        <t>This section provides an overview of the features and the grouping defined in the
        "ietf-udp-client" YANG module.
        </t>
        <section title="Features">
          <t>The "ietf-udp-client" module defines the following "feature" statement:</t>
          <sourcecode type="yangtree"><![CDATA[
Features:
  +-- local-binding
]]></sourcecode>
          <t>This feature indicates that the client supports
            configuring local bindings (i.e., the local address and local port number) for UDP clients.</t>
          
          <t>The diagram above uses syntax that is similar to but not defined in
          <xref target="RFC8340"/>.</t>
        </section>
        <section anchor="udp-client-grouping" title='The "udp-client" Grouping'>
          <t>The following tree diagram <xref target="RFC8340"/> illustrates the tree
          structure of the "udp-client" grouping:</t>

          <sourcecode type="yangtree"><![CDATA[
module: ietf-udp-client

  grouping udp-client:
    +-- remote-address    inet:host
    +-- remote-port?      inet:port-number
    +-- local-address?    inet:ip-address {local-binding}?
    +-- local-port?       inet:port-number {local-binding}?
]]></sourcecode>

          <t>The description of these parameters is provided below:</t>
          <ul>
            <li>The "remote-address", which is mandatory, may be configured as
              an IPv4 address, an IPv6 address, or a hostname. The resolved address should be
              compatible with the local address family, if also provided.</li>
            <li>The "remote-port" is defined with neither a "default"
              nor a "mandatory" statement.  YANG modules using this grouping
              SHOULD refine the grouping with a "default" statement,
              when the port number is well-known (e.g., a port number allocated by IANA),
              or with a "mandatory" statement, if a port number needs to always be configured.
              This MAY be ignored when the port number is neither
              well-known nor mandatory to configure, such as might be the case when this grouping
              is used by another grouping.</li>
            <li>The "local-address", which is enabled by the "local-binding"
              feature, may be configured as
              an IPv4 address, an IPv6 address, or a wildcard value.
              The local address must use the same address family as the configured remote address.</li>
            <li>The "local-port", which depends on the "local-binding"
              feature, is not mandatory. Its default
              value is "0", indicating that the operating system can select an
              arbitrary port number.</li>
          </ul>
        </section>
      </section>

      <section anchor="example-client" title="Example Usage">
        <t>This section presents an example of usage of the "udp-client"
        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>

        <sourcecode name="ietf-udp-client@2025-06-10.yang" type="yang" markers="true"><![CDATA[
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) 2025 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 2025-06-10 {
    description
      "Initial revision";
    reference
      "RFC-to-be: YANG Groupings for UDP Clients and UDP Servers";
  }

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

  grouping udp-client {
    description
      "A reusable grouping for UDP clients.
      
      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 name resolution
        should happen before each datagram is sent, unless a
        previously resolved address is cached and still valid.";
    }

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

    leaf local-address {
      if-feature "local-binding";
      type inet:ip-address;
      description
        "The local IP address to bind to when sending UDP
        datagrams 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 client can bind to any IPv4 or IPv6 address.";
    }

    leaf local-port {
      if-feature "local-binding";
      type inet:port-number;
      default "0";
      description
        "The local port number to bind to when sending UDP
        datagrams to the remote server. The port number '0',
        which is the default value, indicates that any available
        local port number may be used.";
    }
  }
}
]]></sourcecode>
      </section>
    </section>

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

      <t><xref target="udp-server-overview"/> provides an overview of the YANG module
      for configuring UDP servers. An example of usage is illustrated in
      <xref target="example-server"/> while <xref target="udp-server-ym"/> defines the YANG
      module itself.</t>

      <section anchor="udp-server-overview" title='Data Model Overview'>
        <t>This section provides an overview of the grouping defined in the 
        "ietf-udp-server" module.</t>
      
      
        <section anchor="udp-server-grouping" title='The "udp-server" Grouping'>
          <t>The following tree diagram <xref target="RFC8340"/> illustrates the structure of
          "udp-server" grouping:</t>

          <sourcecode type="yangtree"><![CDATA[
module: ietf-udp-server

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

          <t>The description of these parameters is provided below:</t>
          <ul>
            <li>The "local-address", which is mandatory, may be configured as
              an IPv4 address, an IPv6 address, or a wildcard value.</li>
            <li>The "local-port" is defined with neither a "default" nor a
              "mandatory" statement. YANG modules using this grouping SHOULD refine the 
              grouping with a "default" statement, when the port number is well-known
              (e.g., a port number allocated by IANA), or with a "mandatory" statement,
              if a port number needs to always be configured. This MAY be ignored
              when the port number is neither well-known nor mandatory to configure, such
              as might be the case when this grouping is used by another grouping.</li>
          </ul>
        </section>
      </section>

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

        <t>This following shows an example of a server configured for listening
        to an 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 following 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>

        <sourcecode name="ietf-udp-server@2025-06-10.yang" type="yang" markers="true"><![CDATA[
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) 2025 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 2025-06-10 {
    description
      "Initial revision";
    reference
      "RFC-to-be: YANG Groupings for UDP Clients and UDP Servers";
  }

  grouping udp-server {
    description
      "Provides a reusable grouping for configuring UDP servers.

       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 number in
         different address families or different port numbers
         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 datagrams.  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
           datagrams.";
      }
    }
  }
}
]]></sourcecode>
      </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 "ietf-udp-client" and "ietf-udp-server" YANG modules defines a data model that is
      designed to be accessed via YANG-based management protocols, such as
      NETCONF <xref target="RFC6241"/> and RESTCONF <xref target="RFC8040"/>. These protocols have to
      use a secure transport layer (e.g., SSH <xref target="RFC6242"/>, TLS <xref target="RFC8446"/>, and
      QUIC <xref target="RFC9000"/>) and have to use mutual authentication.
      </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 modules define 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., 'remote-address', 'remote-port', 'local-address'
        or 'local-port').
      </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>:</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, Ran Chen, Benoit Claise, Qiufang Ma, Jürgen Schönwälder
      and Qin Wu for their review and valuable comments.</t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      <xi:include href="https://xml.resource.org/public/rfc/bibxml/reference.RFC.768.xml"/>
      <xi:include href="https://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
      <xi:include href="https://xml.resource.org/public/rfc/bibxml/reference.RFC.3688.xml"/>
      <xi:include href="https://xml.resource.org/public/rfc/bibxml/reference.RFC.6020.xml"/>
      <xi:include href="https://xml.resource.org/public/rfc/bibxml/reference.RFC.6991.xml"/>
      <xi:include href="https://xml.resource.org/public/rfc/bibxml/reference.RFC.7950.xml"/>
      <xi:include href="https://xml.resource.org/public/rfc/bibxml/reference.RFC.8341.xml"/>
      <xi:include href="https://xml.resource.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
      <xi:include href="https://xml.resource.org/public/rfc/bibxml/reference.RFC.8340.xml"/>
    </references>

    <references title="Informative References">
      <xi:include href="https://bib.ietf.org/public/rfc/bibxml-ids/reference.I-D.ietf-netmod-rfc8407bis.xml"/>
      <xi:include href="https://xml.resource.org/public/rfc/bibxml/reference.RFC.6241.xml"/>
      <xi:include href="https://xml.resource.org/public/rfc/bibxml/reference.RFC.6242.xml"/>
      <xi:include href="https://xml.resource.org/public/rfc/bibxml/reference.RFC.8040.xml"/>
      <xi:include href="https://xml.resource.org/public/rfc/bibxml/reference.RFC.8259.xml"/>
      <xi:include href="https://xml.resource.org/public/rfc/bibxml/reference.RFC.8342.xml"/>
      <xi:include href="https://xml.resource.org/public/rfc/bibxml/reference.RFC.8446.xml"/>
      <xi:include href="https://xml.resource.org/public/rfc/bibxml/reference.RFC.9000.xml"/>

      <reference anchor="W3C.REC-xml-20081126" target="https://www.w3.org/TR/2008/REC-xml-20081126/" quoteTitle="true" derivedAnchor="W3C.REC-xml-20081126">
          <front>
            <title>Extensible Markup Language (XML) 1.0 (Fifth Edition)</title>
            <author initials="T." surname="Bray" fullname="Tim Bray"/>
            <author initials="J." surname="Paoli" fullname="Jean Paoli"/>
            <author initials="C.M." surname="Sperberg-McQueen" fullname="C. M. Sperberg-McQueen"/>
            <author initials="E." surname="Maler" fullname="Eve Maler"/>
            <author initials="F." surname="Yergeau" fullname="François Yergeau"/>
            <date month="November" year="2008"/>
          </front>
          <seriesInfo name="World Wide Web Consortium Recommendation" value="REC-xml-20081126"/>
        </reference>
    </references>
  </back>
</rfc>
