@Test public void testRejectNextHopUnreachable() { Rib mainRib = new Rib(); Bgpv4Rib bgpRib = new Bgpv4Rib(mainRib, BgpTieBreaker.ARRIVAL_ORDER, 1, null, false, false); Bgpv4Route route = _rb.setProtocol(RoutingProtocol.IBGP) .setClusterList(ImmutableSet.of()) .setOriginatorIp(Ip.ZERO) .setNextHopIp(Ip.parse("1.1.1.1")) .build(); assertTrue(bgpRib.mergeRouteGetDelta(route).isEmpty()); mainRib.mergeRoute( new AnnotatedRoute<>(new ConnectedRoute(Prefix.parse("1.1.1.0/24"), "eth0"), "vrf")); assertThat(bgpRib.mergeRouteGetDelta(route).getRoutes(), contains(route)); }
@Nonnull @Override public RibDelta<Bgpv4Route> mergeRouteGetDelta(Bgpv4Route route) { Ip nextHopIp = route.getNextHopIp(); if (Route.UNSET_NEXT_HOP_INTERFACE.equals(route.getNextHopInterface()) && !nextHopIp.equals(Ip.AUTO) && route.getProtocol() != RoutingProtocol.AGGREGATE && _mainRib != null && _mainRib.longestPrefixMatch(nextHopIp).isEmpty()) { return RibDelta.empty(); } return super.mergeRouteGetDelta(route); }
Bgpv4Rib extends BgpRib<Bgpv4Route> { @Nonnull @Override public RibDelta<Bgpv4Route> mergeRouteGetDelta(Bgpv4Route route) { Ip nextHopIp = route.getNextHopIp(); if (Route.UNSET_NEXT_HOP_INTERFACE.equals(route.getNextHopInterface()) && !nextHopIp.equals(Ip.AUTO) && route.getProtocol() != RoutingProtocol.AGGREGATE && _mainRib != null && _mainRib.longestPrefixMatch(nextHopIp).isEmpty()) { return RibDelta.empty(); } return super.mergeRouteGetDelta(route); } }
Bgpv4Rib extends BgpRib<Bgpv4Route> { @Nonnull @Override public RibDelta<Bgpv4Route> mergeRouteGetDelta(Bgpv4Route route) { Ip nextHopIp = route.getNextHopIp(); if (Route.UNSET_NEXT_HOP_INTERFACE.equals(route.getNextHopInterface()) && !nextHopIp.equals(Ip.AUTO) && route.getProtocol() != RoutingProtocol.AGGREGATE && _mainRib != null && _mainRib.longestPrefixMatch(nextHopIp).isEmpty()) { return RibDelta.empty(); } return super.mergeRouteGetDelta(route); } Bgpv4Rib(
      @Nullable GenericRibReadOnly<AnnotatedRoute<AbstractRoute>> mainRib,
      BgpTieBreaker tieBreaker,
      @Nullable Integer maxPaths,
      @Nullable MultipathEquivalentAsPathMatchMode multipathEquivalentAsPathMatchMode,
      boolean withBackups,
      boolean clusterListAsIgpCost); }
Bgpv4Rib extends BgpRib<Bgpv4Route> { @Nonnull @Override public RibDelta<Bgpv4Route> mergeRouteGetDelta(Bgpv4Route route) { Ip nextHopIp = route.getNextHopIp(); if (Route.UNSET_NEXT_HOP_INTERFACE.equals(route.getNextHopInterface()) && !nextHopIp.equals(Ip.AUTO) && route.getProtocol() != RoutingProtocol.AGGREGATE && _mainRib != null && _mainRib.longestPrefixMatch(nextHopIp).isEmpty()) { return RibDelta.empty(); } return super.mergeRouteGetDelta(route); } Bgpv4Rib(
      @Nullable GenericRibReadOnly<AnnotatedRoute<AbstractRoute>> mainRib,
      BgpTieBreaker tieBreaker,
      @Nullable Integer maxPaths,
      @Nullable MultipathEquivalentAsPathMatchMode multipathEquivalentAsPathMatchMode,
      boolean withBackups,
      boolean clusterListAsIgpCost); @Nonnull @Override RibDelta<Bgpv4Route> mergeRouteGetDelta(Bgpv4Route route); }
Bgpv4Rib extends BgpRib<Bgpv4Route> { @Nonnull @Override public RibDelta<Bgpv4Route> mergeRouteGetDelta(Bgpv4Route route) { Ip nextHopIp = route.getNextHopIp(); if (Route.UNSET_NEXT_HOP_INTERFACE.equals(route.getNextHopInterface()) && !nextHopIp.equals(Ip.AUTO) && route.getProtocol() != RoutingProtocol.AGGREGATE && _mainRib != null && _mainRib.longestPrefixMatch(nextHopIp).isEmpty()) { return RibDelta.empty(); } return super.mergeRouteGetDelta(route); } Bgpv4Rib(
      @Nullable GenericRibReadOnly<AnnotatedRoute<AbstractRoute>> mainRib,
      BgpTieBreaker tieBreaker,
      @Nullable Integer maxPaths,
      @Nullable MultipathEquivalentAsPathMatchMode multipathEquivalentAsPathMatchMode,
      boolean withBackups,
      boolean clusterListAsIgpCost); @Nonnull @Override RibDelta<Bgpv4Route> mergeRouteGetDelta(Bgpv4Route route);  }