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

JunOS: Support As-Path-Group #8613

Merged
merged 4 commits into from Dec 6, 2022
Merged

Conversation

ktaegyum
Copy link
Collaborator

@ktaegyum ktaegyum commented Dec 5, 2022

Add support for as-path-group in JunOS.

@batfish-bot
Copy link

This change is Reviewable

@ktaegyum ktaegyum changed the title JunOS: Support as-path-group JunOS: Support As-Path-Group Dec 5, 2022
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 11 of 11 files at r1, all commit messages.
Reviewable status: all files reviewed, 7 unresolved discussions (waiting on @ktaegyum)


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

  public void exitPo_as_path_group(Po_as_path_groupContext ctx) {
      String name = toString(ctx.name);
      _configuration.referenceStructure(

as-path-group should not have a self reference, should it? It should be tracked as an unused structure if it's not referred to.


projects/batfish/src/main/java/org/batfish/representation/juniper/AsPathGroup.java line 31 at r1 (raw file):

  }

  public @Nonnull List<String> getAsPathRegexes() {

why is this needed here? This seems like a thing to do in conversion.


projects/batfish/src/main/java/org/batfish/representation/juniper/JuniperConfiguration.java line 3144 at r1 (raw file):

      conj.getConjuncts().add(new Disjunction(toBooleanExprs(froms.getFromAsPaths())));
    }
    if (!froms.getFromAsPathGroups().isEmpty()) {

please add a TODO: can you have both as-path and as-path-group together, and how does it work?


projects/batfish/src/main/java/org/batfish/representation/juniper/JuniperStructureUsage.java line 11 at r1 (raw file):

  APPLICATION_SET_MEMBER_APPLICATION("application-set member application"),
  APPLICATION_SET_MEMBER_APPLICATION_SET("application-set member application-set"),
  AS_PATH_GROUP_SELF_REFERENCE("as-path-group"),

as discussed, drop?


projects/batfish/src/main/java/org/batfish/representation/juniper/PsFromAsPathGroup.java line 39 at r1 (raw file):

            asPathGroup
                    .getAsPathRegexes()
                    .forEach(

please just use a regular for loop. This code is so hard to read.


projects/batfish/src/main/java/org/batfish/representation/juniper/PsFromAsPathGroup.java line 44 at r1 (raw file):

                                            org.batfish.representation.juniper.parboiled.AsPathRegex.convertToJavaRegex(
                                                    regex)));
            String ORedRegexes = String.join(" | ", javaRegex);

Moving this into the regex is the wrong way to do it. Don't we have an OrExpr?


tests/parsing-tests/networks/unit-tests/configs/juniper_policy_statement line 46 at r1 (raw file):

set policy-options as-path ORIGINATED_IN_65535 ".* 65535"
set policy-options as-path UNUSED_ORIGINATED_IN_65535 ".* 65535"
set policy-options as-path-group AS_PATH_GROUP as-path ASN714 ".* 714$"

use private ASes for this. Maybe 65535 and 65534?

Code quote:

ASN714 "

@ktaegyum
Copy link
Collaborator Author

ktaegyum commented Dec 5, 2022

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

Previously, dhalperi (Dan Halperin) wrote…

as-path-group should not have a self reference, should it? It should be tracked as an unused structure if it's not referred to.

done

Copy link
Collaborator Author

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


projects/batfish/src/main/java/org/batfish/representation/juniper/JuniperConfiguration.java line 3144 at r1 (raw file):

Previously, dhalperi (Dan Halperin) wrote…

please add a TODO: can you have both as-path and as-path-group together, and how does it work?

done


projects/batfish/src/main/java/org/batfish/representation/juniper/PsFromAsPathGroup.java line 39 at r1 (raw file):

Previously, dhalperi (Dan Halperin) wrote…

please just use a regular for loop. This code is so hard to read.

done


projects/batfish/src/main/java/org/batfish/representation/juniper/PsFromAsPathGroup.java line 44 at r1 (raw file):

Previously, dhalperi (Dan Halperin) wrote…

Moving this into the regex is the wrong way to do it. Don't we have an OrExpr?

done


tests/parsing-tests/networks/unit-tests/configs/juniper_policy_statement line 46 at r1 (raw file):

Previously, dhalperi (Dan Halperin) wrote…

use private ASes for this. Maybe 65535 and 65534?

done


projects/batfish/src/main/java/org/batfish/representation/juniper/AsPathGroup.java line 31 at r1 (raw file):

Previously, dhalperi (Dan Halperin) wrote…

why is this needed here? This seems like a thing to do in conversion.

removed


projects/batfish/src/main/java/org/batfish/representation/juniper/JuniperStructureUsage.java line 11 at r1 (raw file):

Previously, dhalperi (Dan Halperin) wrote…

as discussed, drop?

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 8 of 8 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @ktaegyum)

@codecov
Copy link

codecov bot commented Dec 5, 2022

Codecov Report

Merging #8613 (891bbc4) into master (6b9b5be) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8613      +/-   ##
==========================================
+ Coverage   71.45%   71.47%   +0.01%     
==========================================
  Files        3274     3275       +1     
  Lines      168922   168947      +25     
  Branches    19627    19629       +2     
==========================================
+ Hits       120704   120752      +48     
+ Misses      38943    38920      -23     
  Partials     9275     9275              
Impacted Files Coverage Δ
...fish/grammar/flatjuniper/ConfigurationBuilder.java 67.29% <100.00%> (+0.50%) ⬆️
...h/representation/juniper/JuniperConfiguration.java 85.82% <100.00%> (+0.01%) ⬆️
...fish/representation/juniper/PsFromAsPathGroup.java 100.00% <100.00%> (ø)
...va/org/batfish/representation/juniper/PsFroms.java 90.72% <100.00%> (+0.50%) ⬆️
...fish/bddreachability/BDDLoopDetectionAnalysis.java 76.81% <0.00%> (-13.05%) ⬇️
...rg/batfish/dataplane/ibdp/EigrpRoutingProcess.java 89.08% <0.00%> (-0.36%) ⬇️
...main/java/org/batfish/datamodel/acl/AclTracer.java 64.96% <0.00%> (+1.27%) ⬆️
...rg/batfish/representation/juniper/NamedAsPath.java 83.33% <0.00%> (+83.33%) ⬆️
...rg/batfish/representation/juniper/AsPathGroup.java 100.00% <0.00%> (+100.00%) ⬆️

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.

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ktaegyum)

a discussion (no related file):
Missing test coverage! I think we need to extend the tests here.

# set policy-options policy-statement AS_PATH_POLICY term T1 from as-path AS1

and here

public void testJuniperPolicyStatementTermFromEvaluation() {


Copy link
Collaborator Author

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

a discussion (no related file):

Previously, dhalperi (Dan Halperin) wrote…

Missing test coverage! I think we need to extend the tests here.

# set policy-options policy-statement AS_PATH_POLICY term T1 from as-path AS1

and here

public void testJuniperPolicyStatementTermFromEvaluation() {

test added.


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 r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @ktaegyum)

@dhalperi dhalperi merged commit 1d7d56e into batfish:master Dec 6, 2022
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