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
21 import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.api.DeviceInfo
22 import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.core.NetconfRpcServiceImpl
23 import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.core.NetconfSessionImpl
24 import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.mocks.NetconfDeviceSimulator
26 class NetconfSessionImplTest {
28 private var device: NetconfDeviceSimulator? = null
29 private var deviceInfo: DeviceInfo? = null
33 deviceInfo = DeviceInfo().apply {
36 ipAddress = "localhost"
41 device = NetconfDeviceSimulator(deviceInfo!!.port)
50 @Throws(Exception::class)
51 fun testNetconfSession() {
52 val netconfSession = NetconfSessionImpl(deviceInfo!!, NetconfRpcServiceImpl(DeviceInfo()))
54 Assert.assertNotNull(netconfSession.getSessionId())
55 Assert.assertEquals("localhost:2224", netconfSession.getDeviceInfo().toString())
57 netconfSession.checkAndReestablish()
59 Assert.assertNotNull(netconfSession.getSessionId())
60 Assert.assertEquals("localhost:2224", netconfSession.getDeviceInfo().toString())
62 Assert.assertTrue(!netconfSession.getDeviceCapabilitiesSet().isEmpty())