diff options
Diffstat (limited to 'sshapi-call-node/provider/src')
2 files changed, 12 insertions, 15 deletions
diff --git a/sshapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/sshapicall/SshApiCallNode.java b/sshapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/sshapicall/SshApiCallNode.java index 452d9478..146188fb 100644 --- a/sshapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/sshapicall/SshApiCallNode.java +++ b/sshapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/sshapicall/SshApiCallNode.java @@ -6,7 +6,9 @@ * ============================================================================= * Copyright (C) 2018 Samsung Electronics. All rights reserved. -* * ================================================================================ + * ================================================================================ + * Modifications Copyright © 2018 IBM + * ================================================================================ * 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 @@ -24,16 +26,9 @@ package org.onap.ccsdk.sli.plugins.sshapicall; -//import com.fasterxml.jackson.databind.ObjectMapper; - import java.io.ByteArrayOutputStream; -import java.util.Collections; -import java.util.HashSet; import java.util.Map; -import java.util.Set; -import com.google.common.base.Strings; -import org.json.JSONObject; import org.onap.appc.adapter.ssh.SshAdapter; import org.onap.appc.adapter.ssh.SshConnection; import org.onap.ccsdk.sli.core.sli.SvcLogicException; @@ -77,6 +72,10 @@ public class SshApiCallNode implements SvcLogicJavaPlugin { */ private int DEF_SUCCESS_STATUS = 0; + + + private SshAdapter sshAdapter; + /** * Used for jUnit test and testing interface */ @@ -88,8 +87,6 @@ public class SshApiCallNode implements SvcLogicJavaPlugin { PARAM_TEST_MODE = false; } - private SshAdapter sshAdapter; - public void setSshAdapter(SshAdapter sshAdapter) { this.sshAdapter = sshAdapter; } @@ -138,7 +135,8 @@ public class SshApiCallNode implements SvcLogicJavaPlugin { int status = -1; ByteArrayOutputStream stdout = new ByteArrayOutputStream(); ByteArrayOutputStream stderr = new ByteArrayOutputStream(); - String stdoutRes = "", stderrRes = ""; + String stdoutRes = ""; + String stderrRes = ""; try { if (!PARAM_TEST_MODE) { sshConnection = getSshConnection(p); @@ -156,7 +154,7 @@ public class SshApiCallNode implements SvcLogicJavaPlugin { stderrRes = stderr.toString(); } else { - if (params.get("TestFail").equalsIgnoreCase("true")) + if (("true").equalsIgnoreCase(params.get("TestFail"))) status = 202; else status = DEF_SUCCESS_STATUS; @@ -183,11 +181,9 @@ public class SshApiCallNode implements SvcLogicJavaPlugin { return sshAdapter.getConnection(p.sshapiUrl, p.sshapiPort, p.sshapiUser, p.sshapiPassword); // This is not supported yet in the API, patch has already been added to APPC else if (p.authtype == AuthType.KEY){ - //return sshAdapter.getConnection(p.sshapiUrl, p.sshapiPort, p.sshKey); throw new SvcLogicException("SSH Key based Auth method not supported"); } else if (p.authtype == AuthType.NONE){ - //return sshAdapter.getConnection(p.sshapiUrl, p.sshapiPort, p.sshKey); throw new SvcLogicException("SSH Auth type required, BASIC auth in support"); } else if (p.authtype == AuthType.UNSPECIFIED){ diff --git a/sshapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/sshapicall/model/JsonParser.java b/sshapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/sshapicall/model/JsonParser.java index 296192a5..3d48a790 100644 --- a/sshapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/sshapicall/model/JsonParser.java +++ b/sshapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/sshapicall/model/JsonParser.java @@ -7,6 +7,8 @@ * Copyright (C) 2018 Samsung Electronics. All rights * reserved. * ================================================================================ + * Modifications Copyright © 2018 IBM + * ================================================================================ * 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 @@ -33,7 +35,6 @@ import java.util.Map; import org.codehaus.jettison.json.JSONArray; import org.codehaus.jettison.json.JSONException; import org.codehaus.jettison.json.JSONObject; -import org.onap.ccsdk.sli.core.sli.SvcLogicException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; |