@Test public void testToBooleanExpr() { RouteMapMatchIpAddressPrefixList match = new RouteMapMatchIpAddressPrefixList(ImmutableList.of("N1", "N2")); CumulusNcluConfiguration config = new CumulusNcluConfiguration(); config .getIpPrefixLists() .putAll( ImmutableMap.of( "N1", new IpPrefixList("N1"), "N2", new IpPrefixList("N2"), "N3", new IpPrefixList("N3"))); assertThat( match.toBooleanExpr(null, config, null), equalTo( new Disjunction( new MatchPrefixSet(DestinationNetwork.instance(), new NamedPrefixSet("N1")), new MatchPrefixSet(DestinationNetwork.instance(), new NamedPrefixSet("N2"))))); }
@Nonnull @Override public BooleanExpr toBooleanExpr(Configuration c, CumulusNodeConfiguration vc, Warnings w) { return new Disjunction( _names.stream() .filter(vc.getIpPrefixLists()::containsKey) .map( name -> new MatchPrefixSet(DestinationNetwork.instance(), new NamedPrefixSet(name))) .collect(ImmutableList.toImmutableList())); }
RouteMapMatchIpAddressPrefixList implements RouteMapMatch { @Nonnull @Override public BooleanExpr toBooleanExpr(Configuration c, CumulusNodeConfiguration vc, Warnings w) { return new Disjunction( _names.stream() .filter(vc.getIpPrefixLists()::containsKey) .map( name -> new MatchPrefixSet(DestinationNetwork.instance(), new NamedPrefixSet(name))) .collect(ImmutableList.toImmutableList())); } }
RouteMapMatchIpAddressPrefixList implements RouteMapMatch { @Nonnull @Override public BooleanExpr toBooleanExpr(Configuration c, CumulusNodeConfiguration vc, Warnings w) { return new Disjunction( _names.stream() .filter(vc.getIpPrefixLists()::containsKey) .map( name -> new MatchPrefixSet(DestinationNetwork.instance(), new NamedPrefixSet(name))) .collect(ImmutableList.toImmutableList())); } RouteMapMatchIpAddressPrefixList(Iterable<String> names); }
RouteMapMatchIpAddressPrefixList implements RouteMapMatch { @Nonnull @Override public BooleanExpr toBooleanExpr(Configuration c, CumulusNodeConfiguration vc, Warnings w) { return new Disjunction( _names.stream() .filter(vc.getIpPrefixLists()::containsKey) .map( name -> new MatchPrefixSet(DestinationNetwork.instance(), new NamedPrefixSet(name))) .collect(ImmutableList.toImmutableList())); } RouteMapMatchIpAddressPrefixList(Iterable<String> names); @Nonnull @Override BooleanExpr toBooleanExpr(Configuration c, CumulusNodeConfiguration vc, Warnings w); @Nonnull List<String> getNames(); }
RouteMapMatchIpAddressPrefixList implements RouteMapMatch { @Nonnull @Override public BooleanExpr toBooleanExpr(Configuration c, CumulusNodeConfiguration vc, Warnings w) { return new Disjunction( _names.stream() .filter(vc.getIpPrefixLists()::containsKey) .map( name -> new MatchPrefixSet(DestinationNetwork.instance(), new NamedPrefixSet(name))) .collect(ImmutableList.toImmutableList())); } RouteMapMatchIpAddressPrefixList(Iterable<String> names); @Nonnull @Override BooleanExpr toBooleanExpr(Configuration c, CumulusNodeConfiguration vc, Warnings w); @Nonnull List<String> getNames();  }