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
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
25 import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.utils.NetconfSubsystemFactory
29 class NetconfDeviceSimulator(private val port: Int) {
31 private var sshd: SshServer? = null
34 sshd = SshServer.setUpDefaultServer()
36 sshd!!.keyPairProvider = SimpleGeneratorHostKeyProvider()
38 val userAuthFactories = ArrayList<NamedFactory<UserAuth>>()
39 userAuthFactories.add(UserAuthNoneFactory())
40 sshd!!.userAuthFactories = userAuthFactories
42 val namedFactoryList = ArrayList<NamedFactory<Command>>()
43 namedFactoryList.add(NetconfSubsystemFactory())
44 sshd!!.subsystemFactories = namedFactoryList
48 } catch (e: Exception) {
57 } catch (e: Exception) {