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

PAN: loopback routes are local #6677

Merged
merged 1 commit into from
Mar 3, 2021
Merged

Conversation

dhalperi
Copy link
Member

@dhalperi dhalperi commented Mar 2, 2021

Requires changes to ConnectedRouteMetadata as well.

@batfish-bot
Copy link

This change is Reviewable

Requires changes to ConnectedRouteMetadata as well.
@codecov
Copy link

codecov bot commented Mar 2, 2021

Codecov Report

Merging #6677 (0f1bf12) into master (62d7db0) will decrease coverage by 0.00%.
The diff coverage is 95.45%.

@@             Coverage Diff              @@
##             master    #6677      +/-   ##
============================================
- Coverage     73.54%   73.54%   -0.01%     
- Complexity    36686    36697      +11     
============================================
  Files          2934     2934              
  Lines        147569   147633      +64     
  Branches      17788    17797       +9     
============================================
+ Hits         108531   108573      +42     
- Misses        30502    30514      +12     
- Partials       8536     8546      +10     
Impacted Files Coverage Δ Complexity Δ
.../org/batfish/datamodel/ConnectedRouteMetadata.java 82.60% <83.33%> (-1.61%) 16.00 <5.00> (+2.00) ⬇️
...java/org/batfish/dataplane/ibdp/VirtualRouter.java 90.40% <100.00%> (-0.24%) 210.00 <8.00> (+3.00) ⬇️
...resentation/cisco_nxos/CiscoNxosConfiguration.java 87.24% <100.00%> (ø) 390.00 <0.00> (ø)
...tion/cumulus/CumulusConcatenatedConfiguration.java 70.43% <100.00%> (ø) 81.00 <0.00> (ø)
...epresentation/palo_alto/PaloAltoConfiguration.java 89.45% <100.00%> (+0.12%) 428.00 <6.00> (+5.00)
.../org/batfish/dataplane/rib/RouteAdvertisement.java 83.67% <0.00%> (-4.09%) 18.00% <0.00%> (-1.00%)
...n/java/org/batfish/vendor/VendorConfiguration.java 94.36% <0.00%> (-2.89%) 58.00% <0.00%> (+8.00%) ⬇️
...org/batfish/datamodel/flow/BidirectionalTrace.java 81.81% <0.00%> (-2.28%) 14.00% <0.00%> (-1.00%)
...col/src/main/java/org/batfish/role/InferRoles.java 89.54% <0.00%> (-1.37%) 50.00% <0.00%> (-1.00%)
...src/main/java/org/batfish/coordinator/PoolMgr.java 59.52% <0.00%> (-1.20%) 15.00% <0.00%> (-1.00%)
... and 6 more

Copy link
Contributor

@corinaminer corinaminer left a comment

Choose a reason for hiding this comment

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

Reviewed 12 of 12 files at r1.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @dhalperi and @sfraint)


