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;
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
*/
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");
}
/**
dbRegistration = null;
}
}
-
- public String getName() {
- return "APPC NETCONF adapter";
- }
-
}
import org.onap.appc.exceptions.APPCException;
-
public class MockOperationalStateValidatorImpl implements OperationalStateValidator {
+
@Override
public VnfType getVnfType() {
return VnfType.MOCK;
@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
public class NetconfClientFactory {
- public NetconfClient GetNetconfClient(NetconfClientType type){
+ public NetconfClient getNetconfClient(NetconfClientType type){
if(type==NetconfClientType.RESTCONF) {
return new NetconfClientRestconfImpl();
* @return
* @throws DataAccessException
*/
- String retrieveConfigFileName(String xmlID) throws DataAccessException;
+ String retrieveConfigFileName(String xmlID);
/**
*
* @return
* @throws DataAccessException
*/
- boolean retrieveConnectionDetails(String vnfType, ConnectionDetails connectionDetails) throws DataAccessException;
+ boolean retrieveConnectionDetails(String vnfType, ConnectionDetails connectionDetails);
/**
*
* @return
* @throws DataAccessException
*/
- boolean retrieveNetconfConnectionDetails(String vnfType, NetconfConnectionDetails connectionDetails) throws
- DataAccessException;
+ boolean retrieveNetconfConnectionDetails(String vnfType, NetconfConnectionDetails connectionDetails);
/**
*
* @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);
}
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";
+
}
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) {
public class VNFOperationalStateValidatorImpl implements OperationalStateValidator {
private static final String OPERATIONAL_STATE_ELEMENT_NAME = "operationalState";
+
@Override
public VnfType getVnfType() {
return VnfType.VNF;
@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;
}
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) {
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);
throw new IOException(e);
}
- if (status == false) {
+ if (!status) {
throw new IOException("Failed to read netconf message");
}
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";
"</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" +
"</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() {}
}
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 + " " +
}
@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 + "," +
}
@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))
{
}
@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+","+
}
}
- 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
}
boolean isCompleted() {
- return (text != null);
+ return text != null;
}
byte[] getFrame() {
case com.jcraft.jsch.Logger.FATAL:
LOG.error(message);
break;
+ default:
+ break;
}
}
}
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);
}
}
+ 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) {
private NetconfConnectionDetails connectionDetails;
- //constructor
public NetconfClientRestconfImpl(){
+ //constructor
}
//restconf client impl
import org.junit.Assert;
import org.junit.Test;
-import org.onap.appc.adapter.netconf.internal.NetconfAdapter;
import java.io.IOException;
import java.io.PipedInputStream;
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";
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);
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";
" </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);
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";
" </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);
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
" </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);
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";
" </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);
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");
}
//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;
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
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
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"));
private final NetconfClientJschMock jschClient = new NetconfClientJschMock();
@Override
- public NetconfClient GetNetconfClient(NetconfClientType type){
+ public NetconfClient getNetconfClient(NetconfClientType type){
return jschClient;
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;
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());
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 {
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 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<>();
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 daoServiceMock = (DAOServiceMock) dao;
daoServiceMock.setConfigFile(fileContent);
- NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.GetNetconfClient(NetconfClientType.SSH);
+ NetconfClientJschMock client = (NetconfClientJschMock) clientFactory.getNetconfClient(NetconfClientType.SSH);
client.setAnswer("wrong");
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());
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());
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);
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);
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);
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);
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 {
public class OperationStateValidatorFactoryMock extends OperationalStateValidatorFactory {
public static OperationalStateValidator getOperationalStateValidator(String vnfType) {
- VnfType vnfTypeEnum = null;
+ VnfType vnfTypeEnum;
try {
vnfTypeEnum = VnfType.getVnfType(vnfType);
} catch (IllegalArgumentException e) {
}
-
-
}