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

FRR: Adding support for interface shutdown command #6169

Merged
merged 2 commits into from Sep 3, 2020

Conversation

kylehoferamzn
Copy link
Contributor

Behavior tested is that if you issue shutdown in Zebra, the interface is admin down. If you configure "no shut" it just deletes the command - similar to unconfigured. For that reason I made it non-null and initialized to false as default. /etc/network/interfaces state parsing happens prior and also controls (hence I do not have a no-shut force admin up for Zebra)

@batfish-bot
Copy link

This change is Reviewable

@codecov
Copy link

codecov bot commented Sep 3, 2020

Codecov Report

Merging #6169 into master will decrease coverage by 0.06%.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##             master    #6169      +/-   ##
============================================
- Coverage     72.88%   72.81%   -0.07%     
+ Complexity    34859    34742     -117     
============================================
  Files          2818     2818              
  Lines        142254   141749     -505     
  Branches      17146    17004     -142     
============================================
- Hits         103676   103216     -460     
+ Misses        30404    30360      -44     
+ Partials       8174     8173       -1     
Impacted Files Coverage Δ Complexity Δ
...ar/cumulus_frr/CumulusFrrConfigurationBuilder.java 74.91% <100.00%> (+0.08%) 154.00 <1.00> (+1.00)
...tion/cumulus/CumulusConcatenatedConfiguration.java 68.15% <100.00%> (+0.17%) 77.00 <0.00> (+1.00)
...g/batfish/representation/cumulus/FrrInterface.java 86.95% <100.00%> (+2.74%) 11.00 <3.00> (+2.00)
...r/src/main/java/org/batfish/minesweeper/Graph.java 80.67% <0.00%> (-4.57%) 205.00% <0.00%> (-54.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%)
...c/main/java/org/batfish/dataplane/rib/RibTree.java 89.58% <0.00%> (-4.17%) 27.00% <0.00%> (-1.00%)
...a/org/batfish/minesweeper/SymbolicAsPathRegex.java 60.00% <0.00%> (-2.97%) 5.00% <0.00%> (-5.00%)
...archroutepolicies/SearchRoutePoliciesAnswerer.java 91.86% <0.00%> (-1.99%) 42.00% <0.00%> (-23.00%)
...src/main/java/org/batfish/coordinator/PoolMgr.java 59.25% <0.00%> (-1.24%) 15.00% <0.00%> (-1.00%)
... and 7 more

Copy link
Contributor

@progwriter progwriter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 7 of 7 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @kylehoferamzn)


projects/batfish/src/main/java/org/batfish/representation/cumulus/FrrInterface.java, line 19 at r1 (raw file):

  private final @Nonnull String _name;
  private final @Nullable String _vrfName;
  private @Nonnull Boolean _shutdown = false;

Are you absolutely sure the behavior you describe (shutdown = false being the default) is always true? i.e., it doesn't vary based on properties of iface (e.g., physical/l3/switchport/portchannel/etc.) Reason I ask, is because we've seen that w/ nxos for example. 🙄

if yes, then ok to make this a primitive boolean
if no, then mark @Nullable and just do firstNonNull(iface.getShutdown(), false) in conversion. Later, we can replace false w/ dynamically-computed default value if needed.

Copy link
Contributor Author

@kylehoferamzn kylehoferamzn 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 @nonnull)


projects/batfish/src/main/java/org/batfish/representation/cumulus/FrrInterface.java, line 19 at r1 (raw file):

Previously, progwriter (Victor Heorhiadi) wrote…

Are you absolutely sure the behavior you describe (shutdown = false being the default) is always true? i.e., it doesn't vary based on properties of iface (e.g., physical/l3/switchport/portchannel/etc.) Reason I ask, is because we've seen that w/ nxos for example. 🙄

if yes, then ok to make this a primitive boolean
if no, then mark @Nullable and just do firstNonNull(iface.getShutdown(), false) in conversion. Later, we can replace false w/ dynamically-computed default value if needed.

Well I'm not 100% sure of anything ;)

But I tested in in FRR 7.2 where "unconfigured" means admin up - for any case where the "shutdown" command isn't seen, Batfish's behavior will continue as-is. All this code does is shutdown interfaces that are configured as "shutdown" in Zebra. I tested no shutdown and all it does is remove the "shutdown" command (essentially brings it back to default)

I was gonna make it a primitive but then I can't annotate it with @nonnull. Figured it'd be useful for IDE inspection but on second thought, it'll probably catch the null anyway. I'll go ahead and fix that.

Copy link
Contributor

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

@progwriter progwriter merged commit f69d5c9 into batfish:master Sep 3, 2020
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