@Test public void testEquals() { Builder builder = BgpSessionProperties.builder(); long headAs = 1; long tailAs = 3; Ip headIp = Ip.parse("1.1.1.1"); Ip tailIp = Ip.parse("2.2.2.2"); BgpSessionProperties bsp = builder.setTailAs(tailAs).setHeadAs(headAs).setTailIp(tailIp).setHeadIp(headIp).build(); new EqualsTester() .addEqualityGroup(bsp, bsp, builder.build()) .addEqualityGroup( builder .setRouteExchangeSettings( ImmutableMap.of(Type.IPV4_UNICAST, new RouteExchange(true, false, true))) .build()) .addEqualityGroup(builder.setAddressFamilies(ImmutableSet.of(Type.IPV4_UNICAST)).build()) .addEqualityGroup(builder.setHeadAs(headAs + 1).build()) .addEqualityGroup(builder.setTailAs(tailAs + 1).build()) .addEqualityGroup(builder.setHeadIp(tailIp).build()) .addEqualityGroup(builder.setTailIp(headIp).build()) .addEqualityGroup(builder.setSessionType(SessionType.EBGP_SINGLEHOP)) .addEqualityGroup(new Object()) .testEquals(); }
@Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } if (!(o instanceof BgpSessionProperties)) { return false; } BgpSessionProperties that = (BgpSessionProperties) o; return _headAs == that._headAs && _tailAs == that._tailAs && _headIp.equals(that._headIp) && _tailIp.equals(that._tailIp) && _sessionType == that._sessionType && _routeExchangeSettings.equals(that._routeExchangeSettings) && _addressFamilies.equals(that._addressFamilies) && _confedSessionType == that._confedSessionType; }
BgpSessionProperties { @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } if (!(o instanceof BgpSessionProperties)) { return false; } BgpSessionProperties that = (BgpSessionProperties) o; return _headAs == that._headAs && _tailAs == that._tailAs && _headIp.equals(that._headIp) && _tailIp.equals(that._tailIp) && _sessionType == that._sessionType && _routeExchangeSettings.equals(that._routeExchangeSettings) && _addressFamilies.equals(that._addressFamilies) && _confedSessionType == that._confedSessionType; } }
BgpSessionProperties { @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } if (!(o instanceof BgpSessionProperties)) { return false; } BgpSessionProperties that = (BgpSessionProperties) o; return _headAs == that._headAs && _tailAs == that._tailAs && _headIp.equals(that._headIp) && _tailIp.equals(that._tailIp) && _sessionType == that._sessionType && _routeExchangeSettings.equals(that._routeExchangeSettings) && _addressFamilies.equals(that._addressFamilies) && _confedSessionType == that._confedSessionType; } private  BgpSessionProperties(
      Collection<Type> addressFamilies,
      Map<Type, RouteExchange> routeExchangeSettings,
      long tailAs,
      long headAs,
      Ip tailIp,
      Ip headIp,
      SessionType sessionType,
      ConfedSessionType confedType); }
