@Test public void testReachableEdgeBothDirections() { assertTrue( VxlanTopologyUtils.reachableEdge( EndpointPair.unordered(new VxlanNode(NODE1, VNI), new VxlanNode(NODE2, VNI)), NetworkConfigurations.of(compatibleVxlanConfigs()), new TestTracerouteEngine( ImmutableMap.of( NODE1, new TestTracerouteEngineResult(NODE2, true, true), NODE2, new TestTracerouteEngineResult(NODE1, true, true))))); }
@VisibleForTesting static boolean reachableEdge( EndpointPair<VxlanNode> edge, NetworkConfigurations nc, TracerouteEngine tracerouteEngine) { VxlanNode nodeU = edge.nodeU(); VxlanNode nodeV = edge.nodeV(); String hostU = nodeU.getHostname(); String hostV = nodeV.getHostname(); int vni = nodeU.getVni(); Layer2Vni vniSettingsU = nc.getVniSettings(hostU, vni).get(); if (vniSettingsU.getBumTransportMethod() != BumTransportMethod.UNICAST_FLOOD_GROUP) { return false; } Layer2Vni vniSettingsV = nc.getVniSettings(hostV, vni).get(); String vrfU = getVniSrcVrf(vniSettingsU); String vrfV = getVniSrcVrf(vniSettingsV); Ip srcIpU = vniSettingsU.getSourceAddress(); Ip srcIpV = vniSettingsV.getSourceAddress(); int udpPort = vniSettingsU.getUdpPort(); return vxlanFlowDelivered(hostU, vrfU, srcIpU, hostV, srcIpV, udpPort, tracerouteEngine) && vxlanFlowDelivered(hostV, vrfV, srcIpV, hostU, srcIpU, udpPort, tracerouteEngine); }
VxlanTopologyUtils { @VisibleForTesting static boolean reachableEdge( EndpointPair<VxlanNode> edge, NetworkConfigurations nc, TracerouteEngine tracerouteEngine) { VxlanNode nodeU = edge.nodeU(); VxlanNode nodeV = edge.nodeV(); String hostU = nodeU.getHostname(); String hostV = nodeV.getHostname(); int vni = nodeU.getVni(); Layer2Vni vniSettingsU = nc.getVniSettings(hostU, vni).get(); if (vniSettingsU.getBumTransportMethod() != BumTransportMethod.UNICAST_FLOOD_GROUP) { return false; } Layer2Vni vniSettingsV = nc.getVniSettings(hostV, vni).get(); String vrfU = getVniSrcVrf(vniSettingsU); String vrfV = getVniSrcVrf(vniSettingsV); Ip srcIpU = vniSettingsU.getSourceAddress(); Ip srcIpV = vniSettingsV.getSourceAddress(); int udpPort = vniSettingsU.getUdpPort(); return vxlanFlowDelivered(hostU, vrfU, srcIpU, hostV, srcIpV, udpPort, tracerouteEngine) && vxlanFlowDelivered(hostV, vrfV, srcIpV, hostU, srcIpU, udpPort, tracerouteEngine); } }
VxlanTopologyUtils { @VisibleForTesting static boolean reachableEdge( EndpointPair<VxlanNode> edge, NetworkConfigurations nc, TracerouteEngine tracerouteEngine) { VxlanNode nodeU = edge.nodeU(); VxlanNode nodeV = edge.nodeV(); String hostU = nodeU.getHostname(); String hostV = nodeV.getHostname(); int vni = nodeU.getVni(); Layer2Vni vniSettingsU = nc.getVniSettings(hostU, vni).get(); if (vniSettingsU.getBumTransportMethod() != BumTransportMethod.UNICAST_FLOOD_GROUP) { return false; } Layer2Vni vniSettingsV = nc.getVniSettings(hostV, vni).get(); String vrfU = getVniSrcVrf(vniSettingsU); String vrfV = getVniSrcVrf(vniSettingsV); Ip srcIpU = vniSettingsU.getSourceAddress(); Ip srcIpV = vniSettingsV.getSourceAddress(); int udpPort = vniSettingsU.getUdpPort(); return vxlanFlowDelivered(hostU, vrfU, srcIpU, hostV, srcIpV, udpPort, tracerouteEngine) && vxlanFlowDelivered(hostV, vrfV, srcIpV, hostU, srcIpU, udpPort, tracerouteEngine); } private  VxlanTopologyUtils(); }
VxlanTopologyUtils { @VisibleForTesting static boolean reachableEdge( EndpointPair<VxlanNode> edge, NetworkConfigurations nc, TracerouteEngine tracerouteEngine) { VxlanNode nodeU = edge.nodeU(); VxlanNode nodeV = edge.nodeV(); String hostU = nodeU.getHostname(); String hostV = nodeV.getHostname(); int vni = nodeU.getVni(); Layer2Vni vniSettingsU = nc.getVniSettings(hostU, vni).get(); if (vniSettingsU.getBumTransportMethod() != BumTransportMethod.UNICAST_FLOOD_GROUP) { return false; } Layer2Vni vniSettingsV = nc.getVniSettings(hostV, vni).get(); String vrfU = getVniSrcVrf(vniSettingsU); String vrfV = getVniSrcVrf(vniSettingsV); Ip srcIpU = vniSettingsU.getSourceAddress(); Ip srcIpV = vniSettingsV.getSourceAddress(); int udpPort = vniSettingsU.getUdpPort(); return vxlanFlowDelivered(hostU, vrfU, srcIpU, hostV, srcIpV, udpPort, tracerouteEngine) && vxlanFlowDelivered(hostV, vrfV, srcIpV, hostU, srcIpU, udpPort, tracerouteEngine); } private  VxlanTopologyUtils(); static @Nonnull VxlanTopology computeVxlanTopology(
      Map<String, Configuration> configurations); static @Nonnull VxlanTopology computeVxlanTopology(
      Table<String, String, ? extends Collection<Layer2Vni>> allVniSettings); static @Nonnull VxlanTopology prunedVxlanTopology(
      VxlanTopology initialVxlanTopology,
      Map<String, Configuration> configurations,
      TracerouteEngine tracerouteEngine); }
