Search in sources :

Example 1 with DestinationClasses

use of org.batfish.symbolic.abstraction.DestinationClasses in project batfish by batfish.

the class PropertyChecker method findAllNetworkSlices.

private Tuple<Stream<Supplier<NetworkSlice>>, Long> findAllNetworkSlices(HeaderQuestion q, @Nullable Graph graph, boolean useDefaultCase) {
    if (q.getUseAbstraction()) {
        HeaderSpace h = q.getHeaderSpace();
        int numFailures = q.getFailures();
        System.out.println("Start verification");
        System.out.println("Using headerspace: " + h.getDstIps());
        DestinationClasses dcs = DestinationClasses.create(_batfish, graph, h, useDefaultCase);
        System.out.println("Number of edges: " + dcs.getGraph().getAllRealEdges().size());
        System.out.println("Created destination classes");
        System.out.println("Num Classes: " + dcs.getHeaderspaceMap().size());
        long l = System.currentTimeMillis();
        ArrayList<Supplier<NetworkSlice>> ecs = NetworkSlice.allSlices(dcs, numFailures);
        l = System.currentTimeMillis() - l;
        System.out.println("Created BDDs");
        return new Tuple<>(ecs.parallelStream(), l);
    } else {
        List<Supplier<NetworkSlice>> singleEc = new ArrayList<>();
        Graph g = graph == null ? new Graph(_batfish) : graph;
        Abstraction a = new Abstraction(g, null);
        NetworkSlice slice = new NetworkSlice(q.getHeaderSpace(), a, false);
        Supplier<NetworkSlice> sup = () -> slice;
        singleEc.add(sup);
        return new Tuple<>(singleEc.stream(), 0L);
    }
}
Also used : ArrayList(java.util.ArrayList) HeaderSpace(org.batfish.datamodel.HeaderSpace) DestinationClasses(org.batfish.symbolic.abstraction.DestinationClasses) Abstraction(org.batfish.symbolic.abstraction.Abstraction) NetworkSlice(org.batfish.symbolic.abstraction.NetworkSlice) Graph(org.batfish.symbolic.Graph) Supplier(java.util.function.Supplier) Tuple(org.batfish.symbolic.utils.Tuple)

Aggregations

ArrayList (java.util.ArrayList)1 Supplier (java.util.function.Supplier)1 HeaderSpace (org.batfish.datamodel.HeaderSpace)1 Graph (org.batfish.symbolic.Graph)1 Abstraction (org.batfish.symbolic.abstraction.Abstraction)1 DestinationClasses (org.batfish.symbolic.abstraction.DestinationClasses)1 NetworkSlice (org.batfish.symbolic.abstraction.NetworkSlice)1 Tuple (org.batfish.symbolic.utils.Tuple)1