@Test public void testIgnoreGeneratedFilters() { IpAccessList aclGenerated = _aclb .setLines( ImmutableList.of( ExprAclLine.accepting().setMatchCondition(FalseExpr.INSTANCE).build())) .setName("~aclGenerated") .build(); SpecifierContext ctxt = MockSpecifierContext.builder().setConfigs(ImmutableMap.of("c1", _c1)).build(); assertThat( getSpecifiedFilters(new FilterLineReachabilityQuestion((String) null, null, true), ctxt), equalTo(ImmutableMap.of("c1", ImmutableSet.of()))); assertThat( getSpecifiedFilters(new FilterLineReachabilityQuestion((String) null, null, false), ctxt), equalTo(ImmutableMap.of("c1", ImmutableSet.of(aclGenerated)))); }
static Map<String, Set<IpAccessList>> getSpecifiedFilters( FilterLineReachabilityQuestion question, SpecifierContext ctxt) { Set<String> specifiedNodes = question.nodeSpecifier().resolve(ctxt); FilterSpecifier filterSpecifier = question.getFilterSpecifier(); return CollectionUtil.toImmutableMap( specifiedNodes, Function.identity(), node -> filterSpecifier.resolve(node, ctxt).stream() .filter(f -> !(question.getIgnoreComposites() && f.isComposite())) .collect(ImmutableSet.toImmutableSet())); }
FilterLineReachabilityAnswerer extends Answerer { static Map<String, Set<IpAccessList>> getSpecifiedFilters( FilterLineReachabilityQuestion question, SpecifierContext ctxt) { Set<String> specifiedNodes = question.nodeSpecifier().resolve(ctxt); FilterSpecifier filterSpecifier = question.getFilterSpecifier(); return CollectionUtil.toImmutableMap( specifiedNodes, Function.identity(), node -> filterSpecifier.resolve(node, ctxt).stream() .filter(f -> !(question.getIgnoreComposites() && f.isComposite())) .collect(ImmutableSet.toImmutableSet())); } }
FilterLineReachabilityAnswerer extends Answerer { static Map<String, Set<IpAccessList>> getSpecifiedFilters( FilterLineReachabilityQuestion question, SpecifierContext ctxt) { Set<String> specifiedNodes = question.nodeSpecifier().resolve(ctxt); FilterSpecifier filterSpecifier = question.getFilterSpecifier(); return CollectionUtil.toImmutableMap( specifiedNodes, Function.identity(), node -> filterSpecifier.resolve(node, ctxt).stream() .filter(f -> !(question.getIgnoreComposites() && f.isComposite())) .collect(ImmutableSet.toImmutableSet())); } FilterLineReachabilityAnswerer(Question question, IBatfish batfish); }
FilterLineReachabilityAnswerer extends Answerer { static Map<String, Set<IpAccessList>> getSpecifiedFilters( FilterLineReachabilityQuestion question, SpecifierContext ctxt) { Set<String> specifiedNodes = question.nodeSpecifier().resolve(ctxt); FilterSpecifier filterSpecifier = question.getFilterSpecifier(); return CollectionUtil.toImmutableMap( specifiedNodes, Function.identity(), node -> filterSpecifier.resolve(node, ctxt).stream() .filter(f -> !(question.getIgnoreComposites() && f.isComposite())) .collect(ImmutableSet.toImmutableSet())); } FilterLineReachabilityAnswerer(Question question, IBatfish batfish); @Override TableAnswerElement answer(NetworkSnapshot snapshot); }
FilterLineReachabilityAnswerer extends Answerer { static Map<String, Set<IpAccessList>> getSpecifiedFilters( FilterLineReachabilityQuestion question, SpecifierContext ctxt) { Set<String> specifiedNodes = question.nodeSpecifier().resolve(ctxt); FilterSpecifier filterSpecifier = question.getFilterSpecifier(); return CollectionUtil.toImmutableMap( specifiedNodes, Function.identity(), node -> filterSpecifier.resolve(node, ctxt).stream() .filter(f -> !(question.getIgnoreComposites() && f.isComposite())) .collect(ImmutableSet.toImmutableSet())); } FilterLineReachabilityAnswerer(Question question, IBatfish batfish); @Override TableAnswerElement answer(NetworkSnapshot snapshot);  }