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

juniper parse and partially convert condition #6658

Merged
merged 3 commits into from Feb 25, 2021

Conversation

arifogel
Copy link
Member

@arifogel arifogel commented Feb 25, 2021

  • parse, convert policy-statement from condition
  • parse, partially convert policy-options condition if-route-exists
    • TODO: VI design and implementation for checking route existence in RP
      • just return false for if-route-exists for now

- parse, convert policy-statement from condition
- parse, partially convert policy-options condition if-route-exists
  - TODO: VI design and implementation for HasRoute
    - HasRoute just returns false for now
@batfish-bot
Copy link

This change is Reviewable

@dhalperi dhalperi removed the request for review from ratulm February 25, 2021 02:28
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 15 of 15 files at r1.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @arifogel)


projects/batfish/src/main/antlr4/org/batfish/grammar/flatjuniper/FlatJuniper_policy_options.g4, line 41 at r1 (raw file):

 (

please put paren on next line. Better to conform with existing standards. If you want to refactor entire grammar, that can be done, but later.


projects/batfish/src/main/java/org/batfish/grammar/flatjuniper/ConfigurationBuilder.java, line 6168 at r1 (raw file):

tIfRouteExists().setPrefix(toPrefix(ctx.prefix));

can't check two prefixes?


projects/batfish/src/main/java/org/batfish/grammar/flatjuniper/ConfigurationBuilder.java, line 6173 at r1 (raw file):

xists().setTable(unquote(ctx.name.getText()));

can't check two tables?


projects/batfish/src/main/java/org/batfish/representation/juniper/Condition.java, line 30 at r1 (raw file):

  }

  private final String _name;

@nonnull


projects/batfish/src/main/java/org/batfish/representation/juniper/PsFromCondition.java, line 5 at r1 (raw file):

n.base.Objects;

use java objects, not guava objects. (MoreObjects if guava).


projects/batfish-common-protocol/src/main/java/org/batfish/datamodel/routing_policy/expr/HasRoute.java, line 15 at r1 (raw file):

@ParametersAreNonnullByDefault
public final class HasRoute extends BooleanExpr {

This looks like a never-implemented IOS-XR construct. Let's not add a new dependency on it, but rather just convert as False for now?

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: 10 of 14 files reviewed, 3 unresolved discussions (waiting on @dhalperi)


projects/batfish/src/main/antlr4/org/batfish/grammar/flatjuniper/FlatJuniper_policy_options.g4, line 41 at r1 (raw file):

Previously, dhalperi (Dan Halperin) wrote…
 (

please put paren on next line. Better to conform with existing standards. If you want to refactor entire grammar, that can be done, but later.

ok, done


projects/batfish/src/main/java/org/batfish/grammar/flatjuniper/ConfigurationBuilder.java, line 6168 at r1 (raw file):

Previously, dhalperi (Dan Halperin) wrote…
tIfRouteExists().setPrefix(toPrefix(ctx.prefix));

can't check two prefixes?

nope


projects/batfish/src/main/java/org/batfish/grammar/flatjuniper/ConfigurationBuilder.java, line 6173 at r1 (raw file):

Previously, dhalperi (Dan Halperin) wrote…
xists().setTable(unquote(ctx.name.getText()));

can't check two tables?

nope


projects/batfish/src/main/java/org/batfish/representation/juniper/Condition.java, line 30 at r1 (raw file):

Previously, dhalperi (Dan Halperin) wrote…

@nonnull

done


projects/batfish/src/main/java/org/batfish/representation/juniper/PsFromCondition.java, line 5 at r1 (raw file):

Previously, dhalperi (Dan Halperin) wrote…
n.base.Objects;

use java objects, not guava objects. (MoreObjects if guava).

oops! fixed.


projects/batfish-common-protocol/src/main/java/org/batfish/datamodel/routing_policy/expr/HasRoute.java, line 15 at r1 (raw file):

Previously, dhalperi (Dan Halperin) wrote…

This looks like a never-implemented IOS-XR construct. Let's not add a new dependency on it, but rather just convert as False for now?

ok. reverted here, and changed where it was used.

@codecov
Copy link

codecov bot commented Feb 25, 2021

Codecov Report

Merging #6658 (0d5ac88) into master (8514c0f) will increase coverage by 0.01%.
The diff coverage is 89.28%.

@@             Coverage Diff              @@
##             master    #6658      +/-   ##
============================================
+ Coverage     73.50%   73.51%   +0.01%     
- Complexity    36592    36628      +36     
============================================
  Files          2930     2933       +3     
  Lines        147316   147422     +106     
  Branches      17765    17771       +6     
============================================
+ Hits         108278   108371      +93     
- Misses        30511    30517       +6     
- Partials       8527     8534       +7     
Impacted Files Coverage Δ Complexity Δ
...atfish/representation/juniper/PsFromCondition.java 58.33% <58.33%> (ø) 4.00 <4.00> (?)
...h/representation/juniper/JuniperConfiguration.java 88.44% <86.20%> (-0.05%) 470.00 <4.00> (+5.00) ⬇️
...fish/grammar/flatjuniper/ConfigurationBuilder.java 72.81% <100.00%> (+0.14%) 883.00 <7.00> (+7.00)
.../org/batfish/representation/juniper/Condition.java 100.00% <100.00%> (ø) 5.00 <5.00> (?)
.../batfish/representation/juniper/IfRouteExists.java 100.00% <100.00%> (ø) 5.00 <5.00> (?)
...h/representation/juniper/JuniperStructureType.java 100.00% <100.00%> (ø) 3.00 <0.00> (ø)
.../representation/juniper/JuniperStructureUsage.java 100.00% <100.00%> (ø) 3.00 <0.00> (ø)
.../batfish/representation/juniper/LogicalSystem.java 96.06% <100.00%> (+0.06%) 62.00 <1.00> (+1.00)
...va/org/batfish/representation/juniper/PsFroms.java 93.18% <100.00%> (+0.41%) 36.00 <2.00> (+2.00)
.../org/batfish/dataplane/rib/RouteAdvertisement.java 83.67% <0.00%> (-4.09%) 18.00% <0.00%> (-1.00%)
... and 20 more

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.

:lgtm:

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


projects/batfish/src/main/antlr4/org/batfish/grammar/flatjuniper/FlatJuniper_policy_options.g4, line 42 at r2 (raw file):

:
  CONDITION name = junos_name
  (

Throughout? Or leave it.

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


projects/batfish/src/main/antlr4/org/batfish/grammar/flatjuniper/FlatJuniper_policy_options.g4, line 42 at r2 (raw file):

Previously, dhalperi (Dan Halperin) wrote…

Throughout? Or leave it.

missed that other one.

WRT other style changes, I'd prefer to leave the one-line rules/tokens that are super simple unless you strongly object prior to a full refactor.

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.

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

@arifogel arifogel merged commit e2c2c78 into batfish:master Feb 25, 2021
@arifogel arifogel deleted the ari-juniper-condition branch February 25, 2021 20:16
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