2 * Copyright © 2017-2018 AT&T Intellectual Property.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.mocks
19 import org.apache.sshd.common.NamedFactory
20 import org.apache.sshd.server.command.Command
21 import org.apache.sshd.server.SshServer
22 import org.apache.sshd.server.auth.UserAuth
23 import org.apache.sshd.server.auth.UserAuthNoneFactory
24 import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider
28 class NetconfDeviceSimulator(private val port: Int) {
30 private var sshd: SshServer? = null
33 sshd = SshServer.setUpDefaultServer()
35 sshd!!.keyPairProvider = SimpleGeneratorHostKeyProvider()
37 val userAuthFactories = ArrayList<NamedFactory<UserAuth>>()
38 userAuthFactories.add(UserAuthNoneFactory())
39 sshd!!.userAuthFactories = userAuthFactories
41 val namedFactoryList = ArrayList<NamedFactory<Command>>()
42 namedFactoryList.add(NetconfSubsystemFactory())
43 sshd!!.subsystemFactories = namedFactoryList
47 } catch (e: Exception) {
56 } catch (e: Exception) {