@Test public void testProcessIntraAreaAdvertisement() { RibDelta.Builder<OspfIntraAreaRoute> intraAreaDelta = RibDelta.builder(); RibDelta.Builder<OspfInterAreaRoute> interAreaDelta = RibDelta.builder(); _routingProcess.processIntraAreaAdvertisement( intraAreaDelta, interAreaDelta, ACTIVE_IFACE_NAME, 10, RouteAdvertisement.<OspfIntraAreaRoute>builder() .setRoute( OspfIntraAreaRoute.builder() .setArea(0) .setNetwork(Prefix.parse("1.1.1.1/29")) .setMetric(1) .build()) .build()); assertFalse(intraAreaDelta.isEmpty()); assertFalse(interAreaDelta.isEmpty()); }
@VisibleForTesting void processIntraAreaAdvertisement( RibDelta.Builder<OspfIntraAreaRoute> intraAreaDelta, RibDelta.Builder<OspfInterAreaRoute> interAreaDelta, String ifaceName, long incrementalCost, RouteAdvertisement<OspfIntraAreaRoute> routeAdvertisement) { OspfIntraAreaRoute.Builder ospfRouteBuilder = transformIntraAreaRouteOnImport(routeAdvertisement.getRoute(), incrementalCost); applyDistributeList(_c, _vrfName, ifaceName, ospfRouteBuilder); OspfIntraAreaRoute intraAreaRoute = ospfRouteBuilder.build(); intraAreaDelta.from( processRouteAdvertisement( routeAdvertisement.toBuilder().setRoute(intraAreaRoute).build(), _intraAreaRib)); if (isABR()) { OspfInterAreaRoute interAreaRoute = OspfInterAreaRoute.builder(intraAreaRoute).setNonRouting(true).build(); interAreaDelta.from( processRouteAdvertisement( RouteAdvertisement.<OspfInterAreaRoute>builder() .setReason(routeAdvertisement.getReason()) .setRoute(interAreaRoute) .build(), _interAreaRib)); } }
OspfRoutingProcess implements RoutingProcess<OspfTopology, OspfRoute> { @VisibleForTesting void processIntraAreaAdvertisement( RibDelta.Builder<OspfIntraAreaRoute> intraAreaDelta, RibDelta.Builder<OspfInterAreaRoute> interAreaDelta, String ifaceName, long incrementalCost, RouteAdvertisement<OspfIntraAreaRoute> routeAdvertisement) { OspfIntraAreaRoute.Builder ospfRouteBuilder = transformIntraAreaRouteOnImport(routeAdvertisement.getRoute(), incrementalCost); applyDistributeList(_c, _vrfName, ifaceName, ospfRouteBuilder); OspfIntraAreaRoute intraAreaRoute = ospfRouteBuilder.build(); intraAreaDelta.from( processRouteAdvertisement( routeAdvertisement.toBuilder().setRoute(intraAreaRoute).build(), _intraAreaRib)); if (isABR()) { OspfInterAreaRoute interAreaRoute = OspfInterAreaRoute.builder(intraAreaRoute).setNonRouting(true).build(); interAreaDelta.from( processRouteAdvertisement( RouteAdvertisement.<OspfInterAreaRoute>builder() .setReason(routeAdvertisement.getReason()) .setRoute(interAreaRoute) .build(), _interAreaRib)); } } }
OspfRoutingProcess implements RoutingProcess<OspfTopology, OspfRoute> { @VisibleForTesting void processIntraAreaAdvertisement( RibDelta.Builder<OspfIntraAreaRoute> intraAreaDelta, RibDelta.Builder<OspfInterAreaRoute> interAreaDelta, String ifaceName, long incrementalCost, RouteAdvertisement<OspfIntraAreaRoute> routeAdvertisement) { OspfIntraAreaRoute.Builder ospfRouteBuilder = transformIntraAreaRouteOnImport(routeAdvertisement.getRoute(), incrementalCost); applyDistributeList(_c, _vrfName, ifaceName, ospfRouteBuilder); OspfIntraAreaRoute intraAreaRoute = ospfRouteBuilder.build(); intraAreaDelta.from( processRouteAdvertisement( routeAdvertisement.toBuilder().setRoute(intraAreaRoute).build(), _intraAreaRib)); if (isABR()) { OspfInterAreaRoute interAreaRoute = OspfInterAreaRoute.builder(intraAreaRoute).setNonRouting(true).build(); interAreaDelta.from( processRouteAdvertisement( RouteAdvertisement.<OspfInterAreaRoute>builder() .setReason(routeAdvertisement.getReason()) .setRoute(interAreaRoute) .build(), _interAreaRib)); } } OspfRoutingProcess(
      OspfProcess process, String vrfName, Configuration configuration, OspfTopology topology); }
