@JsonCreator private static SetCommunity jsonCreator( @Nullable @JsonProperty(PROP_EXPR) CommunitySetExpr expr) { checkArgument(expr != null, "%s must be provided", PROP_EXPR); return new SetCommunity(expr); }
if (stmt instanceof SetCommunity) { SetCommunity sc = (SetCommunity) stmt; comms.addAll(collectCommunityVars(conf, sc.getExpr()));
curP.debug("SetCommunity"); SetCommunity sc = (SetCommunity) stmt; Set<CommunityVar> comms = collectCommunityVars(_conf, sc.getExpr()); for (CommunityVar cvar : comms) { BoolExpr newValue =
@Override public void applyTo( List<Statement> statements, CiscoConfiguration cc, Configuration c, Warnings w) { statements.add(new SetCommunity(new LiteralCommunitySet(_communities))); }
curP.debug("SetCommunity"); SetCommunity sc = (SetCommunity) stmt; Set<CommunityVar> comms = collectCommunityVars(_conf, sc.getExpr()); for (CommunityVar cvar : comms) { if (!_policyQuotient.getCommsAssignedButNotMatched().contains(cvar)) {
@Override public Statement toSetStatement(CiscoConfiguration cc, Configuration c, Warnings w) { CommunitySetExpr expr = _commSet.toCommunitySetExpr(cc, c, w); if (_additive) { return new AddCommunity(expr); } else { return new SetCommunity(expr); } } }
_name, _name, _name)); statements.add(new SetCommunity(new LiteralCommunitySet(literalCommunities)));
/** * For each static route in the given {@link RoutingInstance} that has at least one community set, * creates an {@link If} that matches that route (specifically, matches static routes with that * route's destination network), and sets communities for matching exported routes. */ @Nonnull private static List<If> getStaticRouteCommunitySetters(@Nonnull RoutingInstance ri) { MatchProtocol matchStatic = new MatchProtocol(RoutingProtocol.STATIC); return ri.getRibs().get(RoutingInformationBase.RIB_IPV4_UNICAST).getStaticRoutes().values() .stream() .filter(route -> !route.getCommunities().isEmpty()) .map( route -> { // Create matcher that matches routes that share this route's destination network PrefixExpr destNetworkMatcher = DestinationNetwork.instance(); PrefixSetExpr destNetwork = new ExplicitPrefixSet(new PrefixSpace(PrefixRange.fromPrefix(route.getPrefix()))); MatchPrefixSet networkMatcher = new MatchPrefixSet(destNetworkMatcher, destNetwork); // When a matching static route is exported, set its communities return new If( new Conjunction(ImmutableList.of(matchStatic, networkMatcher)), ImmutableList.of( new SetCommunity(new LiteralCommunitySet(route.getCommunities())))); }) .collect(ImmutableList.toImmutableList()); }
if (index == 0) { statements.add( new SetCommunity( new org.batfish.datamodel.routing_policy.expr.NamedCommunitySet( communityListName)));