import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.nio.channels.AsynchronousChannelGroup;
-import java.nio.file.Files;
-import java.nio.file.Path;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import org.apache.sshd.common.keyprovider.KeyPairProvider;
-import org.apache.sshd.common.util.security.SecurityUtils;
import org.apache.sshd.common.util.threads.ThreadUtils;
import org.opendaylight.netconf.api.capability.BasicCapability;
import org.opendaylight.netconf.api.capability.Capability;
import org.opendaylight.netconf.api.monitoring.NetconfMonitoringService;
import org.opendaylight.netconf.impl.NetconfServerDispatcherImpl;
import org.opendaylight.netconf.impl.NetconfServerSessionNegotiatorFactory;
+import org.opendaylight.netconf.impl.ServerChannelInitializer;
import org.opendaylight.netconf.impl.SessionIdProvider;
import org.opendaylight.netconf.impl.osgi.AggregatedNetconfOperationServiceFactory;
import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.model.repo.api.RevisionSourceIdentifier;
-import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceFilter;
import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceRepresentation;
import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
configuration.getGenerateConfigsTimeout(),
monitoringService1, serverCapabilities);
- final NetconfServerDispatcherImpl.ServerChannelInitializer serverChannelInitializer =
- new NetconfServerDispatcherImpl.ServerChannelInitializer(serverNegotiatorFactory);
+ final ServerChannelInitializer serverChannelInitializer =
+ new ServerChannelInitializer(serverNegotiatorFactory);
return new NetconfServerDispatcherImpl(serverChannelInitializer, nettyThreadgroup, nettyThreadgroup);
}
final List<Integer> openDevices = Lists.newArrayList();
// Generate key to temp folder
- final KeyPairProvider keyPairProvider = getPemGeneratorHostKeyProvider();
+ final KeyPairProvider keyPairProvider = new VirtualKeyPairProvider();
final AsynchronousChannelGroup group;
try {
.createSshProxyServerConfiguration();
}
- private static KeyPairProvider getPemGeneratorHostKeyProvider() {
- try {
- final Path tempFile = Files.createTempFile("tempKeyNetconfTest", "suffix");
- return SecurityUtils.createGeneratorHostKeyProvider(tempFile.toAbsolutePath());
- } catch (final IOException e) {
- LOG.error("Unable to generate PEM key", e);
- throw new RuntimeException(e);
- }
- }
-
private Set<Capability> parseSchemasToModuleCapabilities(final SharedSchemaRepository consumer) {
final Set<SourceIdentifier> loadedSources = Sets.newHashSet();
consumer.registerSchemaSourceListener(TextToASTTransformer.create(consumer, consumer));
try {
//necessary for creating mdsal data stores and operations
- this.schemaContext = consumer.createSchemaContextFactory(SchemaSourceFilter.ALWAYS_ACCEPT)
- .createSchemaContext(loadedSources).get();
+ this.schemaContext = consumer.createEffectiveModelContextFactory()
+ .createEffectiveModelContext(loadedSources).get();
} catch (final InterruptedException | ExecutionException e) {
throw new RuntimeException("Cannot parse schema context", e);
}