Adopt draft-ietf-netconf-udp-client-server-04 90/113990/3
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 15 Oct 2024 10:53:32 +0000 (12:53 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 15 Oct 2024 11:44:12 +0000 (13:44 +0200)
Import ietf-udp-{client,server}.yang as found in the latest version of
draft-ietf-netconf-udp-client-server -- in transport-udp.

Change-Id: Id483a3f195346ebea51530be35cd6cb0d4c321e9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
artifacts/pom.xml
transport/pom.xml
transport/transport-udp/pom.xml [new file with mode: 0644]
transport/transport-udp/src/main/java/org/opendaylight/netconf/transport/udp/IetfUdpClientFeatureProvider.java [new file with mode: 0644]
transport/transport-udp/src/main/yang/ietf-udp-client@2024-10-04.yang [new file with mode: 0644]
transport/transport-udp/src/main/yang/ietf-udp-server@2024-10-04.yang [new file with mode: 0644]

index 84f6418e235cd4495ff9b386c0e83f249509ba1b..70eac0e2f3718340f13399bf79ed731a26aa8c8d 100644 (file)
                 <artifactId>transport-tls</artifactId>
                 <version>${project.version}</version>
             </dependency>
+            <dependency>
+                <groupId>org.opendaylight.netconf</groupId>
+                <artifactId>transport-udp</artifactId>
+                <version>${project.version}</version>
+            </dependency>
 
             <!-- NETCONF Transport features -->
             <dependency>
index 0f8876dff2fb7c3b2c1f4bd7a8c8b6c0d967dc8b..c8bdeddd6b5aecea68a4bd7c529cea2e214c2a3d 100644 (file)
@@ -34,5 +34,6 @@
         <module>transport-ssh</module>
         <module>transport-tcp</module>
         <module>transport-tls</module>
+        <module>transport-udp</module>
     </modules>
 </project>
diff --git a/transport/transport-udp/pom.xml b/transport/transport-udp/pom.xml
new file mode 100644 (file)
index 0000000..bc5b6fd
--- /dev/null
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+ Copyright (c) 2024 PANTHEON.tech, s.r.o. and others.  All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.opendaylight.netconf</groupId>
+        <artifactId>netconf-parent</artifactId>
+        <version>8.0.3-SNAPSHOT</version>
+        <relativePath>../../parent</relativePath>
+    </parent>
+
+    <artifactId>transport-udp</artifactId>
+    <name>${project.artifactId}</name>
+    <packaging>bundle</packaging>
+    <description>NETCONF UDP transport</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.netty</groupId>
+            <artifactId>netty-common</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.netty</groupId>
+            <artifactId>netty-transport</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.netty</groupId>
+            <artifactId>netty-transport-classes-epoll</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jdt</groupId>
+            <artifactId>org.eclipse.jdt.annotation</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.kohsuke.metainf-services</groupId>
+            <artifactId>metainf-services</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>binding-spec</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-common</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.mdsal.binding.model.ietf</groupId>
+            <artifactId>rfc6991-ietf-inet-types</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.netconf</groupId>
+            <artifactId>transport-api</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>mockito-configuration</artifactId>
+        </dependency>
+    </dependencies>
+</project>
diff --git a/transport/transport-udp/src/main/java/org/opendaylight/netconf/transport/udp/IetfUdpClientFeatureProvider.java b/transport/transport-udp/src/main/java/org/opendaylight/netconf/transport/udp/IetfUdpClientFeatureProvider.java
new file mode 100644 (file)
index 0000000..456cdc7
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2022 PANTHEON.tech, s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.netconf.transport.udp;
+
+import java.util.Set;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.kohsuke.MetaInfServices;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.udp.client.rev241004.IetfUdpClientData;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.udp.client.rev241004.LocalBindingSupported;
+import org.opendaylight.yangtools.binding.YangFeature;
+import org.opendaylight.yangtools.binding.meta.YangFeatureProvider;
+
+/**
+ * Baseline features supported from {@code ietf-udp-client.yang}.
+ */
+@MetaInfServices
+@NonNullByDefault
+public final class IetfUdpClientFeatureProvider implements YangFeatureProvider<IetfUdpClientData> {
+    @Override
+    public Class<IetfUdpClientData> boundModule() {
+        return IetfUdpClientData.class;
+    }
+
+    @Override
+    public Set<? extends YangFeature<?, IetfUdpClientData>> supportedFeatures() {
+        return Set.of(LocalBindingSupported.VALUE);
+    }
+}
diff --git a/transport/transport-udp/src/main/yang/ietf-udp-client@2024-10-04.yang b/transport/transport-udp/src/main/yang/ietf-udp-client@2024-10-04.yang
new file mode 100644 (file)
index 0000000..784da4c
--- /dev/null
@@ -0,0 +1,104 @@
+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-10-04 {
+    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;
+      default "0";
+      description
+        "The local port number to bind to when sending UDP
+        messages to the remote server. The port number '0',
+        which is the default value, indicates that any available
+        local port number may be used.";
+    }
+  }
+}
diff --git a/transport/transport-udp/src/main/yang/ietf-udp-server@2024-10-04.yang b/transport/transport-udp/src/main/yang/ietf-udp-server@2024-10-04.yang
new file mode 100644 (file)
index 0000000..1b0e78f
--- /dev/null
@@ -0,0 +1,83 @@
+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-10-04 {
+    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.";
+      }
+    }
+  }
+}