use of org.batfish.datamodel.GenericConfigObject in project batfish by batfish.
the class Batfish method convertConfigurations.
private Map<String, Configuration> convertConfigurations(Map<String, GenericConfigObject> vendorConfigurations, ConvertConfigurationAnswerElement answerElement) {
_logger.info("\n*** CONVERTING VENDOR CONFIGURATIONS TO INDEPENDENT FORMAT ***\n");
_logger.resetTimer();
Map<String, Configuration> configurations = new TreeMap<>();
List<ConvertConfigurationJob> jobs = new ArrayList<>();
for (Entry<String, GenericConfigObject> config : vendorConfigurations.entrySet()) {
GenericConfigObject vc = config.getValue();
ConvertConfigurationJob job = new ConvertConfigurationJob(_settings, vc, config.getKey());
jobs.add(job);
}
BatfishJobExecutor.runJobsInExecutor(_settings, _logger, jobs, configurations, answerElement, _settings.getHaltOnConvertError(), "Convert configurations to vendor-independent format");
_logger.printElapsedTime();
return configurations;
}
use of org.batfish.datamodel.GenericConfigObject in project batfish by batfish.
the class Batfish method deserializeVendorConfigurations.
public Map<String, GenericConfigObject> deserializeVendorConfigurations(Path serializedVendorConfigPath) {
_logger.info("\n*** DESERIALIZING VENDOR CONFIGURATION STRUCTURES ***\n");
_logger.resetTimer();
Map<Path, String> namesByPath = new TreeMap<>();
try (DirectoryStream<Path> serializedConfigs = Files.newDirectoryStream(serializedVendorConfigPath)) {
for (Path serializedConfig : serializedConfigs) {
String name = serializedConfig.getFileName().toString();
namesByPath.put(serializedConfig, name);
}
} catch (IOException e) {
throw new BatfishException("Error reading vendor configs directory", e);
}
Map<String, GenericConfigObject> vendorConfigurations = deserializeObjects(namesByPath, GenericConfigObject.class);
_logger.printElapsedTime();
return vendorConfigurations;
}
Aggregations