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

SearchRoutePolicies: AS-path support #6168

Merged
merged 29 commits into from
Sep 3, 2020
Merged

Conversation

millstein
Copy link
Contributor

Support AS-path filtering in the searchRoutePolicies question. Also support constraints on the AS paths of the input/output route announcements.

…zed it in preparation for handling AS path regexes
…zed it in preparation for handling AS path regexes
@batfish-bot
Copy link

This change is Reviewable

@codecov
Copy link

codecov bot commented Sep 2, 2020

Codecov Report

Merging #6168 into master will decrease coverage by 0.06%.
The diff coverage is 95.74%.

@@             Coverage Diff              @@
##             master    #6168      +/-   ##
============================================
- Coverage     72.88%   72.81%   -0.07%     
+ Complexity    34859    34735     -124     
============================================
  Files          2818     2818              
  Lines        142254   141741     -513     
  Branches      17146    17003     -143     
============================================
- Hits         103676   103205     -471     
+ Misses        30404    30363      -41     
+ Partials       8174     8173       -1     
Impacted Files Coverage Δ Complexity Δ
...archroutepolicies/SearchRoutePoliciesAnswerer.java 91.86% <94.11%> (-1.99%) 42.00 <10.00> (-23.00)
...ain/java/org/batfish/minesweeper/CommunityVar.java 97.67% <100.00%> (-0.84%) 17.00 <1.00> (-14.00)
...r/src/main/java/org/batfish/minesweeper/Graph.java 80.67% <100.00%> (-4.57%) 205.00 <5.00> (-54.00)
...a/org/batfish/minesweeper/SymbolicAsPathRegex.java 60.00% <100.00%> (-2.97%) 5.00 <1.00> (-5.00)
...ain/java/org/batfish/minesweeper/bdd/BDDRoute.java 49.77% <100.00%> (+4.73%) 26.00 <3.00> (-6.00) ⬆️
...stion/searchroutepolicies/BgpRouteConstraints.java 92.45% <100.00%> (-0.89%) 15.00 <2.00> (-13.00)
...rg/batfish/identifiers/StorageBasedIdResolver.java 88.88% <0.00%> (-4.45%) 27.00% <0.00%> (ø%)
.../org/batfish/dataplane/rib/RouteAdvertisement.java 84.78% <0.00%> (-4.35%) 16.00% <0.00%> (-1.00%)
... and 11 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.

Reviewed 8 of 8 files at r1.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @millstein)


projects/minesweeper/src/main/java/org/batfish/minesweeper/bdd/BDDRoute.java, line 233 at r1 (raw file):

It is useful when the goal is to produce concrete example routes from a BDDRoute, for instance.

The constraints don't always have to hold?


projects/minesweeper/src/main/java/org/batfish/minesweeper/bdd/BDDRoute.java, line 241 at r1 (raw file):

    // at most one AS-path regex atomic predicate should be true, since by construction their
    // regexes are all pairwise disjoint

in this case, can you just allocate log(N) BDD variables instead of N, for N=number of APs? That's what we do in BDDFiniteDomain. In fact, maybe you can use BDDFiniteDomain? It still has a well-formedness constraint, since there may be extra values.

Copy link
Contributor Author

@millstein millstein 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, 2 unresolved discussions (waiting on @anothermattbrown)


projects/minesweeper/src/main/java/org/batfish/minesweeper/bdd/BDDRoute.java, line 233 at r1 (raw file):

Previously, anothermattbrown (Matt Brown) wrote…
It is useful when the goal is to produce concrete example routes from a BDDRoute, for instance.

The constraints don't always have to hold?

The constraints do always have to hold. But I don't think it suffices to enforce them during symbolic route analysis (TransferBDD). That analysis computes a BDD representing the input routes that are accepted by the route map. So ANDing the well-formedness constraints in there would ensure that any models of that BDD are feasible routes. But if what a client is interested in is routes that are denied by the route map, then simply negating that whole thing would be incorrect, because it would not ensure that the well-formedness constraints hold. So I think it's logically a separate notion.


projects/minesweeper/src/main/java/org/batfish/minesweeper/bdd/BDDRoute.java, line 241 at r1 (raw file):

Previously, anothermattbrown (Matt Brown) wrote…
    // at most one AS-path regex atomic predicate should be true, since by construction their
    // regexes are all pairwise disjoint

in this case, can you just allocate log(N) BDD variables instead of N, for N=number of APs? That's what we do in BDDFiniteDomain. In fact, maybe you can use BDDFiniteDomain? It still has a well-formedness constraint, since there may be extra values.

Could do that, although I'm not sure if it's worth it given that I expect N to be small. Also I've found in other projects that the smallest encoding is not always the best performing one, because it introduces spurious correlations. For example, with the "unary" encoding after an AS-path regex match some subset of the choices will have the BDD 1 and the rest the BDD 0, while with the binary encoding there will be more complicated BDDs. Happy to discuss of course.

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: all files reviewed, 2 unresolved discussions (waiting on @millstein)


projects/minesweeper/src/main/java/org/batfish/minesweeper/bdd/BDDRoute.java, line 233 at r1 (raw file):

Previously, millstein (Todd Millstein) wrote…

The constraints do always have to hold. But I don't think it suffices to enforce them during symbolic route analysis (TransferBDD). That analysis computes a BDD representing the input routes that are accepted by the route map. So ANDing the well-formedness constraints in there would ensure that any models of that BDD are feasible routes. But if what a client is interested in is routes that are denied by the route map, then simply negating that whole thing would be incorrect, because it would not ensure that the well-formedness constraints hold. So I think it's logically a separate notion.

makes sense. these points would be worth including in the comment.


projects/minesweeper/src/main/java/org/batfish/minesweeper/bdd/BDDRoute.java, line 241 at r1 (raw file):

Previously, millstein (Todd Millstein) wrote…

Could do that, although I'm not sure if it's worth it given that I expect N to be small. Also I've found in other projects that the smallest encoding is not always the best performing one, because it introduces spurious correlations. For example, with the "unary" encoding after an AS-path regex match some subset of the choices will have the BDD 1 and the rest the BDD 0, while with the binary encoding there will be more complicated BDDs. Happy to discuss of course.

Yeah it'll be interesting to see how many APs we see in practice. The other benefit of the log(N) encoding is that it would eliminate the need for this n^2 constraint, since the AP identifiers would be mutually exclusive. In any case, it would be worth making a note of these trade-offs in the comment.

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 1 of 1 files at r2.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

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.

:lgtm:

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@millstein millstein merged commit b3b57d6 into master Sep 3, 2020
@millstein millstein deleted the transfer-bdd-as-path-4 branch September 3, 2020 03:41
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