@Test public void testGetEigrpEdges() { MutableNetwork<EigrpNeighborConfigId, EigrpEdge> eigrpTopology = NetworkBuilder.directed().allowsParallelEdges(false).allowsSelfLoops(false).build(); EigrpNeighborConfigId eigrpNeighborConfigId1 = new EigrpNeighborConfigId(1L, "host1", "int1", "vrf1"); EigrpNeighborConfigId eigrpNeighborConfigId2 = new EigrpNeighborConfigId(1L, "host2", "int2", "vrf2"); eigrpTopology.addEdge( eigrpNeighborConfigId1, eigrpNeighborConfigId2, new EigrpEdge(eigrpNeighborConfigId1, eigrpNeighborConfigId2)); Multiset<Row> rows = getEigrpEdges(_includeNodes, _includeRemoteNodes, new EigrpTopology(eigrpTopology)); 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> getEigrpEdges( Set<String> includeNodes, Set<String> includeRemoteNodes, EigrpTopology eigrpTopology) { return eigrpTopology.getNetwork().edges().stream() .filter( eigrpEdge -> includeNodes.contains(eigrpEdge.getNode1().getHostname()) && includeRemoteNodes.contains(eigrpEdge.getNode2().getHostname())) .map(EdgesAnswerer::eigrpEdgeToRow) .collect(Collectors.toCollection(HashMultiset::create)); }
EdgesAnswerer extends Answerer { @VisibleForTesting static Multiset<Row> getEigrpEdges( Set<String> includeNodes, Set<String> includeRemoteNodes, EigrpTopology eigrpTopology) { return eigrpTopology.getNetwork().edges().stream() .filter( eigrpEdge -> includeNodes.contains(eigrpEdge.getNode1().getHostname()) && includeRemoteNodes.contains(eigrpEdge.getNode2().getHostname())) .map(EdgesAnswerer::eigrpEdgeToRow) .collect(Collectors.toCollection(HashMultiset::create)); } }
EdgesAnswerer extends Answerer { @VisibleForTesting static Multiset<Row> getEigrpEdges( Set<String> includeNodes, Set<String> includeRemoteNodes, EigrpTopology eigrpTopology) { return eigrpTopology.getNetwork().edges().stream() .filter( eigrpEdge -> includeNodes.contains(eigrpEdge.getNode1().getHostname()) && includeRemoteNodes.contains(eigrpEdge.getNode2().getHostname())) .map(EdgesAnswerer::eigrpEdgeToRow) .collect(Collectors.toCollection(HashMultiset::create)); } EdgesAnswerer(Question question, IBatfish batfish); }
EdgesAnswerer extends Answerer { @VisibleForTesting static Multiset<Row> getEigrpEdges( Set<String> includeNodes, Set<String> includeRemoteNodes, EigrpTopology eigrpTopology) { return eigrpTopology.getNetwork().edges().stream() .filter( eigrpEdge -> includeNodes.contains(eigrpEdge.getNode1().getHostname()) && includeRemoteNodes.contains(eigrpEdge.getNode2().getHostname())) .map(EdgesAnswerer::eigrpEdgeToRow) .collect(Collectors.toCollection(HashMultiset::create)); } EdgesAnswerer(Question question, IBatfish batfish); @Override AnswerElement answer(NetworkSnapshot snapshot); }
EdgesAnswerer extends Answerer { @VisibleForTesting static Multiset<Row> getEigrpEdges( Set<String> includeNodes, Set<String> includeRemoteNodes, EigrpTopology eigrpTopology) { return eigrpTopology.getNetwork().edges().stream() .filter( eigrpEdge -> includeNodes.contains(eigrpEdge.getNode1().getHostname()) && includeRemoteNodes.contains(eigrpEdge.getNode2().getHostname())) .map(EdgesAnswerer::eigrpEdgeToRow) .collect(Collectors.toCollection(HashMultiset::create)); } EdgesAnswerer(Question question, IBatfish batfish); @Override AnswerElement answer(NetworkSnapshot snapshot);  }