BgpSessionProperties { @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } if (!(o instanceof BgpSessionProperties)) { return false; } BgpSessionProperties that = (BgpSessionProperties) o; return _headAs == that._headAs && _tailAs == that._tailAs && _headIp.equals(that._headIp) && _tailIp.equals(that._tailIp) && _sessionType == that._sessionType && _routeExchangeSettings.equals(that._routeExchangeSettings) && _addressFamilies.equals(that._addressFamilies) && _confedSessionType == that._confedSessionType; } private  BgpSessionProperties(
      Collection<Type> addressFamilies,
      Map<Type, RouteExchange> routeExchangeSettings,
      long tailAs,
      long headAs,
      Ip tailIp,
      Ip headIp,
      SessionType sessionType,
      ConfedSessionType confedType); static @Nonnull Builder builder(); @JsonIgnore boolean getAdvertiseExternal(); @JsonIgnore boolean getAdvertiseInactive(); @JsonIgnore boolean getAdditionalPaths(); @JsonIgnore boolean isEbgp(); @JsonProperty(PROP_TAIL_AS) long getTailAs(); @JsonProperty(PROP_HEAD_AS) long getHeadAs(); @JsonProperty(PROP_TAIL_IP) @Nonnull Ip getTailIp(); @JsonProperty(PROP_HEAD_IP) @Nonnull Ip getHeadIp(); @JsonProperty(PROP_SESSION_TYPE) SessionType getSessionType(); @JsonProperty(PROP_CONFEDERATION_TYPE) @Nonnull ConfedSessionType getConfedSessionType(); boolean advertiseUnchangedMed(); boolean advertiseUnchangedLocalPref(); @Nonnull @JsonProperty(PROP_ADDRESS_FAMILIES) Set<Type> getAddressFamilies(); @JsonProperty(PROP_ROUTE_EXCHANGE) @Nonnull Map<Type, RouteExchange> getRouteExchangeSettings(); static BgpSessionProperties from(
      BgpPeerConfig initiator,
      BgpPeerConfig listener,
      boolean reverseDirection,
      long initiatorLocalAs,
      long listenerLocalAs,
      ConfedSessionType confedSessionType); @VisibleForTesting static BgpSessionProperties from(
      BgpPeerConfig initiator, BgpPeerConfig listener, boolean reverseDirection); static @Nonnull SessionType getSessionType(BgpPeerConfig initiator); @Override boolean equals(@Nullable Object o); @Override int hashCode(); @Override String toString(); }
BgpSessionProperties { @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } if (!(o instanceof BgpSessionProperties)) { return false; } BgpSessionProperties that = (BgpSessionProperties) o; return _headAs == that._headAs && _tailAs == that._tailAs && _headIp.equals(that._headIp) && _tailIp.equals(that._tailIp) && _sessionType == that._sessionType && _routeExchangeSettings.equals(that._routeExchangeSettings) && _addressFamilies.equals(that._addressFamilies) && _confedSessionType == that._confedSessionType; } private  BgpSessionProperties(
      Collection<Type> addressFamilies,
      Map<Type, RouteExchange> routeExchangeSettings,
      long tailAs,
      long headAs,
      Ip tailIp,
      Ip headIp,
      SessionType sessionType,
      ConfedSessionType confedType); static @Nonnull Builder builder(); @JsonIgnore boolean getAdvertiseExternal(); @JsonIgnore boolean getAdvertiseInactive(); @JsonIgnore boolean getAdditionalPaths(); @JsonIgnore boolean isEbgp(); @JsonProperty(PROP_TAIL_AS) long getTailAs(); @JsonProperty(PROP_HEAD_AS) long getHeadAs(); @JsonProperty(PROP_TAIL_IP) @Nonnull Ip getTailIp(); @JsonProperty(PROP_HEAD_IP) @Nonnull Ip getHeadIp(); @JsonProperty(PROP_SESSION_TYPE) SessionType getSessionType(); @JsonProperty(PROP_CONFEDERATION_TYPE) @Nonnull ConfedSessionType getConfedSessionType(); boolean advertiseUnchangedMed(); boolean advertiseUnchangedLocalPref(); @Nonnull @JsonProperty(PROP_ADDRESS_FAMILIES) Set<Type> getAddressFamilies(); @JsonProperty(PROP_ROUTE_EXCHANGE) @Nonnull Map<Type, RouteExchange> getRouteExchangeSettings(); static BgpSessionProperties from(
      BgpPeerConfig initiator,
      BgpPeerConfig listener,
      boolean reverseDirection,
      long initiatorLocalAs,
      long listenerLocalAs,
      ConfedSessionType confedSessionType); @VisibleForTesting static BgpSessionProperties from(
      BgpPeerConfig initiator, BgpPeerConfig listener, boolean reverseDirection); static @Nonnull SessionType getSessionType(BgpPeerConfig initiator); @Override boolean equals(@Nullable Object o); @Override int hashCode(); @Override String toString();  }