Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recompute layer-2,layer-3,vxlan topologies in iBDP #3835

Merged
merged 5 commits into from
May 10, 2019

Conversation

arifogel
Copy link
Member

@arifogel arifogel commented May 9, 2019

No description provided.

@batfish-bot
Copy link

This change is Reviewable

Copy link
Contributor

@progwriter progwriter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 7 of 11 files at r1.
Reviewable status: 7 of 11 files reviewed, 3 unresolved discussions (waiting on @arifogel, @corinaminer, @haverma, and @progwriter)


projects/batfish/src/main/java/org/batfish/dataplane/ibdp/TopologyContext.java, line 29 at r1 (raw file):

    private @Nonnull BgpTopology _bgpTopology;
    private @Nonnull Set<Edge> _edgeBlacklist;

This gives me pause.

  1. Why should DP be aware of any blacklists? This feels like a code smell.
  2. Did we not agree do deprecate edge blacklists?

projects/batfish/src/main/java/org/batfish/main/Batfish.java, line 735 at r1 (raw file):

      _storage.storeBgpTopology(topologies.getBgpTopology(), networkSnapshot);
      _storage.storeEigrpTopology(topologies.getEigrpTopology(), networkSnapshot);
      _storage.storeLayer2Topology(topologies.getLayer2Topology().orElse(null), networkSnapshot);

how is this not going to throw? storage expects a non-null topology


projects/batfish-common-protocol/src/main/java/org/batfish/common/topology/Layer1Topology.java, line 15 at r1 (raw file):

import javax.annotation.ParametersAreNonnullByDefault;

/** Represents physical (logical) wiring between physical (logical) interfaces. */

what is physical (logical)? physical or logical? both at the same time?

@codecov
Copy link

codecov bot commented May 10, 2019

Codecov Report

Merging #3835 into master will decrease coverage by 0.11%.
The diff coverage is 98.97%.

@@             Coverage Diff              @@
##             master    #3835      +/-   ##
============================================
- Coverage     74.16%   74.04%   -0.12%     
+ Complexity    24336    24199     -137     
============================================
  Files          2039     2039              
  Lines         98762    98246     -516     
  Branches      11871    11779      -92     
============================================
- Hits          73248    72751     -497     
+ Misses        20228    20212      -16     
+ Partials       5286     5283       -3
Impacted Files Coverage Δ Complexity Δ
...ain/java/org/batfish/storage/FileBasedStorage.java 83.48% <100%> (+0.07%) 126 <1> (ø) ⬇️
...va/org/batfish/dataplane/ibdp/TopologyContext.java 100% <100%> (+2.7%) 31 <5> (-13) ⬇️
...java/org/batfish/common/topology/TopologyUtil.java 91.35% <100%> (-2.05%) 144 <3> (-63)
...g/batfish/dataplane/ibdp/IncrementalBdpEngine.java 90.24% <100%> (-1.9%) 87 <1> (-42)
...ish/dataplane/ibdp/IncrementalDataPlanePlugin.java 94.44% <100%> (+2.6%) 7 <0> (-3) ⬇️
...ava/org/batfish/topology/TopologyProviderImpl.java 66.4% <100%> (-8.32%) 29 <0> (-11)
...ion/bgpsessionstatus/BgpSessionStatusAnswerer.java 80.64% <100%> (+0.21%) 27 <0> (ø) ⬇️
...va/org/batfish/common/topology/Layer1Topology.java 68.42% <66.66%> (+0.56%) 7 <2> (-1) ⬇️
...ain/java/org/batfish/symbolic/state/PostInVrf.java 78.57% <0%> (-7.15%) 7% <0%> (-1%)
.../src/main/java/org/batfish/datamodel/flow/Hop.java 53.33% <0%> (-6.67%) 5% <0%> (-1%)
... and 9 more

Copy link
Member Author

@arifogel arifogel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 4 of 18 files reviewed, 3 unresolved discussions (waiting on @arifogel, @corinaminer, @haverma, and @progwriter)


projects/batfish/src/main/java/org/batfish/main/Batfish.java, line 735 at r1 (raw file):

Previously, progwriter (Victor Heorhiadi) wrote…

