OperationsCreator operationsCreator = new CustomOperationsCreator(macID, swVersion, hwVersion);\r
configuration.setOperationsCreator(operationsCreator);\r
configuration.setGenerateConfigsTimeout((int) TimeUnit.MINUTES.toMillis(30));\r
-\r
- String versionPath = versionManager.getNetconfYangSchemaPath(swVersion, hwVersion);\r
- if (versionPath == null && swVersion != null) {\r
- LOG.error("Failed to get version path for software version {}, calling base version",\r
- swVersion);\r
- versionPath = versionManager.getBaseNetconfYangSchemaPath();\r
- } else if (swVersion == null) {\r
- LOG.error("Software version is null {}", swVersion);\r
- return false;\r
- }\r
- String schemaCommonPath = schemaDirPath + "/common";\r
- String schemaVerPath = schemaDirPath + "/" + versionPath;\r
if (portStr != null) {\r
try {\r
int port = Integer.parseInt(portStr);\r
}\r
configuration.setDeviceCount(1);\r
configuration.setSsh(Boolean.TRUE);\r
- File schemaDir = new File(schemaCommonPath);\r
configuration.setCapabilities(Configuration.DEFAULT_BASE_CAPABILITIES_EXI);\r
configuration.setIp("0.0.0.0");\r
-\r
- File schemaVerDir = new File(schemaVerPath);\r
- if (!schemaVerDir.isDirectory()) {\r
- LOG.error("No folder path found for given version path {}", schemaVerDir.getAbsolutePath());\r
+ \r
+ String versionPath = versionManager.getNetconfYangSchemaPath(swVersion, hwVersion);\r
+ if (versionPath == null && swVersion != null) {\r
+ LOG.error("Failed to get version path for software version {}, calling base version",\r
+ swVersion);\r
+ versionPath = versionManager.getBaseNetconfYangSchemaPath();\r
+ } else if (swVersion == null) {\r
+ LOG.error("Software version is null {}", swVersion);\r
return false;\r
}\r
-\r
- try {\r
- FileUtils.copyDirectory(schemaDir, schemaVerDir);\r
- } catch (IOException e) {\r
- LOG.error("Failed to copy directory " + e.getMessage());\r
- }\r
+ String schemaVerPath = schemaDirPath + File.separator + versionPath;\r
+ File schemaVerDir = new File(schemaVerPath);\r
configuration.setSchemasDir(schemaVerDir);\r
- boolean isSchemaLoaded = loadSchemas(schemaVerDir);\r
- if (!isSchemaLoaded) {\r
- LOG.debug("Failed to load schema for netconf server instance {}", macID);\r
- return false;\r
- }\r
\r
try (final NetconfDevice netconfDevice = new NetconfDevice(configuration)) {\r
final List<Integer> openDevices = netconfDevice.start();\r
return false;\r
}\r
\r
- private boolean loadSchemas(File schemasDir) {\r
+ protected boolean loadSchemas(File schemasDir) {\r
if (schemasDir != null) {\r
if (!schemasDir.exists() || !schemasDir.isDirectory() || !schemasDir.canRead()) {\r
LOG.error("Failed to load schema. schema location is not valid.");\r