2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Copyright (C) 2017 Amdocs
8 * =============================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
21 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 * ============LICENSE_END=========================================================
25 package org.onap.appc.dg.ssh;
29 import org.onap.appc.exceptions.APPCException;
30 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
31 import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
34 * Set of common methods that can be called from DG.
36 public interface SshService extends SvcLogicJavaPlugin {
39 * Input parameter for SHH connection details
41 String PARAM_IN_connection_details = "connection_details";
44 * Input parameter for SSH command to be executed.
46 String PARAM_IN_command = "command";
49 * Input parameter for SSH command timeout
51 String PARAM_IN_timeout = "timeout";
54 * Output parameter - SSH command execution status.
56 String PARAM_OUT_status = "status";
59 * Output parameter - content of SSH command stdout.
61 String PARAM_OUT_stdout = "stdout";
64 * Output parameter - content of SSH command stderr.
66 String PARAM_OUT_stderr = "stderr";
69 * Default SSH connection port.
74 * Default SSH command timeout
76 long DEF_timeout = 120000;
79 * Default success status.
81 int DEF_SUCCESS_STATUS = 0;
84 * Execute remote command over SSH.
86 * @param params contains list of input parameters required for the implementation
87 * @param ctx SLI service logic context
88 * @throws APPCException
90 void exec(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
93 * Execute remote command over SSH and check return status assuming that success status is 0.
94 * If non-zero status is returned - fail the execution by throwing exception with content written
95 * by command to stderr.
97 * @param params contains list of input parameters required for the implementation
98 * @param ctx SLI service logic context
99 * @throws APPCException
101 void execWithStatusCheck(Map<String, String> params, SvcLogicContext ctx) throws APPCException;