use of org.batfish.datamodel.answers.ParseVendorConfigurationAnswerElement in project batfish by batfish.
the class Batfish method histogram.
private void histogram(Path testRigPath) {
Map<Path, String> configurationData = readConfigurationFiles(testRigPath, BfConsts.RELPATH_CONFIGURATIONS_DIR);
// todo: either remove histogram function or do something userful with
// answer
Map<String, VendorConfiguration> vendorConfigurations = parseVendorConfigurations(configurationData, new ParseVendorConfigurationAnswerElement(), ConfigurationFormat.UNKNOWN);
_logger.info("Building feature histogram...");
MultiSet<String> histogram = new TreeMultiSet<>();
for (VendorConfiguration vc : vendorConfigurations.values()) {
Set<String> unimplementedFeatures = vc.getUnimplementedFeatures();
histogram.add(unimplementedFeatures);
}
_logger.info("OK\n");
for (String feature : histogram.elements()) {
int count = histogram.count(feature);
_logger.outputf("%s: %s\n", feature, count);
}
}
use of org.batfish.datamodel.answers.ParseVendorConfigurationAnswerElement in project batfish by batfish.
the class Batfish method repairConfigurations.
private void repairConfigurations() {
ParseVendorConfigurationAnswerElement pvcae = loadParseVendorConfigurationAnswerElement();
if (!Version.isCompatibleVersion("Service", "Old parsed configurations", pvcae.getVersion())) {
repairVendorConfigurations();
}
Path inputPath = _testrigSettings.getSerializeVendorPath();
serializeIndependentConfigs(inputPath);
}
use of org.batfish.datamodel.answers.ParseVendorConfigurationAnswerElement in project batfish by batfish.
the class WorkMgr method getParsingResults.
public JSONObject getParsingResults(String containerName, String testrigName) throws JsonProcessingException, JSONException {
ParseVendorConfigurationAnswerElement pvcae = deserializeObject(getdirTestrig(containerName, testrigName).resolve(BfConsts.RELPATH_PARSE_ANSWER_PATH), ParseVendorConfigurationAnswerElement.class);
JSONObject warnings = new JSONObject();
SortedMap<String, Warnings> warningsMap = pvcae.getWarnings();
ObjectWriter writer = BatfishObjectMapper.prettyWriter();
for (String s : warningsMap.keySet()) {
warnings.put(s, writer.writeValueAsString(warningsMap.get(s)));
}
return warnings;
}
Aggregations