OspfRoutingProcess implements RoutingProcess<OspfTopology, OspfRoute> { @VisibleForTesting void processIntraAreaAdvertisement( RibDelta.Builder<OspfIntraAreaRoute> intraAreaDelta, RibDelta.Builder<OspfInterAreaRoute> interAreaDelta, String ifaceName, long incrementalCost, RouteAdvertisement<OspfIntraAreaRoute> routeAdvertisement) { OspfIntraAreaRoute.Builder ospfRouteBuilder = transformIntraAreaRouteOnImport(routeAdvertisement.getRoute(), incrementalCost); applyDistributeList(_c, _vrfName, ifaceName, ospfRouteBuilder); OspfIntraAreaRoute intraAreaRoute = ospfRouteBuilder.build(); intraAreaDelta.from( processRouteAdvertisement( routeAdvertisement.toBuilder().setRoute(intraAreaRoute).build(), _intraAreaRib)); if (isABR()) { OspfInterAreaRoute interAreaRoute = OspfInterAreaRoute.builder(intraAreaRoute).setNonRouting(true).build(); interAreaDelta.from( processRouteAdvertisement( RouteAdvertisement.<OspfInterAreaRoute>builder() .setReason(routeAdvertisement.getReason()) .setRoute(interAreaRoute) .build(), _interAreaRib)); } } OspfRoutingProcess(
      OspfProcess process, String vrfName, Configuration configuration, OspfTopology topology); @Override void initialize(Node n); @Override void executeIteration(Map<String, Node> allNodes); @Override void updateTopology(OspfTopology topology); @Nonnull @Override RibDelta<OspfRoute> getUpdatesForMainRib(); @Override void redistribute(RibDelta<? extends AnnotatedRoute<AbstractRoute>> mainRibDelta); @Override boolean isDirty(); }
OspfRoutingProcess implements RoutingProcess<OspfTopology, OspfRoute> { @VisibleForTesting void processIntraAreaAdvertisement( RibDelta.Builder<OspfIntraAreaRoute> intraAreaDelta, RibDelta.Builder<OspfInterAreaRoute> interAreaDelta, String ifaceName, long incrementalCost, RouteAdvertisement<OspfIntraAreaRoute> routeAdvertisement) { OspfIntraAreaRoute.Builder ospfRouteBuilder = transformIntraAreaRouteOnImport(routeAdvertisement.getRoute(), incrementalCost); applyDistributeList(_c, _vrfName, ifaceName, ospfRouteBuilder); OspfIntraAreaRoute intraAreaRoute = ospfRouteBuilder.build(); intraAreaDelta.from( processRouteAdvertisement( routeAdvertisement.toBuilder().setRoute(intraAreaRoute).build(), _intraAreaRib)); if (isABR()) { OspfInterAreaRoute interAreaRoute = OspfInterAreaRoute.builder(intraAreaRoute).setNonRouting(true).build(); interAreaDelta.from( processRouteAdvertisement( RouteAdvertisement.<OspfInterAreaRoute>builder() .setReason(routeAdvertisement.getReason()) .setRoute(interAreaRoute) .build(), _interAreaRib)); } } OspfRoutingProcess(
      OspfProcess process, String vrfName, Configuration configuration, OspfTopology topology); @Override void initialize(Node n); @Override void executeIteration(Map<String, Node> allNodes); @Override void updateTopology(OspfTopology topology); @Nonnull @Override RibDelta<OspfRoute> getUpdatesForMainRib(); @Override void redistribute(RibDelta<? extends AnnotatedRoute<AbstractRoute>> mainRibDelta); @Override boolean isDirty();  }