projects/batfish/src/main/java/org/batfish/representation/palo_alto/PaloAltoConfiguration.java, line 2003 at r1 (raw file):

      if (iface.getType() == Interface.Type.LOOPBACK) {
        // On PAN, loopback addresses are not connected routes, they are only local routes.

Are there no /32s on non-loopback interfaces? or are /32s on loopback interfaces the only ones that count as "loopback addresses"?

more fundamentally: do we need to make customized ConnectedRouteMetadata for /32s on non-loopback interfaces?


projects/batfish/src/main/java/org/batfish/representation/palo_alto/PaloAltoConfiguration.java, line 2005 at r1 (raw file):

We have already filtered down to valid addresses, all of which are /32

We didn't actually confirm they're all /32. Should the allValidAddresses stream above have another filter to limit loopback interface addresses to /32s? or is there something earlier in the pipeline that would block any other addresses from being attributed to a loopback iface?


projects/batfish/src/main/java/org/batfish/representation/palo_alto/PaloAltoConfiguration.java, line 2010 at r1 (raw file):

                .collect(
                    ImmutableMap.toImmutableMap(
                        a -> a,

nit: could replace with Function.identity()


projects/batfish-common-protocol/src/test/java/org/batfish/datamodel/ConnectedRouteMetadataTest.java, line 25 at r1 (raw file):

        .addEqualityGroup(builder.setTag(1).build())
        .addEqualityGroup(builder.setGenerateLocalRoutes(true).build())
        .addEqualityGroup(builder.setAdmin(1).setGenerateLocalRoutes(true))

👀

Copy link
Member Author

@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, 2 unresolved discussions (waiting on @corinaminer, @dhalperi, and @sfraint)


projects/batfish/src/main/java/org/batfish/representation/palo_alto/PaloAltoConfiguration.java, line 2005 at r1 (raw file):

Previously, corinaminer (Corina Miner) wrote…

We have already filtered down to valid addresses, all of which are /32

We didn't actually confirm they're all /32. Should the allValidAddresses stream above have another filter to limit loopback interface addresses to /32s? or is there something earlier in the pipeline that would block any other addresses from being attributed to a loopback iface?

I don't think you understood the code? Can you take another look and suggest clarifications?

The filtering only applies to loopback interfaces, and only lets /32 through in that case only.

We did confirm they're all /32, and we only want to handle loopback interfaces, and we don't need connected route metadata for other interfaces.


projects/batfish/src/main/java/org/batfish/representation/palo_alto/PaloAltoConfiguration.java, line 2010 at r1 (raw file):

Previously, corinaminer (Corina Miner) wrote…

nit: could replace with Function.identity()

Following the Java style recommendations here: this is shorter than function identity

@dhalperi
Copy link
Member Author

dhalperi commented Mar 3, 2021


projects/batfish-common-protocol/src/test/java/org/batfish/datamodel/ConnectedRouteMetadataTest.java, line 25 at r1 (raw file):

Previously, corinaminer (Corina Miner) wrote…

👀

Not sure what this means. But the old tests were confusing and complicated; since the builder keeps state we just need to change each property once and we've covered all the bases: for each property we have a pair that only differ in that.

Additionally I went ahead and made sure that null and false are different, mainly because of paranoia

Copy link
Contributor

@corinaminer corinaminer 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 (waiting on @sfraint)


projects/batfish/src/main/java/org/batfish/representation/palo_alto/PaloAltoConfiguration.java, line 2003 at r1 (raw file):
on your other comment you said:

we don't need connected route metadata for other interfaces

so i assume this question has been considered. Still not personally clear on whether other interfaces have /32s, but nonblocking


projects/batfish/src/main/java/org/batfish/representation/palo_alto/PaloAltoConfiguration.java, line 2005 at r1 (raw file):

Previously, dhalperi (Dan Halperin) wrote…

I don't think you understood the code? Can you take another look and suggest clarifications?

The filtering only applies to loopback interfaces, and only lets /32 through in that case only.

We did confirm they're all /32, and we only want to handle loopback interfaces, and we don't need connected route metadata for other interfaces.

Oh, yeah, never mind. Misread the filtering.


projects/batfish-common-protocol/src/test/java/org/batfish/datamodel/ConnectedRouteMetadataTest.java, line 25 at r1 (raw file):

Previously, dhalperi (Dan Halperin) wrote…

Not sure what this means. But the old tests were confusing and complicated; since the builder keeps state we just need to change each property once and we've covered all the bases: for each property we have a pair that only differ in that.

Additionally I went ahead and made sure that null and false are different, mainly because of paranoia

yeah i was just confused by the old version of the test

@dhalperi
Copy link
Member Author

dhalperi commented Mar 3, 2021


projects/batfish/src/main/java/org/batfish/representation/palo_alto/PaloAltoConfiguration.java, line 2005 at r1 (raw file):

Previously, corinaminer (Corina Miner) wrote…

Oh, yeah, never mind. Misread the filtering.

Thanks. If this code can be cleaner I'm happy to do it! This is complicated.

Appreciate the detailed review.

@dhalperi dhalperi merged commit 1e4083e into batfish:master Mar 3, 2021
@dhalperi dhalperi deleted the pan-local branch March 3, 2021 05:36
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