-
Notifications
You must be signed in to change notification settings - Fork 229
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
OSPF distribute-list data-plane change #3667
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3667 +/- ##
============================================
+ Coverage 73.78% 73.81% +0.02%
- Complexity 24801 24830 +29
============================================
Files 2115 2118 +3
Lines 101926 101662 -264
Branches 12064 12010 -54
============================================
- Hits 75210 75039 -171
+ Misses 21348 21263 -85
+ Partials 5368 5360 -8
|
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 1 of 2 files at r2.
Reviewable status: 1 of 6 files reviewed, 6 unresolved discussions (waiting on @haverma and @progwriter)
projects/batfish/src/main/java/org/batfish/dataplane/ibdp/OspfRoutingProcess.java, line 267 at r2 (raw file):
@VisibleForTesting static void applyDistributeList(
please javadoc
projects/batfish/src/main/java/org/batfish/dataplane/ibdp/OspfRoutingProcess.java, line 271 at r2 (raw file):
Interface iface = c.getAllInterfaces().get(ifaceName); assert iface != null; if (iface.getOspfInboundDistributeListPolicy() != null) {
flip to early exit?
projects/batfish/src/main/java/org/batfish/dataplane/ibdp/OspfRoutingProcess.java, line 275 at r2 (raw file):
c.getRoutingPolicies().get(iface.getOspfInboundDistributeListPolicy()); assert routingPolicy != null; routeBuilder.setNonRouting(
Explain this boolean logic in a comment.
projects/batfish/src/main/java/org/batfish/dataplane/ibdp/OspfRoutingProcess.java, line 468 at r2 (raw file):
_interAreaIncomingRoutes.forEach( (edgeId, queue) -> { String headIfaceName = edgeId.getHead().getInterfaceName();
I think it's fine to call these just 'ifaceName' (applies other places as well) It's clear that this is the local interface.
projects/batfish/src/main/java/org/batfish/dataplane/ibdp/OspfRoutingProcess.java, line 473 at r2 (raw file):
RouteAdvertisement<OspfInterAreaRoute> routeAdvertisement = queue.remove(); transformInterAreaRouteOnImport(routeAdvertisement, incrementalCost)
Make transformOnImport functions either apply the distribute list or return a builder. Why bother building/unbuilding multiple times? This will make the pattern consistent across the functions.
projects/batfish/src/test/java/org/batfish/dataplane/ibdp/OspfRoutingProcessTest.java, line 242 at r2 (raw file):
LineAction.DENY, PrefixRange.fromPrefix(Prefix.parse("1.1.1.0/24"))))); c.getRouteFilterLists().put(prefixList.getName(), prefixList); RoutingPolicy rp = new RoutingPolicy("policy", c);
nit: use builder for routing policy
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 4 of 6 files at r1, 1 of 2 files at r2.
Reviewable status: 5 of 6 files reviewed, 7 unresolved discussions (waiting on @haverma and @progwriter)
projects/batfish/src/test/resources/org/batfish/dataplane/ibdp/ospf-distribute-lists/configs/r1, line 20 at r3 (raw file):
ip route 192.168.15.0 255.255.255.0 172.22.1.5 ip route 192.168.16.0 255.255.255.0 172.22.1.5 ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0
why do you need this default route (and by extension the route map when redistributing static)?
Your test has no assertions on the default route, and it will be immediately blocked, right?
I could be misunderstanding the test setup.
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 1 of 1 files at r3.
Reviewable status: all files reviewed, 7 unresolved discussions (waiting on @haverma)
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: 4 of 6 files reviewed, 2 unresolved discussions (waiting on @haverma and @progwriter)
projects/batfish/src/main/java/org/batfish/dataplane/ibdp/OspfRoutingProcess.java, line 267 at r2 (raw file):
Previously, progwriter (Victor Heorhiadi) wrote…
please javadoc
done
projects/batfish/src/main/java/org/batfish/dataplane/ibdp/OspfRoutingProcess.java, line 271 at r2 (raw file):
Previously, progwriter (Victor Heorhiadi) wrote…
flip to early exit?
done
projects/batfish/src/main/java/org/batfish/dataplane/ibdp/OspfRoutingProcess.java, line 275 at r2 (raw file):
Previously, progwriter (Victor Heorhiadi) wrote…
Explain this boolean logic in a comment.
done
projects/batfish/src/main/java/org/batfish/dataplane/ibdp/OspfRoutingProcess.java, line 468 at r2 (raw file):
Previously, progwriter (Victor Heorhiadi) wrote…
I think it's fine to call these just 'ifaceName' (applies other places as well) It's clear that this is the local interface.
done
projects/batfish/src/main/java/org/batfish/dataplane/ibdp/OspfRoutingProcess.java, line 473 at r2 (raw file):
Previously, progwriter (Victor Heorhiadi) wrote…
Make transformOnImport functions either apply the distribute list or return a builder. Why bother building/unbuilding multiple times? This will make the pattern consistent across the functions.
that is right. Going with making transformOnImport
to return builders as they will need additional parameters if they apply the distribute lists as well (thus making testing a bit more cumbersome). Also I think passing the routes to them should be enough as they are only transforming the routes.
projects/batfish/src/test/java/org/batfish/dataplane/ibdp/OspfRoutingProcessTest.java, line 242 at r2 (raw file):
Previously, progwriter (Victor Heorhiadi) wrote…
nit: use builder for routing policy
done, thanks
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: 2 of 6 files reviewed, 2 unresolved discussions (waiting on @progwriter)
projects/batfish/src/test/resources/org/batfish/dataplane/ibdp/ospf-distribute-lists/configs/r1, line 20 at r3 (raw file):
Previously, progwriter (Victor Heorhiadi) wrote…
why do you need this default route (and by extension the route map when redistributing static)?
Your test has no assertions on the default route, and it will be immediately blocked, right?I could be misunderstanding the test setup.
The default route is needed to get the static routes to install. If I remove it, the two static routes don't install. I think it is because there is no way to reach the next hop IP of the static routes without the default route (this is consistent with GNS3-IOS behavior). I don't want to advertise the default route so I am not asserting on it. Added a comment in the configuration for the reason of default route.
Also the route-map is needed because I want to set the type to OSPF E1
when redistributing. Otherwise if I just use redistribute static
, by default it picks E2 (which is again consistent with GNS3-IOS)
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 4 of 4 files at r4.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @haverma)
projects/batfish/src/test/resources/org/batfish/dataplane/ibdp/ospf-distribute-lists/configs/r1, line 20 at r3 (raw file):
Previously, haverma (Harsh Verma) wrote…
The default route is needed to get the static routes to install. If I remove it, the two static routes don't install. I think it is because there is no way to reach the next hop IP of the static routes without the default route (this is consistent with GNS3-IOS behavior). I don't want to advertise the default route so I am not asserting on it. Added a comment in the configuration for the reason of default route.
Also the route-map is needed because I want to set the type to
OSPF E1
when redistributing. Otherwise if I just useredistribute static
, by default it picks E2 (which is again consistent with GNS3-IOS)
- Any reason not to make the static routes null-routed? So for example
ip route 192.168.16.0 255.255.255.0 Null0
? then they will be installed and redistributed. - You are not actually setting the type in the route map though,
redistribute static metric-type 1
is a valid command as far as I can tell
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: 4 of 6 files reviewed, all discussions resolved (waiting on @progwriter)
projects/batfish/src/test/resources/org/batfish/dataplane/ibdp/ospf-distribute-lists/configs/r1, line 20 at r3 (raw file):
Previously, progwriter (Victor Heorhiadi) wrote…
- Any reason not to make the static routes null-routed? So for example
ip route 192.168.16.0 255.255.255.0 Null0
? then they will be installed and redistributed.- You are not actually setting the type in the route map though,
redistribute static metric-type 1
is a valid command as far as I can tell
Thanks, that worked. done (1, 2)
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 1 of 2 files at r5, 2 of 2 files at r6.
Reviewable status: complete! all files reviewed, all discussions resolved
data-plane support for filtering of OSPF routes based on OSPF distribute list. More details here
distribute-list can be used to filter OSPF routes from getting installed in the main RIB.
The filtering can be done using prefix-list, route-maps or ACLs. Currently Batfish only supports prefix-list to be used in distribute-lists.
This PR applies filter on applicable OSPF routes going in the main RIB by declaring them as non-routing.