@Test public void testTraceDag() { Hop hopA = forwardedHop("A"); Hop hopB1 = forwardedHop("B1"); Hop hopB2 = forwardedHop("B2"); Hop hopC1 = acceptedHop("C1"); Hop hopC2 = noRouteHop("C2"); Hop hopC3 = noRouteHop("C3"); FirewallSessionTraceInfo session = new FirewallSessionTraceInfo( "B1", FibLookup.INSTANCE, new OriginatingSessionScope("vrf"), new SessionMatchExpr(IpProtocol.TCP, Ip.ZERO, Ip.ZERO, 0, 0), null); Flow c1ReturnFlow = TEST_FLOW.toBuilder().setIngressNode("C1").build(); Flow c2ReturnFlow = TEST_FLOW.toBuilder().setIngressNode("C2").build(); Node nodeA = new Node(hopA, null, null, null, ImmutableList.of(1, 2)); Node nodeB1 = new Node(hopB1, session, null, null, ImmutableList.of(3, 4, 5)); Node nodeB2 = new Node(hopB2, null, null, null, ImmutableList.of(3, 4, 5)); Node nodeC1 = new Node(hopC1, null, FlowDisposition.ACCEPTED, c1ReturnFlow, ImmutableList.of()); Node nodeC2 = new Node(hopC2, null, FlowDisposition.ACCEPTED, c2ReturnFlow, ImmutableList.of()); Node nodeC3 = new Node(hopC3, null, FlowDisposition.NO_ROUTE, null, ImmutableList.of()); TraceDag dag = new TraceDag( ImmutableList.of(nodeA, nodeB1, nodeB2, nodeC1, nodeC2, nodeC3), ImmutableList.of(0)); List<TraceAndReverseFlow> traces = dag.getTraces().collect(Collectors.toList()); assertThat( traces, contains( new TraceAndReverseFlow( new Trace(FlowDisposition.ACCEPTED, ImmutableList.of(hopA, hopB1, hopC1)), c1ReturnFlow, ImmutableList.of(session)), new TraceAndReverseFlow( new Trace(FlowDisposition.ACCEPTED, ImmutableList.of(hopA, hopB1, hopC2)), c2ReturnFlow, ImmutableList.of(session)), new TraceAndReverseFlow( new Trace(FlowDisposition.NO_ROUTE, ImmutableList.of(hopA, hopB1, hopC3)), null, ImmutableList.of(session)), new TraceAndReverseFlow( new Trace(FlowDisposition.ACCEPTED, ImmutableList.of(hopA, hopB2, hopC1)), c1ReturnFlow, ImmutableList.of()), new TraceAndReverseFlow( new Trace(FlowDisposition.ACCEPTED, ImmutableList.of(hopA, hopB2, hopC2)), c2ReturnFlow, ImmutableList.of()), new TraceAndReverseFlow( new Trace(FlowDisposition.NO_ROUTE, ImmutableList.of(hopA, hopB2, hopC3)), null, ImmutableList.of()))); assertEquals(6, dag.size()); assertEquals(6, dag.countNodes()); assertEquals(8, dag.countEdges()); }
public TraceDag(List<Node> nodes, List<Integer> rootIds) { _nodes = nodes; _rootIds = rootIds; }
TraceDag { public TraceDag(List<Node> nodes, List<Integer> rootIds) { _nodes = nodes; _rootIds = rootIds; } }
TraceDag { public TraceDag(List<Node> nodes, List<Integer> rootIds) { _nodes = nodes; _rootIds = rootIds; } TraceDag(List<Node> nodes, List<Integer> rootIds); }
TraceDag { public TraceDag(List<Node> nodes, List<Integer> rootIds) { _nodes = nodes; _rootIds = rootIds; } TraceDag(List<Node> nodes, List<Integer> rootIds); int size(); Stream<TraceAndReverseFlow> getTraces(); }
TraceDag { public TraceDag(List<Node> nodes, List<Integer> rootIds) { _nodes = nodes; _rootIds = rootIds; } TraceDag(List<Node> nodes, List<Integer> rootIds); int size(); Stream<TraceAndReverseFlow> getTraces();  }