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

bgp: fix detection of new BGP sessions #6606

Merged
merged 4 commits into from Feb 2, 2021

Conversation

dhalperi
Copy link
Member

Fix a bug introduced in refactoring from #6251, where
some routes would not be exchanged on BGP links that come up after
the snapshot starts. Fairly rare in datacenters, because BGP links in
datacenters are usually ebgp singlehop.

When sending routes to new links, we need to use the main RIB from
the previous round rather than the current RIB, because depending on
iteration order of the current round the current RIB may include
routes that were not yet advertised in the previous round. This adds
some memory overhead, but pointers to the routes are much smaller
than the routes themselves, so this should be less than 10%.

Add a test.

Fix a bug introduced in refactoring from batfish#6251, where
some routes would not be exchanged on BGP links that come up after
the snapshot starts. Fairly rare in datacenters, because BGP links in
datacenters are usually ebgp singlehop.

When sending routes to new links, we need to use the main RIB from
the previous round rather than the current RIB, because depending on
iteration order of the current round the current RIB may include
routes that were not yet advertised in the previous round. This adds
some memory overhead, but pointers to the routes are much smaller
than the routes themselves, so this should be less than 10%.

Add a test.
@batfish-bot
Copy link

This change is Reviewable

@dhalperi dhalperi requested review from corinaminer and removed request for progwriter January 31, 2021 21:00
@codecov
Copy link

codecov bot commented Jan 31, 2021

Codecov Report

Merging #6606 (67d1f7b) into master (738882b) will increase coverage by 0.00%.
The diff coverage is 73.84%.

@@            Coverage Diff            @@
##             master    #6606   +/-   ##
=========================================
  Coverage     73.41%   73.42%           
- Complexity    35826    35830    +4     
=========================================
  Files          2842     2842           
  Lines        144595   144615   +20     
  Branches      17498    17504    +6     
=========================================
+ Hits         106157   106178   +21     
+ Misses        30021    30011   -10     
- Partials       8417     8426    +9     
Impacted Files Coverage Δ Complexity Δ
...java/org/batfish/dataplane/ibdp/VirtualRouter.java 90.32% <66.66%> (-0.44%) 206.00 <2.00> (-1.00)
.../org/batfish/dataplane/ibdp/BgpRoutingProcess.java 84.90% <74.19%> (+0.55%) 151.00 <8.00> (+5.00)
...batfish/representation/aws/LoadBalancerTarget.java 54.16% <0.00%> (-4.17%) 7.00% <0.00%> (-2.00%)
.../org/batfish/dataplane/rib/RouteAdvertisement.java 83.67% <0.00%> (-4.09%) 18.00% <0.00%> (-1.00%)
...main/java/org/batfish/datamodel/acl/AclTracer.java 60.37% <0.00%> (-1.26%) 43.00% <0.00%> (-1.00%)
...a/org/batfish/representation/aws/LoadBalancer.java 82.18% <0.00%> (-0.32%) 70.00% <0.00%> (-1.00%)
...src/main/java/org/batfish/coordinator/WorkMgr.java 75.81% <0.00%> (-0.16%) 247.00% <0.00%> (-1.00%)
...mar/cisco_nxos/CiscoNxosControlPlaneExtractor.java 76.61% <0.00%> (+0.10%) 1056.00% <0.00%> (+2.00%)
...batfish/representation/cisco_nxos/Conversions.java 79.89% <0.00%> (+0.26%) 76.00% <0.00%> (+1.00%)
... and 4 more

Copy link
Contributor

@anothermattbrown anothermattbrown 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: 0 of 14 files reviewed, 1 unresolved discussion (waiting on @corinaminer and @dhalperi)

a discussion (no related file):
(haven't looked at the code yet, but I have some questions about the description)

depending on iteration order of the current round the current RIB may include
routes that were not yet advertised in the previous round

This sounds like we need to advertise the current RIB, but you say we need to advertise the previous round's main RIB. Can you clarify that for me?

Also, I'm curious what kind of variance there is in the "iteration order". Is it possible to fix that order, and would doing so allow us to avoid this overhead?


Copy link
Contributor

@anothermattbrown anothermattbrown left a comment

Choose a reason for hiding this comment

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

Reviewed 14 of 14 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @corinaminer and @dhalperi)

* make invariants more clear and enforced in only one place
* not track the previous entire RIB unless necessary

The main thing missing was to defer processing of external
advertisements to the first round of BGP instead of doing it
in the neutral zone between IGP and EGP computations.
Copy link
Member Author

@dhalperi dhalperi 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: 6 of 8 files reviewed, 1 unresolved discussion (waiting on @anothermattbrown and @corinaminer)

a discussion (no related file):
Revised and added invariants per discussion.


Copy link
Contributor

@anothermattbrown anothermattbrown left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 8 files at r2.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @corinaminer)

@dhalperi dhalperi merged commit 74d482a into batfish:master Feb 2, 2021
@dhalperi dhalperi deleted the bgp-new-sessions branch February 2, 2021 17:59
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

3 participants