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

Fix Juniper ethernet switching parsing #5860

Merged
merged 3 commits into from
Jun 4, 2020

Conversation

arifogel
Copy link
Member

@arifogel arifogel commented Jun 4, 2020

  • support access vlan specified as integer
  • change VS model to look more like configs
  • move guts of switching conversion to JuniperConfiguration

- support access vlan specified as integer
- change VS model to look more like configs
- move guts of switching conversion to JuniperConfiguration
@arifogel arifogel requested a review from dhalperi June 4, 2020 01:26
@batfish-bot
Copy link

This change is Reviewable

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 9 of 9 files at r1.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @arifogel)


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

Quoted 19 lines of code…

    if (ctx.range() != null) {
      IntegerSpace range = IntegerSpace.unionOf(toRange(ctx.range()).toArray(new SubRange[] {}));
      _currentInterfaceOrRange.getEthernetSwitching().getVlanMembers().add(new VlanRange(range));
    } else if (ctx.name != null) {
      String name = ctx.name.getText();

      _configuration.referenceStructure(VLAN, name, INTERFACE_VLAN, getLine(ctx.name.getStart()));



      _currentInterfaceOrRange.getEthernetSwitching().getVlanMembers().add(new VlanReference(name));





    }
  }

double-checking: the config can say members a 1 b?


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

      _currentInterfaceOrRange.getEthernetSwitching().getVlanMembers().add(new VlanReference(name));
    }
  }
else {
// ife_vlan has ALL selected
}

?

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


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

Previously, dhalperi (Dan Halperin) wrote…

    if (ctx.range() != null) {
      IntegerSpace range = IntegerSpace.unionOf(toRange(ctx.range()).toArray(new SubRange[] {}));
      _currentInterfaceOrRange.getEthernetSwitching().getVlanMembers().add(new VlanRange(range));
    } else if (ctx.name != null) {
      String name = ctx.name.getText();

      _configuration.referenceStructure(VLAN, name, INTERFACE_VLAN, getLine(ctx.name.getStart()));



      _currentInterfaceOrRange.getEthernetSwitching().getVlanMembers().add(new VlanReference(name));





    }
  }

double-checking: the config can say members a 1 b?

It can have e.g. members [a 1-2,5 b], which is really 3 separate lines

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


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

Previously, dhalperi (Dan Halperin) wrote…
else {
// ife_vlan has ALL selected
}

?

done

@codecov
Copy link

codecov bot commented Jun 4, 2020

Codecov Report

Merging #5860 into master will decrease coverage by 0.00%.
The diff coverage is 79.80%.

@@             Coverage Diff              @@
##             master    #5860      +/-   ##
============================================
- Coverage     71.99%   71.98%   -0.01%     
- Complexity    33882    33894      +12     
============================================
  Files          2795     2799       +4     
  Lines        139542   139588      +46     
  Branches      16765    16770       +5     
============================================
+ Hits         100462   100482      +20     
- Misses        31210    31230      +20     
- Partials       7870     7876       +6     
Impacted Files Coverage Δ Complexity Δ
...h/representation/juniper/JuniperConfiguration.java 88.30% <70.76%> (-0.46%) 454.00 <8.00> (+9.00) ⬇️
...fish/grammar/flatjuniper/ConfigurationBuilder.java 64.76% <83.33%> (-0.05%) 736.00 <5.00> (-2.00)
...a/org/batfish/representation/juniper/AllVlans.java 100.00% <100.00%> (ø) 3.00 <3.00> (?)
...fish/representation/juniper/EthernetSwitching.java 100.00% <100.00%> (ø) 6.00 <6.00> (?)
.../org/batfish/representation/juniper/Interface.java 93.86% <100.00%> (-0.26%) 82.00 <3.00> (-4.00)
.../org/batfish/representation/juniper/VlanRange.java 100.00% <100.00%> (ø) 3.00 <3.00> (?)
.../batfish/representation/juniper/VlanReference.java 100.00% <100.00%> (ø) 3.00 <3.00> (?)
...src/main/java/org/batfish/coordinator/PoolMgr.java 58.42% <0.00%> (-5.62%) 13.00% <0.00%> (-3.00%)
...col/src/main/java/org/batfish/role/InferRoles.java 89.54% <0.00%> (-1.37%) 50.00% <0.00%> (-1.00%)
... and 8 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.

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

@dhalperi dhalperi merged commit 4eb4e0d into batfish:master Jun 4, 2020
kylehoferamzn pushed a commit to kylehoferamzn/batfish that referenced this pull request Jun 22, 2020
- support access vlan specified as integer
- change VS model to look more like configs
- move guts of switching conversion to JuniperConfiguration
@arifogel arifogel deleted the ari-juniper-vlan-access-fix 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
Development

Successfully merging this pull request may close these issues.

None yet

3 participants