use of org.batfish.job.ParseEnvironmentBgpTableJob in project batfish by batfish.
the class Batfish method parseEnvironmentBgpTables.
private SortedMap<String, BgpAdvertisementsByVrf> parseEnvironmentBgpTables(SortedMap<Path, String> inputData, ParseEnvironmentBgpTablesAnswerElement answerElement) {
_logger.info("\n*** PARSING ENVIRONMENT BGP TABLES ***\n");
_logger.resetTimer();
SortedMap<String, BgpAdvertisementsByVrf> bgpTables = new TreeMap<>();
List<ParseEnvironmentBgpTableJob> jobs = new ArrayList<>();
SortedMap<String, Configuration> configurations = loadConfigurations();
for (Entry<Path, String> bgpFile : inputData.entrySet()) {
Path currentFile = bgpFile.getKey();
String fileText = bgpFile.getValue();
String hostname = currentFile.getFileName().toString();
String optionalSuffix = ".bgp";
if (hostname.endsWith(optionalSuffix)) {
hostname = hostname.substring(0, hostname.length() - optionalSuffix.length());
}
if (!configurations.containsKey(hostname)) {
continue;
}
Warnings warnings = buildWarnings(_settings);
ParseEnvironmentBgpTableJob job = new ParseEnvironmentBgpTableJob(_settings, fileText, hostname, currentFile, warnings, _bgpTablePlugins);
jobs.add(job);
}
BatfishJobExecutor.runJobsInExecutor(_settings, _logger, jobs, bgpTables, answerElement, _settings.getHaltOnParseError(), "Parse environment BGP tables");
_logger.printElapsedTime();
return bgpTables;
}
Aggregations