aboutsummaryrefslogtreecommitdiffstats
path: root/appc-dg/appc-dg-shared/appc-dg-ssh
diff options
context:
space:
mode:
authorPatrick Brady <pb071s@att.com>2017-06-01 10:45:37 -0700
committerPatrick Brady <pb071s@att.com>2017-06-02 13:05:15 -0700
commitc7d0075d223eab9f89fd28853c4b138792059be9 (patch)
tree40aa3e41e598ea7a59bcf6899a2004c1abab11c2 /appc-dg/appc-dg-shared/appc-dg-ssh
parent8aac2df744820304ee29354333661699e9695939 (diff)
Merge of new rebased code
Change-Id: I9b8d1f69eb3e0af1935ed8304fea4bf54c1aac47 Signed-off-by: Patrick Brady <pb071s@att.com>
Diffstat (limited to 'appc-dg/appc-dg-shared/appc-dg-ssh')
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-ssh/pom.xml6
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-ssh/src/main/java/org/openecomp/appc/dg/ssh/impl/SshDBPluginImpl.java26
2 files changed, 21 insertions, 11 deletions
diff --git a/appc-dg/appc-dg-shared/appc-dg-ssh/pom.xml b/appc-dg/appc-dg-shared/appc-dg-ssh/pom.xml
index 3f5c51f28..f27c2828e 100644
--- a/appc-dg/appc-dg-shared/appc-dg-ssh/pom.xml
+++ b/appc-dg/appc-dg-shared/appc-dg-ssh/pom.xml
@@ -58,8 +58,10 @@
<Bundle-SymbolicName>appc-dg-ssh</Bundle-SymbolicName>
<Export-Package>org.openecomp.appc.dg.ssh</Export-Package>
<Private-Package>org.openecomp.appc.dg.ssh.impl.*</Private-Package>
- <Import-Package>!org.apache.log,!org.apache.commons.logging,!groovy.lang,!javax.jms,!org.codehaus.commons.compiler,!org.codehaus.groovy.*,!org.codehaus.janino,!com.ibm.icu.*,!com.sun.faces.*,!org.jasypt.*,*;resolution:=optional</Import-Package>
- <Embed-Dependency>appc-common,eelf-core,logback-core,logback-classic;scope=compile|runtime;inline=false</Embed-Dependency>
+ <Import-Package>
+ *;resolution:=optional
+ </Import-Package>
+ <!--Embed-Dependency>eelf-core,logback-core,logback-classic;scope=compile|runtime;inline=false</Embed-Dependency-->
<Embed-Transitive>true</Embed-Transitive>
</instructions>
</configuration>
diff --git a/appc-dg/appc-dg-shared/appc-dg-ssh/src/main/java/org/openecomp/appc/dg/ssh/impl/SshDBPluginImpl.java b/appc-dg/appc-dg-shared/appc-dg-ssh/src/main/java/org/openecomp/appc/dg/ssh/impl/SshDBPluginImpl.java
index 382d41894..89dd424c9 100644
--- a/appc-dg/appc-dg-shared/appc-dg-ssh/src/main/java/org/openecomp/appc/dg/ssh/impl/SshDBPluginImpl.java
+++ b/appc-dg/appc-dg-shared/appc-dg-ssh/src/main/java/org/openecomp/appc/dg/ssh/impl/SshDBPluginImpl.java
@@ -21,6 +21,7 @@
package org.openecomp.appc.dg.ssh.impl;
+import com.att.eelf.i18n.EELFResourceManager;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -32,6 +33,8 @@ import org.openecomp.appc.adapter.ssh.SshDataAccessException;
import org.openecomp.appc.adapter.ssh.SshDataAccessService;
import org.openecomp.appc.dg.ssh.SshDBPlugin;
import org.openecomp.appc.exceptions.APPCException;
+import org.openecomp.appc.i18n.Msg;
+
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import org.openecomp.sdnc.sli.SvcLogicContext;
@@ -49,24 +52,29 @@ public class SshDBPluginImpl implements SshDBPlugin {
public void retrieveConnectionDetails(Map<String, String> params, SvcLogicContext ctx) throws APPCException {
SshConnectionDetails connectionDetails = new SshConnectionDetails();
- String vnfType = ctx.getAttribute("aai.prefix")+"."+"vnf-type";
+ //String vnfType = ctx.getAttribute("aai.prefix")+"."+"vnf-type";
+ String vnfType = params.get("vnf-type");
try {
- if (!dataAccessService.retrieveConnectionDetails(ctx.getAttribute(vnfType), connectionDetails)) {
- logger.error("Missing configuration for " + params.get(vnfType));
- throw new APPCException("Missing configuration for " + params.get(vnfType) + " in " + Constants.DEVICE_AUTHENTICATION_TABLE_NAME);
+ if (!dataAccessService.retrieveConnectionDetails(vnfType, connectionDetails)) {
+ logger.error("Missing connection details for VNF type: " + vnfType);
+ throw new APPCException("Missing configuration for " + vnfType + " in " + Constants.DEVICE_AUTHENTICATION_TABLE_NAME);
}
connectionDetails.setHost(params.get(Constants.VNF_HOST_IP_ADDRESS_FIELD_NAME));
ctx.setAttribute(Constants.CONNECTION_DETAILS_FIELD_NAME, mapper.writeValueAsString(connectionDetails));
} catch(APPCException e) {
- ctx.setAttribute(Constants.DG_OUTPUT_STATUS_MESSAGE, e.getMessage());
+ String msg = EELFResourceManager.format(Msg.APPC_EXCEPTION, vnfType, e.getMessage());
+ logger.error(msg);
+ ctx.setAttribute(Constants.ATTRIBUTE_ERROR_MESSAGE,msg);
throw e;
} catch(SshDataAccessException e) {
- logger.error("Error " + e.getMessage());
- ctx.setAttribute(Constants.DG_OUTPUT_STATUS_MESSAGE, e.getMessage());
+ String msg = EELFResourceManager.format(Msg.SSH_DATA_EXCEPTION, e.getMessage());
+ logger.error(msg);
+ ctx.setAttribute(Constants.ATTRIBUTE_ERROR_MESSAGE, msg);
throw e;
} catch (JsonProcessingException e) {
- logger.error("Error " + e.getMessage());
- ctx.setAttribute(Constants.DG_OUTPUT_STATUS_MESSAGE, e.getMessage());
+ String msg = EELFResourceManager.format(Msg.JSON_PROCESSING_EXCEPTION, e.getMessage());
+ logger.error(msg);
+ ctx.setAttribute(Constants.ATTRIBUTE_ERROR_MESSAGE, msg);
throw new APPCException(e);
}
}