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 OSPF to BGP Redistribution Route-Map Support #6052
Conversation
There was a problem hiding this 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.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @kylehoferamzn)
projects/batfish/src/main/antlr4/org/batfish/grammar/cumulus_frr/CumulusFrr_bgp.g4, line 87 at r1 (raw file):
redist_type = (STATIC | CONNECTED | OSPF)
Please pull out into a helper rule and use both places
projects/batfish/src/main/java/org/batfish/grammar/cumulus_frr/CumulusFrrConfigurationBuilder.java, line 387 at r1 (raw file):
String redistType
Do not use string as type, write a helper function to return a CumulusRoutingProtocol
given the newly created rule context as input.
projects/batfish/src/main/java/org/batfish/grammar/cumulus_frr/CumulusFrrConfigurationBuilder.java, line 411 at r1 (raw file):
BgpRedistributionPolicy oldRedistributionPolicy; if (_currentBgpVrf.getIpv4Unicast() == null) {
here would be the perfect place to getOrCreate
an ipv4unicast family and just put the redistribution policy there.
isn't that the same as behavior of the box?
There was a problem hiding this 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, 3 unresolved discussions (waiting on @kylehoferamzn and @progwriter)
projects/batfish/src/main/java/org/batfish/grammar/cumulus_frr/CumulusFrrConfigurationBuilder.java, line 411 at r1 (raw file):
Previously, progwriter (Victor Heorhiadi) wrote…
here would be the perfect place to
getOrCreate
an ipv4unicast family and just put the redistribution policy there.
isn't that the same as behavior of the box?
So I had one concern here, maybe it's invalid - but that I could end up creating a duplicate ipv4uaf vrf if ordering. Maybe it's not as big of a problem as I think?
REF:
Line 358 in de23e1b
_w.addWarning(ctx, ctx.getText(), _parser, "duplicate 'address-family ipv4 unicast'"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 7 of 12 files reviewed, 3 unresolved discussions (waiting on @progwriter)
projects/batfish/src/main/antlr4/org/batfish/grammar/cumulus_frr/CumulusFrr_bgp.g4, line 87 at r1 (raw file):
Previously, progwriter (Victor Heorhiadi) wrote…
redist_type = (STATIC | CONNECTED | OSPF)
Please pull out into a helper rule and use both places
I think I got this in a fairly generic way where it will work for BGP -> OSPF as well, take a gander.
projects/batfish/src/main/java/org/batfish/grammar/cumulus_frr/CumulusFrrConfigurationBuilder.java, line 387 at r1 (raw file):
Previously, progwriter (Victor Heorhiadi) wrote…
String redistType
Do not use string as type, write a helper function to return a
CumulusRoutingProtocol
given the newly created rule context as input.
I'm not sure if I got this quite the way you wanted, I couldn't quite figure out how to pass a generic context that also had the specific context pieces I needed - I'll change it around if you have an example?
projects/batfish/src/main/java/org/batfish/grammar/cumulus_frr/CumulusFrrConfigurationBuilder.java, line 411 at r1 (raw file):
Previously, kylehoferamzn wrote…
So I had one concern here, maybe it's invalid - but that I could end up creating a duplicate ipv4uaf vrf if ordering. Maybe it's not as big of a problem as I think?
REF:
Line 358 in de23e1b
_w.addWarning(ctx, ctx.getText(), _parser, "duplicate 'address-family ipv4 unicast'");
Went ahead and implemented as you requested regardless of my above concern, my concern doesn't seem like a huge deal by my reading of the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 6 of 6 files at r2.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @kylehoferamzn)
projects/batfish/src/main/java/org/batfish/grammar/cumulus_frr/CumulusFrrConfigurationBuilder.java, line 387 at r1 (raw file):
Previously, kylehoferamzn wrote…
I'm not sure if I got this quite the way you wanted, I couldn't quite figure out how to pass a generic context that also had the specific context pieces I needed - I'll change it around if you have an example?
almost there. instead passing in bgp_redist_type().getText()
and using valueOf
you can just pass in cxt.bgp_redist_type()
and use the if-else to check if ctx.CONNECTED() != null
or ctx.OSPF() != null
and so on.
projects/batfish/src/main/java/org/batfish/representation/cumulus/CumulusRoutingProtocol.java, line 20 at r2 (raw file):
public static final Map<CumulusRoutingProtocol, Set<RoutingProtocol>> VI_PROTOCOLS_MAP = ImmutableMap.of( BGP, ImmutableSet.of(RoutingProtocol.BGP),
bgp in VI means only ebgp. what are the semantics for FRR? both bgp/ibgp or just ebgp?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 9 of 12 files reviewed, 2 unresolved discussions (waiting on @progwriter)
projects/batfish/src/main/java/org/batfish/grammar/cumulus_frr/CumulusFrrConfigurationBuilder.java, line 387 at r1 (raw file):
Previously, progwriter (Victor Heorhiadi) wrote…
almost there. instead passing in
bgp_redist_type().getText()
and usingvalueOf
you can just pass incxt.bgp_redist_type()
and use the if-else to check ifctx.CONNECTED() != null
orctx.OSPF() != null
and so on.
Check out the new structure, I think I've gotten this the way you wanted.
One issue lingers - CumulusRoutingProtocol vs RoutingProtocol - we still need to make this conversion at some point in order to please downstream methods but I dealt with it through a valueOf lookup for now.
projects/batfish/src/main/java/org/batfish/representation/cumulus/CumulusRoutingProtocol.java, line 20 at r2 (raw file):
Previously, progwriter (Victor Heorhiadi) wrote…
bgp in VI means only ebgp. what are the semantics for FRR? both bgp/ibgp or just ebgp?
Both - bgp just means bgp generically (ala Cisco). I've added iBGP here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 3 files at r3.
Reviewable status: 11 of 12 files reviewed, 1 unresolved discussion (waiting on @kylehoferamzn and @progwriter)
projects/batfish/src/main/java/org/batfish/grammar/cumulus_frr/CumulusFrrConfigurationBuilder.java, line 387 at r1 (raw file):
Previously, kylehoferamzn wrote…
Check out the new structure, I think I've gotten this the way you wanted.
One issue lingers - CumulusRoutingProtocol vs RoutingProtocol - we still need to make this conversion at some point in order to please downstream methods but I dealt with it through a valueOf lookup for now.
why RoutingProtocol srcProtocol
instead of CumulusRoutingProtocol srcProtocol
? I'm missing where the VI version is used.
It should (I say optimistically) be only used during conversion, and you've already got VI_PROTOCOLS_MAP
for that.
There was a problem hiding this 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 12 files reviewed, 1 unresolved discussion (waiting on @progwriter)
projects/batfish/src/main/java/org/batfish/grammar/cumulus_frr/CumulusFrrConfigurationBuilder.java, line 387 at r1 (raw file):
Previously, progwriter (Victor Heorhiadi) wrote…
why
RoutingProtocol srcProtocol
instead ofCumulusRoutingProtocol srcProtocol
? I'm missing where the VI version is used.
It should (I say optimistically) be only used during conversion, and you've already gotVI_PROTOCOLS_MAP
for that.
Because BgpRedistributionPolicy takes CumulusRoutingProtocol. It's a good catch - this seems to be different compared to other VS implementations. Basically we were converting to CRP just to convert back to RP later - not converting at this point should be more efficient. I'll unwind this code and see if I can get it working this more straightforward way.
There was a problem hiding this 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 12 files reviewed, 1 unresolved discussion (waiting on @progwriter)
projects/batfish/src/main/java/org/batfish/grammar/cumulus_frr/CumulusFrrConfigurationBuilder.java, line 387 at r1 (raw file):
Previously, kylehoferamzn wrote…
Because BgpRedistributionPolicy takes CumulusRoutingProtocol. It's a good catch - this seems to be different compared to other VS implementations. Basically we were converting to CRP just to convert back to RP later - not converting at this point should be more efficient. I'll unwind this code and see if I can get it working this more straightforward way.
Okay disregard above, using CRP instead of RP makes the most sense here - did that.
There was a problem hiding this 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 r4.
Reviewable status: complete! all files reviewed, all discussions resolved
2f003d8
to
131e2b8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 6 of 6 files at r5.
Reviewable status: complete! all files reviewed, all discussions resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 3 of 3 files at r6.
Reviewable status: complete! all files reviewed, all discussions resolved
Codecov Report
@@ Coverage Diff @@
## master #6052 +/- ##
============================================
+ Coverage 72.69% 72.76% +0.07%
- Complexity 34630 34705 +75
============================================
Files 2815 2816 +1
Lines 141275 141626 +351
Branches 16965 16985 +20
============================================
+ Hits 102697 103054 +357
+ Misses 30418 30407 -11
- Partials 8160 8165 +5 |
No description provided.