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.api
18 import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.utils.ModifyAction
19 import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.utils.NetconfDatastore
21 interface NetconfRpcService {
26 * @param configTarget running or candidate, default candidate
27 * @return Device response
29 fun lock(configTarget: String = NetconfDatastore.CANDIDATE.datastore): DeviceResponse
34 * @param filter filter content, default empty
35 * @param configTarget running or candidate, default running
36 * @return Device response
38 fun getConfig(filter: String = "", configTarget: String = NetconfDatastore.RUNNING.datastore): DeviceResponse
43 * @param configTarget running or candidate, default candidate
44 * @return Device response
46 fun deleteConfig(configTarget: String = NetconfDatastore.CANDIDATE.datastore): DeviceResponse
51 * @param messageContent edit config content.
52 * @param configTarget running or candidate, default candidate
53 * @param editDefaultOperation, default set to none. Valid values: merge, replace, create, delete, none
54 * @return Device response
56 fun editConfig(messageContent: String, configTarget: String = NetconfDatastore.CANDIDATE.datastore,
57 editDefaultOperation: String = ModifyAction.NONE.action): DeviceResponse
60 * Invoke custom RPC as provided as input.
62 * Some use cases might required one to directly invoke a device
63 * specific RPC. The RPC must be correctly formatted.
65 * Ex: in order to rollback last submitted configuration
66 * for JUNOS devices, such RPC can be use:
69 * <load-configuration rollback="1"/>
73 * @param rpc the rpc content.
75 fun invokeRpc(rpc: String): DeviceResponse
80 * @param configTarget running or candidate, default candidate
81 * @return Device response
83 fun validate(configTarget: String = NetconfDatastore.CANDIDATE.datastore): DeviceResponse
88 * @param confirmed Perform a confirmed <commit> operation. If flag set to true,
89 * then it is expected to have a follow-up <commit> operation to confirm the request
90 * @param confirmTimeout Timeout period for confirmed commit, in seconds.
91 * @param persist Make the confirmed commit survive a session termination, and
92 * set a token on the ongoing confirmed commit.
93 * @param persistId Used to issue a follow-up confirmed commit or a confirming
94 * commit from any session, with the token from the previous <commit> operation.
95 * If unspecified, the confirm timeout defaults to 600 seconds.
96 * @return Device response
98 fun commit(confirmed: Boolean = false, confirmTimeout: Int = 60, persist: String = "",
99 persistId: String = ""): DeviceResponse
102 * Cancels an ongoing confirmed commit. If the <persist-id> parameter is not given,
103 * the <cancel-commit> operation MUST be issued on the same session that issued
104 * the confirmed commit.
106 * @param persistId Cancels a persistent confirmed commit. The value MUST be equal
107 * to the value given in the <persist> parameter to the <commit> operation.
108 * If the value does not match, the operation fails with an "invalid-value" error.
110 fun cancelCommit(persistId: String = ""): DeviceResponse
115 * @param configTarget running or candidate, default candidate
116 * @return Device response
118 fun unLock(configTarget: String = NetconfDatastore.CANDIDATE.datastore): DeviceResponse
123 * @return Device response
125 fun discardConfig(): DeviceResponse
130 * @param force force closeSession
131 * @return Device response
133 fun closeSession(force: Boolean): DeviceResponse
136 * Executes an RPC request to the netconf server.
138 * @param request the XML containing the RPC request for the server.
139 * @return Device response
141 fun asyncRpc(request: String, messageId: String): DeviceResponse