From: Robert Varga Date: Tue, 15 Oct 2024 10:29:33 +0000 (+0200) Subject: Convert transport-tls to a JPMS module X-Git-Tag: v8.0.3~41 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F86%2F113986%2F1;p=netconf.git Convert transport-tls to a JPMS module Now that we do not have generated code here, we can switch to being a JPMS module, properly encapsulating our internals. Change-Id: Ib8c06203408f53b40db996b868329ae928dd1745 Signed-off-by: Robert Varga --- diff --git a/transport/transport-tls/pom.xml b/transport/transport-tls/pom.xml index 533ca039d0..c7a087a5c8 100644 --- a/transport/transport-tls/pom.xml +++ b/transport/transport-tls/pom.xml @@ -12,20 +12,16 @@ org.opendaylight.netconf - netconf-parent + bnd-parent 8.0.3-SNAPSHOT - ../../parent + ../../bnd-parent transport-tls ${project.artifactId} - bundle + jar NETCONF TLS transport - - true - - com.google.guava @@ -107,6 +103,12 @@ org.opendaylight.yangtools binding-spec + + org.opendaylight.yangtools + yang-common + + provided + @@ -120,11 +122,6 @@ linux-x86_64 test - - org.opendaylight.yangtools - yang-common - test - org.opendaylight.mdsal.binding.model.ietf rfc6991-ietf-inet-types diff --git a/transport/transport-tls/src/main/java/module-info.java b/transport/transport-tls/src/main/java/module-info.java new file mode 100644 index 0000000000..5e85599ec1 --- /dev/null +++ b/transport/transport-tls/src/main/java/module-info.java @@ -0,0 +1,39 @@ +/* + * 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 + */ +module org.opendaylight.netconf.transport.tls { + exports org.opendaylight.netconf.transport.tls; + + provides org.opendaylight.yangtools.binding.meta.YangFeatureProvider with + org.opendaylight.netconf.transport.tls.impl.IetfTlsClientFeatureProvider, + org.opendaylight.netconf.transport.tls.impl.IetfTlsCommonFeatureProvider, + org.opendaylight.netconf.transport.tls.impl.IetfTlsServerFeatureProvider; + + requires transitive io.netty.handler; + requires transitive org.opendaylight.netconf.transport.api; + requires transitive org.opendaylight.yang.gen.ietf.tcp.client.rfc9643; + requires transitive org.opendaylight.yang.gen.ietf.tcp.server.rfc9643; + requires transitive org.opendaylight.yang.gen.ietf.tls.client.rfc9645; + requires transitive org.opendaylight.yang.gen.ietf.tls.server.rfc9645; + requires com.google.common; + requires io.netty.buffer; + requires io.netty.transport; + requires org.bouncycastle.provider; + requires org.opendaylight.netconf.transport.tcp; + requires org.opendaylight.yang.gen.iana.tls.cipher.suite.algs; + requires org.opendaylight.yang.gen.ietf.crypto.types.rfc9640; + requires org.opendaylight.yang.gen.ietf.keystore.rfc9642; + requires org.opendaylight.yang.gen.ietf.tls.common.rfc9645; + requires org.opendaylight.yang.gen.ietf.truststore.rfc9641; + requires org.opendaylight.yangtools.binding.spec; + requires org.slf4j; + + // Annotation-only dependencies + requires static transitive org.eclipse.jdt.annotation; + requires static org.kohsuke.metainf_services; + requires static org.osgi.annotation.bundle; +} diff --git a/transport/transport-tls/src/main/java/org/opendaylight/netconf/transport/tls/KeyStoreUtils.java b/transport/transport-tls/src/main/java/org/opendaylight/netconf/transport/tls/KeyStoreUtils.java index bebfad935b..2b42617478 100644 --- a/transport/transport-tls/src/main/java/org/opendaylight/netconf/transport/tls/KeyStoreUtils.java +++ b/transport/transport-tls/src/main/java/org/opendaylight/netconf/transport/tls/KeyStoreUtils.java @@ -89,8 +89,7 @@ final class KeyStoreUtils { * @throws CertificateException if certificate error occurs * @throws IOException if input read error occurs */ - static Certificate buildX509Certificate(final byte[] bytes) - throws CertificateException, IOException { + static Certificate buildX509Certificate(final byte[] bytes) throws CertificateException, IOException { try (var in = new ByteArrayInputStream(bytes)) { return CertificateFactory.getInstance("X.509").generateCertificate(in); } diff --git a/transport/transport-tls/src/main/java/org/opendaylight/netconf/transport/tls/SslHandlerFactory.java b/transport/transport-tls/src/main/java/org/opendaylight/netconf/transport/tls/SslHandlerFactory.java index 419302cc06..501c57e443 100644 --- a/transport/transport-tls/src/main/java/org/opendaylight/netconf/transport/tls/SslHandlerFactory.java +++ b/transport/transport-tls/src/main/java/org/opendaylight/netconf/transport/tls/SslHandlerFactory.java @@ -32,6 +32,7 @@ import javax.net.ssl.TrustManagerFactory; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; import org.opendaylight.netconf.transport.api.UnsupportedConfigurationException; +import org.opendaylight.netconf.transport.tls.impl.IetfTlsCommonFeatureProvider; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana.tls.cipher.suite.algs.rev240316.TlsCipherSuiteAlgorithm; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.keystore.rev241010.InlineOrKeystoreAsymmetricKeyGrouping; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.keystore.rev241010.InlineOrKeystoreEndEntityCertWithKeyGrouping; diff --git a/transport/transport-tls/src/main/java/org/opendaylight/netconf/transport/tls/IetfTlsClientFeatureProvider.java b/transport/transport-tls/src/main/java/org/opendaylight/netconf/transport/tls/impl/IetfTlsClientFeatureProvider.java similarity index 96% rename from transport/transport-tls/src/main/java/org/opendaylight/netconf/transport/tls/IetfTlsClientFeatureProvider.java rename to transport/transport-tls/src/main/java/org/opendaylight/netconf/transport/tls/impl/IetfTlsClientFeatureProvider.java index 0d7d46ab2b..f31a1b0962 100644 --- a/transport/transport-tls/src/main/java/org/opendaylight/netconf/transport/tls/IetfTlsClientFeatureProvider.java +++ b/transport/transport-tls/src/main/java/org/opendaylight/netconf/transport/tls/impl/IetfTlsClientFeatureProvider.java @@ -5,7 +5,7 @@ * 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.tls; +package org.opendaylight.netconf.transport.tls.impl; import java.util.Set; import org.eclipse.jdt.annotation.NonNullByDefault; diff --git a/transport/transport-tls/src/main/java/org/opendaylight/netconf/transport/tls/IetfTlsCommonFeatureProvider.java b/transport/transport-tls/src/main/java/org/opendaylight/netconf/transport/tls/impl/IetfTlsCommonFeatureProvider.java similarity index 93% rename from transport/transport-tls/src/main/java/org/opendaylight/netconf/transport/tls/IetfTlsCommonFeatureProvider.java rename to transport/transport-tls/src/main/java/org/opendaylight/netconf/transport/tls/impl/IetfTlsCommonFeatureProvider.java index 434836d3a6..0a2c4e305a 100644 --- a/transport/transport-tls/src/main/java/org/opendaylight/netconf/transport/tls/IetfTlsCommonFeatureProvider.java +++ b/transport/transport-tls/src/main/java/org/opendaylight/netconf/transport/tls/impl/IetfTlsCommonFeatureProvider.java @@ -5,7 +5,7 @@ * 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.tls; +package org.opendaylight.netconf.transport.tls.impl; import java.util.Map; import java.util.Set; @@ -42,7 +42,7 @@ public final class IetfTlsCommonFeatureProvider implements YangFeatureProviderRFC7589. - * Configuration follows - * draft-ietf-netconf-tls-client-server. + * Configuration follows RFC9645. */ +@org.osgi.annotation.bundle.Export package org.opendaylight.netconf.transport.tls; \ No newline at end of file