use of org.batfish.datamodel.CommunityListLine in project batfish by batfish.
the class Graph method findNamedCommunities.
/*
* Map named community sets that contain a single match
* back to the community/regex value. This makes it
* easier to provide intuitive counter examples.
*/
public Map<String, String> findNamedCommunities() {
Map<String, String> comms = new HashMap<>();
for (Configuration conf : getConfigurations().values()) {
for (Entry<String, CommunityList> entry : conf.getCommunityLists().entrySet()) {
String name = entry.getKey();
CommunityList cl = entry.getValue();
if (cl != null && cl.getLines().size() == 1) {
CommunityListLine line = cl.getLines().get(0);
comms.put(line.getRegex(), name);
}
}
}
return comms;
}
use of org.batfish.datamodel.CommunityListLine in project batfish by batfish.
the class NamedCommunitySet method allCommunities.
@Override
public SortedSet<Long> allCommunities(Environment environment) {
ImmutableSortedSet.Builder<Long> out = ImmutableSortedSet.naturalOrder();
CommunityList cl = environment.getConfiguration().getCommunityLists().get(_name);
for (CommunityListLine line : cl.getLines()) {
Long community = line.toLiteralCommunity();
out.add(community);
}
return out.build();
}
Aggregations