summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/AppcNetconfAdapterActivator.java22
-rw-r--r--appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/MockOperationalStateValidatorImpl.java6
-rw-r--r--appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/NetconfClientFactory.java2
-rw-r--r--appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/NetconfDataAccessService.java10
-rw-r--r--appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/OperationalStateValidator.java3
-rw-r--r--appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/OperationalStateValidatorFactory.java4
-rw-r--r--appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/VNFOperationalStateValidatorImpl.java76
-rw-r--r--appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/internal/NetconfAdapter.java27
-rw-r--r--appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/internal/NetconfConstMessages.java10
-rw-r--r--appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/internal/NetconfDataAccessServiceImpl.java20
-rw-r--r--appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/internal/NetconfMessage.java5
-rw-r--r--appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/jsch/JSchLogger.java2
-rw-r--r--appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/jsch/NetconfClientJsch.java28
-rw-r--r--appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/odlconnector/NetconfClientRestconfImpl.java2
-rw-r--r--appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/internal/TestNetconfAdapter.java1
-rw-r--r--appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestGetRunningConfig.java8
-rw-r--r--appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestModifyConfig.java8
-rw-r--r--appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestModifyConfigMock.java8
-rw-r--r--appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestModifyConfigRouterMock.java8
-rw-r--r--appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestOperationalStates.java8
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-netconf/src/main/java/org/onap/appc/dg/netconf/impl/NetconfClientPluginImpl.java12
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfClientFactoryMock.java2
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfClientPluginImplTest.java27
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/OperationStateValidatorFactoryMock.java4
24 files changed, 136 insertions, 167 deletions
diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/AppcNetconfAdapterActivator.java b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/AppcNetconfAdapterActivator.java
index 70438d7da..33bf33112 100644
--- a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/AppcNetconfAdapterActivator.java
+++ b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/AppcNetconfAdapterActivator.java
@@ -26,9 +26,6 @@ package org.onap.appc.adapter.netconf;
import org.onap.appc.adapter.netconf.internal.NetconfDataAccessServiceImpl;
import org.onap.ccsdk.sli.core.dblib.DbLibService;
-import org.onap.appc.i18n.Msg;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
@@ -43,10 +40,6 @@ public class AppcNetconfAdapterActivator implements BundleActivator {
private ServiceRegistration reporterRegistration = null;
private ServiceRegistration factoryRegistration = null;
private ServiceRegistration dbRegistration = null;
- /**
- * The logger to be used
- */
- private static final EELFLogger logger = EELFManager.getInstance().getLogger(AppcNetconfAdapterActivator.class);
/**
* Called when this bundle is started so the Framework can perform the bundle-specific activities necessary to start
@@ -71,17 +64,13 @@ public class AppcNetconfAdapterActivator implements BundleActivator {
*/
NetconfClientFactory clientFactory = new NetconfClientFactory();
factoryRegistration = context.registerService(NetconfClientFactory.class, clientFactory, null);
- NetconfDataAccessService DAService = new NetconfDataAccessServiceImpl();
+ NetconfDataAccessService dataAccessService = new NetconfDataAccessServiceImpl();
//set dblib service
- DbLibService dblibSvc = null;
ServiceReference sref = context.getServiceReference(DbLibService.class.getName());
- dblibSvc = (DbLibService)context.getService(sref);
- DAService.setDbLibService(dblibSvc);
+ dataAccessService.setDbLibService((DbLibService)context.getService(sref));
///////////////////////////////////
- factoryRegistration = context.registerService(NetconfDataAccessService.class, DAService, null);
+ factoryRegistration = context.registerService(NetconfDataAccessService.class, dataAccessService, null);
}
-
- //logger.info(Msg.COMPONENT_INITIALIZED, "NETCONF adapter");
}
/**
@@ -122,9 +111,4 @@ public class AppcNetconfAdapterActivator implements BundleActivator {
dbRegistration = null;
}
}
-
- public String getName() {
- return "APPC NETCONF adapter";
- }
-
}
diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/MockOperationalStateValidatorImpl.java b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/MockOperationalStateValidatorImpl.java
index 079ae76a4..f29336280 100644
--- a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/MockOperationalStateValidatorImpl.java
+++ b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/MockOperationalStateValidatorImpl.java
@@ -26,8 +26,8 @@ package org.onap.appc.adapter.netconf;
import org.onap.appc.exceptions.APPCException;
-
public class MockOperationalStateValidatorImpl implements OperationalStateValidator {
+
@Override
public VnfType getVnfType() {
return VnfType.MOCK;
@@ -35,8 +35,8 @@ public class MockOperationalStateValidatorImpl implements OperationalStateValida
@Override
public String getConfigurationFileName() {
- String configFileName = OperationalStateValidatorFactory.configuration.getProperty(this.getClass().getCanonicalName() + CONFIG_FILE_PROPERTY_SUFFIX);
- return configFileName;
+ return OperationalStateValidatorFactory.configuration
+ .getProperty(this.getClass().getCanonicalName() + CONFIG_FILE_PROPERTY_SUFFIX);
}
@Override
diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/NetconfClientFactory.java b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/NetconfClientFactory.java
index 45c8fb0ed..0ce6c4bc5 100644
--- a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/NetconfClientFactory.java
+++ b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/NetconfClientFactory.java
@@ -30,7 +30,7 @@ import org.onap.appc.adapter.netconf.odlconnector.NetconfClientRestconfImpl;
public class NetconfClientFactory {
- public NetconfClient GetNetconfClient(NetconfClientType type){
+ public NetconfClient getNetconfClient(NetconfClientType type){
if(type==NetconfClientType.RESTCONF) {
return new NetconfClientRestconfImpl();
diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/NetconfDataAccessService.java b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/NetconfDataAccessService.java
index f831541da..a8607a5c9 100644
--- a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/NetconfDataAccessService.java
+++ b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/NetconfDataAccessService.java
@@ -49,7 +49,7 @@ public interface NetconfDataAccessService {
* @return
* @throws DataAccessException
*/
- String retrieveConfigFileName(String xmlID) throws DataAccessException;
+ String retrieveConfigFileName(String xmlID);
/**
*
@@ -58,7 +58,7 @@ public interface NetconfDataAccessService {
* @return
* @throws DataAccessException
*/
- boolean retrieveConnectionDetails(String vnfType, ConnectionDetails connectionDetails) throws DataAccessException;
+ boolean retrieveConnectionDetails(String vnfType, ConnectionDetails connectionDetails);
/**
*
@@ -67,8 +67,7 @@ public interface NetconfDataAccessService {
* @return
* @throws DataAccessException
*/
- boolean retrieveNetconfConnectionDetails(String vnfType, NetconfConnectionDetails connectionDetails) throws
- DataAccessException;
+ boolean retrieveNetconfConnectionDetails(String vnfType, NetconfConnectionDetails connectionDetails);
/**
*
@@ -79,7 +78,6 @@ public interface NetconfDataAccessService {
* @return
* @throws DataAccessException
*/
- boolean logDeviceInteraction(String instanceId, String requestId, String creationDate, String logText) throws
- DataAccessException;
+ boolean logDeviceInteraction(String instanceId, String requestId, String creationDate, String logText);
}
diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/OperationalStateValidator.java b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/OperationalStateValidator.java
index ffa3862e8..db3a8ef7e 100644
--- a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/OperationalStateValidator.java
+++ b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/OperationalStateValidator.java
@@ -28,8 +28,9 @@ import org.onap.appc.exceptions.APPCException;
public interface OperationalStateValidator {
+ public static final String CONFIG_FILE_PROPERTY_SUFFIX = "-CONFIG_FILE";
public VnfType getVnfType();
public String getConfigurationFileName();
public void validateResponse(String response) throws APPCException;
- final public static String CONFIG_FILE_PROPERTY_SUFFIX = "-CONFIG_FILE";
+
}
diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/OperationalStateValidatorFactory.java b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/OperationalStateValidatorFactory.java
index 37e96917d..d6d34ba13 100644
--- a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/OperationalStateValidatorFactory.java
+++ b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/OperationalStateValidatorFactory.java
@@ -31,8 +31,10 @@ import org.onap.appc.configuration.ConfigurationFactory;
public class OperationalStateValidatorFactory {
protected static final Configuration configuration = ConfigurationFactory.getConfiguration();
+ protected OperationalStateValidatorFactory() {}
+
public static OperationalStateValidator getOperationalStateValidator(String vnfType) {
- VnfType vnfTypeEnum = null;
+ VnfType vnfTypeEnum;
try {
vnfTypeEnum = VnfType.getVnfType(vnfType);
} catch (IllegalArgumentException e) {
diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/VNFOperationalStateValidatorImpl.java b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/VNFOperationalStateValidatorImpl.java
index 4bb5ab238..ebe69c851 100644
--- a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/VNFOperationalStateValidatorImpl.java
+++ b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/VNFOperationalStateValidatorImpl.java
@@ -41,6 +41,7 @@ import java.util.*;
public class VNFOperationalStateValidatorImpl implements OperationalStateValidator {
private static final String OPERATIONAL_STATE_ELEMENT_NAME = "operationalState";
+
@Override
public VnfType getVnfType() {
return VnfType.VNF;
@@ -48,8 +49,9 @@ public class VNFOperationalStateValidatorImpl implements OperationalStateValidat
@Override
public String getConfigurationFileName() {
- String configFileName = OperationalStateValidatorFactory.configuration.getProperty(this.getClass().getCanonicalName() + CONFIG_FILE_PROPERTY_SUFFIX);
- configFileName = configFileName == null? "VnfGetOperationalStates" : configFileName;
+ String configFileName = OperationalStateValidatorFactory.configuration
+ .getProperty(this.getClass().getCanonicalName() + CONFIG_FILE_PROPERTY_SUFFIX);
+ configFileName = configFileName == null ? "VnfGetOperationalStates" : configFileName;
return configFileName;
}
@@ -58,54 +60,46 @@ public class VNFOperationalStateValidatorImpl implements OperationalStateValidat
if(StringUtils.isEmpty(response)) {
throw new APPCException("empty response");
}
-
- boolean isValid = false;
- String errorMsg = "unexpected response";
try {
- List<Map.Entry> operationalStateList = getOperationalStateList(response);
- if(operationalStateList != null && !operationalStateList.isEmpty()) {
- for (Map.Entry stateEntry : operationalStateList) {
- if(!((String)stateEntry.getValue()).equalsIgnoreCase("ENABLED")){
- errorMsg = "at least one "+OPERATIONAL_STATE_ELEMENT_NAME+" is not in valid satae. "+operationalStateList.toString();
- isValid = false;
- break;
- }else{
- isValid =true;
- }
- }
- }else {
- errorMsg = "response without any "+OPERATIONAL_STATE_ELEMENT_NAME+" element";
+ List<Map.Entry> operationalStateList = getOperationalStateList(response).orElseThrow(() ->
+ new APPCException("response without any "+OPERATIONAL_STATE_ELEMENT_NAME+" element"));
+
+ if(operationalStateList.stream().anyMatch(this::isNotEnabled)) {
+ throw new APPCException("at least one "+OPERATIONAL_STATE_ELEMENT_NAME+" is not in valid state. "
+ +operationalStateList.toString());
}
- } catch (Exception e ) {
- isValid = false;
- errorMsg = e.toString();
+
+ } catch (Exception e) {
+ throw new APPCException(e);
}
- if(!isValid) throw new APPCException(errorMsg);
}
- private static List<Map.Entry> getOperationalStateList(String xmlText) throws IOException, ParserConfigurationException, SAXException {
+ private boolean isNotEnabled(Map.Entry stateEntry) {
+ return !("ENABLED").equalsIgnoreCase((String)stateEntry.getValue());
+ }
+
+ private static Optional<List<Map.Entry>> getOperationalStateList(String xmlText) throws IOException, ParserConfigurationException, SAXException {
List<Map.Entry> entryList = null;
- if(StringUtils.isNotEmpty(xmlText)) {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder builder = factory.newDocumentBuilder();
-
- Document document = builder.parse(new ByteArrayInputStream(xmlText.getBytes("UTF-8")));
- if(document != null) {
- Element rootElement = document.getDocumentElement();
- NodeList nodeList = rootElement.getElementsByTagName(OPERATIONAL_STATE_ELEMENT_NAME);
- if (nodeList != null && nodeList.getLength() > 0) {
- for (int i = 0; i < nodeList.getLength(); i++) {
- Node node = nodeList.item(i);
- String text = node.getTextContent();
- String id = getElementID(node);
- entryList = (entryList == null) ? new ArrayList<Map.Entry>() : entryList;
- Map.Entry entry = new AbstractMap.SimpleEntry<String, String>(id, text);
- entryList.add(entry);
- }
+
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ Document document = builder.parse(new ByteArrayInputStream(xmlText.getBytes("UTF-8")));
+
+ if(document != null) {
+ Element rootElement = document.getDocumentElement();
+ NodeList nodeList = rootElement.getElementsByTagName(OPERATIONAL_STATE_ELEMENT_NAME);
+ if (nodeList != null && nodeList.getLength() > 0) {
+ entryList = new ArrayList<>();
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ Node node = nodeList.item(i);
+ String text = node.getTextContent();
+ String id = getElementID(node);
+ Map.Entry entry = new AbstractMap.SimpleEntry<>(id, text);
+ entryList.add(entry);
}
}
}
- return entryList;
+ return Optional.ofNullable(entryList);
}
private static String getElementID(Node node) {
diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/internal/NetconfAdapter.java b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/internal/NetconfAdapter.java
index 2d8c6f417..bb2a333ea 100644
--- a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/internal/NetconfAdapter.java
+++ b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/internal/NetconfAdapter.java
@@ -71,26 +71,17 @@ public class NetconfAdapter {
final NetconfMessage message = new NetconfMessage();
final byte[] buf = new byte[1024];
- //int readByte = 1;
// Read data with timeout
- Callable<Boolean> readTask = new Callable<Boolean>() {
- @Override
- public Boolean call() throws Exception {
- int c;
- while ((c = in.read(buf)) > 0) {
- if (c > 0) {
- message.append(buf, 0, c);
- if (message.isCompleted()) {
- break;
- }
- }
+ Callable<Boolean> readTask = () -> {
+ int c;
+ while ((c = in.read(buf)) > 0) {
+ message.append(buf, 0, c);
+ if (message.isCompleted()) {
+ break;
}
-
- if (c < 0) {
- return false;
- }
- return true;
}
+
+ return c >= 0;
};
Future<Boolean> future = executor.submit(readTask);
@@ -101,7 +92,7 @@ public class NetconfAdapter {
throw new IOException(e);
}
- if (status == false) {
+ if (!status) {
throw new IOException("Failed to read netconf message");
}
diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/internal/NetconfConstMessages.java b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/internal/NetconfConstMessages.java
index c7ad9bc50..897788e1e 100644
--- a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/internal/NetconfConstMessages.java
+++ b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/internal/NetconfConstMessages.java
@@ -26,8 +26,10 @@ package org.onap.appc.adapter.netconf.internal;
public class NetconfConstMessages {
+ private static final String XML_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
+
public static final String CAPABILITIES_START =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+ XML_HEADER +
"<hello xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n" +
" <capabilities>\n";
@@ -39,7 +41,7 @@ public class NetconfConstMessages {
"</hello>";
public static final String GET_RUNNING_CONFIG =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+ XML_HEADER +
"<rpc message-id=\"1\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n" +
" <get-config>\n" +
" <source>\n" +
@@ -49,8 +51,10 @@ public class NetconfConstMessages {
"</rpc>";
public static final String CLOSE_SESSION =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+ XML_HEADER +
"<rpc message-id=\"terminateConnection\" xmlns:netconf=\"urn:ietf:params:xml:ns:netconf:base:1.0\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n" +
" <close-session/>\n" +
"</rpc>";
+
+ private NetconfConstMessages() {}
}
diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/internal/NetconfDataAccessServiceImpl.java b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/internal/NetconfDataAccessServiceImpl.java
index 6ed181d1d..7a6848b53 100644
--- a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/internal/NetconfDataAccessServiceImpl.java
+++ b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/internal/NetconfDataAccessServiceImpl.java
@@ -41,18 +41,21 @@ public class NetconfDataAccessServiceImpl implements NetconfDataAccessService {
private final EELFLogger logger = EELFManager.getInstance().getLogger(NetconfDataAccessServiceImpl.class);
+ private String schema;
+
+ private DbLibService dbLibService;
+
+ @Override
public void setSchema(String schema) {
this.schema = schema;
}
- private String schema;
-
+ @Override
public void setDbLibService(DbLibService service) {dbLibService = service;}
- private DbLibService dbLibService;
@Override
- public String retrieveConfigFileName(String xmlID) throws DataAccessException {
+ public String retrieveConfigFileName(String xmlID) {
String fileContent = "";
String queryString = "select " + Constants.FILE_CONTENT_TABLE_FIELD_NAME + " " +
@@ -76,8 +79,7 @@ public class NetconfDataAccessServiceImpl implements NetconfDataAccessService {
}
@Override
- public boolean retrieveConnectionDetails(String vnfType, ConnectionDetails connectionDetails) throws
- DataAccessException {
+ public boolean retrieveConnectionDetails(String vnfType, ConnectionDetails connectionDetails) {
boolean recordFound = false;
String queryString = "select " + Constants.USER_NAME_TABLE_FIELD_NAME + "," +
@@ -105,8 +107,7 @@ public class NetconfDataAccessServiceImpl implements NetconfDataAccessService {
}
@Override
- public boolean retrieveNetconfConnectionDetails(String vnfType, NetconfConnectionDetails connectionDetails)
- throws DataAccessException {
+ public boolean retrieveNetconfConnectionDetails(String vnfType, NetconfConnectionDetails connectionDetails) {
ConnectionDetails connDetails = new ConnectionDetails();
if(this.retrieveConnectionDetails(vnfType, connDetails))
{
@@ -119,8 +120,7 @@ public class NetconfDataAccessServiceImpl implements NetconfDataAccessService {
}
@Override
- public boolean logDeviceInteraction(String instanceId, String requestId, String creationDate, String logText)
- throws DataAccessException {
+ public boolean logDeviceInteraction(String instanceId, String requestId, String creationDate, String logText) {
String queryString = "INSERT INTO "+ Constants.DEVICE_INTERFACE_LOG_TABLE_NAME+"("+
Constants.SERVICE_INSTANCE_ID_FIELD_NAME+","+
Constants.REQUEST_ID_FIELD_NAME+","+
diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/internal/NetconfMessage.java b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/internal/NetconfMessage.java
index 700a51b9f..40e00964d 100644
--- a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/internal/NetconfMessage.java
+++ b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/internal/NetconfMessage.java
@@ -47,8 +47,9 @@ class NetconfMessage {
}
}
- void append(byte[] bytes, int start, int end) {
+ void append(byte[] bytes, int start, int finish) {
boolean eomFound = false;
+ int end = finish;
for(int i = start; i < end; i++) {
if(bytes[i] == EOM.charAt(eomNotch)) {
// advance notch
@@ -76,7 +77,7 @@ class NetconfMessage {
}
boolean isCompleted() {
- return (text != null);
+ return text != null;
}
byte[] getFrame() {
diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/jsch/JSchLogger.java b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/jsch/JSchLogger.java
index 37bb3b2f2..ffcd9033e 100644
--- a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/jsch/JSchLogger.java
+++ b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/jsch/JSchLogger.java
@@ -58,6 +58,8 @@ public class JSchLogger implements com.jcraft.jsch.Logger {
case com.jcraft.jsch.Logger.FATAL:
LOG.error(message);
break;
+ default:
+ break;
}
}
}
diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/jsch/NetconfClientJsch.java b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/jsch/NetconfClientJsch.java
index 7b9d7a4ae..c60fbbd1f 100644
--- a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/jsch/NetconfClientJsch.java
+++ b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/jsch/NetconfClientJsch.java
@@ -75,17 +75,9 @@ public class NetconfClientJsch implements NetconfClient {
session.connect(SESSION_CONNECT_TIMEOUT);
session.setTimeout(10000);
- try {
-// session.setServerAliveCountMax(0); // If this is not set to '0', then socket timeout on all reads will not work!!!!
- channel = session.openChannel("subsystem");
- ((ChannelSubsystem)channel).setSubsystem("netconf");
- netconfAdapter = new NetconfAdapter(channel.getInputStream(), channel.getOutputStream());
- channel.connect(CHANNEL_CONNECT_TIMEOUT);
- hello(connectionDetails.getCapabilities());
- } catch(Exception e) {
- disconnect();
- throw e;
- }
+
+ createConnection(connectionDetails);
+
} catch(Exception e) {
String message = EELFResourceManager.format(Msg.CANNOT_ESTABLISH_CONNECTION, host, String.valueOf(port), username);
throw new APPCException(message, e);
@@ -138,6 +130,20 @@ public class NetconfClientJsch implements NetconfClient {
}
}
+ private void createConnection(NetconfConnectionDetails connectionDetails) throws APPCException {
+ try {
+// session.setServerAliveCountMax(0); // If this is not set to '0', then socket timeout on all reads will not work!!!!
+ channel = session.openChannel("subsystem");
+ ((ChannelSubsystem)channel).setSubsystem("netconf");
+ netconfAdapter = new NetconfAdapter(channel.getInputStream(), channel.getOutputStream());
+ channel.connect(CHANNEL_CONNECT_TIMEOUT);
+ hello(connectionDetails.getCapabilities());
+ } catch(Exception e) {
+ disconnect();
+ throw new APPCException(e);
+ }
+ }
+
private void hello(List<String> capabilities) throws IOException {
String helloIn = netconfAdapter.receiveMessage();
if(helloIn == null) {
diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/odlconnector/NetconfClientRestconfImpl.java b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/odlconnector/NetconfClientRestconfImpl.java
index bc89551a8..d2d90194c 100644
--- a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/odlconnector/NetconfClientRestconfImpl.java
+++ b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/odlconnector/NetconfClientRestconfImpl.java
@@ -42,8 +42,8 @@ public class NetconfClientRestconfImpl implements NetconfClient, NetconfClientRe
private NetconfConnectionDetails connectionDetails;
- //constructor
public NetconfClientRestconfImpl(){
+ //constructor
}
//restconf client impl
diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/internal/TestNetconfAdapter.java b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/internal/TestNetconfAdapter.java
index cb20cbdb5..1d1c8f142 100644
--- a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/internal/TestNetconfAdapter.java
+++ b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/internal/TestNetconfAdapter.java
@@ -26,7 +26,6 @@ package org.onap.appc.adapter.netconf.internal;
import org.junit.Assert;
import org.junit.Test;
-import org.onap.appc.adapter.netconf.internal.NetconfAdapter;
import java.io.IOException;
import java.io.PipedInputStream;
diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestGetRunningConfig.java b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestGetRunningConfig.java
index b559bc749..09281f44a 100644
--- a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestGetRunningConfig.java
+++ b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestGetRunningConfig.java
@@ -24,13 +24,11 @@
package org.onap.appc.adapter.netconf.jsch;
+import org.onap.appc.adapter.netconf.NetconfConnectionDetails;
+
import java.util.Collections;
import java.util.List;
-import org.onap.appc.adapter.netconf.NetconfConnectionDetails;
-import org.onap.appc.adapter.netconf.jsch.NetconfClientJsch;
-import org.onap.appc.exceptions.APPCException;
-
public class TestGetRunningConfig {
private static final String HOST = "192.168.1.2";
@@ -39,7 +37,7 @@ public class TestGetRunningConfig {
private static final int PORT = 830;
private static final List<String> CAPABILITIES = Collections.singletonList("<capability>urn:org:onap:appc:capability:1.1.0</capability>");
- public static void main(String[] args) throws APPCException {
+ public static void main(String[] args) {
try {
NetconfConnectionDetails connectionDetails = new NetconfConnectionDetails();
connectionDetails.setHost(HOST);
diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestModifyConfig.java b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestModifyConfig.java
index 809625333..8750473d1 100644
--- a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestModifyConfig.java
+++ b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestModifyConfig.java
@@ -24,13 +24,11 @@
package org.onap.appc.adapter.netconf.jsch;
+import org.onap.appc.adapter.netconf.NetconfConnectionDetails;
+
import java.util.Collections;
import java.util.List;
-import org.onap.appc.adapter.netconf.NetconfConnectionDetails;
-import org.onap.appc.adapter.netconf.jsch.NetconfClientJsch;
-import org.onap.appc.exceptions.APPCException;
-
public class TestModifyConfig {
private static final String HOST = "192.168.1.2";
@@ -64,7 +62,7 @@ public class TestModifyConfig {
" </edit-config>\n" +
"</rpc>";
- public static void main(String[] args) throws APPCException {
+ public static void main(String[] args) {
try {
NetconfConnectionDetails connectionDetails = new NetconfConnectionDetails();
connectionDetails.setHost(HOST);
diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestModifyConfigMock.java b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestModifyConfigMock.java
index 915721d51..31dee091c 100644
--- a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestModifyConfigMock.java
+++ b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestModifyConfigMock.java
@@ -24,13 +24,11 @@
package org.onap.appc.adapter.netconf.jsch;
+import org.onap.appc.adapter.netconf.NetconfConnectionDetails;
+
import java.util.Collections;
import java.util.List;
-import org.onap.appc.adapter.netconf.NetconfConnectionDetails;
-import org.onap.appc.adapter.netconf.jsch.NetconfClientJsch;
-import org.onap.appc.exceptions.APPCException;
-
public class TestModifyConfigMock {
private static final String HOST = "192.168.1.2";
@@ -64,7 +62,7 @@ public class TestModifyConfigMock {
" </edit-config>\n" +
"</rpc>";
- public static void main(String[] args) throws APPCException {
+ public static void main(String[] args) {
try {
NetconfConnectionDetails connectionDetails = new NetconfConnectionDetails();
connectionDetails.setHost(HOST);
diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestModifyConfigRouterMock.java b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestModifyConfigRouterMock.java
index 83e62bc9f..1001c012f 100644
--- a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestModifyConfigRouterMock.java
+++ b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestModifyConfigRouterMock.java
@@ -24,13 +24,11 @@
package org.onap.appc.adapter.netconf.jsch;
+import org.onap.appc.adapter.netconf.NetconfConnectionDetails;
+
import java.util.Collections;
import java.util.List;
-import org.onap.appc.adapter.netconf.NetconfConnectionDetails;
-import org.onap.appc.adapter.netconf.jsch.NetconfClientJsch;
-import org.onap.appc.exceptions.APPCException;
-
public class TestModifyConfigRouterMock {
private static final String HOST = "10.147.27.50"; // yuma netconf simulator
@@ -66,7 +64,7 @@ public class TestModifyConfigRouterMock {
" </edit-config>\n" +
"</rpc>\n";
- public static void main(String[] args) throws APPCException {
+ public static void main(String[] args) {
try {
NetconfConnectionDetails connectionDetails = new NetconfConnectionDetails();
connectionDetails.setHost(HOST);
diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestOperationalStates.java b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestOperationalStates.java
index 263dd5a8f..a8c9e28b4 100644
--- a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestOperationalStates.java
+++ b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/onap/appc/adapter/netconf/jsch/TestOperationalStates.java
@@ -24,13 +24,11 @@
package org.onap.appc.adapter.netconf.jsch;
+import org.onap.appc.adapter.netconf.NetconfConnectionDetails;
+
import java.util.Collections;
import java.util.List;
-import org.onap.appc.adapter.netconf.NetconfConnectionDetails;
-import org.onap.appc.adapter.netconf.jsch.NetconfClientJsch;
-import org.onap.appc.exceptions.APPCException;
-
public class TestOperationalStates {
private static final String HOST = "192.168.1.2";
@@ -62,7 +60,7 @@ public class TestOperationalStates {
" </get>\n" +
"</rpc>";
- public static void main(String[] args) throws APPCException {
+ public static void main(String[] args) {
try {
NetconfConnectionDetails connectionDetails = new NetconfConnectionDetails();
connectionDetails.setHost(HOST);
diff --git a/appc-dg/appc-dg-shared/appc-dg-netconf/src/main/java/org/onap/appc/dg/netconf/impl/NetconfClientPluginImpl.java b/appc-dg/appc-dg-shared/appc-dg-netconf/src/main/java/org/onap/appc/dg/netconf/impl/NetconfClientPluginImpl.java
index 174226473..1684f1cf5 100644
--- a/appc-dg/appc-dg-shared/appc-dg-netconf/src/main/java/org/onap/appc/dg/netconf/impl/NetconfClientPluginImpl.java
+++ b/appc-dg/appc-dg-shared/appc-dg-netconf/src/main/java/org/onap/appc/dg/netconf/impl/NetconfClientPluginImpl.java
@@ -69,8 +69,8 @@ public class NetconfClientPluginImpl implements NetconfClientPlugin {
public void configure(Map<String, String> params, SvcLogicContext ctx) throws APPCException {
try {
- // by default, it uses the jsch Netconf Adapter implementation by calling GetNetconfClient(NetconfClientType.SSH).
- NetconfClient client = clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ // by default, it uses the jsch Netconf Adapter implementation by calling getNetconfClient(NetconfClientType.SSH).
+ NetconfClient client = clientFactory.getNetconfClient(NetconfClientType.SSH);
try {
NetconfConnectionDetails connectionDetails = mapper.readValue(params.get("connection-details"), NetconfConnectionDetails.class);
String netconfMessage = params.get("file-content");
@@ -127,7 +127,7 @@ public class NetconfClientPluginImpl implements NetconfClientPlugin {
}
//connect checK Opertaions state and dissconnect
- NetconfClient client = clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ NetconfClient client = clientFactory.getNetconfClient(NetconfClientType.SSH);
try {
client.connect(connectionDetails);
String response = null;
@@ -164,7 +164,7 @@ public class NetconfClientPluginImpl implements NetconfClientPlugin {
logger.debug("Entered backup to DEVICE_INTERFACE_LOG");
}
- client = clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ client = clientFactory.getNetconfClient(NetconfClientType.SSH);
//get connection details
NetconfConnectionDetails connectionDetails = mapper.readValue(params.get("connection-details"), NetconfConnectionDetails.class);
//connect the client and get configuration
@@ -199,7 +199,7 @@ public class NetconfClientPluginImpl implements NetconfClientPlugin {
BundleContext bctx = FrameworkUtil.getBundle(this.getClass()).getBundleContext();
ServiceReference sref = bctx.getServiceReference(NETCONF_CLIENT_FACTORY_NAME);
NetconfClientFactory clientFactory = (NetconfClientFactory) bctx.getService(sref);
- client = clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ client = clientFactory.getNetconfClient(NetconfClientType.SSH);
//get connection details
NetconfConnectionDetails connectionDetails = mapper.readValue(params.get("connection-details"), NetconfConnectionDetails.class);
//connect the client and get configuration
@@ -245,7 +245,7 @@ public class NetconfClientPluginImpl implements NetconfClientPlugin {
BundleContext bctx = FrameworkUtil.getBundle(this.getClass()).getBundleContext();
ServiceReference sref = bctx.getServiceReference(NETCONF_CLIENT_FACTORY_NAME);
NetconfClientFactory clientFactory = (NetconfClientFactory) bctx.getService(sref);
- client = clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ client = clientFactory.getNetconfClient(NetconfClientType.SSH);
//get connection details
NetconfConnectionDetails connectionDetails = new NetconfConnectionDetails();
connectionDetails.setHost(params.get("host-ip-address"));
diff --git a/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfClientFactoryMock.java b/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfClientFactoryMock.java
index f61d188d9..52307b9bd 100644
--- a/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfClientFactoryMock.java
+++ b/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfClientFactoryMock.java
@@ -36,7 +36,7 @@ public class NetconfClientFactoryMock extends NetconfClientFactory {
private final NetconfClientJschMock jschClient = new NetconfClientJschMock();
@Override
- public NetconfClient GetNetconfClient(NetconfClientType type){
+ public NetconfClient getNetconfClient(NetconfClientType type){
return jschClient;
diff --git a/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfClientPluginImplTest.java b/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfClientPluginImplTest.java
index 0becff701..220328c45 100644
--- a/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfClientPluginImplTest.java
+++ b/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfClientPluginImplTest.java
@@ -34,7 +34,6 @@ import org.mockito.Matchers;
import org.mockito.Mockito;
import org.onap.appc.adapter.netconf.*;
import org.onap.appc.adapter.netconf.util.Constants;
-import org.onap.appc.dg.netconf.impl.NetconfClientPluginImpl;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -129,7 +128,7 @@ public class NetconfClientPluginImplTest {
netconfClientPlugin.configure(params, ctx);
- NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.getNetconfClient(NetconfClientType.SSH);
try {
Assert.assertEquals("wrong configuration", fileContent, client.getConf());
@@ -154,7 +153,7 @@ public class NetconfClientPluginImplTest {
params = new HashMap<>();
params.put(Constants.CONNECTION_DETAILS_FIELD_NAME, "{" + connectionDetails);
params.put(Constants.FILE_CONTENT_FIELD_NAME, fileContent);
- NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.getNetconfClient(NetconfClientType.SSH);
try {
@@ -174,7 +173,7 @@ public class NetconfClientPluginImplTest {
DAOServiceMock daoServiceMock = (DAOServiceMock) dao;
daoServiceMock.setConfigFile(fileContent);
- NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.getNetconfClient(NetconfClientType.SSH);
client.setAnswer(operationalState);
@@ -202,7 +201,7 @@ public class NetconfClientPluginImplTest {
DAOServiceMock daoServiceMock = (DAOServiceMock) dao;
daoServiceMock.setConfigFile(fileContent);
- NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.getNetconfClient(NetconfClientType.SSH);
client.setAnswer(operationalState);
params = new HashMap<>();
@@ -234,7 +233,7 @@ public class NetconfClientPluginImplTest {
DAOServiceMock daoServiceMock = (DAOServiceMock) dao;
daoServiceMock.setConfigFile(fileContent);
- NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.getNetconfClient(NetconfClientType.SSH);
client.setAnswer(operationalState);
@@ -270,7 +269,7 @@ public class NetconfClientPluginImplTest {
DAOServiceMock daoServiceMock = (DAOServiceMock) dao;
daoServiceMock.setConfigFile(fileContent);
- NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.getNetconfClient(NetconfClientType.SSH);
client.setAnswer("wrong");
@@ -303,7 +302,7 @@ public class NetconfClientPluginImplTest {
DAOServiceMock daoServiceMock = (DAOServiceMock) dao;
daoServiceMock.setConfigFile(fileContent);
- NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.getNetconfClient(NetconfClientType.SSH);
client.setAnswer(operationalState);
((DAOServiceMock) dao).setConnection(getConnectionDetails());
@@ -331,7 +330,7 @@ public class NetconfClientPluginImplTest {
DAOServiceMock daoServiceMock = (DAOServiceMock) dao;
daoServiceMock.setConfigFile(fileContent);
- NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.getNetconfClient(NetconfClientType.SSH);
client.setAnswer(operationalState);
((DAOServiceMock) dao).setConnection(getConnectionDetails());
@@ -359,7 +358,7 @@ public class NetconfClientPluginImplTest {
SvcLogicContext ctx = new SvcLogicContext();
params = new HashMap<>();
params.put(Constants.CONNECTION_DETAILS_FIELD_NAME, connectionDetails);
- NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.getNetconfClient(NetconfClientType.SSH);
client.setConf(fileContent);
netconfClientPlugin.backupConfiguration(params, ctx);
@@ -383,7 +382,7 @@ public class NetconfClientPluginImplTest {
SvcLogicContext ctx = new SvcLogicContext();
params = new HashMap<>();
params.put(Constants.CONNECTION_DETAILS_FIELD_NAME, "{" + connectionDetails);
- NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.getNetconfClient(NetconfClientType.SSH);
client.setConf(fileContent);
try {
netconfClientPlugin.backupConfiguration(params, ctx);
@@ -408,7 +407,7 @@ public class NetconfClientPluginImplTest {
params = new HashMap<>();
params.put("conf-id", "current");
params.put(Constants.CONNECTION_DETAILS_FIELD_NAME, connectionDetails);
- NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.getNetconfClient(NetconfClientType.SSH);
client.setConf(fileContent);
@@ -500,7 +499,7 @@ public class NetconfClientPluginImplTest {
params.put("password", password);
params.put("port-number", String.valueOf(port));
- NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.getNetconfClient(NetconfClientType.SSH);
client.setConf(fileContent);
netconfClientPlugin.getRunningConfig(params, ctx);
@@ -519,7 +518,7 @@ public class NetconfClientPluginImplTest {
params.put("user-name", username);
params.put("password", password);
- NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.getNetconfClient(NetconfClientType.SSH);
client.setConf(fileContent);
try {
diff --git a/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/OperationStateValidatorFactoryMock.java b/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/OperationStateValidatorFactoryMock.java
index 2194fc14c..9472b69a1 100644
--- a/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/OperationStateValidatorFactoryMock.java
+++ b/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/OperationStateValidatorFactoryMock.java
@@ -30,7 +30,7 @@ import org.onap.appc.adapter.netconf.*;
public class OperationStateValidatorFactoryMock extends OperationalStateValidatorFactory {
public static OperationalStateValidator getOperationalStateValidator(String vnfType) {
- VnfType vnfTypeEnum = null;
+ VnfType vnfTypeEnum;
try {
vnfTypeEnum = VnfType.getVnfType(vnfType);
} catch (IllegalArgumentException e) {
@@ -45,6 +45,4 @@ public class OperationStateValidatorFactoryMock extends OperationalStateValidato
}
-
-
}