@Test public void testComputeVniInterNodeEdges() { String s1Name = "S1"; String s2Name = "S2"; int vlanId = 2; int vni = 10002; String vrfName = "v1"; Configuration s1 = _cb.setHostname(s1Name).build(); Configuration s2 = _cb.setHostname(s2Name).build(); Vrf v1 = _vb.setOwner(s1).setName(vrfName).build(); Vrf v2 = _vb.setOwner(s2).setName(vrfName).build(); Layer2Vni.Builder vnb = testBuilder() .setBumTransportIps(ImmutableSortedSet.of(Ip.FIRST_MULTICAST_IP)) .setBumTransportMethod(BumTransportMethod.MULTICAST_GROUP) .setVlan(vlanId) .setVni(vni); v1.addLayer2Vni(vnb.build()); v2.addLayer2Vni(vnb.build()); String vniName = computeVniName(vni); MutableGraph<VxlanNode> graph = GraphBuilder.undirected().allowsSelfLoops(false).build(); graph.putEdge(new VxlanNode(s1Name, vni), new VxlanNode(s2Name, vni)); VxlanTopology vxlanTopology = new VxlanTopology(graph); Layer2Node n1 = new Layer2Node(s1Name, vniName, null); Layer2Node n2 = new Layer2Node(s2Name, vniName, null); assertThat( computeVniInterNodeEdges(vxlanTopology).collect(ImmutableList.toImmutableList()), containsInAnyOrder(new Layer2Edge(n1, n2, null), new Layer2Edge(n2, n1, null))); }
@VisibleForTesting static @Nonnull Stream<Layer2Edge> computeVniInterNodeEdges(VxlanTopology vxlanTopology) { return vxlanTopology.getGraph().edges().stream().flatMap(TopologyUtil::toVniVniEdges); }
TopologyUtil { @VisibleForTesting static @Nonnull Stream<Layer2Edge> computeVniInterNodeEdges(VxlanTopology vxlanTopology) { return vxlanTopology.getGraph().edges().stream().flatMap(TopologyUtil::toVniVniEdges); } }
TopologyUtil { @VisibleForTesting static @Nonnull Stream<Layer2Edge> computeVniInterNodeEdges(VxlanTopology vxlanTopology) { return vxlanTopology.getGraph().edges().stream().flatMap(TopologyUtil::toVniVniEdges); } private  TopologyUtil(); }
TopologyUtil { @VisibleForTesting static @Nonnull Stream<Layer2Edge> computeVniInterNodeEdges(VxlanTopology vxlanTopology) { return vxlanTopology.getGraph().edges().stream().flatMap(TopologyUtil::toVniVniEdges); } private  TopologyUtil(); static @Nonnull Layer1Topology cleanLayer1PhysicalTopology(
      @Nonnull Layer1Topology rawLayer1Topology,
      @Nonnull Map<String, Configuration> configurations); static @Nonnull Optional<Layer1Topology> unionLayer1PhysicalTopologies(
      Optional<Layer1Topology> topology1, Optional<Layer1Topology> topology2); static @Nonnull Layer2Topology computeLayer2Topology(
      @Nonnull Layer1Topology layer1LogicalTopology,
      VxlanTopology vxlanTopology,
      @Nonnull Map<String, Configuration> configurations); static @Nonnull Topology computeRawLayer3Topology(
      @Nonnull Optional<Layer1Topology> rawLayer1PhysicalTopology,
      @Nonnull Optional<Layer1Topology> layer1LogicalTopology,
      @Nonnull Optional<Layer2Topology> layer2Topology,
      @Nonnull Map<String, Configuration> configurations); static @Nonnull Topology computeLayer3Topology(
      Topology rawLayer3Topology, Set<Edge> overlayEdges); static @Nullable Interface getInterface(
      @Nonnull Layer1Node layer1Node, @Nonnull Map<String, Configuration> configurations); static @Nullable Interface getInterface(
      @Nonnull Layer2Node layer2Node, @Nonnull Map<String, Configuration> configurations); static IpsecTopology computeIpsecTopology(Map<String, Configuration> configurations); static Map<String, Set<Interface>> computeNodeInterfaces(
      Map<String, Configuration> configurations); static Topology synthesizeL3Topology(Map<String, Configuration> configurations); static @Nonnull Layer1Topology computeLayer1LogicalTopology(
      Layer1Topology layer1PhysicalTopology, Map<String, Configuration> configurations); @Nonnull static TunnelTopology computeInitialTunnelTopology(
      Map<String, Configuration> configurations); @Nonnull static TunnelTopology pruneUnreachableTunnelEdges(
      TunnelTopology initialTunnelTopology,
      NetworkConfigurations configurations,
      TracerouteEngine tracerouteEngine); }
TopologyUtil { @VisibleForTesting static @Nonnull Stream<Layer2Edge> computeVniInterNodeEdges(VxlanTopology vxlanTopology) { return vxlanTopology.getGraph().edges().stream().flatMap(TopologyUtil::toVniVniEdges); } private  TopologyUtil(); static @Nonnull Layer1Topology cleanLayer1PhysicalTopology(
      @Nonnull Layer1Topology rawLayer1Topology,
      @Nonnull Map<String, Configuration> configurations); static @Nonnull Optional<Layer1Topology> unionLayer1PhysicalTopologies(
      Optional<Layer1Topology> topology1, Optional<Layer1Topology> topology2); static @Nonnull Layer2Topology computeLayer2Topology(
      @Nonnull Layer1Topology layer1LogicalTopology,
      VxlanTopology vxlanTopology,
      @Nonnull Map<String, Configuration> configurations); static @Nonnull Topology computeRawLayer3Topology(
      @Nonnull Optional<Layer1Topology> rawLayer1PhysicalTopology,
      @Nonnull Optional<Layer1Topology> layer1LogicalTopology,
      @Nonnull Optional<Layer2Topology> layer2Topology,
      @Nonnull Map<String, Configuration> configurations); static @Nonnull Topology computeLayer3Topology(
      Topology rawLayer3Topology, Set<Edge> overlayEdges); static @Nullable Interface getInterface(
      @Nonnull Layer1Node layer1Node, @Nonnull Map<String, Configuration> configurations); static @Nullable Interface getInterface(
      @Nonnull Layer2Node layer2Node, @Nonnull Map<String, Configuration> configurations); static IpsecTopology computeIpsecTopology(Map<String, Configuration> configurations); static Map<String, Set<Interface>> computeNodeInterfaces(
      Map<String, Configuration> configurations); static Topology synthesizeL3Topology(Map<String, Configuration> configurations); static @Nonnull Layer1Topology computeLayer1LogicalTopology(
      Layer1Topology layer1PhysicalTopology, Map<String, Configuration> configurations); @Nonnull static TunnelTopology computeInitialTunnelTopology(
      Map<String, Configuration> configurations); @Nonnull static TunnelTopology pruneUnreachableTunnelEdges(
      TunnelTopology initialTunnelTopology,
      NetworkConfigurations configurations,
      TracerouteEngine tracerouteEngine);  }