@Test public void testGetLayer3Edges() { Topology layer3Topology = new Topology(ImmutableSortedSet.of(Edge.of("host1", "int1", "host2", "int2"))); Multiset<Row> rows = getLayer3Edges(_configurations, _includeNodes, _includeRemoteNodes, layer3Topology); assertThat( rows, contains( allOf( hasColumn( COL_INTERFACE, equalTo(NodeInterfacePair.of("host1", "int1")), Schema.INTERFACE), hasColumn( COL_IPS, equalTo(ImmutableSet.of(Ip.parse("1.1.1.1"))), Schema.set(Schema.IP)), hasColumn( COL_REMOTE_INTERFACE, equalTo(NodeInterfacePair.of("host2", "int2")), Schema.INTERFACE), hasColumn( COL_REMOTE_IPS, equalTo(ImmutableSet.of(Ip.parse("2.2.2.2"))), Schema.set(Schema.IP))))); }
@VisibleForTesting static Multiset<Row> getLayer3Edges( Map<String, Configuration> configurations, Set<String> includeNodes, Set<String> includeRemoteNodes, Topology topology) { return topology.getEdges().stream() .filter( layer3Edge -> includeNodes.contains(layer3Edge.getNode1()) && includeRemoteNodes.contains(layer3Edge.getNode2())) .map(layer3edge -> layer3EdgeToRow(configurations, layer3edge)) .collect(Collectors.toCollection(HashMultiset::create)); }
EdgesAnswerer extends Answerer { @VisibleForTesting static Multiset<Row> getLayer3Edges( Map<String, Configuration> configurations, Set<String> includeNodes, Set<String> includeRemoteNodes, Topology topology) { return topology.getEdges().stream() .filter( layer3Edge -> includeNodes.contains(layer3Edge.getNode1()) && includeRemoteNodes.contains(layer3Edge.getNode2())) .map(layer3edge -> layer3EdgeToRow(configurations, layer3edge)) .collect(Collectors.toCollection(HashMultiset::create)); } }
EdgesAnswerer extends Answerer { @VisibleForTesting static Multiset<Row> getLayer3Edges( Map<String, Configuration> configurations, Set<String> includeNodes, Set<String> includeRemoteNodes, Topology topology) { return topology.getEdges().stream() .filter( layer3Edge -> includeNodes.contains(layer3Edge.getNode1()) && includeRemoteNodes.contains(layer3Edge.getNode2())) .map(layer3edge -> layer3EdgeToRow(configurations, layer3edge)) .collect(Collectors.toCollection(HashMultiset::create)); } EdgesAnswerer(Question question, IBatfish batfish); }
EdgesAnswerer extends Answerer { @VisibleForTesting static Multiset<Row> getLayer3Edges( Map<String, Configuration> configurations, Set<String> includeNodes, Set<String> includeRemoteNodes, Topology topology) { return topology.getEdges().stream() .filter( layer3Edge -> includeNodes.contains(layer3Edge.getNode1()) && includeRemoteNodes.contains(layer3Edge.getNode2())) .map(layer3edge -> layer3EdgeToRow(configurations, layer3edge)) .collect(Collectors.toCollection(HashMultiset::create)); } EdgesAnswerer(Question question, IBatfish batfish); @Override AnswerElement answer(NetworkSnapshot snapshot); }
EdgesAnswerer extends Answerer { @VisibleForTesting static Multiset<Row> getLayer3Edges( Map<String, Configuration> configurations, Set<String> includeNodes, Set<String> includeRemoteNodes, Topology topology) { return topology.getEdges().stream() .filter( layer3Edge -> includeNodes.contains(layer3Edge.getNode1()) && includeRemoteNodes.contains(layer3Edge.getNode2())) .map(layer3edge -> layer3EdgeToRow(configurations, layer3edge)) .collect(Collectors.toCollection(HashMultiset::create)); } EdgesAnswerer(Question question, IBatfish batfish); @Override AnswerElement answer(NetworkSnapshot snapshot);  }