@Test(timeout = 5000) public void testComputeFixedPoint() throws IOException { SortedMap<String, Configuration> configurations = new TreeMap<>(); Configuration h1 = BatfishTestUtils.createTestConfiguration("h1", ConfigurationFormat.HOST, "eth0"); configurations.put(h1.getHostname(), h1); Vrf vrf1 = Vrf.builder().setName(Configuration.DEFAULT_VRF_NAME).setOwner(h1).build(); h1.getAllInterfaces().get("eth0").setVrf(vrf1); Configuration h2 = BatfishTestUtils.createTestConfiguration("h2", ConfigurationFormat.HOST, "e0"); configurations.put(h2.getHostname(), h2); Vrf vrf2 = Vrf.builder().setName(Configuration.DEFAULT_VRF_NAME).setOwner(h2).build(); h2.getAllInterfaces().get("e0").setVrf(vrf2); Batfish batfish = BatfishTestUtils.getBatfish(configurations, _folder); batfish.getSettings().setDataplaneEngineName(IncrementalDataPlanePlugin.PLUGIN_NAME); DataPlanePlugin dataPlanePlugin = batfish.getDataPlanePlugin(); dataPlanePlugin.computeDataPlane(batfish.getSnapshot()); }
@Override public ComputeDataPlaneResult computeDataPlane(NetworkSnapshot snapshot) { Map<String, Configuration> configurations = _batfish.loadConfigurations(snapshot); Set<BgpAdvertisement> externalAdverts = _batfish.loadExternalBgpAnnouncements(snapshot, configurations); TopologyProvider topologyProvider = _batfish.getTopologyProvider(); TopologyContext topologyContext = TopologyContext.builder() .setIpsecTopology(topologyProvider.getInitialIpsecTopology(snapshot)) .setLayer1LogicalTopology(topologyProvider.getLayer1LogicalTopology(snapshot)) .setLayer2Topology(topologyProvider.getInitialLayer2Topology(snapshot)) .setLayer3Topology(topologyProvider.getInitialLayer3Topology(snapshot)) .setOspfTopology(topologyProvider.getInitialOspfTopology(snapshot)) .setRawLayer1PhysicalTopology(topologyProvider.getRawLayer1PhysicalTopology(snapshot)) .build(); ComputeDataPlaneResult answer = _engine.computeDataPlane(configurations, topologyContext, externalAdverts); _logger.infof( "Generated data-plane for snapshot:%s; iterations:%s", snapshot.getSnapshot(), ((IncrementalBdpAnswerElement) answer._answerElement).getDependentRoutesIterations()); return answer; }
IncrementalDataPlanePlugin extends DataPlanePlugin { @Override public ComputeDataPlaneResult computeDataPlane(NetworkSnapshot snapshot) { Map<String, Configuration> configurations = _batfish.loadConfigurations(snapshot); Set<BgpAdvertisement> externalAdverts = _batfish.loadExternalBgpAnnouncements(snapshot, configurations); TopologyProvider topologyProvider = _batfish.getTopologyProvider(); TopologyContext topologyContext = TopologyContext.builder() .setIpsecTopology(topologyProvider.getInitialIpsecTopology(snapshot)) .setLayer1LogicalTopology(topologyProvider.getLayer1LogicalTopology(snapshot)) .setLayer2Topology(topologyProvider.getInitialLayer2Topology(snapshot)) .setLayer3Topology(topologyProvider.getInitialLayer3Topology(snapshot)) .setOspfTopology(topologyProvider.getInitialOspfTopology(snapshot)) .setRawLayer1PhysicalTopology(topologyProvider.getRawLayer1PhysicalTopology(snapshot)) .build(); ComputeDataPlaneResult answer = _engine.computeDataPlane(configurations, topologyContext, externalAdverts); _logger.infof( "Generated data-plane for snapshot:%s; iterations:%s", snapshot.getSnapshot(), ((IncrementalBdpAnswerElement) answer._answerElement).getDependentRoutesIterations()); return answer; } }
IncrementalDataPlanePlugin extends DataPlanePlugin { @Override public ComputeDataPlaneResult computeDataPlane(NetworkSnapshot snapshot) { Map<String, Configuration> configurations = _batfish.loadConfigurations(snapshot); Set<BgpAdvertisement> externalAdverts = _batfish.loadExternalBgpAnnouncements(snapshot, configurations); TopologyProvider topologyProvider = _batfish.getTopologyProvider(); TopologyContext topologyContext = TopologyContext.builder() .setIpsecTopology(topologyProvider.getInitialIpsecTopology(snapshot)) .setLayer1LogicalTopology(topologyProvider.getLayer1LogicalTopology(snapshot)) .setLayer2Topology(topologyProvider.getInitialLayer2Topology(snapshot)) .setLayer3Topology(topologyProvider.getInitialLayer3Topology(snapshot)) .setOspfTopology(topologyProvider.getInitialOspfTopology(snapshot)) .setRawLayer1PhysicalTopology(topologyProvider.getRawLayer1PhysicalTopology(snapshot)) .build(); ComputeDataPlaneResult answer = _engine.computeDataPlane(configurations, topologyContext, externalAdverts); _logger.infof( "Generated data-plane for snapshot:%s; iterations:%s", snapshot.getSnapshot(), ((IncrementalBdpAnswerElement) answer._answerElement).getDependentRoutesIterations()); return answer; } IncrementalDataPlanePlugin(); }
IncrementalDataPlanePlugin extends DataPlanePlugin { @Override public ComputeDataPlaneResult computeDataPlane(NetworkSnapshot snapshot) { Map<String, Configuration> configurations = _batfish.loadConfigurations(snapshot); Set<BgpAdvertisement> externalAdverts = _batfish.loadExternalBgpAnnouncements(snapshot, configurations); TopologyProvider topologyProvider = _batfish.getTopologyProvider(); TopologyContext topologyContext = TopologyContext.builder() .setIpsecTopology(topologyProvider.getInitialIpsecTopology(snapshot)) .setLayer1LogicalTopology(topologyProvider.getLayer1LogicalTopology(snapshot)) .setLayer2Topology(topologyProvider.getInitialLayer2Topology(snapshot)) .setLayer3Topology(topologyProvider.getInitialLayer3Topology(snapshot)) .setOspfTopology(topologyProvider.getInitialOspfTopology(snapshot)) .setRawLayer1PhysicalTopology(topologyProvider.getRawLayer1PhysicalTopology(snapshot)) .build(); ComputeDataPlaneResult answer = _engine.computeDataPlane(configurations, topologyContext, externalAdverts); _logger.infof( "Generated data-plane for snapshot:%s; iterations:%s", snapshot.getSnapshot(), ((IncrementalBdpAnswerElement) answer._answerElement).getDependentRoutesIterations()); return answer; } IncrementalDataPlanePlugin(); @Override ComputeDataPlaneResult computeDataPlane(NetworkSnapshot snapshot); @Override String getName(); }
IncrementalDataPlanePlugin extends DataPlanePlugin { @Override public ComputeDataPlaneResult computeDataPlane(NetworkSnapshot snapshot) { Map<String, Configuration> configurations = _batfish.loadConfigurations(snapshot); Set<BgpAdvertisement> externalAdverts = _batfish.loadExternalBgpAnnouncements(snapshot, configurations); TopologyProvider topologyProvider = _batfish.getTopologyProvider(); TopologyContext topologyContext = TopologyContext.builder() .setIpsecTopology(topologyProvider.getInitialIpsecTopology(snapshot)) .setLayer1LogicalTopology(topologyProvider.getLayer1LogicalTopology(snapshot)) .setLayer2Topology(topologyProvider.getInitialLayer2Topology(snapshot)) .setLayer3Topology(topologyProvider.getInitialLayer3Topology(snapshot)) .setOspfTopology(topologyProvider.getInitialOspfTopology(snapshot)) .setRawLayer1PhysicalTopology(topologyProvider.getRawLayer1PhysicalTopology(snapshot)) .build(); ComputeDataPlaneResult answer = _engine.computeDataPlane(configurations, topologyContext, externalAdverts); _logger.infof( "Generated data-plane for snapshot:%s; iterations:%s", snapshot.getSnapshot(), ((IncrementalBdpAnswerElement) answer._answerElement).getDependentRoutesIterations()); return answer; } IncrementalDataPlanePlugin(); @Override ComputeDataPlaneResult computeDataPlane(NetworkSnapshot snapshot); @Override String getName(); static final String PLUGIN_NAME; }