@Test public void testVxlanFlowDeliveredNotAccepted() { assertFalse( vxlanFlowDelivered( NODE1, _v1.getName(), SRC_IP1, NODE2, SRC_IP2, UDP_PORT, new TestTracerouteEngine( ImmutableMap.of(NODE1, new TestTracerouteEngineResult(NODE2, false, true))))); }
@VisibleForTesting static boolean vxlanFlowDelivered( String sender, String senderVrf, Ip srcIp, String receiver, Ip dstIp, int udpPort, TracerouteEngine tracerouteEngine) { Flow flow = Flow.builder() .setIpProtocol(IpProtocol.UDP) .setIngressNode(sender) .setIngressVrf(senderVrf) .setSrcIp(srcIp) .setDstIp(dstIp) .setSrcPort(NamedPort.EPHEMERAL_LOWEST.number()) .setDstPort(udpPort) .build(); List<Trace> traces = tracerouteEngine.computeTraces(ImmutableSet.of(flow), false).get(flow); return traces.stream() .anyMatch( trace -> { List<Hop> hops = trace.getHops(); return !hops.isEmpty() && hops.get(hops.size() - 1).getNode().getName().equals(receiver) && trace.getDisposition() == FlowDisposition.ACCEPTED; }); }
VxlanTopologyUtils { @VisibleForTesting static boolean vxlanFlowDelivered( String sender, String senderVrf, Ip srcIp, String receiver, Ip dstIp, int udpPort, TracerouteEngine tracerouteEngine) { Flow flow = Flow.builder() .setIpProtocol(IpProtocol.UDP) .setIngressNode(sender) .setIngressVrf(senderVrf) .setSrcIp(srcIp) .setDstIp(dstIp) .setSrcPort(NamedPort.EPHEMERAL_LOWEST.number()) .setDstPort(udpPort) .build(); List<Trace> traces = tracerouteEngine.computeTraces(ImmutableSet.of(flow), false).get(flow); return traces.stream() .anyMatch( trace -> { List<Hop> hops = trace.getHops(); return !hops.isEmpty() && hops.get(hops.size() - 1).getNode().getName().equals(receiver) && trace.getDisposition() == FlowDisposition.ACCEPTED; }); } }
VxlanTopologyUtils { @VisibleForTesting static boolean vxlanFlowDelivered( String sender, String senderVrf, Ip srcIp, String receiver, Ip dstIp, int udpPort, TracerouteEngine tracerouteEngine) { Flow flow = Flow.builder() .setIpProtocol(IpProtocol.UDP) .setIngressNode(sender) .setIngressVrf(senderVrf) .setSrcIp(srcIp) .setDstIp(dstIp) .setSrcPort(NamedPort.EPHEMERAL_LOWEST.number()) .setDstPort(udpPort) .build(); List<Trace> traces = tracerouteEngine.computeTraces(ImmutableSet.of(flow), false).get(flow); return traces.stream() .anyMatch( trace -> { List<Hop> hops = trace.getHops(); return !hops.isEmpty() && hops.get(hops.size() - 1).getNode().getName().equals(receiver) && trace.getDisposition() == FlowDisposition.ACCEPTED; }); } private  VxlanTopologyUtils(); }
VxlanTopologyUtils { @VisibleForTesting static boolean vxlanFlowDelivered( String sender, String senderVrf, Ip srcIp, String receiver, Ip dstIp, int udpPort, TracerouteEngine tracerouteEngine) { Flow flow = Flow.builder() .setIpProtocol(IpProtocol.UDP) .setIngressNode(sender) .setIngressVrf(senderVrf) .setSrcIp(srcIp) .setDstIp(dstIp) .setSrcPort(NamedPort.EPHEMERAL_LOWEST.number()) .setDstPort(udpPort) .build(); List<Trace> traces = tracerouteEngine.computeTraces(ImmutableSet.of(flow), false).get(flow); return traces.stream() .anyMatch( trace -> { List<Hop> hops = trace.getHops(); return !hops.isEmpty() && hops.get(hops.size() - 1).getNode().getName().equals(receiver) && trace.getDisposition() == FlowDisposition.ACCEPTED; }); } 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 vxlanFlowDelivered( String sender, String senderVrf, Ip srcIp, String receiver, Ip dstIp, int udpPort, TracerouteEngine tracerouteEngine) { Flow flow = Flow.builder() .setIpProtocol(IpProtocol.UDP) .setIngressNode(sender) .setIngressVrf(senderVrf) .setSrcIp(srcIp) .setDstIp(dstIp) .setSrcPort(NamedPort.EPHEMERAL_LOWEST.number()) .setDstPort(udpPort) .build(); List<Trace> traces = tracerouteEngine.computeTraces(ImmutableSet.of(flow), false).get(flow); return traces.stream() .anyMatch( trace -> { List<Hop> hops = trace.getHops(); return !hops.isEmpty() && hops.get(hops.size() - 1).getNode().getName().equals(receiver) && trace.getDisposition() == FlowDisposition.ACCEPTED; }); } 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);  }