2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.openecomp.appc.dg.ssh;
26 import org.openecomp.appc.exceptions.APPCException;
27 import org.openecomp.sdnc.sli.SvcLogicContext;
28 import org.openecomp.sdnc.sli.SvcLogicJavaPlugin;
31 * Set of common methods that can be called from DG.
33 public interface SshService extends SvcLogicJavaPlugin {
36 * Input parameter for SHH connection details
38 String PARAM_IN_connection_details = "connection_details";
41 * Input parameter for SSH command to be executed.
43 String PARAM_IN_command = "command";
46 String PARAM_IN_host = "host";
47 String PARAM_IN_port = "port";
48 String PARAM_IN_username = "username";
49 String PARAM_IN_password = "password";
53 * Input parameter for SSH command timeout
55 String PARAM_IN_timeout = "timeout";
58 * Output parameter - SSH command execution status.
60 String PARAM_OUT_status = "status";
63 * Output parameter - content of SSH command stdout.
65 String PARAM_OUT_stdout = "stdout";
68 * Output parameter - content of SSH command stderr.
70 String PARAM_OUT_stderr = "stderr";
73 * Default SSH connection port.
78 * Default SSH command timeout
80 long DEF_timeout = 120000;
83 * Default success status.
85 int DEF_SUCCESS_STATUS = 0;
88 * Execute remote command over SSH.
90 * @param params contains list of input parameters required for the implementation
91 * @param ctx SLI service logic context
92 * @throws APPCException
94 void exec(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
97 * Execute remote command over SSH and check return status assuming that success status is 0.
98 * If non-zero status is returned - fail the execution by throwing exception with content written
99 * by command to stderr.
101 * @param params contains list of input parameters required for the implementation
102 * @param ctx SLI service logic context
103 * @throws APPCException
105 void execWithStatusCheck(Map<String, String> params, SvcLogicContext ctx) throws APPCException;