@Test public void testEbgpSinglehopSuccess() throws IOException { SortedMap<String, Configuration> configs = generateNetworkWithThreeHops(false, false); Batfish batfish = BatfishTestUtils.getBatfish(configs, _folder); batfish.getSettings().setDataplaneEngineName(IncrementalDataPlanePlugin.PLUGIN_NAME); DataPlanePlugin dataPlanePlugin = batfish.getDataPlanePlugin(); ComputeDataPlaneResult result = dataPlanePlugin.computeDataPlane(batfish.getSnapshot()); DataPlane dp = result._dataPlane; BgpPeerConfigId initiator = new BgpPeerConfigId("node1", "~Vrf_0~", Prefix.parse("1.0.0.0/32"), false); BgpPeerConfigId listener = new BgpPeerConfigId("node2", "~Vrf_1~", Prefix.parse("1.0.0.1/32"), false); BgpActivePeerConfig source = BgpActivePeerConfig.builder() .setLocalIp(Ip.parse("1.0.0.0")) .setPeerAddress(Ip.parse("1.0.0.1")) .setEbgpMultihop(false) .setLocalAs(1L) .setRemoteAs(2L) .setIpv4UnicastAddressFamily(Ipv4UnicastAddressFamily.builder().build()) .build(); assertTrue( BgpTopologyUtils.isReachableBgpNeighbor( initiator, listener, source, new TracerouteEngineImpl(dp, result._topologies.getLayer3Topology(), configs))); }
@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; }