use of org.batfish.symbolic.CommunityVar in project batfish by batfish.
the class TransferBDD method matchCommunitySet.
/*
* Converts a community set to a boolean expression
*/
private BDD matchCommunitySet(TransferParam<BDDRoute> p, Configuration conf, CommunitySetExpr e, BDDRoute other) {
if (e instanceof InlineCommunitySet) {
Set<CommunityVar> comms = _graph.findAllCommunities(conf, e);
BDD acc = factory.one();
for (CommunityVar comm : comms) {
p.debug("Inline Community Set: " + comm);
BDD c = other.getCommunities().get(comm);
if (c == null) {
throw new BatfishException("matchCommunitySet: should not be null");
}
acc = acc.and(c);
}
return acc;
}
if (e instanceof NamedCommunitySet) {
p.debug("Named");
NamedCommunitySet x = (NamedCommunitySet) e;
CommunityList cl = conf.getCommunityLists().get(x.getName());
p.debug("Named Community Set: " + cl.getName());
return matchCommunityList(p, cl, other);
}
throw new BatfishException("TODO: match community set");
}
Aggregations