aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImplTest.kt
diff options
context:
space:
mode:
Diffstat (limited to 'ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImplTest.kt')
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImplTest.kt124
1 files changed, 124 insertions, 0 deletions
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImplTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImplTest.kt
new file mode 100644
index 00000000..8f1f7150
--- /dev/null
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImplTest.kt
@@ -0,0 +1,124 @@
+package org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.core
+
+import org.junit.After
+import org.junit.Assert
+import org.junit.Before
+import org.junit.Test
+
+import org.junit.Assert.*
+import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.api.DeviceInfo
+import org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.mocks.NetconfDeviceSimulator
+
+class NetconfRpcServiceImplTest {
+
+ private var device: NetconfDeviceSimulator? = null
+ private var deviceInfo: DeviceInfo? = null
+
+ @Before
+ fun before() {
+ deviceInfo = DeviceInfo().apply {
+ username = "username"
+ password = "password"
+ ipAddress = "localhost"
+ port = 2224
+ connectTimeout = 10
+ }
+
+ device = NetconfDeviceSimulator(deviceInfo!!.port)
+ device!!.start()
+ }
+
+ @After
+ fun after() {
+ device!!.stop()
+ }
+
+ @Test
+ fun setNetconfSession() {
+
+ }
+
+ @Test
+ fun getConfig() {
+
+ val netconfRpcServiceImpl = NetconfRpcServiceImpl(deviceInfo!!)
+ val netconfSession = NetconfSessionImpl(deviceInfo!!, netconfRpcServiceImpl)
+ netconfRpcServiceImpl.setNetconfSession(netconfSession)
+ netconfSession.connect()
+ Assert.assertTrue(netconfRpcServiceImpl.getConfig("filter","target").status.equals("failure"))
+ }
+
+
+ @Test
+ fun deleteConfig() {
+
+ val netconfRpcServiceImpl = NetconfRpcServiceImpl(deviceInfo!!)
+ val netconfSession = NetconfSessionImpl(deviceInfo!!, netconfRpcServiceImpl)
+ netconfRpcServiceImpl.setNetconfSession(netconfSession)
+ netconfSession.connect()
+ Assert.assertTrue(netconfRpcServiceImpl.deleteConfig("target").status.equals("failure"))
+ }
+
+ @Test
+ fun lock() {
+ val netconfRpcServiceImpl = NetconfRpcServiceImpl(deviceInfo!!)
+ val netconfSession = NetconfSessionImpl(deviceInfo!!, netconfRpcServiceImpl)
+ netconfRpcServiceImpl.setNetconfSession(netconfSession)
+ netconfSession.connect()
+ Assert.assertTrue(netconfRpcServiceImpl.lock("target").status.equals("failure"))
+ }
+
+ @Test
+ fun unLock() {
+ val netconfRpcServiceImpl = NetconfRpcServiceImpl(deviceInfo!!)
+ val netconfSession = NetconfSessionImpl(deviceInfo!!, netconfRpcServiceImpl)
+ netconfRpcServiceImpl.setNetconfSession(netconfSession)
+ netconfSession.connect()
+ Assert.assertTrue(netconfRpcServiceImpl.unLock("target").status.equals("failure"))
+ }
+
+ @Test
+ fun commit() {
+ val netconfRpcServiceImpl = NetconfRpcServiceImpl(deviceInfo!!)
+ val netconfSession = NetconfSessionImpl(deviceInfo!!, netconfRpcServiceImpl)
+ netconfRpcServiceImpl.setNetconfSession(netconfSession)
+ netconfSession.connect()
+ Assert.assertTrue(netconfRpcServiceImpl.commit(true,60,"persist","1").status.equals("failure"))
+
+ }
+
+ @Test
+ fun cancelCommit() {
+ val netconfSession = NetconfSessionImpl(deviceInfo!!, NetconfRpcServiceImpl(DeviceInfo()))
+ val netconfRpcServiceImpl = NetconfRpcServiceImpl(DeviceInfo())
+ netconfRpcServiceImpl.setNetconfSession(netconfSession)
+ netconfSession.connect()
+
+ Assert.assertNotNull(netconfRpcServiceImpl.cancelCommit("1"))
+ }
+
+ @Test
+ fun discardConfig() {
+ val netconfRpcServiceImpl = NetconfRpcServiceImpl(deviceInfo!!)
+ val netconfSession = NetconfSessionImpl(deviceInfo!!, netconfRpcServiceImpl)
+ netconfRpcServiceImpl.setNetconfSession(netconfSession)
+ netconfSession.connect()
+ Assert.assertTrue(netconfRpcServiceImpl.discardConfig().status.equals("failure"))
+
+ }
+
+ @Test
+ fun editConfig() {
+ }
+
+ @Test
+ fun validate() {
+ val netconfRpcServiceImpl = NetconfRpcServiceImpl(deviceInfo!!)
+ val netconfSession = NetconfSessionImpl(deviceInfo!!, netconfRpcServiceImpl)
+ netconfRpcServiceImpl.setNetconfSession(netconfSession)
+ netconfSession.connect()
+ Assert.assertTrue(netconfRpcServiceImpl.validate("target").status.equals("failure"))
+
+ }
+
+} \ No newline at end of file