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.apps.blueprintsprocessor.functions.netconf.executor
18 import org.junit.After
19 import org.junit.Assert
20 import org.junit.Before
22 import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.core.NetconfSessionImpl
23 import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.interfaces.DeviceInfo
24 import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.utils.NetconfDeviceSimulator
27 class NetconfSessionImplTest {
29 private var device: NetconfDeviceSimulator? = null
30 private var deviceInfo: DeviceInfo? = null
34 deviceInfo =DeviceInfo("name", "password", "localhost", 2224, "10")
36 device = NetconfDeviceSimulator(deviceInfo!!.port)
45 @Throws(Exception::class)
46 fun testNetconfSession() {
47 val netconfSession = NetconfSessionImpl(deviceInfo!!)
49 Assert.assertNotNull(netconfSession.getSessionId())
50 Assert.assertEquals("localhost:2224", netconfSession.getDeviceInfo().toString())
52 netconfSession.checkAndReestablish()
54 Assert.assertNotNull(netconfSession.getSessionId())
55 Assert.assertEquals("localhost:2224", netconfSession.getDeviceInfo().toString())
57 Assert.assertTrue(!netconfSession.getDeviceCapabilitiesSet().isEmpty())