@Test public void toStatements() { List<StandardCommunity> communities = ImmutableList.of(StandardCommunity.parse("65000:1"), StandardCommunity.parse("65000:2")); RouteMapSetCommunity set = new RouteMapSetCommunity(communities, false); assertThat( set.toStatements(null, null, null).collect(ImmutableList.toImmutableList()), equalTo( ImmutableList.of( new SetCommunities( CommunitySetUnion.of( new CommunitySetExpr[] { new CommunitySetDifference( InputCommunities.instance(), AllStandardCommunities.instance()), new LiteralCommunitySet(CommunitySet.of(communities)) }))))); }
@Nonnull @Override public Stream<Statement> toStatements(Configuration c, CumulusNodeConfiguration vc, Warnings w) { CommunitySetExpr communities = new LiteralCommunitySet(CommunitySet.of(_communities)); return Stream.of( new SetCommunities( getAdditive() ? CommunitySetUnion.of(InputCommunities.instance(), communities) : CommunitySetUnion.of( new CommunitySetDifference( InputCommunities.instance(), AllStandardCommunities.instance()), communities))); }
RouteMapSetCommunity implements RouteMapSet { @Nonnull @Override public Stream<Statement> toStatements(Configuration c, CumulusNodeConfiguration vc, Warnings w) { CommunitySetExpr communities = new LiteralCommunitySet(CommunitySet.of(_communities)); return Stream.of( new SetCommunities( getAdditive() ? CommunitySetUnion.of(InputCommunities.instance(), communities) : CommunitySetUnion.of( new CommunitySetDifference( InputCommunities.instance(), AllStandardCommunities.instance()), communities))); } }
RouteMapSetCommunity implements RouteMapSet { @Nonnull @Override public Stream<Statement> toStatements(Configuration c, CumulusNodeConfiguration vc, Warnings w) { CommunitySetExpr communities = new LiteralCommunitySet(CommunitySet.of(_communities)); return Stream.of( new SetCommunities( getAdditive() ? CommunitySetUnion.of(InputCommunities.instance(), communities) : CommunitySetUnion.of( new CommunitySetDifference( InputCommunities.instance(), AllStandardCommunities.instance()), communities))); } RouteMapSetCommunity(Iterable<StandardCommunity> communities, boolean additive); }
RouteMapSetCommunity implements RouteMapSet { @Nonnull @Override public Stream<Statement> toStatements(Configuration c, CumulusNodeConfiguration vc, Warnings w) { CommunitySetExpr communities = new LiteralCommunitySet(CommunitySet.of(_communities)); return Stream.of( new SetCommunities( getAdditive() ? CommunitySetUnion.of(InputCommunities.instance(), communities) : CommunitySetUnion.of( new CommunitySetDifference( InputCommunities.instance(), AllStandardCommunities.instance()), communities))); } RouteMapSetCommunity(Iterable<StandardCommunity> communities, boolean additive); boolean getAdditive(); void setAdditive(boolean additive); @Nonnull @Override Stream<Statement> toStatements(Configuration c, CumulusNodeConfiguration vc, Warnings w); @Nonnull List<StandardCommunity> getCommunities(); void setCommunities(List<StandardCommunity> communities); }
RouteMapSetCommunity implements RouteMapSet { @Nonnull @Override public Stream<Statement> toStatements(Configuration c, CumulusNodeConfiguration vc, Warnings w) { CommunitySetExpr communities = new LiteralCommunitySet(CommunitySet.of(_communities)); return Stream.of( new SetCommunities( getAdditive() ? CommunitySetUnion.of(InputCommunities.instance(), communities) : CommunitySetUnion.of( new CommunitySetDifference( InputCommunities.instance(), AllStandardCommunities.instance()), communities))); } RouteMapSetCommunity(Iterable<StandardCommunity> communities, boolean additive); boolean getAdditive(); void setAdditive(boolean additive); @Nonnull @Override Stream<Statement> toStatements(Configuration c, CumulusNodeConfiguration vc, Warnings w); @Nonnull List<StandardCommunity> getCommunities(); void setCommunities(List<StandardCommunity> communities);  }