@Test public void testInitEvpnType3Route() { Ip ip = Ip.parse("1.1.1.1"); ExtendedCommunity routeTarget = ExtendedCommunity.target(1, 1); RouteDistinguisher routeDistinguisher = RouteDistinguisher.from(ip, 1); int admin = 20; EvpnType3Route route = initEvpnType3Route( admin, Layer2Vni.testBuilder() .setVlan(1) .setVni(10001) .setBumTransportMethod(BumTransportMethod.UNICAST_FLOOD_GROUP) .setSourceAddress(ip) .build(), routeTarget, routeDistinguisher, ip); assertThat( route, equalTo( EvpnType3Route.builder() .setAdmin(admin) .setRouteDistinguisher(routeDistinguisher) .setCommunities(ImmutableSet.of(routeTarget)) .setNonRouting(true) .setProtocol(RoutingProtocol.BGP) .setOriginType(OriginType.EGP) .setLocalPreference(BgpRoute.DEFAULT_LOCAL_PREFERENCE) .setVniIp(ip) .setOriginatorIp(ip) .build())); }
@Nonnull @VisibleForTesting static EvpnType3Route initEvpnType3Route( int ebgpAdmin, Layer2Vni vni, ExtendedCommunity routeTarget, RouteDistinguisher routeDistinguisher, Ip routerId) { checkArgument( vni.getSourceAddress() != null, "Cannot construct type 3 route for invalid VNI %s", vni.getVni()); EvpnType3Route.Builder type3RouteBuilder = EvpnType3Route.builder(); type3RouteBuilder.setAdmin(ebgpAdmin); type3RouteBuilder.setCommunities(ImmutableSet.of(routeTarget)); type3RouteBuilder.setLocalPreference(BgpRoute.DEFAULT_LOCAL_PREFERENCE); type3RouteBuilder.setNonRouting(true); type3RouteBuilder.setOriginatorIp(routerId); type3RouteBuilder.setOriginType(OriginType.EGP); type3RouteBuilder.setProtocol(RoutingProtocol.BGP); type3RouteBuilder.setRouteDistinguisher(routeDistinguisher); type3RouteBuilder.setVniIp(vni.getSourceAddress()); return type3RouteBuilder.build(); }
BgpRoutingProcess implements RoutingProcess<BgpTopology, BgpRoute<?, ?>> { @Nonnull @VisibleForTesting static EvpnType3Route initEvpnType3Route( int ebgpAdmin, Layer2Vni vni, ExtendedCommunity routeTarget, RouteDistinguisher routeDistinguisher, Ip routerId) { checkArgument( vni.getSourceAddress() != null, "Cannot construct type 3 route for invalid VNI %s", vni.getVni()); EvpnType3Route.Builder type3RouteBuilder = EvpnType3Route.builder(); type3RouteBuilder.setAdmin(ebgpAdmin); type3RouteBuilder.setCommunities(ImmutableSet.of(routeTarget)); type3RouteBuilder.setLocalPreference(BgpRoute.DEFAULT_LOCAL_PREFERENCE); type3RouteBuilder.setNonRouting(true); type3RouteBuilder.setOriginatorIp(routerId); type3RouteBuilder.setOriginType(OriginType.EGP); type3RouteBuilder.setProtocol(RoutingProtocol.BGP); type3RouteBuilder.setRouteDistinguisher(routeDistinguisher); type3RouteBuilder.setVniIp(vni.getSourceAddress()); return type3RouteBuilder.build(); } }
BgpRoutingProcess implements RoutingProcess<BgpTopology, BgpRoute<?, ?>> { @Nonnull @VisibleForTesting static EvpnType3Route initEvpnType3Route( int ebgpAdmin, Layer2Vni vni, ExtendedCommunity routeTarget, RouteDistinguisher routeDistinguisher, Ip routerId) { checkArgument( vni.getSourceAddress() != null, "Cannot construct type 3 route for invalid VNI %s", vni.getVni()); EvpnType3Route.Builder type3RouteBuilder = EvpnType3Route.builder(); type3RouteBuilder.setAdmin(ebgpAdmin); type3RouteBuilder.setCommunities(ImmutableSet.of(routeTarget)); type3RouteBuilder.setLocalPreference(BgpRoute.DEFAULT_LOCAL_PREFERENCE); type3RouteBuilder.setNonRouting(true); type3RouteBuilder.setOriginatorIp(routerId); type3RouteBuilder.setOriginType(OriginType.EGP); type3RouteBuilder.setProtocol(RoutingProtocol.BGP); type3RouteBuilder.setRouteDistinguisher(routeDistinguisher); type3RouteBuilder.setVniIp(vni.getSourceAddress()); return type3RouteBuilder.build(); } BgpRoutingProcess(
      BgpProcess process,
      Configuration configuration,
      String vrfName,
      Rib mainRib,
      BgpTopology topology,
      PrefixTracer prefixTracer); }
