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

Support setting BGP properties on generated routes during activation #6728

Merged

Conversation

arifogel
Copy link
Member

@arifogel arifogel commented Mar 13, 2021

Fix #6691

  • fixes crash on NX-OS when setting community in
    bgp neighbor default-originate route-map

- fixes crash on NX-OS when setting community in
  bgp neighbor default-originate route-map
@arifogel arifogel requested a review from dhalperi March 13, 2021 01:26
@batfish-bot
Copy link

This change is Reviewable

- Too much code relies on special semantics of `instanceof BgpRoute`
  to be able to safely inherit from `BgpRoute`
  - instead, move needed code into BgpAttributesRoute, from which
    both GeneratedRoute and BgpRoute now inherit
- update api for fetching/matching communities in various places
- use interfaces in routing policy where applicable, don't crash for
inapplicable routes
Copy link
Member

@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.

Reviewed 1 of 6 files at r1, 50 of 50 files at r3.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @arifogel)


projects/batfish-common-protocol/src/main/java/org/batfish/datamodel/routing_policy/expr/IncrementLocalPreference.java, line 43 at r3 (raw file):

  @Override
  public long evaluate(Environment environment) {
    BgpRoute<?, ?> oldRoute = (BgpRoute) environment.getOriginalRoute();

What about this one and decrement?

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: :shipit: complete! all files reviewed, all discussions resolved


projects/batfish-common-protocol/src/main/java/org/batfish/datamodel/routing_policy/expr/IncrementLocalPreference.java, line 43 at r3 (raw file):

Previously, dhalperi (Dan Halperin) wrote…

What about this one and decrement?

done.

Copy link
Member

@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.

Reviewed 2 of 2 files at r4.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@codecov
Copy link

codecov bot commented Mar 16, 2021

Codecov Report

Merging #6728 (0ca1c28) into master (656aa6c) will decrease coverage by 0.02%.
The diff coverage is 74.13%.

@@             Coverage Diff              @@
##             master    #6728      +/-   ##
============================================
- Coverage     70.04%   70.02%   -0.03%     
- Complexity    37690    37696       +6     
============================================
  Files          3097     3096       -1     
  Lines        159712   159821     +109     
  Branches      19483    19501      +18     
============================================
+ Hits         111876   111916      +40     
- Misses        38826    38877      +51     
- Partials       9010     9028      +18     
Impacted Files Coverage Δ Complexity Δ
...tamodel/routing_policy/expr/MatchCommunitySet.java 42.85% <0.00%> (ø) 7.00 <0.00> (ø)
...odel/routing_policy/statement/DeleteCommunity.java 37.50% <0.00%> (ø) 4.00 <0.00> (ø)
.../src/main/java/org/batfish/datamodel/BgpRoute.java 80.95% <50.00%> (-3.52%) 21.00 <0.00> (ø)
.../routing_policy/expr/DecrementLocalPreference.java 56.52% <50.00%> (-8.19%) 7.00 <1.00> (ø)
.../routing_policy/expr/IncrementLocalPreference.java 58.33% <50.00%> (-8.34%) 7.00 <1.00> (ø)
...amodel/routing_policy/statement/PrependAsPath.java 67.50% <60.00%> (-3.56%) 7.00 <2.00> (ø)
...l/routing_policy/statement/SetLocalPreference.java 73.91% <60.00%> (-6.09%) 8.00 <2.00> (ø)
...datamodel/routing_policy/statement/Statements.java 80.95% <60.00%> (-1.98%) 2.00 <0.00> (ø)
...del/routing_policy/communities/SetCommunities.java 86.95% <66.66%> (-8.29%) 10.00 <2.00> (ø)
.../datamodel/routing_policy/statement/SetWeight.java 51.85% <66.66%> (-0.33%) 7.00 <2.00> (+1.00) ⬇️
... and 31 more

@dhalperi dhalperi merged commit 0ba225f into batfish:master Mar 16, 2021
@arifogel arifogel deleted the ari-generated-route-activate-set-bgp-properties branch June 8, 2021 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants