Search in sources :

Example 1 with TreeMultiSet

use of org.batfish.datamodel.collections.TreeMultiSet 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);
    }
}
Also used : Path(java.nio.file.Path) IptablesVendorConfiguration(org.batfish.representation.iptables.IptablesVendorConfiguration) VendorConfiguration(org.batfish.vendor.VendorConfiguration) ParseVendorConfigurationAnswerElement(org.batfish.datamodel.answers.ParseVendorConfigurationAnswerElement) TreeMultiSet(org.batfish.datamodel.collections.TreeMultiSet)

Aggregations

Path (java.nio.file.Path)1 ParseVendorConfigurationAnswerElement (org.batfish.datamodel.answers.ParseVendorConfigurationAnswerElement)1 TreeMultiSet (org.batfish.datamodel.collections.TreeMultiSet)1 IptablesVendorConfiguration (org.batfish.representation.iptables.IptablesVendorConfiguration)1 VendorConfiguration (org.batfish.vendor.VendorConfiguration)1