how is this not going to throw? storage expects a non-null topology

fixed


projects/batfish-common-protocol/src/main/java/org/batfish/common/topology/Layer1Topology.java, line 15 at r1 (raw file):

Previously, progwriter (Victor Heorhiadi) wrote…

what is physical (logical)? physical or logical? both at the same time?

better?

Copy link

@haverma haverma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 11 files at r1.
Reviewable status: 7 of 18 files reviewed, 7 unresolved discussions (waiting on @arifogel, @corinaminer, @haverma, and @progwriter)


projects/batfish/src/main/java/org/batfish/dataplane/ibdp/IncrementalBdpEngine.java, line 130 at r1 (raw file):

          // Update topologies
          TopologyContext newTopologyContext = currentTopologyContext;

An optional suggestion:
I think creating a copy of a reference (TopologyContext newTopologyContext = currentTopologyContext) and then overwriting the reference (with a new TopologyContext object) in each of the subsequent lines in order to carryover two values (vxlanTopology and layer2Topology) is a unnecessary and confusing. We don't need the intermediate instances of TopologyContexts created here and it makes it a bit difficult to understand. I think something like the following would be easier to understand:

 VxlanTopology vxlanTopology =
              prunedVxlanTopology(
                  initialTopologyContext.getVxlanTopology(),
                  configurations,
                  new TracerouteEngineImpl(
                      partialDataplane, currentTopologyContext.getLayer3Topology()));

          Optional<Layer2Topology> layer2Topology =
              currentTopologyContext
                  .getLayer1LogicalTopology()
                  .map(
                      layer1Topology ->
                          computeLayer2Topology(layer1Topology, vxlanTopology, configurations));

          TopologyContext newTopologyContext =
              currentTopologyContext
                  .toBuilder()
                  .setLayer3Topology(
                      computeLayer3Topology(
                          computeRawLayer3Topology(
                              currentTopologyContext.getRawLayer1PhysicalTopology(),
                              layer2Topology,
                              configurations),
                          currentTopologyContext.getEdgeBlacklist(),
                          currentTopologyContext.getNodeBlacklist(),
                          currentTopologyContext.getInterfaceBlacklist(),
                          configurations))
                  .setVxlanTopology(vxlanTopology)
                  .setLayer2Topology(layer2Topology)
                  .build();

