@Override public void visitNamedCommunitySet(NamedCommunitySet namedCommunitySet) { visitCommunityList(_configuration.getCommunityLists().get(namedCommunitySet.getName())); }
private BoolExpr matchCommunitySet(Configuration conf, CommunitySetExpr e, SymbolicRoute other) { if (e instanceof CommunityList) { Set<CommunityVar> comms = collectCommunityVars(conf, e); BoolExpr acc = _enc.mkTrue(); for (CommunityVar comm : comms) { BoolExpr c = other.getCommunities().get(comm); if (c == null) { throw new BatfishException("matchCommunitySet: should not be null"); } acc = _enc.mkAnd(acc, c); } return acc; } if (e instanceof NamedCommunitySet) { NamedCommunitySet x = (NamedCommunitySet) e; CommunityList cl = conf.getCommunityLists().get(x.getName()); return matchCommunityList(cl, other); } throw new BatfishException("TODO: match community set"); }
private BDD matchCommunitySet( TransferParam<BDDRoute> p, Configuration conf, CommunitySetExpr e, BDDRoute other) { if (e instanceof CommunityList) { Set<CommunityVar> comms = ((CommunityList) e) .getLines().stream() .map(line -> toCommunityVar(line.getMatchCondition())) .collect(Collectors.toSet()); 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"); }