code smell. Corrected suggested formating 48/105948/1
authorMamtha <mamtha.sabesan@in.ibm.com>
Tue, 14 Apr 2020 19:32:38 +0000 (01:02 +0530)
committerMamtha <mamtha.sabesan@in.ibm.com>
Tue, 14 Apr 2020 19:32:47 +0000 (01:02 +0530)
Issue-ID: APPC-1858
Change-Id: I9e384a71e756e2fd168be7d30ad726dfe08b261d
Signed-off-by: Mamtha <mamtha.sabesan@in.ibm.com>
appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/onap/appc/adapter/netconf/odlconnector/NetconfClientRestconfImpl.java

index beb14e3..0255836 100644 (file)
@@ -42,6 +42,7 @@ public class NetconfClientRestconfImpl implements NetconfClient, NetconfClientRe
     private EELFLogger logger = EELFManager.getInstance().getLogger(NetconfClientRestconfImpl.class);
 
     private NetconfConnectionDetails connectionDetails;
+       private String appFormat = "application/json";
 
     public NetconfClientRestconfImpl(){
         //constructor
@@ -56,7 +57,7 @@ public class NetconfClientRestconfImpl implements NetconfClient, NetconfClientRe
         logger.info("Configuring device " + deviceMountPointName + " with configuration " + configuration);
 
         int httpCode = httpClient.putMethod(Constants.PROTOCOL,Constants.CONTROLLER_IP,Constants.CONTROLLER_PORT,
-                getModuleConfigurePath(deviceMountPointName, moduleName, nodeName), configuration, "application/json");
+                getModuleConfigurePath(deviceMountPointName, moduleName, nodeName), configuration, appFormat);
 
         if (httpCode != HttpStatus.SC_OK) {
             logger.error("Configuration request failed. throwing Exception !");
@@ -71,7 +72,7 @@ public class NetconfClientRestconfImpl implements NetconfClient, NetconfClientRe
         logger.info("Connecting device " + deviceMountPointName);
 
         int httpCode = httpClient.postMethod(Constants.PROTOCOL, Constants.CONTROLLER_IP, Constants.CONTROLLER_PORT,
-                getConnectPath(), payload, "application/json");
+                getConnectPath(), payload, appFormat);
 
         if(httpCode != HttpStatus.SC_NO_CONTENT){
             logger.error("Connect request failed with code " + httpCode + ". throwing Exception !");
@@ -84,7 +85,7 @@ public class NetconfClientRestconfImpl implements NetconfClient, NetconfClientRe
         logger.info("Checking device " + deviceMountPointName + " connectivity");
 
         String result = httpClient.getMethod(Constants.PROTOCOL, Constants.CONTROLLER_IP,
-                Constants.CONTROLLER_PORT, getCheckConnectivityPath(deviceMountPointName), "application/json");
+                Constants.CONTROLLER_PORT, getCheckConnectivityPath(deviceMountPointName), appFormat);
 
         return result != null;
     }
@@ -94,7 +95,7 @@ public class NetconfClientRestconfImpl implements NetconfClient, NetconfClientRe
         logger.info("Disconnecting " + deviceMountPointName);
 
         int httpCode = httpClient.deleteMethod(Constants.PROTOCOL, Constants.CONTROLLER_IP, Constants.CONTROLLER_PORT,
-                getDisconnectPath(deviceMountPointName), "application/json");
+                getDisconnectPath(deviceMountPointName), appFormat);
 
         if(httpCode != HttpStatus.SC_OK){
             logger.error("Disconnection of device " + deviceMountPointName + " failed!");
@@ -107,7 +108,7 @@ public class NetconfClientRestconfImpl implements NetconfClient, NetconfClientRe
         logger.info("Getting configuration of device " + deviceMountPointName);
 
         String result = httpClient.getMethod(Constants.PROTOCOL, Constants.CONTROLLER_IP, Constants.CONTROLLER_PORT,
-                getModuleConfigurePath(deviceMountPointName, moduleName, nodeName), "application/json");
+                getModuleConfigurePath(deviceMountPointName, moduleName, nodeName), appFormat);
 
         if (result == null) {
             logger.error("Configuration request failed. throwing Exception !");