projects/batfish/src/main/java/org/batfish/dataplane/ibdp/IncrementalBdpEngine.java, line 138 at r1 (raw file):

                  .setVxlanTopology(
                      prunedVxlanTopology(
                          initialTopologyContext.getVxlanTopology(),

why do we not run the pruner on the updated vxlanTopology of currentTopologyContext instead of always using the initialTopologyContext? a design choice ?


projects/batfish/src/main/java/org/batfish/dataplane/ibdp/IncrementalDataPlanePlugin.java, line 52 at r1 (raw file):

            .setOspfTopology(_batfish.getTopologyProvider().getInitialOspfTopology(networkSnapshot))
            .setRawLayer1PhysicalTopology(
                _batfish.getTopologyProvider().getRawLayer1PhysicalTopology(networkSnapshot))

_batfish.getTopologyProvider() can be stored in a var and reused


projects/batfish/src/test/java/org/batfish/dataplane/ibdp/FixedPointTopologyTest.java, line 53 at r1 (raw file):

  private static final String E1_NAME = "E1";

new line intentional?

Copy link

@haverma haverma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 11 files at r1, 11 of 11 files at r2.
Reviewable status: all files reviewed, 7 unresolved discussions (waiting on @arifogel, @corinaminer, and @progwriter)

Copy link
Member Author

@arifogel arifogel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 7 unresolved discussions (waiting on @arifogel, @corinaminer, @haverma, and @progwriter)


projects/batfish/src/main/java/org/batfish/dataplane/ibdp/IncrementalBdpEngine.java, line 138 at r1 (raw file):

Previously, haverma (Harsh Verma) wrote…

why do we not run the pruner on the updated vxlanTopology of currentTopologyContext instead of always using the initialTopologyContext? a design choice ?

The initial VXLAN topology is actually the maximum possible topology assuming full reachability between endpoints. Since any of these tunnels can come up or down each iteration, we need to prune from the initial. If we instead pruned from the most recent one, then the topology would shrink monotonically. That would be incorrect in general.

Copy link
Member Author

@arifogel arifogel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 15 of 18 files reviewed, 7 unresolved discussions (waiting on @arifogel, @corinaminer, @haverma, and @progwriter)


projects/batfish/src/main/java/org/batfish/dataplane/ibdp/IncrementalBdpEngine.java, line 130 at r1 (raw file):

Previously, haverma (Harsh Verma) wrote…

An optional suggestion:
I think creating a copy of a reference (TopologyContext newTopologyContext = currentTopologyContext) and then overwriting the reference (with a new TopologyContext object) in each of the subsequent lines in order to carryover two values (vxlanTopology and layer2Topology) is a unnecessary and confusing. We don't need the intermediate instances of TopologyContexts created here and it makes it a bit difficult to understand. I think something like the following would be easier to understand:

 VxlanTopology vxlanTopology =
              prunedVxlanTopology(
                  initialTopologyContext.getVxlanTopology(),
                  configurations,
                  new TracerouteEngineImpl(
                      partialDataplane, currentTopologyContext.getLayer3Topology()));

          Optional<Layer2Topology> layer2Topology =
              currentTopologyContext
                  .getLayer1LogicalTopology()
                  .map(
                      layer1Topology ->
                          computeLayer2Topology(layer1Topology, vxlanTopology, configurations));

          TopologyContext newTopologyContext =
              currentTopologyContext
                  .toBuilder()
                  .setLayer3Topology(
                      computeLayer3Topology(
                          computeRawLayer3Topology(
                              currentTopologyContext.getRawLayer1PhysicalTopology(),
                              layer2Topology,
                              configurations),
                          currentTopologyContext.getEdgeBlacklist(),
                          currentTopologyContext.getNodeBlacklist(),
                          currentTopologyContext.getInterfaceBlacklist(),
                          configurations))
                  .setVxlanTopology(vxlanTopology)
                  .setLayer2Topology(layer2Topology)
                  .build();

Of course! I don't know what I was thinking.
Fixed.


projects/batfish/src/main/java/org/batfish/dataplane/ibdp/IncrementalDataPlanePlugin.java, line 52 at r1 (raw file):

Previously, haverma (Harsh Verma) wrote…

_batfish.getTopologyProvider() can be stored in a var and reused

done


projects/batfish/src/test/java/org/batfish/dataplane/ibdp/FixedPointTopologyTest.java, line 53 at r1 (raw file):

Previously, haverma (Harsh Verma) wrote…

new line intentional?

nope. fixed.

Copy link

@haverma haverma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 3 files at r3.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @arifogel, @corinaminer, and @progwriter)


projects/batfish/src/main/java/org/batfish/dataplane/ibdp/IncrementalBdpEngine.java, line 138 at r1 (raw file):

Previously, arifogel (Ari Fogel) wrote…

The initial VXLAN topology is actually the maximum possible topology assuming full reachability between endpoints. Since any of these tunnels can come up or down each iteration, we need to prune from the initial. If we instead pruned from the most recent one, then the topology would shrink monotonically. That would be incorrect in general.

got it. Thanks !

Copy link
Member Author

@arifogel arifogel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @corinaminer and @progwriter)


projects/batfish/src/main/java/org/batfish/dataplane/ibdp/TopologyContext.java, line 29 at r1 (raw file):

Previously, progwriter (Victor Heorhiadi) wrote…

This gives me pause.

  1. Why should DP be aware of any blacklists? This feels like a code smell.
  2. Did we not agree do deprecate edge blacklists?

Deferring to follow-on PR.

Copy link
Contributor

@progwriter progwriter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @corinaminer)


projects/batfish-common-protocol/src/main/java/org/batfish/common/topology/Layer1Topology.java, line 15 at r1 (raw file):

Previously, arifogel (Ari Fogel) wrote…

better?

yep

@arifogel arifogel merged commit 8071df5 into batfish:master May 10, 2019
@arifogel arifogel deleted the ari-ibdp-recompute-topologies branch May 10, 2019 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants