@Test public void testGetSpecifiedAcls_includeAll() { Configuration c = createConfigWithAcls(ACL1, ACL2); IBatfish bf = new MockBatfish(c); SearchFiltersQuestion question = SearchFiltersQuestion.builder().build(); SearchFiltersAnswerer answerer = new SearchFiltersAnswerer(question, bf); assertThat( answerer.getSpecifiedAcls(bf.getSnapshot(), question), equalTo(ImmutableMap.of(c.getHostname(), c.getIpAccessLists()))); }
@VisibleForTesting Map<String, Map<String, IpAccessList>> getSpecifiedAcls( NetworkSnapshot snapshot, SearchFiltersQuestion question) { FilterSpecifier filterSpecifier = question.getFilterSpecifier(); SpecifierContext specifierContext = _batfish.specifierContext(snapshot); return question.getNodesSpecifier().resolve(specifierContext).stream() .collect( ImmutableMap.toImmutableMap( Function.identity(), hostname -> filterSpecifier.resolve(hostname, specifierContext).stream() .collect( ImmutableMap.toImmutableMap( IpAccessList::getName, Function.identity())))); }
SearchFiltersAnswerer extends Answerer { @VisibleForTesting Map<String, Map<String, IpAccessList>> getSpecifiedAcls( NetworkSnapshot snapshot, SearchFiltersQuestion question) { FilterSpecifier filterSpecifier = question.getFilterSpecifier(); SpecifierContext specifierContext = _batfish.specifierContext(snapshot); return question.getNodesSpecifier().resolve(specifierContext).stream() .collect( ImmutableMap.toImmutableMap( Function.identity(), hostname -> filterSpecifier.resolve(hostname, specifierContext).stream() .collect( ImmutableMap.toImmutableMap( IpAccessList::getName, Function.identity())))); } }
SearchFiltersAnswerer extends Answerer { @VisibleForTesting Map<String, Map<String, IpAccessList>> getSpecifiedAcls( NetworkSnapshot snapshot, SearchFiltersQuestion question) { FilterSpecifier filterSpecifier = question.getFilterSpecifier(); SpecifierContext specifierContext = _batfish.specifierContext(snapshot); return question.getNodesSpecifier().resolve(specifierContext).stream() .collect( ImmutableMap.toImmutableMap( Function.identity(), hostname -> filterSpecifier.resolve(hostname, specifierContext).stream() .collect( ImmutableMap.toImmutableMap( IpAccessList::getName, Function.identity())))); } SearchFiltersAnswerer(Question question, IBatfish batfish); }
SearchFiltersAnswerer extends Answerer { @VisibleForTesting Map<String, Map<String, IpAccessList>> getSpecifiedAcls( NetworkSnapshot snapshot, SearchFiltersQuestion question) { FilterSpecifier filterSpecifier = question.getFilterSpecifier(); SpecifierContext specifierContext = _batfish.specifierContext(snapshot); return question.getNodesSpecifier().resolve(specifierContext).stream() .collect( ImmutableMap.toImmutableMap( Function.identity(), hostname -> filterSpecifier.resolve(hostname, specifierContext).stream() .collect( ImmutableMap.toImmutableMap( IpAccessList::getName, Function.identity())))); } SearchFiltersAnswerer(Question question, IBatfish batfish); @Override AnswerElement answer(NetworkSnapshot snapshot); @Override AnswerElement answerDiff(NetworkSnapshot snapshot, NetworkSnapshot reference); }
SearchFiltersAnswerer extends Answerer { @VisibleForTesting Map<String, Map<String, IpAccessList>> getSpecifiedAcls( NetworkSnapshot snapshot, SearchFiltersQuestion question) { FilterSpecifier filterSpecifier = question.getFilterSpecifier(); SpecifierContext specifierContext = _batfish.specifierContext(snapshot); return question.getNodesSpecifier().resolve(specifierContext).stream() .collect( ImmutableMap.toImmutableMap( Function.identity(), hostname -> filterSpecifier.resolve(hostname, specifierContext).stream() .collect( ImmutableMap.toImmutableMap( IpAccessList::getName, Function.identity())))); } SearchFiltersAnswerer(Question question, IBatfish batfish); @Override AnswerElement answer(NetworkSnapshot snapshot); @Override AnswerElement answerDiff(NetworkSnapshot snapshot, NetworkSnapshot reference);  }