@Test public void testGetIsisEdges() { IsisNode node1 = new IsisNode("host1", "int1"); IsisNode node2 = new IsisNode("host2", "int2"); IsisEdge edge = new IsisEdge(IsisLevel.LEVEL_1, node1, node2); MutableNetwork<IsisNode, IsisEdge> isisTopology = NetworkBuilder.directed().allowsParallelEdges(false).allowsSelfLoops(false).build(); isisTopology.addEdge(node1, node2, edge); Multiset<Row> rows = getIsisEdges(_includeNodes, _includeRemoteNodes, new IsisTopology(isisTopology)); assertThat( rows, contains( allOf( hasColumn( COL_INTERFACE, equalTo(NodeInterfacePair.of("host1", "int1")), Schema.INTERFACE), hasColumn( COL_REMOTE_INTERFACE, equalTo(NodeInterfacePair.of("host2", "int2")), Schema.INTERFACE)))); }
@VisibleForTesting static Multiset<Row> getIsisEdges( Set<String> includeNodes, Set<String> includeRemoteNodes, IsisTopology isisTopology) { return isisTopology.getNetwork().edges().stream() .filter(Objects::nonNull) .filter( isisEdge -> includeNodes.contains(isisEdge.getNode1().getNode()) && includeRemoteNodes.contains(isisEdge.getNode2().getNode())) .map(EdgesAnswerer::isisEdgeToRow) .collect(Collectors.toCollection(HashMultiset::create)); }
EdgesAnswerer extends Answerer { @VisibleForTesting static Multiset<Row> getIsisEdges( Set<String> includeNodes, Set<String> includeRemoteNodes, IsisTopology isisTopology) { return isisTopology.getNetwork().edges().stream() .filter(Objects::nonNull) .filter( isisEdge -> includeNodes.contains(isisEdge.getNode1().getNode()) && includeRemoteNodes.contains(isisEdge.getNode2().getNode())) .map(EdgesAnswerer::isisEdgeToRow) .collect(Collectors.toCollection(HashMultiset::create)); } }
EdgesAnswerer extends Answerer { @VisibleForTesting static Multiset<Row> getIsisEdges( Set<String> includeNodes, Set<String> includeRemoteNodes, IsisTopology isisTopology) { return isisTopology.getNetwork().edges().stream() .filter(Objects::nonNull) .filter( isisEdge -> includeNodes.contains(isisEdge.getNode1().getNode()) && includeRemoteNodes.contains(isisEdge.getNode2().getNode())) .map(EdgesAnswerer::isisEdgeToRow) .collect(Collectors.toCollection(HashMultiset::create)); } EdgesAnswerer(Question question, IBatfish batfish); }
EdgesAnswerer extends Answerer { @VisibleForTesting static Multiset<Row> getIsisEdges( Set<String> includeNodes, Set<String> includeRemoteNodes, IsisTopology isisTopology) { return isisTopology.getNetwork().edges().stream() .filter(Objects::nonNull) .filter( isisEdge -> includeNodes.contains(isisEdge.getNode1().getNode()) && includeRemoteNodes.contains(isisEdge.getNode2().getNode())) .map(EdgesAnswerer::isisEdgeToRow) .collect(Collectors.toCollection(HashMultiset::create)); } EdgesAnswerer(Question question, IBatfish batfish); @Override AnswerElement answer(NetworkSnapshot snapshot); }
EdgesAnswerer extends Answerer { @VisibleForTesting static Multiset<Row> getIsisEdges( Set<String> includeNodes, Set<String> includeRemoteNodes, IsisTopology isisTopology) { return isisTopology.getNetwork().edges().stream() .filter(Objects::nonNull) .filter( isisEdge -> includeNodes.contains(isisEdge.getNode1().getNode()) && includeRemoteNodes.contains(isisEdge.getNode2().getNode())) .map(EdgesAnswerer::isisEdgeToRow) .collect(Collectors.toCollection(HashMultiset::create)); } EdgesAnswerer(Question question, IBatfish batfish); @Override AnswerElement answer(NetworkSnapshot snapshot);  }