http://www.eclipse.org/legal/epl-v10.html";
revision 2023-01-12 {
- description "Updated timer definitions to uint8 and split them off
- into pcep-session-timers grouping";
+ description
+ "Updated timer definitions to uint8 and split them off into
+ pcep-session-timers grouping.
+
+ Introduced pcep-session-tls to hold TLS-related configuration.";
}
revision 2022-03-28 {
}
}
+ grouping pcep-session-tls {
+ typedef path-type {
+ type enumeration {
+ enum PATH;
+ enum CLASSPATH;
+ }
+ }
+
+ typedef store-type {
+ type enumeration {
+ enum JKS;
+ enum PKCS12;
+ }
+ }
+
+ leaf keystore {
+ description "keystore location";
+ type string;
+ mandatory true;
+ }
+ leaf keystore-type {
+ description "keystore type (JKS or PKCS12)";
+ type store-type;
+ mandatory true;
+ }
+ leaf keystore-path-type {
+ description "keystore path type (CLASSPATH or PATH)";
+ type path-type;
+ mandatory true;
+ }
+ leaf keystore-password {
+ description "password protecting keystore";
+ type string;
+ mandatory true;
+ }
+ leaf certificate-password {
+ description "password protecting certificate";
+ type string;
+ mandatory true;
+ }
+ leaf truststore {
+ description "truststore location";
+ type string;
+ mandatory true;
+ }
+ leaf truststore-type {
+ description "truststore type (JKS or PKCS12)";
+ type store-type;
+ mandatory true;
+ }
+ leaf truststore-path-type {
+ description "truststore path type (CLASSPATH or PATH)";
+ type path-type;
+ mandatory true;
+ }
+ leaf truststore-password {
+ description "password protecting truststore";
+ type string;
+ mandatory true;
+ }
+ }
+
grouping pcep-config {
container session-config {
description "PCEP topology config";
}
uses pcep-session-timers;
+
+ container tls {
+ presence "Indicates TLS-enabled (PCEPS) operation";
+ uses pcep-session-tls;
+ }
}
}
import org.opendaylight.protocol.pcep.impl.spi.Util;
import org.opendaylight.protocol.pcep.impl.tls.SslContextFactory;
import org.opendaylight.protocol.pcep.spi.PCEPErrors;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.app.config.rev160707.pcep.dispatcher.config.Tls;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.config.rev230112.PcepSessionTls;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.Keepalive;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.KeepaliveBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.OpenBuilder;
private static final Keepalive KEEPALIVE =
new KeepaliveBuilder().setKeepaliveMessage(new KeepaliveMessageBuilder().build()).build();
- private final Tls tlsConfiguration;
+ private final PcepSessionTls tlsConfiguration;
private volatile boolean localOK;
private volatile boolean openRetry;
private Open remotePrefs;
protected AbstractPCEPSessionNegotiator(final Promise<PCEPSessionImpl> promise, final Channel channel,
- final Tls tlsConfiguration) {
+ final PcepSessionTls tlsConfiguration) {
super(promise, channel);
this.tlsConfiguration = tlsConfiguration;
}
import io.netty.channel.Channel;
import io.netty.util.concurrent.Promise;
import org.opendaylight.protocol.pcep.PCEPSessionListener;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.app.config.rev160707.pcep.dispatcher.config.Tls;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.config.rev230112.PcepSessionTls;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.Open;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.OpenBuilder;
import org.opendaylight.yangtools.yang.common.Uint8;
public DefaultPCEPSessionNegotiator(final Promise<PCEPSessionImpl> promise, final Channel channel,
final PCEPSessionListener listener, final Uint8 sessionId, final int maxUnknownMessages,
- final Open localPrefs, final Tls tlsConfiguration) {
+ final Open localPrefs, final PcepSessionTls tlsConfiguration) {
super(promise, channel, tlsConfiguration);
this.listener = requireNonNull(listener);
this.maxUnknownMessages = maxUnknownMessages;
import org.opendaylight.protocol.pcep.PCEPSessionNegotiatorFactoryDependencies;
import org.opendaylight.protocol.pcep.PCEPSessionProposalFactory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.app.config.rev160707.PcepDispatcherConfig;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.app.config.rev160707.pcep.dispatcher.config.Tls;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.config.rev230112.PcepSessionTls;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.Open;
import org.opendaylight.yangtools.yang.common.Uint8;
public final class DefaultPCEPSessionNegotiatorFactory extends AbstractPCEPSessionNegotiatorFactory {
private final PCEPSessionProposalFactory spf;
private final int maxUnknownMessages;
- private final Tls tlsConfiguration;
+ private final PcepSessionTls tlsConfiguration;
public DefaultPCEPSessionNegotiatorFactory(final PCEPSessionProposalFactory spf, final int maxUnknownMessages) {
this(spf, maxUnknownMessages, null);
}
private DefaultPCEPSessionNegotiatorFactory(final PCEPSessionProposalFactory spf, final int maxUnknownMessages,
- final Tls tlsConfiguration) {
+ final PcepSessionTls tlsConfiguration) {
this.spf = requireNonNull(spf);
this.maxUnknownMessages = maxUnknownMessages;
this.tlsConfiguration = tlsConfiguration;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManagerFactory;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.app.config.rev160707.pcep.dispatcher.config.Tls;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.config.rev230112.PcepSessionTls;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static final Logger LOG = LoggerFactory.getLogger(SslContextFactory.class);
private static final String PROTOCOL = "TLS";
- private final Tls tlsConfig;
+ private final PcepSessionTls tlsConfig;
/**
* SslContextFactory provides information about the TLS context and configuration.
* @param tlsConfig
* TLS configuration object, contains keystore locations and keystore types
*/
- public SslContextFactory(final Tls tlsConfig) {
+ public SslContextFactory(final PcepSessionTls tlsConfig) {
this.tlsConfig = requireNonNull(tlsConfig);
}
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.app.config.rev160707.PathType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.config.rev230112.pcep.session.tls.PathType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import pcep-config { prefix pc; }
container pcep-session-config {
- // FIXME: remove this container
+ // FIXME: BGPCEP-962: remove this container
uses pc:pcep-session-timers;
}
- typedef path-type {
- type enumeration {
- enum "PATH";
- enum "CLASSPATH";
- }
- }
-
- typedef store-type {
- type enumeration {
- enum "JKS";
- enum "PKCS12";
- }
- }
-
container pcep-dispatcher-config {
+ // FIXME: BGPCEP-962: remove this container
+
leaf max-unknown-messages {
type uint16 {
range "1..max";
container tls {
presence true;
- leaf keystore {
- description "keystore location";
- type string;
- mandatory true;
- }
- leaf keystore-type {
- description "keystore type (JKS or PKCS12)";
- type store-type;
- mandatory true;
- }
- leaf keystore-path-type {
- description "keystore path type (CLASSPATH or PATH)";
- type path-type;
- mandatory true;
- }
- leaf keystore-password {
- description "password protecting keystore";
- type string;
- mandatory true;
- }
- leaf certificate-password {
- description "password protecting certificate";
- type string;
- mandatory true;
- }
- leaf truststore {
- description "truststore location";
- type string;
- mandatory true;
- }
- leaf truststore-type {
- description "truststore type (JKS or PKCS12)";
- type store-type;
- mandatory true;
- }
- leaf truststore-path-type {
- description "truststore path type (CLASSPATH or PATH)";
- type path-type;
- mandatory true;
- }
- leaf truststore-password {
- description "password protecting truststore";
- type string;
- mandatory true;
- }
+ uses pc:pcep-session-tls;
}
}
}
import org.opendaylight.protocol.pcep.PCEPTerminationReason;
import org.opendaylight.protocol.pcep.impl.spi.Util;
import org.opendaylight.protocol.pcep.spi.PCEPErrors;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.app.config.rev160707.pcep.dispatcher.config.TlsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.config.rev230112.pcep.config.session.config.TlsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.Keepalive;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.Open;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.Pcerr;
* 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.protocol.pcep.impl;
import static org.junit.Assert.assertNotNull;
import javax.net.ssl.SSLContext;
import org.junit.Test;
import org.opendaylight.protocol.pcep.impl.tls.SslContextFactory;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.app.config.rev160707.PathType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.app.config.rev160707.StoreType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.app.config.rev160707.pcep.dispatcher.config.Tls;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.app.config.rev160707.pcep.dispatcher.config.TlsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.config.rev230112.PcepSessionTls;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.config.rev230112.pcep.config.session.config.TlsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.config.rev230112.pcep.session.tls.PathType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.config.rev230112.pcep.session.tls.StoreType;
public class SslContextFactoryTest {
assertNotNull(sslContext);
}
- public static Tls createTlsConfig() {
- return new TlsBuilder().setCertificatePassword("opendaylight").setKeystore("/exemplary-ctlKeystore")
- .setKeystorePassword("opendaylight").setKeystorePathType(PathType.CLASSPATH)
- .setKeystoreType(StoreType.JKS).setTruststore("/exemplary-ctlTrustStore")
- .setTruststorePassword("opendaylight").setTruststorePathType(PathType.CLASSPATH)
- .setTruststoreType(StoreType.JKS).build();
+ public static PcepSessionTls createTlsConfig() {
+ return new TlsBuilder()
+ .setCertificatePassword("opendaylight")
+ .setKeystore("/exemplary-ctlKeystore")
+ .setKeystorePassword("opendaylight")
+ .setKeystorePathType(PathType.CLASSPATH)
+ .setKeystoreType(StoreType.JKS)
+ .setTruststore("/exemplary-ctlTrustStore")
+ .setTruststorePassword("opendaylight")
+ .setTruststorePathType(PathType.CLASSPATH)
+ .setTruststoreType(StoreType.JKS)
+ .build();
}
}