VxlanTopologyUtils { @VisibleForTesting static boolean reachableEdge( EndpointPair<VxlanNode> edge, NetworkConfigurations nc, TracerouteEngine tracerouteEngine) { VxlanNode nodeU = edge.nodeU(); VxlanNode nodeV = edge.nodeV(); String hostU = nodeU.getHostname(); String hostV = nodeV.getHostname(); int vni = nodeU.getVni(); Layer2Vni vniSettingsU = nc.getVniSettings(hostU, vni).get(); if (vniSettingsU.getBumTransportMethod() != BumTransportMethod.UNICAST_FLOOD_GROUP) { return false; } Layer2Vni vniSettingsV = nc.getVniSettings(hostV, vni).get(); String vrfU = getVniSrcVrf(vniSettingsU); String vrfV = getVniSrcVrf(vniSettingsV); Ip srcIpU = vniSettingsU.getSourceAddress(); Ip srcIpV = vniSettingsV.getSourceAddress(); int udpPort = vniSettingsU.getUdpPort(); return vxlanFlowDelivered(hostU, vrfU, srcIpU, hostV, srcIpV, udpPort, tracerouteEngine) && vxlanFlowDelivered(hostV, vrfV, srcIpV, hostU, srcIpU, udpPort, tracerouteEngine); } private  VxlanTopologyUtils(); static @Nonnull VxlanTopology computeVxlanTopology(
      Map<String, Configuration> configurations); static @Nonnull VxlanTopology computeVxlanTopology(
      Table<String, String, ? extends Collection<Layer2Vni>> allVniSettings); static @Nonnull VxlanTopology prunedVxlanTopology(
      VxlanTopology initialVxlanTopology,
      Map<String, Configuration> configurations,
      TracerouteEngine tracerouteEngine);  }