@Test public void testBgpOscillation() throws IOException { String testrigName = "bgp-oscillation"; List<String> configurationNames = ImmutableList.of("r1", "r2", "r3"); Batfish batfish = BatfishTestUtils.getBatfishFromTestrigText( TestrigText.builder() .setConfigurationFiles(TESTRIGS_PREFIX + testrigName, configurationNames) .build(), _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; }