- responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix + ".") : "";
- PropertiesConfiguration conf = new PropertiesConfiguration(
- Constants.APPC_CONFIG_DIR + "/appc_southbound.properties");
- conf.setBasePath(null);
- EncryptionTool et = EncryptionTool.getInstance();
- log.info("responsePrefix:"+responsePrefix);
- log.debug("key:"+vnf_Type+"."+protocol+"."+action);
- if(StringUtils.isNotBlank(vnf_Type) && StringUtils.isNotBlank(protocol) && StringUtils.isNotBlank(action))
- {
- String user = (String)conf.getProperty(vnf_Type + "." + protocol + "." + action + "." + "user");
- String password = (String)conf.getProperty(vnf_Type + "." + protocol + "." + action + "." + "password");
- String port = (String)conf.getProperty(vnf_Type + "." + protocol + "." + action + "." + "port");
- String url = (String)conf.getProperty(vnf_Type + "." + protocol + "." + action + "." + "url");
- if (StringUtils.isBlank(user) || StringUtils.isBlank(password)) {
- throw new SvcLogicException("Error-while fetching user or password");
- }
- if ( (user.startsWith("[") && user.endsWith("]")) || (password.startsWith("[") && password.endsWith("]"))|| (port.startsWith("[") && port.endsWith("]"))||(url.startsWith("[") && url.endsWith("]")) )
- {
- throw new SvcLogicException("Duplicate entries found for key "+vnf_Type + "." + protocol + "." + action +"in properties File");
- }
- if (StringUtils.isNotBlank(user))
- ctx.setAttribute(responsePrefix + "user", user);
- if (StringUtils.isNotBlank(password))
- ctx.setAttribute(responsePrefix + "password", et.decrypt(password));
- if (StringUtils.isNotBlank(url))
- ctx.setAttribute(responsePrefix + "url", url);
- if (StringUtils.isNotBlank(port))
- ctx.setAttribute(responsePrefix + "port", port);
- log.debug(ctx.getAttribute(responsePrefix + "user"));
- log.debug(ctx.getAttribute(responsePrefix + "password"));
- log.debug(ctx.getAttribute(responsePrefix + "url"));
- log.debug(ctx.getAttribute(responsePrefix + "port"));
- }
- else
- {
- throw new SvcLogicException("Error-as any of properties such as vnf-type,protocol,action are missing in ctx");
+ if (serviceLogic != null && ctx != null) {
+ String key = "SELECT USER_NAME ,PASSWORD,PORT_NUMBER,URL FROM DEVICE_AUTHENTICATION WHERE VNF_TYPE = '"
+ + vnf_Type + "' AND PROTOCOL = '" + protocol + "' AND ACTION = '" + action + "'";
+ log.info("Getting authentication details :" + key);
+ status = serviceLogic.query("SQL", false, null, key, null, null, ctx);
+ if (status == QueryStatus.FAILURE) {
+ log.info(fn + ":: Error retrieving credentials");
+ throw new SvcLogicException("Error retrieving credentials");
+ }
+ if (status == QueryStatus.NOT_FOUND) {
+ log.info(fn + ":: NOT_FOUND! No data found in device_authentication table for " + vnf_Type + " "
+ + protocol + "" + action + "");
+ throw new SvcLogicException(fn + ":: NOT_FOUND! No data found in device_authentication table for "
+ + vnf_Type + " " + protocol + "" + action + "");