2) Execute a SLS file located on the server : Example command will look like:
Knowing the saltstack server has vim.sls file located at "/srv/salt" directory then user can execute the following commands:
-1.1) Command to run the vim.sls file on saltstack server: cmd = "salt '*' state.apply vim --out=json --static"
-1.2) Command to run the nettools.sls file on saltstack server: cmd = "cd /srv/salt/; salt '*' state.apply <sls-file-name> --out=json --static"
+1.1) Command to run the vim.sls file on saltstack server: Cmd = "salt '*' state.apply vim --out=json --static"
+1.2) Command to run the nettools.sls file on saltstack server: Cmd = "cd /srv/salt/; salt '*' state.apply <sls-file-name> --out=json --static"
Important thing to note: If the reqExecCommand is used to execute sls file then along with following,
"HostName"; -> Saltstack server's host name IP address.
"Port"; -> Saltstack server's port to make SSH connection to.
"Password"; -> Saltstack server's SSH UserName.
"User"; -> Saltstack server's SSH Password.
the param should contain,
- "slsExec"; -> this variable should be set to true.
- "execTimeout"; -> set large timeout if your SLS file will take large time to finish executing (in milliseconds).
+ "SlsExec"; -> this variable should be set to true.
+ "Timeout"; -> set large timeout if your SLS file will take large time to finish executing (in Seconds).
In this case, params that will hold the command execution result for DG access in Key:
Result code at: org.onap.appc.adapter.saltstack.result.code (On success: This will be 200, this means the command was executed successfully and also configuration change made using the SLS file was also successful)
The response from Saltstack comes in json format and it is automatically put to context for DGs access, with a certain request-ID as prefix.
If request Id (Id) is not passed as part of input param, then a random Id will be generated and put to properties in "org.onap.appc.adapter.saltstack.Id" field. All the output message from the execution will be appended with reqId.
1) Execute a single command on SaltState server : Example command will look like:
- In the context set the "slsName" to "test.sls"
- In the context set the "execTimeout"; -> set large timeout if your SLS file will take large time to finish executing (in milliseconds).
- In the context set the "applyTo" to "minion1" //to the minions or VNFCs you want to apply the SLS file to.
- "applyTo" can be empty or set to "*" is the SLS has to be applied to all the minions or VNFCs.
+ In the context set the "SlsName" to "test.sls"
+ In the context set the "Timeout"; -> set large timeout if your SLS file will take large time to finish executing (in Seconds).
+ In the context set the "NodeList" to "minion1" //to the minions or VNFCs you want to apply the SLS file to.
+ "NodeList" can be empty or set to "*" is the SLS has to be applied to all the minions or VNFCs.
+ In the context set the "FileParameters: A JSON dictionary where keys are filenames and values are contents of files. The Saltstack Server will utilize this feature to generate files with keys as filenames and values as content. This attribute can be used to generate files that a SSL file may require as part of execution (Optional).
+ In the context set the "EnvParameters: A JSON dictionary which should list key value pairs to be passed to the Salstack command to run SLS. These values would correspond to instance specific parameters that a playbook may need to execute an action.
+
In this case, params that will hold the command execution result for DG access in Key:
Result code at: org.onap.appc.adapter.saltstack.result.code (On success: This will be 200, this means the command was executed successfully and also configuration change made using the SLS file was also successful)
Message at: org.onap.appc.adapter.saltstack.message
The response from Saltstack comes in json format and it is automatically put to context for DGs access, with a certain request-ID as prefix.
If request Id (Id) is not passed as part of input param, then a random Id will be generated and put to properties in "org.onap.appc.adapter.saltstack.Id" field. All the output message from the execution will be appended with reqId.
1) Execute a single command on SaltState server : Example command will look like:
- In the context set the "slsFile" to "/path/to/test.sls" //mention the path of the SLS file in ODL container.
- In the context set the "execTimeout"; -> set large timeout if your SLS file will take large time to finish executing (in milliseconds).
- In the context set the "applyTo" to "minion1" //to the minions or VNFCs you want to apply the SLS file to.
- "applyTo" can be empty or set to "*" is the SLS has to be applied to all the minions or VNFCs.
+ In the context set the "SlsFile" to "/path/to/test.sls" //mention the path of the SLS file in ODL container.
+ In the context set the "Timeout"; -> set large timeout if your SLS file will take large time to finish executing (in Seconds).
+ In the context set the "NodeList" to "minion1" //to the minions or VNFCs you want to apply the SLS file to.
+ "NodeList" can be empty or set to 'minion*' (pattern matching) or set to "*" is the SLS has to be applied to all the minions or VNFCs.
+ In the context set the "FileParameters: A JSON dictionary where keys are filenames and values are contents of files. The Saltstack Server will utilize this feature to generate files with keys as filenames and values as content. This attribute can be used to generate files that a SSL file may require as part of execution (Optional).
+ In the context set the "EnvParameters: A JSON dictionary which should list key value pairs to be passed to the Salstack command to run SLS. These values would correspond to instance specific parameters that a playbook may need to execute an action.
+
In this case, params that will hold the command execution result for DG access in Key:
Result code at: org.onap.appc.adapter.saltstack.result.code (On success: This will be 200, this means the command was executed successfully and also configuration change made using the SLS file was also successful)
Message at: org.onap.appc.adapter.saltstack.message
Both user inputted/auto generated req Id at: org.onap.appc.adapter.saltstack.Id
The result code here will be the execution of configuration SLS file on the server.
+Control the state system on the minion: by specifying Env Params (pillars) and Files.
+https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.state.html
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!--
============LICENSE_START=======================================================
- ONAP : APPC
+ ONAP : CCSDK
================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ Copyright (C) 2018 Samsung Electronics. All rights reserved.
================================================================================
- Copyright (C) 2017 Amdocs
+
=============================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
See the License for the specific language governing permissions and
limitations under the License.
- ECOMP is a trademark and service mark of AT&T Intellectual Property.
+
============LICENSE_END=========================================================
-->
# ============LICENSE_START==========================================
-# ONAP : APPC
+# ONAP : CCSDK
# ===================================================================
-# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+# Copyright (C) 2017-2018 Samsung Electronics. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
# See the License for the specific language governing permissions and
# limitations under the License.
#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
# ============LICENSE_END============================================
/target/
/target-ide/
<?xml version="1.0" encoding="UTF-8"?>
<!-- ============LICENSE_START=======================================================
- ONAP : APPC ================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. ================================================================================
- Copyright (C) 2017 Amdocs =============================================================================
+ ONAP : CCSDK ================================================================================
+ Copyright (C) 2018 Samsung Electronics. All rights reserved. ================================================================================
+ =============================================================================
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
by applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
OF ANY KIND, either express or implied. See the License for the specific
- language governing permissions and limitations under the License. ECOMP is
- a trademark and service mark of AT&T Intellectual Property. ============LICENSE_END========================================================= -->
+ language governing permissions and limitations under the License. ============LICENSE_END========================================================= -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<?xml version="1.0" encoding="UTF-8"?>
<!--
============LICENSE_START=======================================================
- ONAP : APPC
+ ONAP : CCSDK
================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ Copyright (C) 2018 Samsung Electronics. All rights reserved.
================================================================================
- Copyright (C) 2017 Amdocs
+
=============================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
See the License for the specific language governing permissions and
limitations under the License.
- ECOMP is a trademark and service mark of AT&T Intellectual Property.
+
============LICENSE_END=========================================================
-->
<?xml version="1.0" encoding="UTF-8"?>
<!--
============LICENSE_START=======================================================
- ONAP : APPC
+ ONAP : CCSDK
================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ Copyright (C) 2018 Samsung Electronics. All rights reserved.
================================================================================
- Copyright (C) 2017 Amdocs
+
=============================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
See the License for the specific language governing permissions and
limitations under the License.
- ECOMP is a trademark and service mark of AT&T Intellectual Property.
+
============LICENSE_END=========================================================
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<!--
============LICENSE_START=======================================================
- ONAP : APPC
+ ONAP : CCSDK
================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ Copyright (C) 2018 Samsung Electronics. All rights reserved.
================================================================================
- Copyright (C) 2017 Amdocs
+
=============================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
See the License for the specific language governing permissions and
limitations under the License.
- ECOMP is a trademark and service mark of AT&T Intellectual Property.
+
============LICENSE_END=========================================================
-->
<!--
============LICENSE_START=======================================================
- ONAP : APPC
+ ONAP : CCSDK
================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ Copyright (C) 2018 Samsung Electronics. All rights reserved.
================================================================================
- Copyright (C) 2017 Amdocs
+
=============================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
See the License for the specific language governing permissions and
limitations under the License.
- ECOMP is a trademark and service mark of AT&T Intellectual Property.
+
============LICENSE_END=========================================================
-->
# ============LICENSE_START=======================================================
# ONAP : APPC
# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright (C) 2018 Samsung Electronics. All rights reserved.
# ================================================================================
-# Copyright (C) 2017 Amdocs
+#
# =============================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# See the License for the specific language governing permissions and
# limitations under the License.
#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
# ============LICENSE_END=========================================================
###
# ============LICENSE_START==========================================
-# ONAP : APPC
+# ONAP : CCSDK
# ===================================================================
-# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+# Copyright (C) 2017-2018 Samsung Electronics. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
# See the License for the specific language governing permissions and
# limitations under the License.
#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
# ============LICENSE_END============================================
/bin/
/target/
<?xml version="1.0" encoding="UTF-8"?>
<!-- ============LICENSE_START=======================================================
- ONAP : APPC ================================================================================
- Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ ONAP : CCSDK ================================================================================
+ Copyright (C) 2017-2018 Samsung Electronics. All rights reserved.
================================================================================
- Copyright (C) 2017 Amdocs =============================================================================
+ =============================================================================
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
by applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
OF ANY KIND, either express or implied. See the License for the specific
- language governing permissions and limitations under the License. ECOMP is
- a trademark and service mark of AT&T Intellectual Property. ============LICENSE_END========================================================= -->
+ language governing permissions and limitations under the License. ============LICENSE_END========================================================= -->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
/*-
* ============LICENSE_START=======================================================
- * ONAP : APPC
+ * ONAP : CCSDK
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018 Samsung Electronics. All rights reserved.
* ================================================================================
- * Copyright (C) 2017 Amdocs
+ *
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the License for the specific language governing permissions and
* limitations under the License.
*
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ *
* ============LICENSE_END=========================================================
*/
/*-
* ============LICENSE_START=======================================================
- * ONAP : APPC
+ * ONAP : CCSDK
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018 Samsung Electronics. All rights reserved.
* ================================================================================
- * Copyright (C) 2017 Amdocs
+ *
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the License for the specific language governing permissions and
* limitations under the License.
*
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ *
* ============LICENSE_END=========================================================
*/
/*-
* ============LICENSE_START=======================================================
- * ONAP : APPC
+ * ONAP : CCSDK
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018 Samsung Electronics. All rights reserved.
* ================================================================================
- * Copyright (C) 2017 Amdocs
+ *
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the License for the specific language governing permissions and
* limitations under the License.
*
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ *
* ============LICENSE_END=========================================================
*/
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
+import org.json.JSONException;
+import org.json.JSONObject;
import org.onap.ccsdk.sli.adaptors.saltstack.SaltstackAdapter;
import org.onap.ccsdk.sli.adaptors.saltstack.SaltstackAdapterPropertiesProvider;
import org.onap.ccsdk.sli.adaptors.saltstack.model.SaltstackMessageParser;
public static final String OUTCOME_SUCCESS = "success";
public static final String CONNECTION_RETRY_DELAY = "retryDelay";
public static final String CONNECTION_RETRY_COUNT = "retryCount";
+ private static final String APPC_EXCEPTION_CAUGHT = "APPCException caught";
/**
* Adapter Name
*/
private static final String SS_SERVER_USERNAME = "org.onap.appc.adapter.saltstack.userName";
private static final String SS_SERVER_PASSWD = "org.onap.appc.adapter.saltstack.userPasswd";
private static final String SS_SERVER_SSH_KEY = "org.onap.appc.adapter.saltstack.sshKey";
+
+ private static final String COMMAND_IN_JSON_OUT = " --out=json --static ";
+ private static final String COMMAND_CHANGE_DEFAULT_DIR = " cd /srv/salt/ ;";
+
/**
* The logger to be used
*/
*/
@SuppressWarnings("static-method")
private void doFailure(SvcLogicContext svcLogic, int code, String message) throws SvcLogicException {
-
+ logger.error(APPC_EXCEPTION_CAUGHT, message);
svcLogic.setStatus(OUTCOME_FAILURE);
svcLogic.setAttribute(RESULT_CODE_ATTRIBUTE_NAME, Integer.toString(code));
svcLogic.setAttribute(MESSAGE_ATTRIBUTE_NAME, message);
}
}
+ private String parseEnvParam(JSONObject envParams) {
+ StringBuilder envParamBuilder = new StringBuilder();
+ if (envParams != null) {
+ for(Object key : envParams.keySet()) {
+ if(envParamBuilder.length() > 0) {
+ envParamBuilder.append(", ");
+ }
+ envParamBuilder.append(key+"="+envParams.get((String) key));
+ logger.info("EnvParameters : " + envParamBuilder);
+ }
+ }
+ return envParamBuilder.toString();
+ }
+
+ private String parseFileParam(JSONObject fileParams) {
+ StringBuilder fileParamBuilder = new StringBuilder();
+ if (fileParams != null) {
+ for(Object key : fileParams.keySet()) {
+ fileParamBuilder.append("echo -e \"" + fileParams.get((String) key) + "\" > /srv/salt/" + key).append("; ");
+ logger.info("FileParameters : " + fileParamBuilder);
+ }
+ }
+ return fileParamBuilder.toString();
+ }
+
private String putToCommands(SvcLogicContext ctx, String slsFileName,
- String applyTo) throws SvcLogicException {
- String constructedCommand = "";
+ String applyTo, JSONObject envParams, JSONObject fileParams) throws SvcLogicException {
+
+ StringBuilder constructedCommand = new StringBuilder();
try {
File file = new File(slsFileName);
String slsFile = file.getName();
String str = new String(data, "UTF-8");
in.close();
String slsWithoutExtn = stripExtension(slsFile);
- constructedCommand = "echo -e \""+str+"\" > /srv/salt/"+slsFile+"; cd /srv/salt/; salt '"+
- applyTo+"' state.apply "+slsWithoutExtn+" --out=json --static";
+ constructedCommand.append(parseFileParam(fileParams)).append("echo -e \"").append(str).append("\" > /srv/salt/").
+ append(slsFile).append("; ").append(COMMAND_CHANGE_DEFAULT_DIR).append(" salt '").
+ append(applyTo).append("' state.apply ").append(slsWithoutExtn).append(" ").append(parseEnvParam(envParams)).append(COMMAND_IN_JSON_OUT);
+
+ logger.info("Command to be executed on server : " + constructedCommand.toString());
+
} catch (FileNotFoundException e) {
doFailure(ctx, SaltstackResultCodes.IO_EXCEPTION.getValue(), "Input SLS file " +
"not found in path : " + slsFileName+". "+ e.getMessage());
doFailure(ctx, SaltstackResultCodes.IO_EXCEPTION.getValue(), "Input file " +
"is not of type .sls");
}
- logger.info("Command to be executed on server : " + constructedCommand);
- return constructedCommand;
+ return constructedCommand.toString();
}
private String stripExtension (String str) {
return str.substring(0, pos);
}
- private String putToCommands(String slsName, String applyTo) {
- String
- constructedCommand = "cd /srv/salt/; salt '"+applyTo+"' state.apply "+slsName+" --out=json --static";
+ private String putToCommands(String slsName, String applyTo, JSONObject envParams, JSONObject fileParams) {
+
+ StringBuilder constructedCommand = new StringBuilder();
+
+ constructedCommand.append(parseFileParam(fileParams)).append(COMMAND_CHANGE_DEFAULT_DIR).append(" salt '").append(applyTo)
+ .append("' state.apply ").append(slsName).append(" ").append(parseEnvParam(envParams)).append(COMMAND_IN_JSON_OUT);
- logger.info("Command to be executed on server : " + constructedCommand);
- return constructedCommand;
+ logger.info("Command to be executed on server : " + constructedCommand.toString());
+ return constructedCommand.toString();
}
private void checkResponseStatus(SaltstackResult testResult, SvcLogicContext ctx, String reqID, boolean slsExec)
if (testResult.getStatusCode() != SaltstackResultCodes.FINAL_SUCCESS.getValue()) {
ctx.setAttribute(ID_ATTRIBUTE_NAME, reqID);
doFailure(ctx, testResult.getStatusCode(), "Request for execution of command failed. Reason = " + testResult.getStatusMessage());
- return;
} else {
logger.info(String.format("Execution of request : successful."));
ctx.setAttribute(RESULT_CODE_ATTRIBUTE_NAME, Integer.toString(testResult.getStatusCode()));
String slsName = messageProcessor.reqSlsName(params);
String applyTo = messageProcessor.reqApplyToDevices(params);
long execTimeout = messageProcessor.reqExecTimeout(params);
- String commandToExecute = putToCommands(slsName, applyTo);
+ JSONObject envParams = messageProcessor.reqEnvParameters(params);
+ JSONObject fileParams = messageProcessor.reqFileParameters(params);
+
+ String commandToExecute = putToCommands(slsName, applyTo, envParams, fileParams);
testResult = execCommand(ctx, params, commandToExecute, execTimeout);
testResult = messageProcessor.parseResponse(ctx, reqID, testResult, true);
checkResponseStatus(testResult, ctx, reqID, true);
} catch (IOException e) {
doFailure(ctx, SaltstackResultCodes.IO_EXCEPTION.getValue(),
"IOException in file stream : "+ e.getMessage());
+ } catch (JSONException e) {
+ doFailure(ctx, SaltstackResultCodes.INVALID_COMMAND.getValue(), e.getMessage());
}
}
String slsFile = messageProcessor.reqSlsFile(params);
String applyTo = messageProcessor.reqApplyToDevices(params);
long execTimeout = messageProcessor.reqExecTimeout(params);
- String commandToExecute = putToCommands(ctx, slsFile, applyTo);
+ JSONObject envParams = messageProcessor.reqEnvParameters(params);
+ JSONObject fileParams = messageProcessor.reqFileParameters(params);
+
+ String commandToExecute = putToCommands(ctx, slsFile, applyTo, envParams, fileParams);
testResult = execCommand(ctx, params, commandToExecute, execTimeout);
testResult = messageProcessor.parseResponse(ctx, reqID, testResult, true);
checkResponseStatus(testResult, ctx, reqID, true);
/*-
* ============LICENSE_START=======================================================
- * ONAP : APPC
+ * ONAP : CCSDK
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018 Samsung Electronics. All rights reserved.
* ================================================================================
- * Copyright (C) 2017 Amdocs
+ *
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the License for the specific language governing permissions and
* limitations under the License.
*
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ *
* ============LICENSE_END=========================================================
*/
public static final int DEFAULT_CONNECTION_RETRY_COUNT = 5;
private static final EELFLogger logger = EELFManager.getInstance().getApplicationLogger();
private static final long AUTH_TIMEOUT = 60000;
- private static final long EXEC_TIMEOUT = 120000;
+ private static final long EXEC_TIMEOUT = 120;
private String host;
private int port;
private String username;
}
public void setExecTimeout(long timeout) {
- this.timeout = timeout;
+ //convert seconds to milliseconds
+ this.timeout = timeout*1000;
}
public SaltstackResult execCommand(String cmd, OutputStream out, OutputStream err, SaltstackResult result ) {
* ============LICENSE_START=======================================================
* openECOMP : SDN-C
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * Copyright (C) 2018 Samsung Electronics. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
/*-
* ============LICENSE_START=======================================================
- * ONAP : APPC
+ * ONAP : CCSDK
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 Samsung Electronics. All rights reserved.
* ================================================================================
- * Copyright (C) 2017 Amdocs
+ *
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the License for the specific language governing permissions and
* limitations under the License.
*
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ *
* ============LICENSE_END=========================================================
*/
*/
import com.google.common.base.Strings;
-import org.codehaus.jettison.json.JSONException;
+import org.json.JSONException;
+import org.json.JSONArray;
+import org.json.JSONObject;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.slf4j.Logger;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
+import java.util.Collections;
+import java.util.HashSet;
import java.util.Map;
import java.util.Properties;
+import java.util.Set;
import java.util.UUID;
/**
private static final String SS_AGENT_PORT_KEY = "Port";
private static final String PASS_KEY = "Password";
private static final String USER_KEY = "User";
- private static final String CMD_EXEC = "cmd";
- private static final String IS_SLS_EXEC = "slsExec";
+ private static final String CMD_EXEC = "Cmd"; //cmd
+ private static final String IS_SLS_EXEC = "SlsExec"; //slsExec
private static final String SS_REQ_ID = "Id";
- private static final String SLS_FILE_LOCATION = "slsFile";
- private static final String SLS_NAME = "slsName";
- private static final String MINION_TO_APPLY = "applyTo";
- private static final String EXEC_TIMEOUT_TO_APPLY = "execTimeout";
+ private static final String SLS_FILE_LOCATION = "SlsFile"; //slsFile
+ private static final String SLS_NAME = "SlsName"; //slsName
+ private static final String MINION_TO_APPLY = "NodeList"; //applyTo
+ private static final String EXEC_TIMEOUT_TO_APPLY = "Timeout"; //execTimeout
+ private static final String FILE_PARAMETERS_OPT_KEY = "FileParameters";
+ private static final String ENV_PARAMETERS_OPT_KEY = "EnvParameters";
private static final Logger LOGGER = LoggerFactory.getLogger(SaltstackMessageParser.class);
/**
* Method that validates that the Map has enough information
* to query Saltstack server for a result. If so, it returns
- * the appropriate minions/vnfc to execute the SLS file to.
+ * the appropriate minions/vnfc to execute the SLS file.
*/
public String reqApplyToDevices(Map<String, String> params) {
/**
* Method that validates that the Map has enough information
* to query Saltstack server for a result. If so, it returns
- * the appropriate minions/vnfc to execute the SLS file to.
+ * the appropriate minions/vnfc to execute the SLS file.
*/
public long reqExecTimeout(Map<String, String> params) {
return Long.parseLong(params.get(SaltstackMessageParser.EXEC_TIMEOUT_TO_APPLY));
}
+ /**
+ * Method that validates that the Map has enough information
+ * to query Saltstack server for a result. If so, it returns
+ * the appropriate EnvParameters to execute the SLS file.
+ */
+ public JSONObject reqEnvParameters(Map<String, String> params) throws JSONException {
+
+ JSONObject jsonPayload = new JSONObject();
+ final String[] optionalTestParam = { SaltstackMessageParser.ENV_PARAMETERS_OPT_KEY };
+ parseParam(params, optionalTestParam, jsonPayload);
+
+ return (JSONObject) jsonPayload.remove(SaltstackMessageParser.ENV_PARAMETERS_OPT_KEY);
+ }
+
+ /**
+ * Method that validates that the Map has enough information
+ * to query Saltstack server for a result. If so, it returns
+ * the appropriate EnvParameters to execute the SLS file.
+ */
+ public JSONObject reqFileParameters(Map<String, String> params) throws JSONException {
+
+ JSONObject jsonPayload = new JSONObject();
+ final String[] optionalTestParam = { SaltstackMessageParser.FILE_PARAMETERS_OPT_KEY };
+ parseParam(params, optionalTestParam, jsonPayload);
+
+ return (JSONObject) jsonPayload.remove(SaltstackMessageParser.FILE_PARAMETERS_OPT_KEY);
+ }
+
+ private void parseParam(Map<String, String> params, String[] optionalTestParams, JSONObject jsonPayload)
+ throws JSONException {
+
+ Set<String> optionalParamsSet = new HashSet<>();
+ Collections.addAll(optionalParamsSet, optionalTestParams);
+
+ //@formatter:off
+ params.entrySet()
+ .stream()
+ .filter(entry -> optionalParamsSet.contains(entry.getKey()))
+ .filter(entry -> !Strings.isNullOrEmpty(entry.getValue()))
+ .forEach(entry -> parseParam(entry, jsonPayload));
+ //@formatter:on
+ }
+
+ private void parseParam(Map.Entry<String, String> params, JSONObject jsonPayload)
+ throws JSONException {
+ String key = params.getKey();
+ String payload = params.getValue();
+
+ switch (key) {
+ case ENV_PARAMETERS_OPT_KEY:
+ JSONObject paramsJson = new JSONObject(payload);
+ jsonPayload.put(key, paramsJson);
+ break;
+
+ case FILE_PARAMETERS_OPT_KEY:
+ jsonPayload.put(key, getFilePayload(payload));
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ /**
+ * Return payload with escaped newlines
+ */
+ private JSONObject getFilePayload(String payload) {
+ String formattedPayload = payload.replace("\n", "\\n").replace("\r", "\\r");
+ return new JSONObject(formattedPayload);
+ }
+
/**
* Method that validates that the Map has enough information
* to query Saltstack server for a result. If so, it returns
} catch (FileNotFoundException e) {
return new SaltstackResult(SaltstackResultCodes.INVALID_RESPONSE_FILE.getValue(), "error parsing response file "
+ saltstackResult.getOutputFileName() + " : " + e.getMessage());
- } catch (JSONException e) {
+ } catch (org.codehaus.jettison.json.JSONException e) {
LOGGER.info("Output not in JSON format");
return putToProperties(ctx, pfx, saltstackResult);
} catch (Exception e) {
if (slsExec) {
if (!retCodeFound) {
return new SaltstackResult(SaltstackResultCodes.COMMAND_EXEC_FAILED_STATUS.getValue(),
- "error in executing configuration at the server");
+ "error in executing configuration at the server, check your command input");
}
if (!executionStatus) {
return new SaltstackResult(SaltstackResultCodes.COMMAND_EXEC_FAILED_STATUS.getValue(),
- "error in executing configuration at the server");
+ "error in executing configuration at the server, check your command input");
}
}
saltstackResult.setStatusCode(SaltstackResultCodes.FINAL_SUCCESS.getValue());
/*-
* ============LICENSE_START=======================================================
- * ONAP : APPC
+ * ONAP : CCSDK
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018 Samsung Electronics. All rights reserved.
* ================================================================================
- * Copyright (C) 2017 Amdocs
+ *
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the License for the specific language governing permissions and
* limitations under the License.
*
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ *
* ============LICENSE_END=========================================================
*/
/*-
* ============LICENSE_START=======================================================
- * ONAP : APPC
+ * ONAP : CCSDK
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018 Samsung Electronics. All rights reserved.
* ================================================================================
- * Copyright (C) 2017 Amdocs
+ *
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the License for the specific language governing permissions and
* limitations under the License.
*
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ *
* ============LICENSE_END=========================================================
*/
/*-
* ============LICENSE_START=======================================================
- * ONAP : APPC
+ * ONAP : CCSDK
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018 Samsung Electronics. All rights reserved.
* ================================================================================
- * Copyright (C) 2017 Amdocs
+ *
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the License for the specific language governing permissions and
* limitations under the License.
*
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ *
* ============LICENSE_END=========================================================
*/
============LICENSE_START=======================================================
openECOMP : SDN-C
================================================================================
- Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights
+ Copyright (C) 2017 - 2018 Samsung Electronics. All rights
reserved.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
###
# ============LICENSE_START=======================================================
-# ONAP : APPC
+# ONAP : CCSDK
# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright (C) 2018 Samsung Electronics. All rights reserved.
# ================================================================================
-# Copyright (C) 2017 Amdocs
+#
# =============================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# See the License for the specific language governing permissions and
# limitations under the License.
#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
# ============LICENSE_END=========================================================
###
/*-
* ============LICENSE_START=======================================================
- * ONAP : APPC
+ * ONAP : CCSDK
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018 Samsung Electronics. All rights reserved.
* ================================================================================
- * Copyright (C) 2017 Amdocs
+ *
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the License for the specific language governing permissions and
* limitations under the License.
*
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ *
* ============LICENSE_END=========================================================
*/
/*-
* ============LICENSE_START=======================================================
- * ONAP : APPC
+ * ONAP : CCSDK
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018 Samsung Electronics. All rights reserved.
* ================================================================================
- * Copyright (C) 2017 Amdocs
+ *
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the License for the specific language governing permissions and
* limitations under the License.
*
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ *
* ============LICENSE_END=========================================================
*/
params.put("User", "test");
params.put("Password", "test");
params.put("Test", "success");
- params.put("cmd", "test");
- params.put("slsExec", "false");
+ params.put("Cmd", "test");
+ params.put("SlsExec", "false");
try {
adapter.reqExecCommand(params, svcContext);
String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
params.put("Test", "success");
params.put("retryDelay", "10");
params.put("retryCount", "10");
- params.put("cmd", "test");
- params.put("slsExec", "false");
+ params.put("Cmd", "test");
+ params.put("SlsExec", "false");
try {
adapter.reqExecCommand(params, svcContext);
String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
params.put("Test", "success");
params.put("retryDelay", "0");
params.put("retryCount", "0");
- params.put("cmd", "test");
- params.put("slsExec", "false");
+ params.put("Cmd", "test");
+ params.put("SlsExec", "false");
try {
adapter.reqExecCommand(params, svcContext);
String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
params.put("Test", "success");
params.put("retryDelay", "-1");
params.put("retryCount", "-1");
- params.put("cmd", "test");
- params.put("slsExec", "false");
+ params.put("Cmd", "test");
+ params.put("SlsExec", "false");
try {
adapter.reqExecCommand(params, svcContext);
params.put("Port", "10");
params.put("User", "test");
params.put("Password", "test");
- params.put("cmd", "test");
- params.put("slsExec", "test");
+ params.put("Cmd", "test");
+ params.put("SlsExec", "test");
params.put("Test", "fail");
try {
adapter.reqExecCommand(params, svcContext);
params.put("Test", "success");
params.put("fileName", "src/test/resources/test.json");
params.put("Id", "test1");
- params.put("cmd", "test");
- params.put("slsExec", "false");
+ params.put("Cmd", "test");
+ params.put("SlsExec", "false");
adapter.reqExecCommand(params, svcContext);
String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
params.put("Test", "success");
params.put("fileName", "src/test/resources/test-sls.json");
params.put("Id", "test1");
- params.put("cmd", "test");
- params.put("slsExec", "true");
+ params.put("Cmd", "test");
+ params.put("SlsExec", "true");
adapter.reqExecCommand(params, svcContext);
String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
params.put("Test", "success");
params.put("fileName", "src/test/resources/test.json");
params.put("Id", "test1");
- params.put("cmd", "test");
- params.put("slsExec", "true");
+ params.put("Cmd", "test");
+ params.put("SlsExec", "true");
adapter.reqExecCommand(params, svcContext);
TestId = svcContext.getAttribute("org.onap.appc.adapter.saltstack.Id");
params.put("Test", "success");
params.put("fileName", "src/test/resources/test.txt");
params.put("Id", "txt");
- params.put("cmd", "test");
- params.put("slsExec", "false");
+ params.put("Cmd", "test");
+ params.put("SlsExec", "false");
adapter.reqExecCommand(params, svcContext);
String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
params.put("Test", "success");
params.put("fileName", "src/test/resources/test");
params.put("Id", "txt");
- params.put("cmd", "test");
- params.put("slsExec", "false");
+ params.put("Cmd", "test");
+ params.put("SlsExec", "false");
adapter.reqExecCommand(params, svcContext);
String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
params.put("Test", "success");
params.put("fileName", "src/test/resources/test-invalid.json");
params.put("Id", "test1");
- params.put("cmd", "test");
- params.put("slsExec", "false");
+ params.put("Cmd", "test");
+ params.put("SlsExec", "false");
adapter.reqExecCommand(params, svcContext);
String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
params.put("Password", "test");
params.put("Test", "success");
params.put("fileName", "src/test/resources/test.json");
- params.put("cmd", "test");
- params.put("slsExec", "false");
+ params.put("Cmd", "test");
+ params.put("SlsExec", "false");
adapter.reqExecCommand(params, svcContext);
String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
params.put("User", "test");
params.put("Password", "test");
params.put("Test", "success");
- params.put("slsFile", "src/test/resources/test.sls");
+ params.put("SlsFile", "src/test/resources/test.sls");
params.put("fileName", "src/test/resources/test-sls.json");
params.put("Id", "test1");
- params.put("cmd", "test");
+ params.put("Cmd", "test");
adapter.reqExecSLSFile(params, svcContext);
String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
params.put("User", "test");
params.put("Password", "test");
params.put("Test", "success");
- params.put("slsFile", "src/test/resources/test-none.sls");
+ params.put("SlsFile", "src/test/resources/test-none.sls");
params.put("fileName", "src/test/resources/test-sls.json");
params.put("Id", "test1");
params.put("User", "test");
params.put("Password", "test");
params.put("Test", "success");
- params.put("slsFile", "src/test/resources/test-none");
+ params.put("SlsFile", "src/test/resources/test-none");
params.put("fileName", "src/test/resources/test-sls.json");
params.put("Id", "test1");
params.put("User", "test");
params.put("Password", "test");
params.put("Test", "success");
- params.put("slsFile", "src/test/resources/test.json");
+ params.put("SlsFile", "src/test/resources/test.json");
params.put("fileName", "src/test/resources/test-none.json");
params.put("Id", "test1");
params.put("User", "test");
params.put("Password", "test");
params.put("Test", "success");
- params.put("slsFile", "src/test/resources/test.json");
+ params.put("SlsFile", "src/test/resources/test.json");
params.put("fileName", "src/test/resources/test-sls.json");
params.put("Id", "test1");
- params.put("cmd", "test");
- params.put("applyTo", "minion1");
+ params.put("Cmd", "test");
+ params.put("NodeList", "minion1");
adapter.reqExecSLSFile(params, svcContext);
String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
params.put("User", "test");
params.put("Password", "test");
params.put("Test", "success");
- params.put("slsFile", "src/test/resources/test.sls");
+ params.put("SlsFile", "src/test/resources/test.sls");
params.put("fileName", "src/test/resources/test-sls.json");
params.put("Id", "test1");
- params.put("cmd", "test");
- params.put("applyTo", "minion1");
+ params.put("Cmd", "test");
+ params.put("NodeList", "minion1");
adapter.reqExecSLSFile(params, svcContext);
String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
params.put("User", "test");
params.put("Password", "test");
params.put("Test", "success");
- params.put("slsFile", "src/test/resources/test-none.json");
+ params.put("SlsFile", "src/test/resources/test-none.json");
params.put("fileName", "src/test/resources/test-sls.json");
params.put("Id", "test1");
- params.put("applyTo", "minion1");
+ params.put("NodeList", "minion1");
adapter.reqExecSLSFile(params, svcContext);
TestId = svcContext.getAttribute("org.onap.appc.adapter.saltstack.Id");
params.put("User", "test");
params.put("Password", "test");
params.put("Test", "success");
- params.put("slsFile", "src/test/resources/test.json");
+ params.put("SlsFile", "src/test/resources/test.json");
params.put("fileName", "src/test/resources/test-none.json");
params.put("Id", "test1");
- params.put("applyTo", "minion1");
+ params.put("NodeList", "minion1");
adapter.reqExecSLSFile(params, svcContext);
TestId = svcContext.getAttribute("org.onap.appc.adapter.saltstack.Id");
params.put("User", "test");
params.put("Password", "test");
params.put("Test", "success");
- params.put("slsFile", "src/test/resources/test.sls");
+ params.put("SlsFile", "src/test/resources/test.sls");
params.put("fileName", "src/test/resources/test-sls.json");
params.put("Id", "test1");
- params.put("cmd", "test");
- params.put("applyTo", "*");
+ params.put("Cmd", "test");
+ params.put("NodeList", "*");
adapter.reqExecSLSFile(params, svcContext);
String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
params.put("User", "test");
params.put("Password", "test");
params.put("Test", "success");
- params.put("slsFile", "src/test/resources/test-none.json");
+ params.put("SlsFile", "src/test/resources/test-none.json");
params.put("fileName", "src/test/resources/test-sls.json");
params.put("Id", "test1");
- params.put("applyTo", "*");
+ params.put("NodeList", "*");
adapter.reqExecSLSFile(params, svcContext);
TestId = svcContext.getAttribute("org.onap.appc.adapter.saltstack.Id");
params.put("User", "test");
params.put("Password", "test");
params.put("Test", "success");
- params.put("slsFile", "src/test/resources/test.json");
+ params.put("SlsFile", "src/test/resources/test.json");
params.put("fileName", "src/test/resources/test-none.json");
params.put("Id", "test1");
- params.put("applyTo", "*");
+ params.put("NodeList", "*");
adapter.reqExecSLSFile(params, svcContext);
TestId = svcContext.getAttribute("org.onap.appc.adapter.saltstack.Id");
params.put("User", "test");
params.put("Password", "test");
params.put("Test", "success");
- params.put("slsName", "src/test.sls");
+ params.put("SlsName", "src/test.sls");
params.put("fileName", "src/test/resources/test-sls.json");
params.put("Id", "test1");
- params.put("cmd", "test");
+ params.put("Cmd", "test");
adapter.reqExecSLS(params, svcContext);
String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
params.put("User", "test");
params.put("Password", "test");
params.put("Test", "success");
- params.put("slsName", "src/test");
+ params.put("SlsName", "src/test");
params.put("fileName", "src/test/resources/test-sls.json");
params.put("Id", "test1");
- params.put("cmd", "test");
+ params.put("Cmd", "test");
adapter.reqExecSLS(params, svcContext);
String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
params.put("User", "test");
params.put("Password", "test");
params.put("Test", "success");
- params.put("slsName", "src/test/resources/test.json");
+ params.put("SlsName", "src/test/resources/test.json");
params.put("fileName", "src/test/resources/test-none.json");
params.put("Id", "test1");
params.put("User", "test");
params.put("Password", "test");
params.put("Test", "success");
- params.put("slsName", "src/test/resources/test.sls");
+ params.put("SlsName", "src/test/resources/test.sls");
params.put("fileName", "src/test/resources/test-sls.json");
params.put("Id", "test1");
- params.put("cmd", "test");
- params.put("applyTo", "minion1");
+ params.put("Cmd", "test");
+ params.put("NodeList", "minion1");
adapter.reqExecSLS(params, svcContext);
String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
params.put("User", "test");
params.put("Password", "test");
params.put("Test", "success");
- params.put("slsName", "src/test/resources/test.json");
+ params.put("SlsName", "src/test/resources/test.json");
params.put("fileName", "src/test/resources/test-none.json");
params.put("Id", "test1");
- params.put("applyTo", "minion1");
+ params.put("NodeList", "minion1");
adapter.reqExecSLS(params, svcContext);
TestId = svcContext.getAttribute("org.onap.appc.adapter.saltstack.Id");
params.put("User", "test");
params.put("Password", "test");
params.put("Test", "success");
- params.put("slsName", "src/test/resources/test.sls");
+ params.put("SlsName", "src/test/resources/test.sls");
params.put("fileName", "src/test/resources/test-sls.json");
params.put("Id", "test1");
- params.put("cmd", "test");
- params.put("applyTo", "*");
+ params.put("Cmd", "test");
+ params.put("NodeList", "*");
adapter.reqExecSLS(params, svcContext);
String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
params.put("User", "test");
params.put("Password", "test");
params.put("Test", "success");
- params.put("slsName", "src/test/resources/test.json");
+ params.put("SlsName", "src/test/resources/test.json");
params.put("fileName", "src/test/resources/test-none.json");
params.put("Id", "test1");
- params.put("applyTo", "*");
+ params.put("NodeList", "*");
adapter.reqExecSLS(params, svcContext);
TestId = svcContext.getAttribute("org.onap.appc.adapter.saltstack.Id");
params.put("User", "sdn");
params.put("Password", "foo");
params.put("Id", "test1");
- params.put("cmd", "ls -l");
- params.put("slsExec", "false");
- params.put("execTimeout", "12000");
+ params.put("Cmd", "ls -l");
+ params.put("SlsExec", "false");
+ params.put("Timeout", "120");
adapter = new SaltstackAdapterImpl();
try {
adapter.reqExecCommand(params, svcContext);
assertEquals(TestId, "test1");
} catch (Exception e){
//if local ssh is not enabled
- return;
+ System.out.print(e.getMessage());
}
}
params.put("User", "root");
params.put("Password", "vagrant");
params.put("Id", "test1");
- params.put("cmd", "salt '*' test.ping --out=json --static");
- params.put("slsExec", "false");
- params.put("execTimeout", "12000");
+ params.put("Cmd", "salt '*' test.ping --out=json --static");
+ params.put("SlsExec", "false");
+ params.put("Timeout", "120");
adapter = new SaltstackAdapterImpl();
try {
assertEquals(TestId, "true");
} catch (Exception e){
//if saltstack ssh IP is not enabled
- return;
+ System.out.print(e.getMessage());
}
}
params.put("User", "root");
params.put("Password", "vagrant");
params.put("Id", "test1");
- params.put("cmd", "cd /srv/salt/; salt '*' state.apply vim --out=json --static");
- params.put("slsExec", "true");
- params.put("execTimeout", "12000");
+ params.put("Cmd", "cd /srv/salt/; salt '*' state.apply vim --out=json --static");
+ params.put("SlsExec", "true");
+ params.put("Timeout", "120");
adapter = new SaltstackAdapterImpl();
try {
assertEquals(TestId, "test1");
} catch (Exception e){
//if saltstack ssh IP is not enabled
- return;
+ System.out.print(e.getMessage());
}
}
params.put("User", "root");
params.put("Password", "vagrant");
params.put("Id", "test1");
- params.put("slsName", "vim");
- params.put("execTimeout", "12000");
- params.put("applyTo", "minion1");
+ params.put("SlsName", "vim");
+ params.put("Timeout", "120");
+ params.put("NodeList", "minion1");
+
+ adapter = new SaltstackAdapterImpl();
+ try {
+ adapter.reqExecSLS(params, svcContext);
+ String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
+ TestId = svcContext.getAttribute("org.onap.appc.adapter.saltstack.Id");
+ assertEquals("200", status);
+ assertEquals(TestId, "test1");
+ } catch (Exception e){
+ //if saltstack ssh IP is not enabled
+ System.out.print(e.getMessage());
+ }
+ }
+
+ @Test
+ public void reqExecCommand_shouldSetSuccessEnvParam() throws SvcLogicException,
+ IllegalStateException, IllegalArgumentException {
+
+ params.put("HostName", "<IP>");
+ params.put("Port", "2222");
+ params.put("User", "root");
+ params.put("Password", "vagrant");
+ params.put("Id", "test1");
+ params.put("SlsName", "vim");
+ params.put("Timeout", "120");
+ params.put("NodeList", "minion1");
+ params.put("EnvParameters", "{\"exclude\": bar*}");
+
+ adapter = new SaltstackAdapterImpl();
+ try {
+ adapter.reqExecSLS(params, svcContext);
+ String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
+ TestId = svcContext.getAttribute("org.onap.appc.adapter.saltstack.Id");
+ assertEquals("200", status);
+ assertEquals(TestId, "test1");
+ } catch (Exception e){
+ //if saltstack ssh IP is not enabled
+ System.out.print(e.getMessage());
+ }
+ }
+
+ @Test
+ public void reqExecCommand_shouldSetSuccessFileParam() throws SvcLogicException,
+ IllegalStateException, IllegalArgumentException {
+
+ params.put("HostName", "<IP>");
+ params.put("Port", "2222");
+ params.put("User", "root");
+ params.put("Password", "vagrant");
+ params.put("Id", "test1");
+ params.put("SlsName", "vim");
+ params.put("Timeout", "120");
+ params.put("NodeList", "minion1");
+ params.put("EnvParameters", "{\"exclude\": \"bar,baz\"}");
+ params.put("FileParameters", "{\"config.txt\":\"db_ip=10.1.1.1, sip_timer=10000\"}");
adapter = new SaltstackAdapterImpl();
try {
assertEquals(TestId, "test1");
} catch (Exception e){
//if saltstack ssh IP is not enabled
- return;
+ System.out.print(e.getMessage());
+ }
+ }
+
+ @Test
+ public void reqExecCommand_shouldSetSuccessPillarParam() throws SvcLogicException,
+ IllegalStateException, IllegalArgumentException {
+
+ params.put("HostName", "<IP>");
+ params.put("Port", "2222");
+ params.put("User", "root");
+ params.put("Password", "vagrant");
+ params.put("Id", "test1");
+ params.put("SlsName", "vim");
+ params.put("Timeout", "120");
+ params.put("NodeList", "minion1");
+ params.put("EnvParameters", "{\"exclude\": \"bar,baz\", \"pillar\":\"'{\\\"foo\\\": \\\"bar\\\"}'\"}");
+ params.put("FileParameters", "{\"config.txt\":\"db_ip=10.1.1.1, sip_timer=10000\"}");
+
+ adapter = new SaltstackAdapterImpl();
+ try {
+ adapter.reqExecSLS(params, svcContext);
+ String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
+ TestId = svcContext.getAttribute("org.onap.appc.adapter.saltstack.Id");
+ assertEquals("200", status);
+ assertEquals(TestId, "test1");
+ } catch (Exception e){
+ //if saltstack ssh IP is not enabled
+ System.out.print(e.getMessage());
+ }
+ }
+
+ @Test
+ public void reqExecCommand_shouldSetSuccessMultiFileParam() throws SvcLogicException,
+ IllegalStateException, IllegalArgumentException {
+
+ params.put("HostName", "<IP>");
+ params.put("Port", "2222");
+ params.put("User", "root");
+ params.put("Password", "vagrant");
+ params.put("Id", "test1");
+ params.put("SlsName", "vim");
+ params.put("Timeout", "120");
+ params.put("NodeList", "minion1");
+ params.put("EnvParameters", "{\"exclude\": bar*}");
+ params.put("FileParameters", "{\"config.txt\":\"db_ip=10.1.1.1, sip_timer=10000\" , \"config-tep.txt\":\"db_ip=10.1.1.1, sip_timer=10000\"}");
+
+ adapter = new SaltstackAdapterImpl();
+ try {
+ adapter.reqExecSLS(params, svcContext);
+ String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
+ TestId = svcContext.getAttribute("org.onap.appc.adapter.saltstack.Id");
+ assertEquals("200", status);
+ assertEquals(TestId, "test1");
+ } catch (Exception e){
+ //if saltstack ssh IP is not enabled
+ System.out.print(e.getMessage());
}
}
params.put("User", "root");
params.put("Password", "vagrant");
params.put("Id", "test1");
- params.put("execTimeout", "12000");
- params.put("applyTo", "minion1");
- params.put("slsFile", "src/test/resources/config.sls");
+ params.put("Timeout", "120");
+ params.put("NodeList", "minion1");
+ params.put("SlsFile", "src/test/resources/config.sls");
+
+ adapter = new SaltstackAdapterImpl();
+ try {
+ adapter.reqExecSLSFile(params, svcContext);
+ String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
+ TestId = svcContext.getAttribute("org.onap.appc.adapter.saltstack.Id");
+ assertEquals("200", status);
+ assertEquals(TestId, "test1");
+ } catch (Exception e){
+ //if saltstack ssh IP is not enabled
+ System.out.print(e.getMessage());
+ }
+ }
+
+ @Test
+ public void reqExecCommand_shouldSetSuccessSSLFileMultiFileParam() throws SvcLogicException,
+ IllegalStateException, IllegalArgumentException {
+
+ params.put("HostName", "<IP>");
+ params.put("Port", "2222");
+ params.put("User", "root");
+ params.put("Password", "vagrant");
+ params.put("Id", "test1");
+ params.put("Timeout", "120");
+ params.put("NodeList", "minion1");
+ params.put("SlsFile", "src/test/resources/config.sls");
+ params.put("EnvParameters", "{\"exclude\": bar, \"pillar\":\"'{\\\"foo\\\": \\\"bar\\\"}'\"}");
+ params.put("FileParameters", "{\"config.txt\":\"db_ip=10.1.1.1, sip_timer=10000\" , \"config-tep.txt\":\"db_ip=10.1.1.1, sip_timer=10000\"}");
adapter = new SaltstackAdapterImpl();
try {
assertEquals(TestId, "test1");
} catch (Exception e){
//if saltstack ssh IP is not enabled
- return;
+ System.out.print(e.getMessage());
}
}
}
/*-
* ============LICENSE_START=======================================================
- * ONAP : APPC
+ * ONAP : CCSDK
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018 Samsung Electronics. All rights reserved.
* ================================================================================
- * Copyright (C) 2017 Amdocs
+ *
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the License for the specific language governing permissions and
* limitations under the License.
*
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ *
* ============LICENSE_END=========================================================
*/
* ============LICENSE_START=======================================================
* openECOMP : SDN-C
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * Copyright (C) 2018 Samsung Electronics. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
###
# ============LICENSE_START=======================================================
-# ONAP : APPC
+# ONAP : CCSDK
# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright (C) 2018 Samsung Electronics. All rights reserved.
# ================================================================================
-# Copyright (C) 2017 Amdocs
+#
# =============================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# See the License for the specific language governing permissions and
# limitations under the License.
#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
# ============LICENSE_END=========================================================
###
"id": "d40bf650.8338e8",
"type": "returnFailure",
"name": "return failure",
- "xml": "<return status='failure'>\n<parameter name='error-code' value='200' />\n<parameter name='error-message' value='`$org.openecomp.appc.adapter.ansible.message`' />\n<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.ansible.results`' />\n",
+ "xml": "<return status='failure'>\n<parameter name='error-code' value='200' />\n<parameter name='error-message' value='`$org.openecomp.appc.adapter.saltstack.message`' />\n<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.saltstack.results`' />\n",
"comments": "",
"x": 1007,
"y": 373,
"id": "38662e01.1d3c22",
"type": "execute",
"name": "execute",
- "xml": "<execute plugin='org.openecomp.appc.adapter.ansible.AnsibleAdapter' method='reqExecCommand' >\n <parameter name='HostName' value='`$AgentUrl`'/>\n <parameter name='Port' value='`$Port`'/>\n <parameter name='User' value='`$User`'/>\n <parameter name='Password' value='`$Password`'/>\n <parameter name='Id' value='test1'/>\n <parameter name='cmd' value='cd /srv/salt; ls -l'/>\n <parameter name='slsExec' value='false'/>\n <parameter name='execTimeout' value='`$Timeout`'/>\n",
+ "xml": "<execute plugin='org.openecomp.appc.adapter.saltstack.SaltstackAdapter' method='reqExecCommand' >\n <parameter name='HostName' value='`$AgentUrl`'/>\n <parameter name='Port' value='`$Port`'/>\n <parameter name='User' value='`$User`'/>\n <parameter name='Password' value='`$Password`'/>\n <parameter name='Id' value='test1'/>\n <parameter name='Cmd' value='cd /srv/salt; ls -l'/>\n <parameter name='SlsExec' value='false'/>\n <parameter name='Timeout' value='`$Timeout`'/>\n",
"comments": "",
"outputs": 1,
"x": 700,
"id": "1f81a3db.54cd1c",
"type": "returnSuccess",
"name": "return success",
- "xml": "<return status='success'>\n<parameter name='output.status.code' value='`$org.openecomp.appc.adapter.ansible.result.code`' />\n<parameter name='output.status.message' value='`$org.openecomp.appc.adapter.ansible.message`'/>\n<parameter name='output.status.results' value = '`$org.openecomp.appc.adapter.ansible.results`'/>\n",
+ "xml": "<return status='success'>\n<parameter name='output.status.code' value='`$org.openecomp.appc.adapter.saltstack.result.code`' />\n<parameter name='output.status.message' value='`$org.openecomp.appc.adapter.saltstack.message`'/>\n<parameter name='output.status.results' value = '`$org.openecomp.appc.adapter.saltstack.results`'/>\n",
"comments": "",
"x": 887,
"y": 460,
xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd'\r
module='APPC' version='2.0.1'>\r
<method rpc='saltstack-adapter-1.0-exe-nonSLS' mode='sync'>\r
- <execute plugin='org.openecomp.appc.adapter.ansible.AnsibleAdapter'\r
+ <execute plugin='org.openecomp.appc.adapter.ansible.SaltstackAdapter'\r
method='reqExecCommand'>\r
<parameter name='HostName' value='`$AgentUrl`'/>\r
<parameter name='Port' value='`$Port`'/>\r
<parameter name='User' value='`$User`'/>\r
<parameter name='Password' value='`$Password`'/>\r
<parameter name='Id' value='test1'/>\r
- <parameter name='cmd' value='cd /srv/salt; ls -l'/>\r
- <parameter name='slsExec' value='false'/>\r
- <parameter name='execTimeout' value='`$Timeout`'/>\r
+ <parameter name='Cmd' value='cd /srv/salt; ls -l'/>\r
+ <parameter name='SlsExec' value='false'/>\r
+ <parameter name='Timeout' value='`$Timeout`'/>\r
<outcome value='failure'>\r
<return status='failure'>\r
<parameter name='error-code' value='200'/>\r
"id": "65cc87e2.a95188",
"type": "execute",
"name": "execute",
- "xml": "<execute plugin='org.openecomp.appc.adapter.ansible.AnsibleAdapter' method='reqExecCommand' >\n <parameter name='HostName' value='`$AgentUrl`'/>\n <parameter name='Port' value='`$Port`'/>\n <parameter name='User' value='`$User`'/>\n <parameter name='Password' value='`$Password`'/>\n <parameter name='Id' value='test1'/>\n <parameter name='cmd' value='salt '*' test.ping --out=json --static'/>\n <parameter name='slsExec' value='false'/>\n <parameter name='execTimeout' value='`$Timeout`'/>\n",
+ "xml": "<execute plugin='org.openecomp.appc.adapter.ansible.SaltstackAdapter' method='reqExecCommand' >\n <parameter name='HostName' value='`$AgentUrl`'/>\n <parameter name='Port' value='`$Port`'/>\n <parameter name='User' value='`$User`'/>\n <parameter name='Password' value='`$Password`'/>\n <parameter name='Id' value='test1'/>\n <parameter name='Cmd' value='salt '*' test.ping --out=json --static'/>\n <parameter name='SlsExec' value='false'/>\n <parameter name='Timeout' value='`$Timeout`'/>\n",
"comments": "",
"outputs": 1,
"x": 761,
"id": "770411a5.18825",
"type": "execute",
"name": "execute",
- "xml": "<execute plugin='org.openecomp.appc.adapter.ansible.AnsibleAdapter' method='reqExecCommand' >\n <parameter name='HostName' value='`$AgentUrl`'/>\n <parameter name='Port' value='`$Port`'/>\n <parameter name='User' value='`$User`'/>\n <parameter name='Password' value='`$Password`'/>\n <parameter name='Id' value='test2'/>\n <parameter name='cmd' value='cd /srv/salt/; salt 'minion1' state.apply vim --out=json --static'/>\n <parameter name='slsExec' value='true'/>\n <parameter name='execTimeout' value='`$Timeout`'/>\n",
+ "xml": "<execute plugin='org.openecomp.appc.adapter.ansible.SaltstackAdapter' method='reqExecCommand' >\n <parameter name='HostName' value='`$AgentUrl`'/>\n <parameter name='Port' value='`$Port`'/>\n <parameter name='User' value='`$User`'/>\n <parameter name='Password' value='`$Password`'/>\n <parameter name='Id' value='test2'/>\n <parameter name='Cmd' value='cd /srv/salt/; salt 'minion1' state.apply vim --out=json --static'/>\n <parameter name='SlsExec' value='true'/>\n <parameter name='Timeout' value='`$Timeout`'/>\n",
"comments": "",
"outputs": 1,
"x": 773,
xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd'\r
module='APPC' version='2.0.1'>\r
<method rpc='saltstack-adapter-1.0-exec-SLSFile' mode='sync'>\r
- <execute plugin='org.openecomp.appc.adapter.ansible.AnsibleAdapter'\r
+ <execute plugin='org.openecomp.appc.adapter.ansible.SaltstackAdapter'\r
method='reqExecCommand'>\r
<parameter name='HostName' value='`$AgentUrl`'/>\r
<parameter name='Port' value='`$Port`'/>\r
<parameter name='User' value='`$User`'/>\r
<parameter name='Password' value='`$Password`'/>\r
<parameter name='Id' value='test1'/>\r
- <parameter name='cmd'\r
+ <parameter name='Cmd'\r
value='salt '*' test.ping --out=json --static'/>\r
- <parameter name='slsExec' value='false'/>\r
- <parameter name='execTimeout' value='`$Timeout`'/>\r
+ <parameter name='SlsExec' value='false'/>\r
+ <parameter name='Timeout' value='`$Timeout`'/>\r
<outcome value='failure'>\r
<return status='failure'>\r
<parameter name='error-code' value='200'/>\r
</outcome>\r
<outcome value='true'>\r
<execute\r
- plugin='org.openecomp.appc.adapter.ansible.AnsibleAdapter'\r
+ plugin='org.openecomp.appc.adapter.ansible.SaltstackAdapter'\r
method='reqExecCommand'>\r
<parameter name='HostName'\r
value='`$AgentUrl`'/>\r
<parameter name='Password'\r
value='`$Password`'/>\r
<parameter name='Id' value='test2'/>\r
- <parameter name='cmd'\r
+ <parameter name='Cmd'\r
value='cd /srv/salt/; salt 'minion1' state.apply vim --out=json --static'/>\r
- <parameter name='slsExec' value='true'/>\r
- <parameter name='execTimeout'\r
+ <parameter name='SlsExec' value='true'/>\r
+ <parameter name='Timeout'\r
value='`$Timeout`'/>\r
<outcome value='failure'>\r
<return status='failure'>\r
"id": "c332cb01.51a3e8",
"type": "execute",
"name": "execute",
- "xml": "<execute plugin='org.openecomp.appc.adapter.ansible.AnsibleAdapter' method='reqExecCommand' >\n <parameter name='HostName' value='`$AgentUrl`'/>\n <parameter name='Port' value='`$Port`'/>\n <parameter name='User' value='`$User`'/>\n <parameter name='Password' value='`$Password`'/>\n <parameter name='Id' value='test1'/>\n <parameter name='cmd' value='salt '*' test.ping --out=json --static'/>\n <parameter name='slsExec' value='false'/>\n <parameter name='execTimeout' value='`$Timeout`'/>\n",
+ "xml": "<execute plugin='org.openecomp.appc.adapter.ansible.SaltstackAdapter' method='reqExecCommand' >\n <parameter name='HostName' value='`$AgentUrl`'/>\n <parameter name='Port' value='`$Port`'/>\n <parameter name='User' value='`$User`'/>\n <parameter name='Password' value='`$Password`'/>\n <parameter name='Id' value='test1'/>\n <parameter name='Cmd' value='salt '*' test.ping --out=json --static'/>\n <parameter name='SlsExec' value='false'/>\n <parameter name='Timeout' value='`$Timeout`'/>\n",
"comments": "",
"outputs": 1,
"x": 824,
"id": "df0c0907.d17838",
"type": "execute",
"name": "execute",
- "xml": "<execute plugin='org.openecomp.appc.adapter.ansible.AnsibleAdapter' method='reqExecCommand' >\n <parameter name='HostName' value='`$AgentUrl`'/>\n <parameter name='Port' value='`$Port`'/>\n <parameter name='User' value='`$User`'/>\n <parameter name='Password' value='`$Password`'/>\n <parameter name='Id' value='test2'/>\n <parameter name='cmd' value='salt 'minion1' pkg.install vim --out=json --static'/>\n <parameter name='slsExec' value='false'/>\n <parameter name='execTimeout' value='`$Timeout`'/>\n",
+ "xml": "<execute plugin='org.openecomp.appc.adapter.ansible.SaltstackAdapter' method='reqExecCommand' >\n <parameter name='HostName' value='`$AgentUrl`'/>\n <parameter name='Port' value='`$Port`'/>\n <parameter name='User' value='`$User`'/>\n <parameter name='Password' value='`$Password`'/>\n <parameter name='Id' value='test2'/>\n <parameter name='Cmd' value='salt 'minion1' pkg.install vim --out=json --static'/>\n <parameter name='SlsExec' value='false'/>\n <parameter name='Timeout' value='`$Timeout`'/>\n",
"comments": "",
"outputs": 1,
"x": 836,
xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd'\r
module='APPC' version='2.0.1'>\r
<method rpc='saltstack-adapter-1.0-exec-multi-sls' mode='sync'>\r
- <execute plugin='org.openecomp.appc.adapter.ansible.AnsibleAdapter'\r
+ <execute plugin='org.openecomp.appc.adapter.saltstack.SaltstackAdapter'\r
method='reqExecCommand'>\r
<parameter name='HostName' value='`$AgentUrl`'/>\r
<parameter name='Port' value='`$Port`'/>\r
<parameter name='User' value='`$User`'/>\r
<parameter name='Password' value='`$Password`'/>\r
<parameter name='Id' value='test1'/>\r
- <parameter name='cmd'\r
+ <parameter name='Cmd'\r
value='salt '*' test.ping --out=json --static'/>\r
- <parameter name='slsExec' value='false'/>\r
- <parameter name='execTimeout' value='`$Timeout`'/>\r
+ <parameter name='SlsExec' value='false'/>\r
+ <parameter name='Timeout' value='`$Timeout`'/>\r
<outcome value='failure'>\r
<return status='failure'>\r
<parameter name='error-code' value='200'/>\r
<parameter name='error-message'\r
- value='`$org.openecomp.appc.adapter.ansible.message`'/>\r
+ value='`$org.openecomp.appc.adapter.saltstack.message`'/>\r
<parameter name='output.status.results'\r
- value='`$org.openecomp.appc.adapter.ansible.results`'/>\r
+ value='`$org.openecomp.appc.adapter.saltstack.results`'/>\r
</return>\r
</outcome>\r
<outcome value='Other'>\r
<return status='failure'>\r
<parameter name='error-code' value='200'/>\r
<parameter name='error-message'\r
- value='`$org.openecomp.appc.adapter.ansible.message`'/>\r
+ value='`$org.openecomp.appc.adapter.saltstack.message`'/>\r
<parameter name='output.status.results'\r
- value='`$org.openecomp.appc.adapter.ansible.results`'/>\r
+ value='`$org.openecomp.appc.adapter.saltstack.results`'/>\r
</return>\r
</outcome>\r
<outcome value='200'>\r
<return status='failure'>\r
<parameter name='error-code' value='200'/>\r
<parameter name='error-message'\r
- value='`$org.openecomp.appc.adapter.ansible.message`'/>\r
+ value='`$org.openecomp.appc.adapter.saltstack.message`'/>\r
<parameter name='output.status.results'\r
- value='`$org.openecomp.appc.adapter.ansible.results`'/>\r
+ value='`$org.openecomp.appc.adapter.saltstack.results`'/>\r
</return>\r
</outcome>\r
<outcome value='true'>\r
<execute\r
- plugin='org.openecomp.appc.adapter.ansible.AnsibleAdapter'\r
+ plugin='org.openecomp.appc.adapter.saltstack.SaltstackAdapter'\r
method='reqExecCommand'>\r
<parameter name='HostName'\r
value='`$AgentUrl`'/>\r
<parameter name='Password'\r
value='`$Password`'/>\r
<parameter name='Id' value='test2'/>\r
- <parameter name='cmd'\r
+ <parameter name='Cmd'\r
value='salt 'minion1' pkg.install vim --out=json --static'/>\r
- <parameter name='slsExec' value='false'/>\r
- <parameter name='execTimeout'\r
+ <parameter name='SlsExec' value='false'/>\r
+ <parameter name='Timeout'\r
value='`$Timeout`'/>\r
<outcome value='failure'>\r
<return status='failure'>\r
<parameter name='error-code'\r
value='200'/>\r
<parameter name='error-message'\r
- value='`$org.openecomp.appc.adapter.ansible.message`'/>\r
+ value='`$org.openecomp.appc.adapter.saltstack.message`'/>\r
<parameter\r
name='output.status.results'\r
- value='`$org.openecomp.appc.adapter.ansible.results`'/>\r
+ value='`$org.openecomp.appc.adapter.saltstack.results`'/>\r
</return>\r
</outcome>\r
<outcome value='Other'>\r
"id": "f4e59dd0.ee45f",
"type": "execute",
"name": "execute",
- "xml": "<execute plugin='org.openecomp.appc.adapter.ansible.AnsibleAdapter' method='reqExecCommand' >\n <parameter name='HostName' value='`$AgentUrl`'/>\n <parameter name='Port' value='`$Port`'/>\n <parameter name='User' value='`$User`'/>\n <parameter name='Password' value='`$Password`'/>\n <parameter name='Id' value='test1'/>\n <parameter name='cmd' value='salt '*' test.ping --out=json --static'/>\n <parameter name='slsExec' value='false'/>\n <parameter name='execTimeout' value='`$Timeout`'/>\n",
+ "xml": "<execute plugin='org.openecomp.appc.adapter.ansible.SaltstackAdapter' method='reqExecCommand' >\n <parameter name='HostName' value='`$AgentUrl`'/>\n <parameter name='Port' value='`$Port`'/>\n <parameter name='User' value='`$User`'/>\n <parameter name='Password' value='`$Password`'/>\n <parameter name='Id' value='test1'/>\n <parameter name='Cmd' value='salt '*' test.ping --out=json --static'/>\n <parameter name='SlsExec' value='false'/>\n <parameter name='Timeout' value='`$Timeout`'/>\n",
"comments": "",
"outputs": 1,
"x": 735,
xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd'\r
module='APPC' version='2.0.1'>\r
<method rpc='saltstack-adapter-1.0-exec-single-SLSComm' mode='sync'>\r
- <execute plugin='org.openecomp.appc.adapter.ansible.AnsibleAdapter'\r
+ <execute plugin='org.openecomp.appc.adapter.ansible.SaltstackAdapter'\r
method='reqExecCommand'>\r
<parameter name='HostName' value='`$AgentUrl`'/>\r
<parameter name='Port' value='`$Port`'/>\r
<parameter name='User' value='`$User`'/>\r
<parameter name='Password' value='`$Password`'/>\r
<parameter name='Id' value='test1'/>\r
- <parameter name='cmd'\r
+ <parameter name='Cmd'\r
value='salt '*' test.ping --out=json --static'/>\r
- <parameter name='slsExec' value='false'/>\r
- <parameter name='execTimeout' value='`$Timeout`'/>\r
+ <parameter name='SlsExec' value='false'/>\r
+ <parameter name='Timeout' value='`$Timeout`'/>\r
<outcome value='failure'>\r
<return status='failure'>\r
<parameter name='error-code' value='200'/>\r
-[{"id":"b9234075.7e20b","type":"method","name":"saltstack-adapter-1.0","xml":"<method rpc='saltstack-adapter-1.0' mode='sync'>\n","comments":"","outputs":1,"x":589,"y":221,"z":"8c500c8b.91561","wires":[["a9f084e0.590cc8"]]},{"id":"159aca46.2fdf66","type":"service-logic","name":"APPC 2.0.1","module":"APPC","version":"2.0.1","comments":"","xml":"<service-logic xmlns='http://www.onap.org/sdnc/svclogic' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd' module='APPC' version='2.0.1'>","outputs":1,"x":366,"y":220,"z":"8c500c8b.91561","wires":[["b9234075.7e20b"]]},{"id":"f809843e.12d3b8","type":"returnSuccess","name":"return success","xml":"<return status='success'>\n<parameter name='output.status.code' value='`$org.openecomp.appc.adapter.ansible.result.code`' />\n<parameter name='output.status.message' value='`$org.openecomp.appc.adapter.ansible.message`'/>\n<parameter name='output.status.results' value = '`$org.openecomp.appc.adapter.ansible.results`'/>\n","comments":"","x":968,"y":313,"z":"8c500c8b.91561","wires":[]},{"id":"cad8db4d.3d8978","type":"dgstart","name":"DGSTART","outputs":1,"x":197,"y":219,"z":"8c500c8b.91561","wires":[["159aca46.2fdf66"]]},{"id":"96da3695.f3ade8","type":"comment","name":"SaltStack Adaptor DG","info":"","comments":"","x":574,"y":98,"z":"8c500c8b.91561","wires":[]},{"id":"f3c2409c.90b75","type":"comment","name":"request-method = reqExecSLS, req-action = \"execute SLS\"","info":"This would be the ideal adaptor the orchestrator DG will call, this just takes in slsName.","comments":"","x":585,"y":183,"z":"8c500c8b.91561","wires":[]},{"id":"206ad453.90dcdc","type":"comment","name":"Assumptions for this DG (example-server)","info":"Here we assume, the saltstack server is the example-vagrant based server. Where, the master saltstact controllers minion1 and minion2. ","comments":"","x":577,"y":139,"z":"8c500c8b.91561","wires":[]},{"id":"a9f084e0.590cc8","type":"execute","name":"execute","xml":"<execute plugin='org.openecomp.appc.adapter.ansible.AnsibleAdapter' method='reqExecCommand' >\n <parameter name='HostName' value='`$AgentUrl`'/>\n <parameter name='Port' value='`$Port`'/>\n <parameter name='User' value='`$User`'/>\n <parameter name='Password' value='`$Password`'/>\n <parameter name='Id' value='test2'/>\n <parameter name='slsName' value='test-file.sls'/>\n","comments":"","outputs":1,"x":279,"y":350,"z":"8c500c8b.91561","wires":[["953d6f9.633bc9","2b0177ad.6a0c88"]]},{"id":"953d6f9.633bc9","type":"failure","name":"failure","xml":"<outcome value='failure'>\n","comments":"","outputs":1,"x":472,"y":311,"z":"8c500c8b.91561","wires":[["56ac40b9.ab7d9"]]},{"id":"2b0177ad.6a0c88","type":"other","name":"other","xml":"<outcome value='Other'>\n","comments":"","outputs":1,"x":470,"y":383,"z":"8c500c8b.91561","wires":[["245f2c0b.5f8894"]]},{"id":"245f2c0b.5f8894","type":"switchNode","name":"switch","xml":"<switch test=\"`$org.onap.appc.adapter.saltstack.result.code`\">\n","comments":"","outputs":1,"x":622,"y":371,"z":"8c500c8b.91561","wires":[["9cb78c41.7c1fc","a2c5d59b.172848"]]},{"id":"a2c5d59b.172848","type":"success","name":"success","xml":"<outcome value='200'>\n","comments":"","outputs":1,"x":785,"y":317,"z":"8c500c8b.91561","wires":[["f809843e.12d3b8"]]},{"id":"9cb78c41.7c1fc","type":"other","name":"other","xml":"<outcome value='Other'>\n","comments":"","outputs":1,"x":782,"y":386,"z":"8c500c8b.91561","wires":[["2ca5c925.6ee136"]]},{"id":"56ac40b9.ab7d9","type":"returnFailure","name":"return failure","xml":"<return status='failure'>\n<parameter name='error-code' value='200' />\n<parameter name='error-message' value='`$org.openecomp.appc.adapter.ansible.message`' />\n<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.ansible.results`' />\n","comments":"","x":632,"y":295,"z":"8c500c8b.91561","wires":[]},{"id":"2ca5c925.6ee136","type":"returnFailure","name":"return failure","xml":"<return status='failure'>\n<parameter name='error-code' value='200' />\n<parameter name='error-message' value='`$org.openecomp.appc.adapter.ansible.message`' />\n<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.ansible.results`' />\n","comments":"","x":952,"y":383,"z":"8c500c8b.91561","wires":[]}]
\ No newline at end of file
+[
+ {
+ "id": "80b83851.e527b8",
+ "type": "method",
+ "name": "saltstack-adapter-1.0",
+ "xml": "<method rpc='saltstack-adapter-1.0' mode='sync'>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 676,
+ "y": 277,
+ "z": "1f6661d7.1ebd2e",
+ "wires": [
+ [
+ "83c8d47e.cb9c98"
+ ]
+ ]
+ },
+ {
+ "id": "41231c44.5d1324",
+ "type": "service-logic",
+ "name": "APPC 2.0.1",
+ "module": "APPC",
+ "version": "2.0.1",
+ "comments": "",
+ "xml": "<service-logic xmlns='http://www.onap.org/sdnc/svclogic' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd' module='APPC' version='2.0.1'>",
+ "outputs": 1,
+ "x": 453,
+ "y": 276,
+ "z": "1f6661d7.1ebd2e",
+ "wires": [
+ [
+ "80b83851.e527b8"
+ ]
+ ]
+ },
+ {
+ "id": "1f4a794d.fb3be7",
+ "type": "returnSuccess",
+ "name": "return success",
+ "xml": "<return status='success'>\n<parameter name='output.status.code' value='`$org.openecomp.appc.adapter.saltstack.result.code`' />\n<parameter name='output.status.message' value='`$org.openecomp.appc.adapter.saltstack.message`'/>\n<parameter name='output.status.results' value = '`$org.openecomp.appc.adapter.saltstack.results`'/>\n",
+ "comments": "",
+ "x": 1055,
+ "y": 369,
+ "z": "1f6661d7.1ebd2e",
+ "wires": []
+ },
+ {
+ "id": "5a85036.5a9e2fc",
+ "type": "dgstart",
+ "name": "DGSTART",
+ "outputs": 1,
+ "x": 284,
+ "y": 275,
+ "z": "1f6661d7.1ebd2e",
+ "wires": [
+ [
+ "41231c44.5d1324"
+ ]
+ ]
+ },
+ {
+ "id": "b38fc61c.a23438",
+ "type": "comment",
+ "name": "SaltStack Adaptor DG",
+ "info": "",
+ "comments": "",
+ "x": 661,
+ "y": 154,
+ "z": "1f6661d7.1ebd2e",
+ "wires": []
+ },
+ {
+ "id": "6a821d83.4070e4",
+ "type": "comment",
+ "name": "request-method = reqExecSLS, req-action = \"execute SLS\"",
+ "info": "This would be the ideal adaptor the orchestrator DG will call, this just takes in SlsName.",
+ "comments": "",
+ "x": 672,
+ "y": 239,
+ "z": "1f6661d7.1ebd2e",
+ "wires": []
+ },
+ {
+ "id": "ba16960c.36bad8",
+ "type": "comment",
+ "name": "Assumptions for this DG (example-server)",
+ "info": "Here we assume, the saltstack server is the example-vagrant based server. Where, the master saltstact controllers minion1 and minion2. ",
+ "comments": "",
+ "x": 664,
+ "y": 195,
+ "z": "1f6661d7.1ebd2e",
+ "wires": []
+ },
+ {
+ "id": "83c8d47e.cb9c98",
+ "type": "execute",
+ "name": "execute",
+ "xml": "<execute plugin='org.openecomp.appc.adapter.saltstack.SaltstackAdapter' method='reqExecCommand' >\n <parameter name='HostName' value='`$AgentUrl`'/>\n <parameter name='Port' value='`$Port`'/>\n <parameter name='User' value='`$User`'/>\n <parameter name='Password' value='`$Password`'/>\n <parameter name='Id' value='test2'/>\n <parameter name='SlsName' value='test-file.sls'/>\n <parameter name='NodeList' value='`$NodeList`'/>\n <parameter name='Timeout' value='`$Timeout`'/>\n <parameter name='FileParameters' value='`$FileParameters`'/>\n <parameter name='EnvParameters' value='`$EnvParameters`'/>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 366,
+ "y": 406,
+ "z": "1f6661d7.1ebd2e",
+ "wires": [
+ [
+ "b83f5a23.33f938",
+ "3354190.eb450e8"
+ ]
+ ]
+ },
+ {
+ "id": "b83f5a23.33f938",
+ "type": "failure",
+ "name": "failure",
+ "xml": "<outcome value='failure'>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 559,
+ "y": 367,
+ "z": "1f6661d7.1ebd2e",
+ "wires": [
+ [
+ "efc02e73.0cf1d"
+ ]
+ ]
+ },
+ {
+ "id": "3354190.eb450e8",
+ "type": "other",
+ "name": "other",
+ "xml": "<outcome value='Other'>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 557,
+ "y": 439,
+ "z": "1f6661d7.1ebd2e",
+ "wires": [
+ [
+ "88b53985.e42758"
+ ]
+ ]
+ },
+ {
+ "id": "88b53985.e42758",
+ "type": "switchNode",
+ "name": "switch",
+ "xml": "<switch test=\"`$org.onap.appc.adapter.saltstack.result.code`\">\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 709,
+ "y": 427,
+ "z": "1f6661d7.1ebd2e",
+ "wires": [
+ [
+ "195a294e.61efb7",
+ "bc1bfd78.146bc"
+ ]
+ ]
+ },
+ {
+ "id": "bc1bfd78.146bc",
+ "type": "success",
+ "name": "success",
+ "xml": "<outcome value='200'>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 872,
+ "y": 373,
+ "z": "1f6661d7.1ebd2e",
+ "wires": [
+ [
+ "1f4a794d.fb3be7"
+ ]
+ ]
+ },
+ {
+ "id": "195a294e.61efb7",
+ "type": "other",
+ "name": "other",
+ "xml": "<outcome value='Other'>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 869,
+ "y": 442,
+ "z": "1f6661d7.1ebd2e",
+ "wires": [
+ [
+ "81ddc2e0.dce24"
+ ]
+ ]
+ },
+ {
+ "id": "efc02e73.0cf1d",
+ "type": "returnFailure",
+ "name": "return failure",
+ "xml": "<return status='failure'>\n<parameter name='error-code' value='200' />\n<parameter name='error-message' value='`$org.openecomp.appc.adapter.saltstack.message`' />\n<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.saltstack.results`' />\n",
+ "comments": "",
+ "x": 719,
+ "y": 351,
+ "z": "1f6661d7.1ebd2e",
+ "wires": []
+ },
+ {
+ "id": "81ddc2e0.dce24",
+ "type": "returnFailure",
+ "name": "return failure",
+ "xml": "<return status='failure'>\n<parameter name='error-code' value='200' />\n<parameter name='error-message' value='`$org.openecomp.appc.adapter.saltstack.message`' />\n<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.saltstack.results`' />\n",
+ "comments": "",
+ "x": 1039,
+ "y": 439,
+ "z": "1f6661d7.1ebd2e",
+ "wires": []
+ }
+]
\ No newline at end of file
-<service-logic xmlns='http://www.onap.org/sdnc/svclogic' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd' module='APPC' version='2.0.1'><method rpc='saltstack-adapter-1.0' mode='sync'>\r
-<execute plugin='org.openecomp.appc.adapter.ansible.AnsibleAdapter' method='reqExecCommand' >\r
- <parameter name='HostName' value='`$AgentUrl`'/>\r
- <parameter name='Port' value='`$Port`'/>\r
- <parameter name='User' value='`$User`'/>\r
- <parameter name='Password' value='`$Password`'/>\r
- <parameter name='Id' value='test2'/>\r
- <parameter name='slsName' value='test-file.sls'/>\r
-<outcome value='failure'>\r
-<return status='failure'>\r
-<parameter name='error-code' value='200' />\r
-<parameter name='error-message' value='`$org.openecomp.appc.adapter.ansible.message`' />\r
-<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.ansible.results`' />\r
-</return></outcome><outcome value='Other'>\r
-<switch test="`$org.onap.appc.adapter.saltstack.result.code`">\r
-<outcome value='200'>\r
-<return status='success'>\r
-<parameter name='output.status.code' value='`$org.openecomp.appc.adapter.ansible.result.code`' />\r
-<parameter name='output.status.message' value='`$org.openecomp.appc.adapter.ansible.message`'/>\r
-<parameter name='output.status.results' value = '`$org.openecomp.appc.adapter.ansible.results`'/>\r
-</return></outcome><outcome value='Other'>\r
-<return status='failure'>\r
-<parameter name='error-code' value='200' />\r
-<parameter name='error-message' value='`$org.openecomp.appc.adapter.ansible.message`' />\r
-<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.ansible.results`' />\r
-</return></outcome></switch></outcome></execute></method></service-logic>
\ No newline at end of file
+<service-logic xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'\r
+ xmlns='http://www.onap.org/sdnc/svclogic'\r
+ xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd'\r
+ module='APPC' version='2.0.1'>\r
+ <method rpc='saltstack-adapter-1.0' mode='sync'>\r
+ <execute plugin='org.openecomp.appc.adapter.saltstack.SaltstackAdapter'\r
+ method='reqExecCommand'>\r
+ <parameter name='HostName' value='`$AgentUrl`'/>\r
+ <parameter name='Port' value='`$Port`'/>\r
+ <parameter name='User' value='`$User`'/>\r
+ <parameter name='Password' value='`$Password`'/>\r
+ <parameter name='Id' value='test2'/>\r
+ <parameter name='SlsName' value='test-file.sls'/>\r
+ <parameter name='NodeList' value='`$NodeList`'/>\r
+ <parameter name='Timeout' value='`$Timeout`'/>\r
+ <parameter name='FileParameters' value='`$FileParameters`'/>\r
+ <parameter name='EnvParameters' value='`$EnvParameters`'/>\r
+ <outcome value='failure'>\r
+ <return status='failure'>\r
+ <parameter name='error-code' value='200'/>\r
+ <parameter name='error-message'\r
+ value='`$org.openecomp.appc.adapter.saltstack.message`'/>\r
+ <parameter name='output.status.results'\r
+ value='`$org.openecomp.appc.adapter.saltstack.results`'/>\r
+ </return>\r
+ </outcome>\r
+ <outcome value='Other'>\r
+ <switch test="`$org.onap.appc.adapter.saltstack.result.code`">\r
+ <outcome value='200'>\r
+ <return status='success'>\r
+ <parameter name='output.status.code'\r
+ value='`$org.openecomp.appc.adapter.saltstack.result.code`'/>\r
+ <parameter name='output.status.message'\r
+ value='`$org.openecomp.appc.adapter.saltstack.message`'/>\r
+ <parameter name='output.status.results'\r
+ value='`$org.openecomp.appc.adapter.saltstack.results`'/>\r
+ </return>\r
+ </outcome>\r
+ <outcome value='Other'>\r
+ <return status='failure'>\r
+ <parameter name='error-code' value='200'/>\r
+ <parameter name='error-message'\r
+ value='`$org.openecomp.appc.adapter.saltstack.message`'/>\r
+ <parameter name='output.status.results'\r
+ value='`$org.openecomp.appc.adapter.saltstack.results`'/>\r
+ </return>\r
+ </outcome>\r
+ </switch>\r
+ </outcome>\r
+ </execute>\r
+ </method>\r
+</service-logic>
\ No newline at end of file
-[{"id":"edb39979.b1ccd8","type":"method","name":"saltstack-adapter-1.0","xml":"<method rpc='saltstack-adapter-1.0-exec-SLS-applyTo' mode='sync'>\n","comments":"","outputs":1,"x":476,"y":245,"z":"671ca899.284f68","wires":[["95c9ba42.6e4aa8"]]},{"id":"a16ea11e.f8d1c","type":"service-logic","name":"APPC 2.0.1","module":"APPC","version":"2.0.1","comments":"","xml":"<service-logic xmlns='http://www.onap.org/sdnc/svclogic' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd' module='APPC' version='2.0.1'>","outputs":1,"x":267,"y":323,"z":"671ca899.284f68","wires":[["edb39979.b1ccd8"]]},{"id":"1591f92e.029ca7","type":"returnFailure","name":"return failure","xml":"<return status='failure'>\n<parameter name='error-code' value='200' />\n<parameter name='error-message' value='`$org.openecomp.appc.adapter.ansible.message`' />\n<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.ansible.results`' />\n","comments":"","x":1191,"y":315,"z":"671ca899.284f68","wires":[]},{"id":"95c9ba42.6e4aa8","type":"execute","name":"execute","xml":"<execute plugin='org.openecomp.appc.adapter.ansible.AnsibleAdapter' method='reqExecCommand' >\n <parameter name='HostName' value='`$AgentUrl`'/>\n <parameter name='Port' value='`$Port`'/>\n <parameter name='User' value='`$User`'/>\n <parameter name='Password' value='`$Password`'/>\n <parameter name='Id' value='test1'/>\n <parameter name='cmd' value='salt '*' test.ping --out=json --static'/>\n <parameter name='slsExec' value='false'/>\n <parameter name='execTimeout' value='`$Timeout`'/>\n","comments":"","outputs":1,"x":684,"y":251,"z":"671ca899.284f68","wires":[["cd0c458a.2430b8","69e531e3.4efc3"]]},{"id":"38b44d70.9c85d2","type":"switchNode","name":"switch","xml":"<switch test=\"`$org.onap.appc.adapter.saltstack.result.code`\">\n","comments":"","outputs":1,"x":472,"y":405,"z":"671ca899.284f68","wires":[["505df598.069b9c","5d7292e.22ec06c"]]},{"id":"505df598.069b9c","type":"other","name":"other","xml":"<outcome value='Other'>\n","comments":"","outputs":1,"x":658,"y":463,"z":"671ca899.284f68","wires":[["1591f92e.029ca7"]]},{"id":"cd0c458a.2430b8","type":"failure","name":"failure","xml":"<outcome value='failure'>\n","comments":"","outputs":1,"x":935,"y":244,"z":"671ca899.284f68","wires":[["1591f92e.029ca7"]]},{"id":"69e531e3.4efc3","type":"other","name":"other","xml":"<outcome value='Other'>\n","comments":"","outputs":1,"x":282,"y":412,"z":"671ca899.284f68","wires":[["38b44d70.9c85d2"]]},{"id":"5d7292e.22ec06c","type":"success","name":"success","xml":"<outcome value='200'>\n","comments":"","outputs":1,"x":661,"y":405,"z":"671ca899.284f68","wires":[["c9df0cea.f2361"]]},{"id":"e4f7eb59.0abb58","type":"returnSuccess","name":"return success","xml":"<return status='success'>\n<parameter name='output.status.code' value='`$org.openecomp.appc.adapter.ansible.result.code`' />\n<parameter name='output.status.message' value='`$org.openecomp.appc.adapter.ansible.message`'/>\n<parameter name='output.status.results' value = '`$org.openecomp.appc.adapter.ansible.results`'/>\n","comments":"","x":1079,"y":564,"z":"671ca899.284f68","wires":[]},{"id":"8e586da4.570f1","type":"dgstart","name":"DGSTART","outputs":1,"x":245,"y":223,"z":"671ca899.284f68","wires":[["a16ea11e.f8d1c"]]},{"id":"71387074.137c1","type":"comment","name":"SaltStack Adaptor DG","info":"","comments":"","x":623,"y":110,"z":"671ca899.284f68","wires":[]},{"id":"c5e8c62d.021758","type":"comment","name":"request-method = reqExecSLS, req-action = \"execute SLS\"","info":"Here we basically test if minion1 is active by pinging to it, then respective sls file is executed on to it. \n","comments":"","x":634,"y":195,"z":"671ca899.284f68","wires":[]},{"id":"1805797.a241487","type":"comment","name":"Assumptions for this DG (example-server)","info":"Here we assume, the saltstack server is the example-vagrant based server. Where, the master saltstact controllers minion1 and minion2. ","comments":"","x":626,"y":151,"z":"671ca899.284f68","wires":[]},{"id":"c9df0cea.f2361","type":"switchNode","name":"switch","xml":"<switch test=\"`$test1.minion1`\">\n","comments":"","outputs":1,"x":825,"y":405,"z":"671ca899.284f68","wires":[["d83d6024.2454d","f4d70bbc.f0bc38"]]},{"id":"d83d6024.2454d","type":"other","name":"other","xml":"<outcome value='Other'>\n","comments":"","outputs":1,"x":991,"y":459,"z":"671ca899.284f68","wires":[["1591f92e.029ca7"]]},{"id":"f4d70bbc.f0bc38","type":"other","name":"outcome","xml":"<outcome value='true'>\n","comments":"","outputs":1,"x":994,"y":401,"z":"671ca899.284f68","wires":[["e86d9995.b65c58"]]},{"id":"e86d9995.b65c58","type":"execute","name":"execute","xml":"<execute plugin='org.openecomp.appc.adapter.ansible.AnsibleAdapter' method='reqExecCommand' >\n <parameter name='HostName' value='`$AgentUrl`'/>\n <parameter name='Port' value='`$Port`'/>\n <parameter name='User' value='`$User`'/>\n <parameter name='Password' value='`$Password`'/>\n <parameter name='Id' value='test2'/>\n <parameter name='slsName' value='test-file.sls'/>\n <parameter name='applyTo' value='minion1'/>\n <parameter name='execTimeout' value='`$Timeout`'/>\n","comments":"","outputs":1,"x":398,"y":593,"z":"671ca899.284f68","wires":[["89ff1c2a.08f52","e20c4c85.43d3c"]]},{"id":"89ff1c2a.08f52","type":"failure","name":"failure","xml":"<outcome value='failure'>\n","comments":"","outputs":1,"x":583,"y":562,"z":"671ca899.284f68","wires":[["6032e33e.5b044c"]]},{"id":"e20c4c85.43d3c","type":"other","name":"other","xml":"<outcome value='Other'>\n","comments":"","outputs":1,"x":581,"y":634,"z":"671ca899.284f68","wires":[["8bb4c177.499c8"]]},{"id":"8bb4c177.499c8","type":"switchNode","name":"switch","xml":"<switch test=\"`$org.onap.appc.adapter.saltstack.result.code`\">\n","comments":"","outputs":1,"x":733,"y":622,"z":"671ca899.284f68","wires":[["905334fe.934d68","9c217c10.9d539"]]},{"id":"9c217c10.9d539","type":"success","name":"success","xml":"<outcome value='200'>\n","comments":"","outputs":1,"x":896,"y":568,"z":"671ca899.284f68","wires":[["e4f7eb59.0abb58"]]},{"id":"905334fe.934d68","type":"other","name":"other","xml":"<outcome value='Other'>\n","comments":"","outputs":1,"x":893,"y":637,"z":"671ca899.284f68","wires":[["7026a88c.5bffd8"]]},{"id":"6032e33e.5b044c","type":"returnFailure","name":"return failure","xml":"<return status='failure'>\n<parameter name='error-code' value='200' />\n<parameter name='error-message' value='`$org.openecomp.appc.adapter.ansible.message`' />\n<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.ansible.results`' />\n","comments":"","x":735,"y":559,"z":"671ca899.284f68","wires":[]},{"id":"7026a88c.5bffd8","type":"returnFailure","name":"return failure","xml":"<return status='failure'>\n<parameter name='error-code' value='200' />\n<parameter name='error-message' value='`$org.openecomp.appc.adapter.ansible.message`' />\n<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.ansible.results`' />\n","comments":"","x":1054,"y":637,"z":"671ca899.284f68","wires":[]}]
\ No newline at end of file
+[
+ {
+ "id": "edb39979.b1ccd8",
+ "type": "method",
+ "name": "saltstack-adapter-1.0",
+ "xml": "<method rpc='saltstack-adapter-1.0-exec-SLS-NodeList' mode='sync'>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 476,
+ "y": 245,
+ "z": "671ca899.284f68",
+ "wires": [
+ [
+ "95c9ba42.6e4aa8"
+ ]
+ ]
+ },
+ {
+ "id": "a16ea11e.f8d1c",
+ "type": "service-logic",
+ "name": "APPC 2.0.1",
+ "module": "APPC",
+ "version": "2.0.1",
+ "comments": "",
+ "xml": "<service-logic xmlns='http://www.onap.org/sdnc/svclogic' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd' module='APPC' version='2.0.1'>",
+ "outputs": 1,
+ "x": 267,
+ "y": 323,
+ "z": "671ca899.284f68",
+ "wires": [
+ [
+ "edb39979.b1ccd8"
+ ]
+ ]
+ },
+ {
+ "id": "1591f92e.029ca7",
+ "type": "returnFailure",
+ "name": "return failure",
+ "xml": "<return status='failure'>\n<parameter name='error-code' value='200' />\n<parameter name='error-message' value='`$org.openecomp.appc.adapter.saltstack.message`' />\n<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.saltstack.results`' />\n",
+ "comments": "",
+ "x": 1191,
+ "y": 315,
+ "z": "671ca899.284f68",
+ "wires": []
+ },
+ {
+ "id": "95c9ba42.6e4aa8",
+ "type": "execute",
+ "name": "execute",
+ "xml": "<execute plugin='org.openecomp.appc.adapter.saltstack.SaltstackAdapter' method='reqExecCommand' >\n <parameter name='HostName' value='`$AgentUrl`'/>\n <parameter name='Port' value='`$Port`'/>\n <parameter name='User' value='`$User`'/>\n <parameter name='Password' value='`$Password`'/>\n <parameter name='Id' value='test1'/>\n <parameter name='Cmd' value='salt '*' test.ping --out=json --static'/>\n <parameter name='SlsExec' value='false'/>\n <parameter name='Timeout' value='`$Timeout`'/>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 684,
+ "y": 251,
+ "z": "671ca899.284f68",
+ "wires": [
+ [
+ "cd0c458a.2430b8",
+ "69e531e3.4efc3"
+ ]
+ ]
+ },
+ {
+ "id": "38b44d70.9c85d2",
+ "type": "switchNode",
+ "name": "switch",
+ "xml": "<switch test=\"`$org.onap.appc.adapter.saltstack.result.code`\">\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 472,
+ "y": 405,
+ "z": "671ca899.284f68",
+ "wires": [
+ [
+ "505df598.069b9c",
+ "5d7292e.22ec06c"
+ ]
+ ]
+ },
+ {
+ "id": "505df598.069b9c",
+ "type": "other",
+ "name": "other",
+ "xml": "<outcome value='Other'>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 658,
+ "y": 463,
+ "z": "671ca899.284f68",
+ "wires": [
+ [
+ "1591f92e.029ca7"
+ ]
+ ]
+ },
+ {
+ "id": "cd0c458a.2430b8",
+ "type": "failure",
+ "name": "failure",
+ "xml": "<outcome value='failure'>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 935,
+ "y": 244,
+ "z": "671ca899.284f68",
+ "wires": [
+ [
+ "1591f92e.029ca7"
+ ]
+ ]
+ },
+ {
+ "id": "69e531e3.4efc3",
+ "type": "other",
+ "name": "other",
+ "xml": "<outcome value='Other'>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 282,
+ "y": 412,
+ "z": "671ca899.284f68",
+ "wires": [
+ [
+ "38b44d70.9c85d2"
+ ]
+ ]
+ },
+ {
+ "id": "5d7292e.22ec06c",
+ "type": "success",
+ "name": "success",
+ "xml": "<outcome value='200'>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 661,
+ "y": 405,
+ "z": "671ca899.284f68",
+ "wires": [
+ [
+ "c9df0cea.f2361"
+ ]
+ ]
+ },
+ {
+ "id": "e4f7eb59.0abb58",
+ "type": "returnSuccess",
+ "name": "return success",
+ "xml": "<return status='success'>\n<parameter name='output.status.code' value='`$org.openecomp.appc.adapter.saltstack.result.code`' />\n<parameter name='output.status.message' value='`$org.openecomp.appc.adapter.saltstack.message`'/>\n<parameter name='output.status.results' value = '`$org.openecomp.appc.adapter.saltstack.results`'/>\n",
+ "comments": "",
+ "x": 1079,
+ "y": 564,
+ "z": "671ca899.284f68",
+ "wires": []
+ },
+ {
+ "id": "8e586da4.570f1",
+ "type": "dgstart",
+ "name": "DGSTART",
+ "outputs": 1,
+ "x": 245,
+ "y": 223,
+ "z": "671ca899.284f68",
+ "wires": [
+ [
+ "a16ea11e.f8d1c"
+ ]
+ ]
+ },
+ {
+ "id": "71387074.137c1",
+ "type": "comment",
+ "name": "SaltStack Adaptor DG",
+ "info": "",
+ "comments": "",
+ "x": 623,
+ "y": 110,
+ "z": "671ca899.284f68",
+ "wires": []
+ },
+ {
+ "id": "c5e8c62d.021758",
+ "type": "comment",
+ "name": "request-method = reqExecSLS, req-action = \"execute SLS\"",
+ "info": "Here we basically test if minion1 is active by pinging to it, then respective sls file is executed on to it. \n",
+ "comments": "",
+ "x": 634,
+ "y": 195,
+ "z": "671ca899.284f68",
+ "wires": []
+ },
+ {
+ "id": "1805797.a241487",
+ "type": "comment",
+ "name": "Assumptions for this DG (example-server)",
+ "info": "Here we assume, the saltstack server is the example-vagrant based server. Where, the master saltstact controllers minion1 and minion2. ",
+ "comments": "",
+ "x": 626,
+ "y": 151,
+ "z": "671ca899.284f68",
+ "wires": []
+ },
+ {
+ "id": "c9df0cea.f2361",
+ "type": "switchNode",
+ "name": "switch",
+ "xml": "<switch test=\"`$test1.minion1`\">\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 825,
+ "y": 405,
+ "z": "671ca899.284f68",
+ "wires": [
+ [
+ "d83d6024.2454d",
+ "f4d70bbc.f0bc38"
+ ]
+ ]
+ },
+ {
+ "id": "d83d6024.2454d",
+ "type": "other",
+ "name": "other",
+ "xml": "<outcome value='Other'>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 991,
+ "y": 459,
+ "z": "671ca899.284f68",
+ "wires": [
+ [
+ "1591f92e.029ca7"
+ ]
+ ]
+ },
+ {
+ "id": "f4d70bbc.f0bc38",
+ "type": "other",
+ "name": "outcome",
+ "xml": "<outcome value='true'>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 994,
+ "y": 401,
+ "z": "671ca899.284f68",
+ "wires": [
+ [
+ "e86d9995.b65c58"
+ ]
+ ]
+ },
+ {
+ "id": "e86d9995.b65c58",
+ "type": "execute",
+ "name": "execute",
+ "xml": "<execute plugin='org.openecomp.appc.adapter.saltstack.SaltstackAdapter' method='reqExecCommand' >\n <parameter name='HostName' value='`$AgentUrl`'/>\n <parameter name='Port' value='`$Port`'/>\n <parameter name='User' value='`$User`'/>\n <parameter name='Password' value='`$Password`'/>\n <parameter name='Id' value='test2'/>\n <parameter name='SlsName' value='test-file.sls'/>\n <parameter name='NodeList' value='minion1'/>\n <parameter name='Timeout' value='`$Timeout`'/>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 398,
+ "y": 593,
+ "z": "671ca899.284f68",
+ "wires": [
+ [
+ "89ff1c2a.08f52",
+ "e20c4c85.43d3c"
+ ]
+ ]
+ },
+ {
+ "id": "89ff1c2a.08f52",
+ "type": "failure",
+ "name": "failure",
+ "xml": "<outcome value='failure'>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 583,
+ "y": 562,
+ "z": "671ca899.284f68",
+ "wires": [
+ [
+ "6032e33e.5b044c"
+ ]
+ ]
+ },
+ {
+ "id": "e20c4c85.43d3c",
+ "type": "other",
+ "name": "other",
+ "xml": "<outcome value='Other'>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 581,
+ "y": 634,
+ "z": "671ca899.284f68",
+ "wires": [
+ [
+ "8bb4c177.499c8"
+ ]
+ ]
+ },
+ {
+ "id": "8bb4c177.499c8",
+ "type": "switchNode",
+ "name": "switch",
+ "xml": "<switch test=\"`$org.onap.appc.adapter.saltstack.result.code`\">\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 733,
+ "y": 622,
+ "z": "671ca899.284f68",
+ "wires": [
+ [
+ "905334fe.934d68",
+ "9c217c10.9d539"
+ ]
+ ]
+ },
+ {
+ "id": "9c217c10.9d539",
+ "type": "success",
+ "name": "success",
+ "xml": "<outcome value='200'>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 896,
+ "y": 568,
+ "z": "671ca899.284f68",
+ "wires": [
+ [
+ "e4f7eb59.0abb58"
+ ]
+ ]
+ },
+ {
+ "id": "905334fe.934d68",
+ "type": "other",
+ "name": "other",
+ "xml": "<outcome value='Other'>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 893,
+ "y": 637,
+ "z": "671ca899.284f68",
+ "wires": [
+ [
+ "7026a88c.5bffd8"
+ ]
+ ]
+ },
+ {
+ "id": "6032e33e.5b044c",
+ "type": "returnFailure",
+ "name": "return failure",
+ "xml": "<return status='failure'>\n<parameter name='error-code' value='200' />\n<parameter name='error-message' value='`$org.openecomp.appc.adapter.saltstack.message`' />\n<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.saltstack.results`' />\n",
+ "comments": "",
+ "x": 735,
+ "y": 559,
+ "z": "671ca899.284f68",
+ "wires": []
+ },
+ {
+ "id": "7026a88c.5bffd8",
+ "type": "returnFailure",
+ "name": "return failure",
+ "xml": "<return status='failure'>\n<parameter name='error-code' value='200' />\n<parameter name='error-message' value='`$org.openecomp.appc.adapter.saltstack.message`' />\n<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.saltstack.results`' />\n",
+ "comments": "",
+ "x": 1054,
+ "y": 637,
+ "z": "671ca899.284f68",
+ "wires": []
+ }
+]
\ No newline at end of file
-<service-logic xmlns='http://www.onap.org/sdnc/svclogic' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd' module='APPC' version='2.0.1'><method rpc='saltstack-adapter-1.0-exec-SLS-applyTo' mode='sync'>\r
-<execute plugin='org.openecomp.appc.adapter.ansible.AnsibleAdapter' method='reqExecCommand' >\r
- <parameter name='HostName' value='`$AgentUrl`'/>\r
- <parameter name='Port' value='`$Port`'/>\r
- <parameter name='User' value='`$User`'/>\r
- <parameter name='Password' value='`$Password`'/>\r
- <parameter name='Id' value='test1'/>\r
- <parameter name='cmd' value='salt '*' test.ping --out=json --static'/>\r
- <parameter name='slsExec' value='false'/>\r
- <parameter name='execTimeout' value='`$Timeout`'/>\r
-<outcome value='failure'>\r
-<return status='failure'>\r
-<parameter name='error-code' value='200' />\r
-<parameter name='error-message' value='`$org.openecomp.appc.adapter.ansible.message`' />\r
-<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.ansible.results`' />\r
-</return></outcome><outcome value='Other'>\r
-<switch test="`$org.onap.appc.adapter.saltstack.result.code`">\r
-<outcome value='200'>\r
-<switch test="`$test1.minion1`">\r
-<outcome value='true'>\r
-<execute plugin='org.openecomp.appc.adapter.ansible.AnsibleAdapter' method='reqExecCommand' >\r
- <parameter name='HostName' value='`$AgentUrl`'/>\r
- <parameter name='Port' value='`$Port`'/>\r
- <parameter name='User' value='`$User`'/>\r
- <parameter name='Password' value='`$Password`'/>\r
- <parameter name='Id' value='test2'/>\r
- <parameter name='slsName' value='test-file.sls'/>\r
- <parameter name='applyTo' value='minion1'/>\r
- <parameter name='execTimeout' value='`$Timeout`'/>\r
-<outcome value='failure'>\r
-<return status='failure'>\r
-<parameter name='error-code' value='200' />\r
-<parameter name='error-message' value='`$org.openecomp.appc.adapter.ansible.message`' />\r
-<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.ansible.results`' />\r
-</return></outcome><outcome value='Other'>\r
-<switch test="`$org.onap.appc.adapter.saltstack.result.code`">\r
-<outcome value='200'>\r
-<return status='success'>\r
-<parameter name='output.status.code' value='`$org.openecomp.appc.adapter.ansible.result.code`' />\r
-<parameter name='output.status.message' value='`$org.openecomp.appc.adapter.ansible.message`'/>\r
-<parameter name='output.status.results' value = '`$org.openecomp.appc.adapter.ansible.results`'/>\r
-</return></outcome><outcome value='Other'>\r
-<return status='failure'>\r
-<parameter name='error-code' value='200' />\r
-<parameter name='error-message' value='`$org.openecomp.appc.adapter.ansible.message`' />\r
-<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.ansible.results`' />\r
-</return></outcome></switch></outcome></execute></outcome><outcome value='Other'>\r
-<return status='failure'>\r
-<parameter name='error-code' value='200' />\r
-<parameter name='error-message' value='`$org.openecomp.appc.adapter.ansible.message`' />\r
-<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.ansible.results`' />\r
-</return></outcome></switch></outcome><outcome value='Other'>\r
-<return status='failure'>\r
-<parameter name='error-code' value='200' />\r
-<parameter name='error-message' value='`$org.openecomp.appc.adapter.ansible.message`' />\r
-<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.ansible.results`' />\r
-</return></outcome></switch></outcome></execute></method></service-logic>
\ No newline at end of file
+<service-logic xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'\r
+ xmlns='http://www.onap.org/sdnc/svclogic'\r
+ xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd'\r
+ module='APPC' version='2.0.1'>\r
+ <method rpc='saltstack-adapter-1.0-exec-SLS-NodeList' mode='sync'>\r
+ <execute plugin='org.openecomp.appc.adapter.saltstack.SaltstackAdapter'\r
+ method='reqExecCommand'>\r
+ <parameter name='HostName' value='`$AgentUrl`'/>\r
+ <parameter name='Port' value='`$Port`'/>\r
+ <parameter name='User' value='`$User`'/>\r
+ <parameter name='Password' value='`$Password`'/>\r
+ <parameter name='Id' value='test1'/>\r
+ <parameter name='Cmd'\r
+ value='salt '*' test.ping --out=json --static'/>\r
+ <parameter name='SlsExec' value='false'/>\r
+ <parameter name='Timeout' value='`$Timeout`'/>\r
+ <outcome value='failure'>\r
+ <return status='failure'>\r
+ <parameter name='error-code' value='200'/>\r
+ <parameter name='error-message'\r
+ value='`$org.openecomp.appc.adapter.saltstack.message`'/>\r
+ <parameter name='output.status.results'\r
+ value='`$org.openecomp.appc.adapter.saltstack.results`'/>\r
+ </return>\r
+ </outcome>\r
+ <outcome value='Other'>\r
+ <switch test="`$org.onap.appc.adapter.saltstack.result.code`">\r
+ <outcome value='200'>\r
+ <switch test="`$test1.minion1`">\r
+ <outcome value='true'>\r
+ <execute\r
+ plugin='org.openecomp.appc.adapter.saltstack.SaltstackAdapter'\r
+ method='reqExecCommand'>\r
+ <parameter name='HostName'\r
+ value='`$AgentUrl`'/>\r
+ <parameter name='Port' value='`$Port`'/>\r
+ <parameter name='User' value='`$User`'/>\r
+ <parameter name='Password'\r
+ value='`$Password`'/>\r
+ <parameter name='Id' value='test2'/>\r
+ <parameter name='SlsName'\r
+ value='test-file.sls'/>\r
+ <parameter name='NodeList' value='minion1'/>\r
+ <parameter name='Timeout'\r
+ value='`$Timeout`'/>\r
+ <outcome value='failure'>\r
+ <return status='failure'>\r
+ <parameter name='error-code'\r
+ value='200'/>\r
+ <parameter name='error-message'\r
+ value='`$org.openecomp.appc.adapter.saltstack.message`'/>\r
+ <parameter\r
+ name='output.status.results'\r
+ value='`$org.openecomp.appc.adapter.saltstack.results`'/>\r
+ </return>\r
+ </outcome>\r
+ <outcome value='Other'>\r
+ <switch test="`$org.onap.appc.adapter.saltstack.result.code`">\r
+ <outcome value='200'>\r
+ <return status='success'>\r
+ <parameter\r
+ name='output.status.code'\r
+ value='`$org.openecomp.appc.adapter.saltstack.result.code`'/>\r
+ <parameter\r
+ name='output.status.message'\r
+ value='`$org.openecomp.appc.adapter.saltstack.message`'/>\r
+ <parameter\r
+ name='output.status.results'\r
+ value='`$org.openecomp.appc.adapter.saltstack.results`'/>\r
+ </return>\r
+ </outcome>\r
+ <outcome value='Other'>\r
+ <return status='failure'>\r
+ <parameter name='error-code'\r
+ value='200'/>\r
+ <parameter\r
+ name='error-message'\r
+ value='`$org.openecomp.appc.adapter.saltstack.message`'/>\r
+ <parameter\r
+ name='output.status.results'\r
+ value='`$org.openecomp.appc.adapter.saltstack.results`'/>\r
+ </return>\r
+ </outcome>\r
+ </switch>\r
+ </outcome>\r
+ </execute>\r
+ </outcome>\r
+ <outcome value='Other'>\r
+ <return status='failure'>\r
+ <parameter name='error-code' value='200'/>\r
+ <parameter name='error-message'\r
+ value='`$org.openecomp.appc.adapter.saltstack.message`'/>\r
+ <parameter name='output.status.results'\r
+ value='`$org.openecomp.appc.adapter.saltstack.results`'/>\r
+ </return>\r
+ </outcome>\r
+ </switch>\r
+ </outcome>\r
+ <outcome value='Other'>\r
+ <return status='failure'>\r
+ <parameter name='error-code' value='200'/>\r
+ <parameter name='error-message'\r
+ value='`$org.openecomp.appc.adapter.saltstack.message`'/>\r
+ <parameter name='output.status.results'\r
+ value='`$org.openecomp.appc.adapter.saltstack.results`'/>\r
+ </return>\r
+ </outcome>\r
+ </switch>\r
+ </outcome>\r
+ </execute>\r
+ </method>\r
+</service-logic>
\ No newline at end of file
-[{"id":"3228200a.5dc1a","type":"method","name":"saltstack-adapter-1.0","xml":"<method rpc='saltstack-adapter-1.0-SLSFILE' mode='sync'>\n","comments":"","outputs":1,"x":679,"y":282,"z":"6d4f912d.f07bc","wires":[["50b2729f.712eac"]]},{"id":"9fb54163.4fb28","type":"service-logic","name":"APPC 2.0.1","module":"APPC","version":"2.0.1","comments":"","xml":"<service-logic xmlns='http://www.onap.org/sdnc/svclogic' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd' module='APPC' version='2.0.1'>","outputs":1,"x":456,"y":281,"z":"6d4f912d.f07bc","wires":[["3228200a.5dc1a"]]},{"id":"49109fbc.a7a14","type":"returnSuccess","name":"return success","xml":"<return status='success'>\n<parameter name='output.status.code' value='`$org.openecomp.appc.adapter.ansible.result.code`' />\n<parameter name='output.status.message' value='`$org.openecomp.appc.adapter.ansible.message`'/>\n<parameter name='output.status.results' value = '`$org.openecomp.appc.adapter.ansible.results`'/>\n","comments":"","x":1058,"y":374,"z":"6d4f912d.f07bc","wires":[]},{"id":"d030a396.56232","type":"dgstart","name":"DGSTART","outputs":1,"x":287,"y":280,"z":"6d4f912d.f07bc","wires":[["9fb54163.4fb28"]]},{"id":"281900c4.fd3e8","type":"comment","name":"SaltStack Adaptor DG","info":"","comments":"","x":664,"y":159,"z":"6d4f912d.f07bc","wires":[]},{"id":"431a69db.2d2c58","type":"comment","name":"request-method = reqExecSLS, req-action = \"execute SLS\"","info":"This would be the ideal adaptor the orchestrator DG will call, this just takes in slsName.","comments":"","x":675,"y":244,"z":"6d4f912d.f07bc","wires":[]},{"id":"4202e1ce.09495","type":"comment","name":"Assumptions for this DG (example-server)","info":"Here we assume, the saltstack server is the example-vagrant based server. Where, the master saltstact controllers minion1 and minion2. ","comments":"","x":667,"y":200,"z":"6d4f912d.f07bc","wires":[]},{"id":"50b2729f.712eac","type":"execute","name":"execute","xml":"<execute plugin='org.openecomp.appc.adapter.ansible.AnsibleAdapter' method='reqExecCommand' >\n <parameter name='HostName' value='`$AgentUrl`'/>\n <parameter name='Port' value='`$Port`'/>\n <parameter name='User' value='`$User`'/>\n <parameter name='Password' value='`$Password`'/>\n <parameter name='Id' value='test2'/>\n <parameter name='slsFile' value='file/location/test-file.sls'/>\n","comments":"","outputs":1,"x":369,"y":411,"z":"6d4f912d.f07bc","wires":[["71746570.35f0dc","3e4f7a4a.ae0dc6"]]},{"id":"71746570.35f0dc","type":"failure","name":"failure","xml":"<outcome value='failure'>\n","comments":"","outputs":1,"x":562,"y":372,"z":"6d4f912d.f07bc","wires":[["e59a1a81.112a08"]]},{"id":"3e4f7a4a.ae0dc6","type":"other","name":"other","xml":"<outcome value='Other'>\n","comments":"","outputs":1,"x":560,"y":444,"z":"6d4f912d.f07bc","wires":[["59e320fa.12908"]]},{"id":"59e320fa.12908","type":"switchNode","name":"switch","xml":"<switch test=\"`$org.onap.appc.adapter.saltstack.result.code`\">\n","comments":"","outputs":1,"x":712,"y":432,"z":"6d4f912d.f07bc","wires":[["f81ed07.2135c3","eb55b5a9.f0d2f8"]]},{"id":"eb55b5a9.f0d2f8","type":"success","name":"success","xml":"<outcome value='200'>\n","comments":"","outputs":1,"x":875,"y":378,"z":"6d4f912d.f07bc","wires":[["49109fbc.a7a14"]]},{"id":"f81ed07.2135c3","type":"other","name":"other","xml":"<outcome value='Other'>\n","comments":"","outputs":1,"x":872,"y":447,"z":"6d4f912d.f07bc","wires":[["6549631f.8e516c"]]},{"id":"e59a1a81.112a08","type":"returnFailure","name":"return failure","xml":"<return status='failure'>\n<parameter name='error-code' value='200' />\n<parameter name='error-message' value='`$org.openecomp.appc.adapter.ansible.message`' />\n<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.ansible.results`' />\n","comments":"","x":722,"y":356,"z":"6d4f912d.f07bc","wires":[]},{"id":"6549631f.8e516c","type":"returnFailure","name":"return failure","xml":"<return status='failure'>\n<parameter name='error-code' value='200' />\n<parameter name='error-message' value='`$org.openecomp.appc.adapter.ansible.message`' />\n<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.ansible.results`' />\n","comments":"","x":1042,"y":444,"z":"6d4f912d.f07bc","wires":[]}]
\ No newline at end of file
+[
+ {
+ "id": "3228200a.5dc1a",
+ "type": "method",
+ "name": "saltstack-adapter-1.0",
+ "xml": "<method rpc='saltstack-adapter-1.0-SLSFILE' mode='sync'>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 679,
+ "y": 282,
+ "z": "6d4f912d.f07bc",
+ "wires": [
+ [
+ "50b2729f.712eac"
+ ]
+ ]
+ },
+ {
+ "id": "9fb54163.4fb28",
+ "type": "service-logic",
+ "name": "APPC 2.0.1",
+ "module": "APPC",
+ "version": "2.0.1",
+ "comments": "",
+ "xml": "<service-logic xmlns='http://www.onap.org/sdnc/svclogic' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd' module='APPC' version='2.0.1'>",
+ "outputs": 1,
+ "x": 456,
+ "y": 281,
+ "z": "6d4f912d.f07bc",
+ "wires": [
+ [
+ "3228200a.5dc1a"
+ ]
+ ]
+ },
+ {
+ "id": "49109fbc.a7a14",
+ "type": "returnSuccess",
+ "name": "return success",
+ "xml": "<return status='success'>\n<parameter name='output.status.code' value='`$org.openecomp.appc.adapter.saltstack.result.code`' />\n<parameter name='output.status.message' value='`$org.openecomp.appc.adapter.saltstack.message`'/>\n<parameter name='output.status.results' value = '`$org.openecomp.appc.adapter.saltstack.results`'/>\n",
+ "comments": "",
+ "x": 1058,
+ "y": 374,
+ "z": "6d4f912d.f07bc",
+ "wires": []
+ },
+ {
+ "id": "d030a396.56232",
+ "type": "dgstart",
+ "name": "DGSTART",
+ "outputs": 1,
+ "x": 287,
+ "y": 280,
+ "z": "6d4f912d.f07bc",
+ "wires": [
+ [
+ "9fb54163.4fb28"
+ ]
+ ]
+ },
+ {
+ "id": "281900c4.fd3e8",
+ "type": "comment",
+ "name": "SaltStack Adaptor DG",
+ "info": "",
+ "comments": "",
+ "x": 664,
+ "y": 159,
+ "z": "6d4f912d.f07bc",
+ "wires": []
+ },
+ {
+ "id": "431a69db.2d2c58",
+ "type": "comment",
+ "name": "request-method = reqExecSLS, req-action = \"execute SLS\"",
+ "info": "This would be the ideal adaptor the orchestrator DG will call, this just takes in SlsName.",
+ "comments": "",
+ "x": 675,
+ "y": 244,
+ "z": "6d4f912d.f07bc",
+ "wires": []
+ },
+ {
+ "id": "4202e1ce.09495",
+ "type": "comment",
+ "name": "Assumptions for this DG (example-server)",
+ "info": "Here we assume, the saltstack server is the example-vagrant based server. Where, the master saltstact controllers minion1 and minion2. ",
+ "comments": "",
+ "x": 667,
+ "y": 200,
+ "z": "6d4f912d.f07bc",
+ "wires": []
+ },
+ {
+ "id": "50b2729f.712eac",
+ "type": "execute",
+ "name": "execute",
+ "xml": "<execute plugin='org.openecomp.appc.adapter.saltstack.SaltstackAdapter' method='reqExecCommand' >\n <parameter name='HostName' value='`$AgentUrl`'/>\n <parameter name='Port' value='`$Port`'/>\n <parameter name='User' value='`$User`'/>\n <parameter name='Password' value='`$Password`'/>\n <parameter name='Id' value='test2'/>\n <parameter name='SlsFile' value='file/location/test-file.sls'/>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 369,
+ "y": 411,
+ "z": "6d4f912d.f07bc",
+ "wires": [
+ [
+ "71746570.35f0dc",
+ "3e4f7a4a.ae0dc6"
+ ]
+ ]
+ },
+ {
+ "id": "71746570.35f0dc",
+ "type": "failure",
+ "name": "failure",
+ "xml": "<outcome value='failure'>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 562,
+ "y": 372,
+ "z": "6d4f912d.f07bc",
+ "wires": [
+ [
+ "e59a1a81.112a08"
+ ]
+ ]
+ },
+ {
+ "id": "3e4f7a4a.ae0dc6",
+ "type": "other",
+ "name": "other",
+ "xml": "<outcome value='Other'>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 560,
+ "y": 444,
+ "z": "6d4f912d.f07bc",
+ "wires": [
+ [
+ "59e320fa.12908"
+ ]
+ ]
+ },
+ {
+ "id": "59e320fa.12908",
+ "type": "switchNode",
+ "name": "switch",
+ "xml": "<switch test=\"`$org.onap.appc.adapter.saltstack.result.code`\">\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 712,
+ "y": 432,
+ "z": "6d4f912d.f07bc",
+ "wires": [
+ [
+ "f81ed07.2135c3",
+ "eb55b5a9.f0d2f8"
+ ]
+ ]
+ },
+ {
+ "id": "eb55b5a9.f0d2f8",
+ "type": "success",
+ "name": "success",
+ "xml": "<outcome value='200'>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 875,
+ "y": 378,
+ "z": "6d4f912d.f07bc",
+ "wires": [
+ [
+ "49109fbc.a7a14"
+ ]
+ ]
+ },
+ {
+ "id": "f81ed07.2135c3",
+ "type": "other",
+ "name": "other",
+ "xml": "<outcome value='Other'>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 872,
+ "y": 447,
+ "z": "6d4f912d.f07bc",
+ "wires": [
+ [
+ "6549631f.8e516c"
+ ]
+ ]
+ },
+ {
+ "id": "e59a1a81.112a08",
+ "type": "returnFailure",
+ "name": "return failure",
+ "xml": "<return status='failure'>\n<parameter name='error-code' value='200' />\n<parameter name='error-message' value='`$org.openecomp.appc.adapter.saltstack.message`' />\n<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.saltstack.results`' />\n",
+ "comments": "",
+ "x": 722,
+ "y": 356,
+ "z": "6d4f912d.f07bc",
+ "wires": []
+ },
+ {
+ "id": "6549631f.8e516c",
+ "type": "returnFailure",
+ "name": "return failure",
+ "xml": "<return status='failure'>\n<parameter name='error-code' value='200' />\n<parameter name='error-message' value='`$org.openecomp.appc.adapter.saltstack.message`' />\n<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.saltstack.results`' />\n",
+ "comments": "",
+ "x": 1042,
+ "y": 444,
+ "z": "6d4f912d.f07bc",
+ "wires": []
+ }
+]
\ No newline at end of file
-<service-logic xmlns='http://www.onap.org/sdnc/svclogic' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd' module='APPC' version='2.0.1'><method rpc='saltstack-adapter-1.0-SLSFILE' mode='sync'>\r
-<execute plugin='org.openecomp.appc.adapter.ansible.AnsibleAdapter' method='reqExecCommand' >\r
- <parameter name='HostName' value='`$AgentUrl`'/>\r
- <parameter name='Port' value='`$Port`'/>\r
- <parameter name='User' value='`$User`'/>\r
- <parameter name='Password' value='`$Password`'/>\r
- <parameter name='Id' value='test2'/>\r
- <parameter name='slsFile' value='file/location/test-file.sls'/>\r
-<outcome value='failure'>\r
-<return status='failure'>\r
-<parameter name='error-code' value='200' />\r
-<parameter name='error-message' value='`$org.openecomp.appc.adapter.ansible.message`' />\r
-<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.ansible.results`' />\r
-</return></outcome><outcome value='Other'>\r
-<switch test="`$org.onap.appc.adapter.saltstack.result.code`">\r
-<outcome value='200'>\r
-<return status='success'>\r
-<parameter name='output.status.code' value='`$org.openecomp.appc.adapter.ansible.result.code`' />\r
-<parameter name='output.status.message' value='`$org.openecomp.appc.adapter.ansible.message`'/>\r
-<parameter name='output.status.results' value = '`$org.openecomp.appc.adapter.ansible.results`'/>\r
-</return></outcome><outcome value='Other'>\r
-<return status='failure'>\r
-<parameter name='error-code' value='200' />\r
-<parameter name='error-message' value='`$org.openecomp.appc.adapter.ansible.message`' />\r
-<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.ansible.results`' />\r
-</return></outcome></switch></outcome></execute></method></service-logic>
\ No newline at end of file
+<service-logic xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'\r
+ xmlns='http://www.onap.org/sdnc/svclogic'\r
+ xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd'\r
+ module='APPC' version='2.0.1'>\r
+ <method rpc='saltstack-adapter-1.0-SLSFILE' mode='sync'>\r
+ <execute plugin='org.openecomp.appc.adapter.saltstack.SaltstackAdapter'\r
+ method='reqExecCommand'>\r
+ <parameter name='HostName' value='`$AgentUrl`'/>\r
+ <parameter name='Port' value='`$Port`'/>\r
+ <parameter name='User' value='`$User`'/>\r
+ <parameter name='Password' value='`$Password`'/>\r
+ <parameter name='Id' value='test2'/>\r
+ <parameter name='SlsFile' value='file/location/test-file.sls'/>\r
+ <outcome value='failure'>\r
+ <return status='failure'>\r
+ <parameter name='error-code' value='200'/>\r
+ <parameter name='error-message'\r
+ value='`$org.openecomp.appc.adapter.saltstack.message`'/>\r
+ <parameter name='output.status.results'\r
+ value='`$org.openecomp.appc.adapter.saltstack.results`'/>\r
+ </return>\r
+ </outcome>\r
+ <outcome value='Other'>\r
+ <switch test="`$org.onap.appc.adapter.saltstack.result.code`">\r
+ <outcome value='200'>\r
+ <return status='success'>\r
+ <parameter name='output.status.code'\r
+ value='`$org.openecomp.appc.adapter.saltstack.result.code`'/>\r
+ <parameter name='output.status.message'\r
+ value='`$org.openecomp.appc.adapter.saltstack.message`'/>\r
+ <parameter name='output.status.results'\r
+ value='`$org.openecomp.appc.adapter.saltstack.results`'/>\r
+ </return>\r
+ </outcome>\r
+ <outcome value='Other'>\r
+ <return status='failure'>\r
+ <parameter name='error-code' value='200'/>\r
+ <parameter name='error-message'\r
+ value='`$org.openecomp.appc.adapter.saltstack.message`'/>\r
+ <parameter name='output.status.results'\r
+ value='`$org.openecomp.appc.adapter.saltstack.results`'/>\r
+ </return>\r
+ </outcome>\r
+ </switch>\r
+ </outcome>\r
+ </execute>\r
+ </method>\r
+</service-logic>
\ No newline at end of file
-[{"id":"9a6bf94f.d969f8","type":"method","name":"saltstack-adapter-1.0","xml":"<method rpc='saltstack-adapter-1.0-exec-SLSFile-applyTo' mode='sync'>\n","comments":"","outputs":1,"x":498,"y":240,"z":"723548c7.652d78","wires":[["138ad7ed.403248"]]},{"id":"4bb87049.3f546","type":"service-logic","name":"APPC 2.0.1","module":"APPC","version":"2.0.1","comments":"","xml":"<service-logic xmlns='http://www.onap.org/sdnc/svclogic' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd' module='APPC' version='2.0.1'>","outputs":1,"x":289,"y":318,"z":"723548c7.652d78","wires":[["9a6bf94f.d969f8"]]},{"id":"6c593992.106038","type":"returnFailure","name":"return failure","xml":"<return status='failure'>\n<parameter name='error-code' value='200' />\n<parameter name='error-message' value='`$org.openecomp.appc.adapter.ansible.message`' />\n<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.ansible.results`' />\n","comments":"","x":1202,"y":280,"z":"723548c7.652d78","wires":[]},{"id":"138ad7ed.403248","type":"execute","name":"execute","xml":"<execute plugin='org.openecomp.appc.adapter.ansible.AnsibleAdapter' method='reqExecCommand' >\n <parameter name='HostName' value='`$AgentUrl`'/>\n <parameter name='Port' value='`$Port`'/>\n <parameter name='User' value='`$User`'/>\n <parameter name='Password' value='`$Password`'/>\n <parameter name='Id' value='test1'/>\n <parameter name='cmd' value='salt '*' test.ping --out=json --static'/>\n <parameter name='slsExec' value='false'/>\n <parameter name='execTimeout' value='`$Timeout`'/>\n","comments":"","outputs":1,"x":706,"y":246,"z":"723548c7.652d78","wires":[["167273ed.f0577c","954a34ea.701368"]]},{"id":"d5841e65.537ba","type":"switchNode","name":"switch","xml":"<switch test=\"`$org.onap.appc.adapter.saltstack.result.code`\">\n","comments":"","outputs":1,"x":494,"y":400,"z":"723548c7.652d78","wires":[["ede42371.2f52b","d306d7a0.c830e8"]]},{"id":"ede42371.2f52b","type":"other","name":"other","xml":"<outcome value='Other'>\n","comments":"","outputs":1,"x":680,"y":458,"z":"723548c7.652d78","wires":[["6c593992.106038"]]},{"id":"167273ed.f0577c","type":"failure","name":"failure","xml":"<outcome value='failure'>\n","comments":"","outputs":1,"x":957,"y":239,"z":"723548c7.652d78","wires":[["6c593992.106038"]]},{"id":"954a34ea.701368","type":"other","name":"other","xml":"<outcome value='Other'>\n","comments":"","outputs":1,"x":304,"y":407,"z":"723548c7.652d78","wires":[["d5841e65.537ba"]]},{"id":"d306d7a0.c830e8","type":"success","name":"success","xml":"<outcome value='200'>\n","comments":"","outputs":1,"x":683,"y":400,"z":"723548c7.652d78","wires":[["5b12ba31.94b3b4"]]},{"id":"9ef7fcc3.69279","type":"returnSuccess","name":"return success","xml":"<return status='success'>\n<parameter name='output.status.code' value='`$org.openecomp.appc.adapter.ansible.result.code`' />\n<parameter name='output.status.message' value='`$org.openecomp.appc.adapter.ansible.message`'/>\n<parameter name='output.status.results' value = '`$org.openecomp.appc.adapter.ansible.results`'/>\n","comments":"","x":1101,"y":559,"z":"723548c7.652d78","wires":[]},{"id":"7803eeaf.1e31d","type":"dgstart","name":"DGSTART","outputs":1,"x":267,"y":218,"z":"723548c7.652d78","wires":[["4bb87049.3f546"]]},{"id":"9c6f1e7c.2a3d9","type":"comment","name":"SaltStack Adaptor DG","info":"","comments":"","x":645,"y":105,"z":"723548c7.652d78","wires":[]},{"id":"93ea02a5.4e792","type":"comment","name":"request-method = reqExecSLS, req-action = \"execute SLS FILE\"","info":"Here we basically test if minion1 is active by pinging to it, then respective sls file is executed on to it. \n","comments":"","x":656,"y":190,"z":"723548c7.652d78","wires":[]},{"id":"243edbf.f35fc24","type":"comment","name":"Assumptions for this DG (example-server)","info":"Here we assume, the saltstack server is the example-vagrant based server. Where, the master saltstact controllers minion1 and minion2. ","comments":"","x":648,"y":146,"z":"723548c7.652d78","wires":[]},{"id":"5b12ba31.94b3b4","type":"switchNode","name":"switch","xml":"<switch test=\"`$test1.minion1`\">\n","comments":"","outputs":1,"x":847,"y":400,"z":"723548c7.652d78","wires":[["9bf0915.96f217","f6e533d.95d99d"]]},{"id":"9bf0915.96f217","type":"other","name":"other","xml":"<outcome value='Other'>\n","comments":"","outputs":1,"x":1013,"y":454,"z":"723548c7.652d78","wires":[["6c593992.106038"]]},{"id":"f6e533d.95d99d","type":"other","name":"outcome","xml":"<outcome value='true'>\n","comments":"","outputs":1,"x":1016,"y":396,"z":"723548c7.652d78","wires":[["eb57ba41.1d7328"]]},{"id":"eb57ba41.1d7328","type":"execute","name":"execute","xml":"<execute plugin='org.openecomp.appc.adapter.ansible.AnsibleAdapter' method='reqExecCommand' >\n <parameter name='HostName' value='`$AgentUrl`'/>\n <parameter name='Port' value='`$Port`'/>\n <parameter name='User' value='`$User`'/>\n <parameter name='Password' value='`$Password`'/>\n <parameter name='Id' value='test2'/>\n <parameter name='slsFile' value='file/location/test.sls'/>\n <parameter name='applyTo' value='minion1'/>\n <parameter name='execTimeout' value='`$Timeout`'/>\n","comments":"","outputs":1,"x":420,"y":588,"z":"723548c7.652d78","wires":[["892a8f1d.7d77f","74be8a6e.975f24"]]},{"id":"892a8f1d.7d77f","type":"failure","name":"failure","xml":"<outcome value='failure'>\n","comments":"","outputs":1,"x":605,"y":557,"z":"723548c7.652d78","wires":[["8c091fe.c6cbfe"]]},{"id":"74be8a6e.975f24","type":"other","name":"other","xml":"<outcome value='Other'>\n","comments":"","outputs":1,"x":603,"y":629,"z":"723548c7.652d78","wires":[["3875d695.fd37ca"]]},{"id":"3875d695.fd37ca","type":"switchNode","name":"switch","xml":"<switch test=\"`$org.onap.appc.adapter.saltstack.result.code`\">\n","comments":"","outputs":1,"x":755,"y":617,"z":"723548c7.652d78","wires":[["2e60af80.ea3a6","24ed6dd2.6624c2"]]},{"id":"24ed6dd2.6624c2","type":"success","name":"success","xml":"<outcome value='200'>\n","comments":"","outputs":1,"x":918,"y":563,"z":"723548c7.652d78","wires":[["9ef7fcc3.69279"]]},{"id":"2e60af80.ea3a6","type":"other","name":"other","xml":"<outcome value='Other'>\n","comments":"","outputs":1,"x":915,"y":632,"z":"723548c7.652d78","wires":[["2e4414a7.ba6d4c"]]},{"id":"8c091fe.c6cbfe","type":"returnFailure","name":"return failure","xml":"<return status='failure'>\n<parameter name='error-code' value='200' />\n<parameter name='error-message' value='`$org.openecomp.appc.adapter.ansible.message`' />\n<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.ansible.results`' />\n","comments":"","x":757,"y":554,"z":"723548c7.652d78","wires":[]},{"id":"2e4414a7.ba6d4c","type":"returnFailure","name":"return failure","xml":"<return status='failure'>\n<parameter name='error-code' value='200' />\n<parameter name='error-message' value='`$org.openecomp.appc.adapter.ansible.message`' />\n<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.ansible.results`' />\n","comments":"","x":1076,"y":632,"z":"723548c7.652d78","wires":[]}]
\ No newline at end of file
+[
+ {
+ "id": "9a6bf94f.d969f8",
+ "type": "method",
+ "name": "saltstack-adapter-1.0",
+ "xml": "<method rpc='saltstack-adapter-1.0-exec-SLSFile-SlsName' mode='sync'>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 498,
+ "y": 240,
+ "z": "723548c7.652d78",
+ "wires": [
+ [
+ "138ad7ed.403248"
+ ]
+ ]
+ },
+ {
+ "id": "4bb87049.3f546",
+ "type": "service-logic",
+ "name": "APPC 2.0.1",
+ "module": "APPC",
+ "version": "2.0.1",
+ "comments": "",
+ "xml": "<service-logic xmlns='http://www.onap.org/sdnc/svclogic' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd' module='APPC' version='2.0.1'>",
+ "outputs": 1,
+ "x": 289,
+ "y": 318,
+ "z": "723548c7.652d78",
+ "wires": [
+ [
+ "9a6bf94f.d969f8"
+ ]
+ ]
+ },
+ {
+ "id": "6c593992.106038",
+ "type": "returnFailure",
+ "name": "return failure",
+ "xml": "<return status='failure'>\n<parameter name='error-code' value='200' />\n<parameter name='error-message' value='`$org.openecomp.appc.adapter.saltstack.message`' />\n<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.saltstack.results`' />\n",
+ "comments": "",
+ "x": 1202,
+ "y": 280,
+ "z": "723548c7.652d78",
+ "wires": []
+ },
+ {
+ "id": "138ad7ed.403248",
+ "type": "execute",
+ "name": "execute",
+ "xml": "<execute plugin='org.openecomp.appc.adapter.saltstack.SaltstackAdapter' method='reqExecCommand' >\n <parameter name='HostName' value='`$AgentUrl`'/>\n <parameter name='Port' value='`$Port`'/>\n <parameter name='User' value='`$User`'/>\n <parameter name='Password' value='`$Password`'/>\n <parameter name='Id' value='test1'/>\n <parameter name='Cmd' value='salt '*' test.ping --out=json --static'/>\n <parameter name='SlsExec' value='false'/>\n <parameter name='Timeout' value='`$Timeout`'/>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 706,
+ "y": 246,
+ "z": "723548c7.652d78",
+ "wires": [
+ [
+ "167273ed.f0577c",
+ "954a34ea.701368"
+ ]
+ ]
+ },
+ {
+ "id": "d5841e65.537ba",
+ "type": "switchNode",
+ "name": "switch",
+ "xml": "<switch test=\"`$org.onap.appc.adapter.saltstack.result.code`\">\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 494,
+ "y": 400,
+ "z": "723548c7.652d78",
+ "wires": [
+ [
+ "ede42371.2f52b",
+ "d306d7a0.c830e8"
+ ]
+ ]
+ },
+ {
+ "id": "ede42371.2f52b",
+ "type": "other",
+ "name": "other",
+ "xml": "<outcome value='Other'>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 680,
+ "y": 458,
+ "z": "723548c7.652d78",
+ "wires": [
+ [
+ "6c593992.106038"
+ ]
+ ]
+ },
+ {
+ "id": "167273ed.f0577c",
+ "type": "failure",
+ "name": "failure",
+ "xml": "<outcome value='failure'>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 957,
+ "y": 239,
+ "z": "723548c7.652d78",
+ "wires": [
+ [
+ "6c593992.106038"
+ ]
+ ]
+ },
+ {
+ "id": "954a34ea.701368",
+ "type": "other",
+ "name": "other",
+ "xml": "<outcome value='Other'>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 304,
+ "y": 407,
+ "z": "723548c7.652d78",
+ "wires": [
+ [
+ "d5841e65.537ba"
+ ]
+ ]
+ },
+ {
+ "id": "d306d7a0.c830e8",
+ "type": "success",
+ "name": "success",
+ "xml": "<outcome value='200'>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 683,
+ "y": 400,
+ "z": "723548c7.652d78",
+ "wires": [
+ [
+ "5b12ba31.94b3b4"
+ ]
+ ]
+ },
+ {
+ "id": "9ef7fcc3.69279",
+ "type": "returnSuccess",
+ "name": "return success",
+ "xml": "<return status='success'>\n<parameter name='output.status.code' value='`$org.openecomp.appc.adapter.saltstack.result.code`' />\n<parameter name='output.status.message' value='`$org.openecomp.appc.adapter.saltstack.message`'/>\n<parameter name='output.status.results' value = '`$org.openecomp.appc.adapter.saltstack.results`'/>\n",
+ "comments": "",
+ "x": 1101,
+ "y": 559,
+ "z": "723548c7.652d78",
+ "wires": []
+ },
+ {
+ "id": "7803eeaf.1e31d",
+ "type": "dgstart",
+ "name": "DGSTART",
+ "outputs": 1,
+ "x": 267,
+ "y": 218,
+ "z": "723548c7.652d78",
+ "wires": [
+ [
+ "4bb87049.3f546"
+ ]
+ ]
+ },
+ {
+ "id": "9c6f1e7c.2a3d9",
+ "type": "comment",
+ "name": "SaltStack Adaptor DG",
+ "info": "",
+ "comments": "",
+ "x": 645,
+ "y": 105,
+ "z": "723548c7.652d78",
+ "wires": []
+ },
+ {
+ "id": "93ea02a5.4e792",
+ "type": "comment",
+ "name": "request-method = reqExecSLS, req-action = \"execute SLS FILE\"",
+ "info": "Here we basically test if minion1 is active by pinging to it, then respective sls file is executed on to it. \n",
+ "comments": "",
+ "x": 656,
+ "y": 190,
+ "z": "723548c7.652d78",
+ "wires": []
+ },
+ {
+ "id": "243edbf.f35fc24",
+ "type": "comment",
+ "name": "Assumptions for this DG (example-server)",
+ "info": "Here we assume, the saltstack server is the example-vagrant based server. Where, the master saltstact controllers minion1 and minion2. ",
+ "comments": "",
+ "x": 648,
+ "y": 146,
+ "z": "723548c7.652d78",
+ "wires": []
+ },
+ {
+ "id": "5b12ba31.94b3b4",
+ "type": "switchNode",
+ "name": "switch",
+ "xml": "<switch test=\"`$test1.minion1`\">\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 847,
+ "y": 400,
+ "z": "723548c7.652d78",
+ "wires": [
+ [
+ "9bf0915.96f217",
+ "f6e533d.95d99d"
+ ]
+ ]
+ },
+ {
+ "id": "9bf0915.96f217",
+ "type": "other",
+ "name": "other",
+ "xml": "<outcome value='Other'>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 1013,
+ "y": 454,
+ "z": "723548c7.652d78",
+ "wires": [
+ [
+ "6c593992.106038"
+ ]
+ ]
+ },
+ {
+ "id": "f6e533d.95d99d",
+ "type": "other",
+ "name": "outcome",
+ "xml": "<outcome value='true'>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 1016,
+ "y": 396,
+ "z": "723548c7.652d78",
+ "wires": [
+ [
+ "eb57ba41.1d7328"
+ ]
+ ]
+ },
+ {
+ "id": "eb57ba41.1d7328",
+ "type": "execute",
+ "name": "execute",
+ "xml": "<execute plugin='org.openecomp.appc.adapter.saltstack.SaltstackAdapter' method='reqExecCommand' >\n <parameter name='HostName' value='`$AgentUrl`'/>\n <parameter name='Port' value='`$Port`'/>\n <parameter name='User' value='`$User`'/>\n <parameter name='Password' value='`$Password`'/>\n <parameter name='Id' value='test2'/>\n <parameter name='SlsFile' value='file/location/test.sls'/>\n <parameter name='NodeList' value='minion1'/>\n <parameter name='Timeout' value='`$Timeout`'/>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 420,
+ "y": 588,
+ "z": "723548c7.652d78",
+ "wires": [
+ [
+ "892a8f1d.7d77f",
+ "74be8a6e.975f24"
+ ]
+ ]
+ },
+ {
+ "id": "892a8f1d.7d77f",
+ "type": "failure",
+ "name": "failure",
+ "xml": "<outcome value='failure'>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 605,
+ "y": 557,
+ "z": "723548c7.652d78",
+ "wires": [
+ [
+ "8c091fe.c6cbfe"
+ ]
+ ]
+ },
+ {
+ "id": "74be8a6e.975f24",
+ "type": "other",
+ "name": "other",
+ "xml": "<outcome value='Other'>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 603,
+ "y": 629,
+ "z": "723548c7.652d78",
+ "wires": [
+ [
+ "3875d695.fd37ca"
+ ]
+ ]
+ },
+ {
+ "id": "3875d695.fd37ca",
+ "type": "switchNode",
+ "name": "switch",
+ "xml": "<switch test=\"`$org.onap.appc.adapter.saltstack.result.code`\">\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 755,
+ "y": 617,
+ "z": "723548c7.652d78",
+ "wires": [
+ [
+ "2e60af80.ea3a6",
+ "24ed6dd2.6624c2"
+ ]
+ ]
+ },
+ {
+ "id": "24ed6dd2.6624c2",
+ "type": "success",
+ "name": "success",
+ "xml": "<outcome value='200'>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 918,
+ "y": 563,
+ "z": "723548c7.652d78",
+ "wires": [
+ [
+ "9ef7fcc3.69279"
+ ]
+ ]
+ },
+ {
+ "id": "2e60af80.ea3a6",
+ "type": "other",
+ "name": "other",
+ "xml": "<outcome value='Other'>\n",
+ "comments": "",
+ "outputs": 1,
+ "x": 915,
+ "y": 632,
+ "z": "723548c7.652d78",
+ "wires": [
+ [
+ "2e4414a7.ba6d4c"
+ ]
+ ]
+ },
+ {
+ "id": "8c091fe.c6cbfe",
+ "type": "returnFailure",
+ "name": "return failure",
+ "xml": "<return status='failure'>\n<parameter name='error-code' value='200' />\n<parameter name='error-message' value='`$org.openecomp.appc.adapter.saltstack.message`' />\n<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.saltstack.results`' />\n",
+ "comments": "",
+ "x": 757,
+ "y": 554,
+ "z": "723548c7.652d78",
+ "wires": []
+ },
+ {
+ "id": "2e4414a7.ba6d4c",
+ "type": "returnFailure",
+ "name": "return failure",
+ "xml": "<return status='failure'>\n<parameter name='error-code' value='200' />\n<parameter name='error-message' value='`$org.openecomp.appc.adapter.saltstack.message`' />\n<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.saltstack.results`' />\n",
+ "comments": "",
+ "x": 1076,
+ "y": 632,
+ "z": "723548c7.652d78",
+ "wires": []
+ }
+]
\ No newline at end of file
-<service-logic xmlns='http://www.onap.org/sdnc/svclogic' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd' module='APPC' version='2.0.1'><method rpc='saltstack-adapter-1.0-exec-SLSFile-applyTo' mode='sync'>\r
-<execute plugin='org.openecomp.appc.adapter.ansible.AnsibleAdapter' method='reqExecCommand' >\r
- <parameter name='HostName' value='`$AgentUrl`'/>\r
- <parameter name='Port' value='`$Port`'/>\r
- <parameter name='User' value='`$User`'/>\r
- <parameter name='Password' value='`$Password`'/>\r
- <parameter name='Id' value='test1'/>\r
- <parameter name='cmd' value='salt '*' test.ping --out=json --static'/>\r
- <parameter name='slsExec' value='false'/>\r
- <parameter name='execTimeout' value='`$Timeout`'/>\r
-<outcome value='failure'>\r
-<return status='failure'>\r
-<parameter name='error-code' value='200' />\r
-<parameter name='error-message' value='`$org.openecomp.appc.adapter.ansible.message`' />\r
-<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.ansible.results`' />\r
-</return></outcome><outcome value='Other'>\r
-<switch test="`$org.onap.appc.adapter.saltstack.result.code`">\r
-<outcome value='200'>\r
-<switch test="`$test1.minion1`">\r
-<outcome value='true'>\r
-<execute plugin='org.openecomp.appc.adapter.ansible.AnsibleAdapter' method='reqExecCommand' >\r
- <parameter name='HostName' value='`$AgentUrl`'/>\r
- <parameter name='Port' value='`$Port`'/>\r
- <parameter name='User' value='`$User`'/>\r
- <parameter name='Password' value='`$Password`'/>\r
- <parameter name='Id' value='test2'/>\r
- <parameter name='slsFile' value='file/location/test.sls'/>\r
- <parameter name='applyTo' value='minion1'/>\r
- <parameter name='execTimeout' value='`$Timeout`'/>\r
-<outcome value='failure'>\r
-<return status='failure'>\r
-<parameter name='error-code' value='200' />\r
-<parameter name='error-message' value='`$org.openecomp.appc.adapter.ansible.message`' />\r
-<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.ansible.results`' />\r
-</return></outcome><outcome value='Other'>\r
-<switch test="`$org.onap.appc.adapter.saltstack.result.code`">\r
-<outcome value='200'>\r
-<return status='success'>\r
-<parameter name='output.status.code' value='`$org.openecomp.appc.adapter.ansible.result.code`' />\r
-<parameter name='output.status.message' value='`$org.openecomp.appc.adapter.ansible.message`'/>\r
-<parameter name='output.status.results' value = '`$org.openecomp.appc.adapter.ansible.results`'/>\r
-</return></outcome><outcome value='Other'>\r
-<return status='failure'>\r
-<parameter name='error-code' value='200' />\r
-<parameter name='error-message' value='`$org.openecomp.appc.adapter.ansible.message`' />\r
-<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.ansible.results`' />\r
-</return></outcome></switch></outcome></execute></outcome><outcome value='Other'>\r
-<return status='failure'>\r
-<parameter name='error-code' value='200' />\r
-<parameter name='error-message' value='`$org.openecomp.appc.adapter.ansible.message`' />\r
-<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.ansible.results`' />\r
-</return></outcome></switch></outcome><outcome value='Other'>\r
-<return status='failure'>\r
-<parameter name='error-code' value='200' />\r
-<parameter name='error-message' value='`$org.openecomp.appc.adapter.ansible.message`' />\r
-<parameter name='output.status.results' value='`$org.openecomp.appc.adapter.ansible.results`' />\r
-</return></outcome></switch></outcome></execute></method></service-logic>
\ No newline at end of file
+<service-logic xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'\r
+ xmlns='http://www.onap.org/sdnc/svclogic'\r
+ xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd'\r
+ module='APPC' version='2.0.1'>\r
+ <method rpc='saltstack-adapter-1.0-exec-SLSFile-NodeList' mode='sync'>\r
+ <execute plugin='org.openecomp.appc.adapter.saltstack.SaltstackAdapter'\r
+ method='reqExecCommand'>\r
+ <parameter name='HostName' value='`$AgentUrl`'/>\r
+ <parameter name='Port' value='`$Port`'/>\r
+ <parameter name='User' value='`$User`'/>\r
+ <parameter name='Password' value='`$Password`'/>\r
+ <parameter name='Id' value='test1'/>\r
+ <parameter name='Cmd'\r
+ value='salt '*' test.ping --out=json --static'/>\r
+ <parameter name='SlsExec' value='false'/>\r
+ <parameter name='Timeout' value='`$Timeout`'/>\r
+ <outcome value='failure'>\r
+ <return status='failure'>\r
+ <parameter name='error-code' value='200'/>\r
+ <parameter name='error-message'\r
+ value='`$org.openecomp.appc.adapter.saltstack.message`'/>\r
+ <parameter name='output.status.results'\r
+ value='`$org.openecomp.appc.adapter.saltstack.results`'/>\r
+ </return>\r
+ </outcome>\r
+ <outcome value='Other'>\r
+ <switch test="`$org.onap.appc.adapter.saltstack.result.code`">\r
+ <outcome value='200'>\r
+ <switch test="`$test1.minion1`">\r
+ <outcome value='true'>\r
+ <execute\r
+ plugin='org.openecomp.appc.adapter.saltstack.SaltstackAdapter'\r
+ method='reqExecCommand'>\r
+ <parameter name='HostName'\r
+ value='`$AgentUrl`'/>\r
+ <parameter name='Port' value='`$Port`'/>\r
+ <parameter name='User' value='`$User`'/>\r
+ <parameter name='Password'\r
+ value='`$Password`'/>\r
+ <parameter name='Id' value='test2'/>\r
+ <parameter name='SlsFile'\r
+ value='file/location/test.sls'/>\r
+ <parameter name='NodeList' value='minion1'/>\r
+ <parameter name='Timeout'\r
+ value='`$Timeout`'/>\r
+ <outcome value='failure'>\r
+ <return status='failure'>\r
+ <parameter name='error-code'\r
+ value='200'/>\r
+ <parameter name='error-message'\r
+ value='`$org.openecomp.appc.adapter.saltstack.message`'/>\r
+ <parameter\r
+ name='output.status.results'\r
+ value='`$org.openecomp.appc.adapter.saltstack.results`'/>\r
+ </return>\r
+ </outcome>\r
+ <outcome value='Other'>\r
+ <switch test="`$org.onap.appc.adapter.saltstack.result.code`">\r
+ <outcome value='200'>\r
+ <return status='success'>\r
+ <parameter\r
+ name='output.status.code'\r
+ value='`$org.openecomp.appc.adapter.saltstack.result.code`'/>\r
+ <parameter\r
+ name='output.status.message'\r
+ value='`$org.openecomp.appc.adapter.saltstack.message`'/>\r
+ <parameter\r
+ name='output.status.results'\r
+ value='`$org.openecomp.appc.adapter.saltstack.results`'/>\r
+ </return>\r
+ </outcome>\r
+ <outcome value='Other'>\r
+ <return status='failure'>\r
+ <parameter name='error-code'\r
+ value='200'/>\r
+ <parameter\r
+ name='error-message'\r
+ value='`$org.openecomp.appc.adapter.saltstack.message`'/>\r
+ <parameter\r
+ name='output.status.results'\r
+ value='`$org.openecomp.appc.adapter.saltstack.results`'/>\r
+ </return>\r
+ </outcome>\r
+ </switch>\r
+ </outcome>\r
+ </execute>\r
+ </outcome>\r
+ <outcome value='Other'>\r
+ <return status='failure'>\r
+ <parameter name='error-code' value='200'/>\r
+ <parameter name='error-message'\r
+ value='`$org.openecomp.appc.adapter.saltstack.message`'/>\r
+ <parameter name='output.status.results'\r
+ value='`$org.openecomp.appc.adapter.saltstack.results`'/>\r
+ </return>\r
+ </outcome>\r
+ </switch>\r
+ </outcome>\r
+ <outcome value='Other'>\r
+ <return status='failure'>\r
+ <parameter name='error-code' value='200'/>\r
+ <parameter name='error-message'\r
+ value='`$org.openecomp.appc.adapter.saltstack.message`'/>\r
+ <parameter name='output.status.results'\r
+ value='`$org.openecomp.appc.adapter.saltstack.results`'/>\r
+ </return>\r
+ </outcome>\r
+ </switch>\r
+ </outcome>\r
+ </execute>\r
+ </method>\r
+</service-logic>
\ No newline at end of file
'''
/*-
* ============LICENSE_START=======================================================
-* ONAP : APPC
+* ONAP : CCSDK
* ================================================================================
-* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+* Copyright (C) 2018 Samsung Electronics. All rights reserved.
* ================================================================================
-* Copyright (C) 2017 Amdocs
+*
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the License for the specific language governing permissions and
* limitations under the License.
*
-* ECOMP is a trademark and service mark of AT&T Intellectual Property.
+*
* ============LICENSE_END=========================================================
*/
'''
============
TESTING: Sample Saltstack server command execution.
============
-
+
@Test
public void reqExecCommand_shouldSetSuccessReal() throws SvcLogicException,
IllegalStateException, IllegalArgumentException {
params.put("User", "sdn");
params.put("Password", "foo");
params.put("Id", "test1");
- params.put("cmd", "ls -l");
- params.put("slsExec", "false");
- params.put("execTimeout", "12000");
+ params.put("Cmd", "ls -l");
+ params.put("SlsExec", "false");
+ params.put("Timeout", "12000");
adapter = new SaltstackAdapterImpl();
try {
adapter.reqExecCommand(params, svcContext);
String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
TestId = svcContext.getAttribute("org.onap.appc.adapter.saltstack.Id");
- assertEquals("250", status);
+ assertEquals("200", status);
assertEquals(TestId, "test1");
} catch (Exception e){
//if local ssh is not enabled
- return;
+ System.out.print(e.getMessage());
+ }
+ }
+
+ @Test
+ public void reqExecCommand_shouldSetSuccessRealSLSCommand() throws SvcLogicException,
+ IllegalStateException, IllegalArgumentException {
+
+ params.put("HostName", "<IP>");
+ params.put("Port", "2222");
+ params.put("User", "root");
+ params.put("Password", "vagrant");
+ params.put("Id", "test1");
+ params.put("Cmd", "salt '*' test.ping --out=json --static");
+ params.put("SlsExec", "false");
+ params.put("Timeout", "12000");
+
+ adapter = new SaltstackAdapterImpl();
+ try {
+ adapter.reqExecCommand(params, svcContext);
+ String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
+ TestId = svcContext.getAttribute("org.onap.appc.adapter.saltstack.Id");
+ assertEquals("200", status);
+ assertEquals(TestId, "test1");
+ TestId = svcContext.getAttribute("test1.minion1");
+ assertEquals(TestId, "true");
+ } catch (Exception e){
+ //if saltstack ssh IP is not enabled
+ System.out.print(e.getMessage());
}
}
public void reqExecCommand_shouldSetSuccessRealCommand() throws SvcLogicException,
IllegalStateException, IllegalArgumentException {
- params.put("HostName", "<IP address of SS server>");
+ params.put("HostName", "<IP>");
params.put("Port", "2222");
params.put("User", "root");
params.put("Password", "vagrant");
params.put("Id", "test1");
- params.put("cmd", "cd /srv/salt/; salt '*' state.apply vim --out=json --static");
- params.put("slsExec", "true");
- params.put("execTimeout", "12000");
+ params.put("Cmd", "cd /srv/salt/; salt '*' state.apply vim --out=json --static");
+ params.put("SlsExec", "true");
+ params.put("Timeout", "12000");
adapter = new SaltstackAdapterImpl();
try {
assertEquals(TestId, "test1");
} catch (Exception e){
//if saltstack ssh IP is not enabled
- return;
+ System.out.print(e.getMessage());
}
}
public void reqExecCommand_shouldSetSuccessRealSSL() throws SvcLogicException,
IllegalStateException, IllegalArgumentException {
- params.put("HostName", "10.251.92.17");
+ params.put("HostName", "<IP>");
params.put("Port", "2222");
params.put("User", "root");
params.put("Password", "vagrant");
params.put("Id", "test1");
- params.put("slsName", "vim");
- params.put("execTimeout", "12000");
- params.put("applyTo", "minion1");
+ params.put("SlsName", "vim");
+ params.put("Timeout", "12000");
+ params.put("NodeList", "minion1");
adapter = new SaltstackAdapterImpl();
try {
assertEquals(TestId, "test1");
} catch (Exception e){
//if saltstack ssh IP is not enabled
- return;
+ System.out.print(e.getMessage());
}
}
@Test
- public void reqExecCommand_shouldSetSuccessRealSSLNoApplyTo() throws SvcLogicException,
+ public void reqExecCommand_shouldSetSuccessEnvParam() throws SvcLogicException,
IllegalStateException, IllegalArgumentException {
- params.put("HostName", "10.251.92.17");
+ params.put("HostName", "<IP>");
params.put("Port", "2222");
params.put("User", "root");
params.put("Password", "vagrant");
params.put("Id", "test1");
- params.put("slsName", "vim");
- params.put("execTimeout", "12000");
+ params.put("SlsName", "vim");
+ params.put("Timeout", "12000");
+ params.put("NodeList", "minion1");
+ params.put("EnvParameters", "{\"exclude\": bar*}");
adapter = new SaltstackAdapterImpl();
try {
assertEquals(TestId, "test1");
} catch (Exception e){
//if saltstack ssh IP is not enabled
- return;
+ System.out.print(e.getMessage());
}
}
-
+
+ @Test
+ public void reqExecCommand_shouldSetSuccessFileParam() throws SvcLogicException,
+ IllegalStateException, IllegalArgumentException {
+
+ params.put("HostName", "<IP>");
+ params.put("Port", "2222");
+ params.put("User", "root");
+ params.put("Password", "vagrant");
+ params.put("Id", "test1");
+ params.put("SlsName", "vim");
+ params.put("Timeout", "12000");
+ params.put("NodeList", "minion1");
+ params.put("EnvParameters", "{\"exclude\": \"bar,baz\"}");
+ params.put("FileParameters", "{\"config.txt\":\"db_ip=10.1.1.1, sip_timer=10000\"}");
+
+ adapter = new SaltstackAdapterImpl();
+ try {
+ adapter.reqExecSLS(params, svcContext);
+ String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
+ TestId = svcContext.getAttribute("org.onap.appc.adapter.saltstack.Id");
+ assertEquals("200", status);
+ assertEquals(TestId, "test1");
+ } catch (Exception e){
+ //if saltstack ssh IP is not enabled
+ System.out.print(e.getMessage());
+ }
+ }
+
+ @Test
+ public void reqExecCommand_shouldSetSuccessPillarParam() throws SvcLogicException,
+ IllegalStateException, IllegalArgumentException {
+
+ params.put("HostName", "<IP>");
+ params.put("Port", "2222");
+ params.put("User", "root");
+ params.put("Password", "vagrant");
+ params.put("Id", "test1");
+ params.put("SlsName", "vim");
+ params.put("Timeout", "12000");
+ params.put("NodeList", "minion1");
+ params.put("EnvParameters", "{\"exclude\": \"bar,baz\", \"pillar\":\"'{\\\"foo\\\": \\\"bar\\\"}'\"}");
+ params.put("FileParameters", "{\"config.txt\":\"db_ip=10.1.1.1, sip_timer=10000\"}");
+
+ adapter = new SaltstackAdapterImpl();
+ try {
+ adapter.reqExecSLS(params, svcContext);
+ String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
+ TestId = svcContext.getAttribute("org.onap.appc.adapter.saltstack.Id");
+ assertEquals("200", status);
+ assertEquals(TestId, "test1");
+ } catch (Exception e){
+ //if saltstack ssh IP is not enabled
+ System.out.print(e.getMessage());
+ }
+ }
+
+ @Test
+ public void reqExecCommand_shouldSetSuccessMultiFileParam() throws SvcLogicException,
+ IllegalStateException, IllegalArgumentException {
+
+ params.put("HostName", "<IP>");
+ params.put("Port", "2222");
+ params.put("User", "root");
+ params.put("Password", "vagrant");
+ params.put("Id", "test1");
+ params.put("SlsName", "vim");
+ params.put("Timeout", "12000");
+ params.put("NodeList", "minion1");
+ params.put("EnvParameters", "{\"exclude\": bar*}");
+ params.put("FileParameters", "{\"config.txt\":\"db_ip=10.1.1.1, sip_timer=10000\" , \"config-tep.txt\":\"db_ip=10.1.1.1, sip_timer=10000\"}");
+
+ adapter = new SaltstackAdapterImpl();
+ try {
+ adapter.reqExecSLS(params, svcContext);
+ String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
+ TestId = svcContext.getAttribute("org.onap.appc.adapter.saltstack.Id");
+ assertEquals("200", status);
+ assertEquals(TestId, "test1");
+ } catch (Exception e){
+ //if saltstack ssh IP is not enabled
+ System.out.print(e.getMessage());
+ }
+ }
+
@Test
public void reqExecCommand_shouldSetSuccessSSLFile() throws SvcLogicException,
IllegalStateException, IllegalArgumentException {
- params.put("HostName", "10.251.92.17");
+ params.put("HostName", "<IP>");
params.put("Port", "2222");
params.put("User", "root");
params.put("Password", "vagrant");
params.put("Id", "test1");
- params.put("execTimeout", "12000");
- params.put("applyTo", "minion1");
- params.put("slsFile", "src/test/resources/config.sls");
+ params.put("Timeout", "12000");
+ params.put("NodeList", "minion1");
+ params.put("SlsFile", "src/test/resources/config.sls");
adapter = new SaltstackAdapterImpl();
try {
assertEquals(TestId, "test1");
} catch (Exception e){
//if saltstack ssh IP is not enabled
- return;
+ System.out.print(e.getMessage());
}
- }
\ No newline at end of file
+ }
+
+ @Test
+ public void reqExecCommand_shouldSetSuccessSSLFileMultiFileParam() throws SvcLogicException,
+ IllegalStateException, IllegalArgumentException {
+
+ params.put("HostName", "<IP>");
+ params.put("Port", "2222");
+ params.put("User", "root");
+ params.put("Password", "vagrant");
+ params.put("Id", "test1");
+ params.put("Timeout", "12000");
+ params.put("NodeList", "minion1");
+ params.put("SlsFile", "src/test/resources/config.sls");
+ params.put("EnvParameters", "{\"exclude\": bar, \"pillar\":\"'{\\\"foo\\\": \\\"bar\\\"}'\"}");
+ params.put("FileParameters", "{\"config.txt\":\"db_ip=10.1.1.1, sip_timer=10000\" , \"config-tep.txt\":\"db_ip=10.1.1.1, sip_timer=10000\"}");
+
+ adapter = new SaltstackAdapterImpl();
+ try {
+ adapter.reqExecSLSFile(params, svcContext);
+ String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
+ TestId = svcContext.getAttribute("org.onap.appc.adapter.saltstack.Id");
+ assertEquals("200", status);
+ assertEquals(TestId, "test1");
+ } catch (Exception e){
+ //if saltstack ssh IP is not enabled
+ System.out.print(e.getMessage());
+ }
+ }
\ No newline at end of file
# /*-
# * ============LICENSE_START=======================================================
-# * ONAP : APPC
+# * ONAP : CCSDK
# * ================================================================================
-# * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# * Copyright (C) 2018 Samsung Electronics. All rights reserved.
# * ================================================================================
-# * Copyright (C) 2017 Amdocs
+# *
# * =============================================================================
# * Licensed under the Apache License, Version 2.0 (the "License");
# * you may not use this file except in compliance with the License.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *
-# * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+# *
# * ============LICENSE_END=========================================================
# */
# /*-
# * ============LICENSE_START=======================================================
-# * ONAP : APPC
+# * ONAP : CCSDK
# * ================================================================================
-# * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# * Copyright (C) 2018 Samsung Electronics. All rights reserved.
# * ================================================================================
-# * Copyright (C) 2017 Amdocs
+# *
# * =============================================================================
# * Licensed under the Apache License, Version 2.0 (the "License");
# * you may not use this file except in compliance with the License.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *
-# * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+# *
# * ============LICENSE_END=========================================================
# */