X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=netconf-server%2Fsrc%2Fmain%2Fjava%2Forg%2Fcommscope%2Ftr069adapter%2Fnetconf%2Fserver%2FNetConfServerManagerImpl.java;fp=netconf-server%2Fsrc%2Fmain%2Fjava%2Forg%2Fcommscope%2Ftr069adapter%2Fnetconf%2Fserver%2FNetConfServerManagerImpl.java;h=02c6800c407c2c196a8d0d06ce9b17a612dc9377;hb=bfb65ab24d6ce7db221c5f52689a8efd8873fb1a;hp=b1c746089cf838b6b695d4fd235c1a4341462569;hpb=76744e810f35c84ecbd1d9998e361052466e9483;p=oam%2Ftr069-adapter.git diff --git a/netconf-server/src/main/java/org/commscope/tr069adapter/netconf/server/NetConfServerManagerImpl.java b/netconf-server/src/main/java/org/commscope/tr069adapter/netconf/server/NetConfServerManagerImpl.java index b1c7460..02c6800 100644 --- a/netconf-server/src/main/java/org/commscope/tr069adapter/netconf/server/NetConfServerManagerImpl.java +++ b/netconf-server/src/main/java/org/commscope/tr069adapter/netconf/server/NetConfServerManagerImpl.java @@ -82,6 +82,10 @@ public class NetConfServerManagerImpl { ExecutorService executorService = Executors.newFixedThreadPool(10); + private static final String ENODEBNAME = "enodeBName"; + + private static final String FAIL_DEVICE_UNREGISTER = "Failed to unregister the device "; + public boolean loadSchemas() { LOG.debug("Loading yang schema started"); List profiles = versionManager.getSupportedProfileDefinitions(); @@ -100,11 +104,7 @@ public class NetConfServerManagerImpl { return false; } - try { - FileUtils.copyDirectory(schemaDir, schemaVerDir); - } catch (IOException e) { - LOG.error("Failed to copy directory {} ", e.getMessage()); - } + copyDir(schemaDir, schemaVerDir); boolean isSchemaLoaded = ncServerStarter.loadSchemas(schemaVerDir); if (!isSchemaLoaded) { LOG.debug("Failed to load schema for profile {}", profile.getProfileId()); @@ -119,6 +119,14 @@ public class NetConfServerManagerImpl { return true; } +private void copyDir(File schemaDir, File schemaVerDir) { + try { + FileUtils.copyDirectory(schemaDir, schemaVerDir); + } catch (IOException e) { + LOG.error("Failed to copy directory {} ", e.getMessage()); + } + } + public void restartServers() { LOG.debug("Restarting all netconf servers during startup..."); Iterable entities = netconfDAO.findAll(); @@ -324,12 +332,13 @@ public class NetConfServerManagerImpl { } else { LOG.error( "Both deviceID and enodeBName are null. Hence failed to unregister the netconf server."); - resultMsg = "Failed to unregister the device " + deviceId + ", enodeBName=" + enodeBName - + ". Invalid deviceId/enodeBName specified."; + resultMsg = FAIL_DEVICE_UNREGISTER + deviceId + ", " + ENODEBNAME + "=" + enodeBName + + ". Invalid deviceId/enodeBName specified."; + LOG.info(resultMsg); } if (entity == null) { - resultMsg = "Failed to unregister the device " + deviceId + ", enodeBName=" + enodeBName - + ". Invalid deviceId/enodeBName specified."; + resultMsg = FAIL_DEVICE_UNREGISTER + deviceId + ", " + ENODEBNAME + "=" + enodeBName + + ". Invalid deviceId/enodeBName specified."; LOG.info(resultMsg); return resultMsg; } @@ -342,7 +351,7 @@ public class NetConfServerManagerImpl { LOG.info(resultMsg); delteHeartBeatTimer(deviceId); } else { - resultMsg = "Failed to unregister the device " + deviceId + ", enodeBName=" + enodeBName; + resultMsg = FAIL_DEVICE_UNREGISTER + deviceId + ", " + ENODEBNAME + "=" + enodeBName; LOG.error(resultMsg); }