Migrate "ms/controllerblueprints" from ccsdk/apps
[ccsdk/cds.git] / ms / blueprintsprocessor / functions / netconf-executor / src / main / kotlin / org / onap / ccsdk / apps / blueprintsprocessor / functions / netconf / executor / api / NetconfSession.kt
1 /*
2  * Copyright © 2017-2018 AT&T Intellectual Property.
3  *
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
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.api
18
19 import java.util.concurrent.CompletableFuture
20
21 interface NetconfSession {
22
23     /**
24      * Establish netconf session
25      */
26     fun connect()
27
28
29     /**
30      * Disconnect netconf session
31      */
32     fun disconnect()
33
34     /**
35      * Reconnect netconf session
36      */
37     fun reconnect()
38
39     /**
40      * Executes an synchronous RPC request.
41      *
42      * @param request the XML request
43      * @param messageId message id of the request.
44      * @return Response
45      */
46     @Throws(NetconfException::class)
47     fun syncRpc(request: String, messageId: String): String
48
49     /**
50      * Executes an asynchronous RPC request.
51      *
52      * @param request the XML request
53      * @param messageId message id of the request.
54      * @return Response
55      */
56     @Throws(NetconfException::class)
57     fun asyncRpc(request: String, messageId: String): CompletableFuture<String>
58
59     /**
60      * Checks the state of the underlying SSH session and connection and if necessary it reestablishes
61      * it.
62      */
63     @Throws(NetconfException::class)
64     fun checkAndReestablish()
65
66     /**
67      * Get the device information for initialised session.
68      *
69      * @return DeviceInfo as device information
70      */
71     fun getDeviceInfo(): DeviceInfo
72
73     /**
74      * Gets the session ID of the Netconf session.
75      *
76      * @return Session ID as a string.
77      */
78     fun getSessionId(): String
79
80     /**
81      * Gets the capabilities of the remote Netconf device associated to this session.
82      *
83      * @return Network capabilities as strings in a Set.
84      */
85     fun getDeviceCapabilitiesSet(): Set<String>
86 }