BgpRoutingProcess implements RoutingProcess<BgpTopology, BgpRoute<?, ?>> { @Nonnull @VisibleForTesting static EvpnType3Route initEvpnType3Route( int ebgpAdmin, Layer2Vni vni, ExtendedCommunity routeTarget, RouteDistinguisher routeDistinguisher, Ip routerId) { checkArgument( vni.getSourceAddress() != null, "Cannot construct type 3 route for invalid VNI %s", vni.getVni()); EvpnType3Route.Builder type3RouteBuilder = EvpnType3Route.builder(); type3RouteBuilder.setAdmin(ebgpAdmin); type3RouteBuilder.setCommunities(ImmutableSet.of(routeTarget)); type3RouteBuilder.setLocalPreference(BgpRoute.DEFAULT_LOCAL_PREFERENCE); type3RouteBuilder.setNonRouting(true); type3RouteBuilder.setOriginatorIp(routerId); type3RouteBuilder.setOriginType(OriginType.EGP); type3RouteBuilder.setProtocol(RoutingProtocol.BGP); type3RouteBuilder.setRouteDistinguisher(routeDistinguisher); type3RouteBuilder.setVniIp(vni.getSourceAddress()); return type3RouteBuilder.build(); } BgpRoutingProcess(
      BgpProcess process,
      Configuration configuration,
      String vrfName,
      Rib mainRib,
      BgpTopology topology,
      PrefixTracer prefixTracer); @Override void initialize(Node n); boolean isInitialized(); @Override void updateTopology(BgpTopology topology); @Override void executeIteration(Map<String, Node> allNodes); @Nonnull @Override RibDelta<BgpRoute<?, ?>> getUpdatesForMainRib(); @Override void redistribute(RibDelta<? extends AnnotatedRoute<AbstractRoute>> mainRibDelta); void redistribute(
      RibDelta<? extends AnnotatedRoute<AbstractRoute>> mainRibDelta, String srcVrfName); @Override boolean isDirty(); void endOfRound(); @Nonnull Ip getRouterId(); Set<EvpnType3Route> getEvpnType3Routes(); Set<Bgpv4Route> getV4Routes(); Set<Bgpv4Route> getBestPathRoutes(); }
BgpRoutingProcess implements RoutingProcess<BgpTopology, BgpRoute<?, ?>> { @Nonnull @VisibleForTesting static EvpnType3Route initEvpnType3Route( int ebgpAdmin, Layer2Vni vni, ExtendedCommunity routeTarget, RouteDistinguisher routeDistinguisher, Ip routerId) { checkArgument( vni.getSourceAddress() != null, "Cannot construct type 3 route for invalid VNI %s", vni.getVni()); EvpnType3Route.Builder type3RouteBuilder = EvpnType3Route.builder(); type3RouteBuilder.setAdmin(ebgpAdmin); type3RouteBuilder.setCommunities(ImmutableSet.of(routeTarget)); type3RouteBuilder.setLocalPreference(BgpRoute.DEFAULT_LOCAL_PREFERENCE); type3RouteBuilder.setNonRouting(true); type3RouteBuilder.setOriginatorIp(routerId); type3RouteBuilder.setOriginType(OriginType.EGP); type3RouteBuilder.setProtocol(RoutingProtocol.BGP); type3RouteBuilder.setRouteDistinguisher(routeDistinguisher); type3RouteBuilder.setVniIp(vni.getSourceAddress()); return type3RouteBuilder.build(); } BgpRoutingProcess(
      BgpProcess process,
      Configuration configuration,
      String vrfName,
      Rib mainRib,
      BgpTopology topology,
      PrefixTracer prefixTracer); @Override void initialize(Node n); boolean isInitialized(); @Override void updateTopology(BgpTopology topology); @Override void executeIteration(Map<String, Node> allNodes); @Nonnull @Override RibDelta<BgpRoute<?, ?>> getUpdatesForMainRib(); @Override void redistribute(RibDelta<? extends AnnotatedRoute<AbstractRoute>> mainRibDelta); void redistribute(
      RibDelta<? extends AnnotatedRoute<AbstractRoute>> mainRibDelta, String srcVrfName); @Override boolean isDirty(); void endOfRound(); @Nonnull Ip getRouterId(); Set<EvpnType3Route> getEvpnType3Routes(); Set<Bgpv4Route> getV4Routes(); Set<Bgpv4Route> getBestPathRoutes();  }