@Test public void testGetRouteTarget() { EvpnType2Route.Builder builder = EvpnType2Route.builder() .setIp(Ip.parse("1.1.1.1")) .setMacAddress(MacAddress.parse("00:11:22:33:44:55")) .setNetwork(Prefix.parse("1.1.1.0/24")) .setOriginatorIp(Ip.parse("1.1.1.1")) .setOriginType(OriginType.IGP) .setProtocol(RoutingProtocol.BGP) .setRouteDistinguisher(RouteDistinguisher.from(Ip.parse("1.1.1.1"), 2)); assertThat(builder.build().getRouteTargets(), empty()); assertThat( builder .setCommunities(ImmutableSet.of(StandardCommunity.of(1, 1))) .build() .getRouteTargets(), empty()); assertThat( builder .setCommunities(ImmutableSet.of(ExtendedCommunity.of(1, 1, 1))) .build() .getRouteTargets(), empty()); assertThat( builder .setCommunities(ImmutableSet.of(ExtendedCommunity.target(1, 1))) .build() .getRouteTargets(), equalTo(ImmutableSet.of(ExtendedCommunity.target(1, 1)))); assertThat( builder .setCommunities( ImmutableSet.of(ExtendedCommunity.target(1, 1), StandardCommunity.of(1, 1))) .build() .getRouteTargets(), equalTo(ImmutableSet.of(ExtendedCommunity.target(1, 1)))); assertThat( builder .setCommunities( ImmutableSet.of( ExtendedCommunity.target(1, 1), StandardCommunity.of(1, 1), ExtendedCommunity.target(2, 2))) .build() .getRouteTargets(), equalTo(ImmutableSet.of(ExtendedCommunity.target(1, 1), ExtendedCommunity.target(2, 2)))); }
@JsonIgnore public Set<ExtendedCommunity> getRouteTargets() { return _communities.getExtendedCommunities().stream() .filter(ExtendedCommunity::isRouteTarget) .collect(ImmutableSet.toImmutableSet()); }
EvpnRoute extends BgpRoute<B, R> { @JsonIgnore public Set<ExtendedCommunity> getRouteTargets() { return _communities.getExtendedCommunities().stream() .filter(ExtendedCommunity::isRouteTarget) .collect(ImmutableSet.toImmutableSet()); } }
EvpnRoute extends BgpRoute<B, R> { @JsonIgnore public Set<ExtendedCommunity> getRouteTargets() { return _communities.getExtendedCommunities().stream() .filter(ExtendedCommunity::isRouteTarget) .collect(ImmutableSet.toImmutableSet()); } protected  EvpnRoute(
      Prefix network,
      Ip nextHopIp,
      int admin,
      AsPath asPath,
      Set<Community> communities,
      boolean discard,
      long localPreference,
      long med,
      String nextHopInterface,
      Ip originatorIp,
      Set<Long> clusterList,
      boolean receivedFromRouteReflectorClient,
      OriginType originType,
      RoutingProtocol protocol,
      @Nullable Ip receivedFromIp,
      @Nullable RoutingProtocol srcProtocol,
      long tag,
      int weight,
      boolean nonForwarding,
      boolean nonRouting,
      RouteDistinguisher routeDistinguisher); }
EvpnRoute extends BgpRoute<B, R> { @JsonIgnore public Set<ExtendedCommunity> getRouteTargets() { return _communities.getExtendedCommunities().stream() .filter(ExtendedCommunity::isRouteTarget) .collect(ImmutableSet.toImmutableSet()); } protected  EvpnRoute(
      Prefix network,
      Ip nextHopIp,
      int admin,
      AsPath asPath,
      Set<Community> communities,
      boolean discard,
      long localPreference,
      long med,
      String nextHopInterface,
      Ip originatorIp,
      Set<Long> clusterList,
      boolean receivedFromRouteReflectorClient,
      OriginType originType,
      RoutingProtocol protocol,
      @Nullable Ip receivedFromIp,
      @Nullable RoutingProtocol srcProtocol,
      long tag,
      int weight,
      boolean nonForwarding,
      boolean nonRouting,
      RouteDistinguisher routeDistinguisher); @Nonnull @JsonProperty(PROP_ROUTE_DISTINGUISHER) RouteDistinguisher getRouteDistinguisher(); @JsonIgnore Set<ExtendedCommunity> getRouteTargets(); @Override abstract B toBuilder(); }
EvpnRoute extends BgpRoute<B, R> { @JsonIgnore public Set<ExtendedCommunity> getRouteTargets() { return _communities.getExtendedCommunities().stream() .filter(ExtendedCommunity::isRouteTarget) .collect(ImmutableSet.toImmutableSet()); } protected  EvpnRoute(
      Prefix network,
      Ip nextHopIp,
      int admin,
      AsPath asPath,
      Set<Community> communities,
      boolean discard,
      long localPreference,
      long med,
      String nextHopInterface,
      Ip originatorIp,
      Set<Long> clusterList,
      boolean receivedFromRouteReflectorClient,
      OriginType originType,
      RoutingProtocol protocol,
      @Nullable Ip receivedFromIp,
      @Nullable RoutingProtocol srcProtocol,
      long tag,
      int weight,
      boolean nonForwarding,
      boolean nonRouting,
      RouteDistinguisher routeDistinguisher); @Nonnull @JsonProperty(PROP_ROUTE_DISTINGUISHER) RouteDistinguisher getRouteDistinguisher(); @JsonIgnore Set<ExtendedCommunity> getRouteTargets(); @Override abstract B toBuilder();  }