@Override public boolean isEqualTo(final IpPrefix value) { return myValue.equals(value); } }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; HwVtep HwVtep = (HwVtep) o; if (vlanID != HwVtep.vlanID) return false; if (!transportZone.equals(HwVtep.transportZone)) return false; if (tunnel_type != null ? !tunnel_type.equals(HwVtep.tunnel_type) : HwVtep.tunnel_type != null) return false; if (!ipPrefix.equals(HwVtep.ipPrefix)) return false; if (gatewayIP != null ? !gatewayIP.equals(HwVtep.gatewayIP) : HwVtep.gatewayIP != null) return false; if (!topo_id.equals(HwVtep.topo_id)) return false; if (!node_id.equals(HwVtep.node_id)) return false; return hwIp.equals(HwVtep.hwIp); }
private Subnets findSubnets(List<Subnets> subnets, String subnetIp) { for (Subnets subnet : subnets) { IpPrefix subnetPrefix = new IpPrefix(subnetIp.toCharArray()); if (subnet.getPrefix().equals(subnetPrefix)) { return subnet; } } Subnets retSubnet = newSubnets(subnetIp); subnets.add(retSubnet); return retSubnet; }
public static VtepConfigSchema validateForAddVtepConfigSchema(VtepConfigSchema schema, List<VtepConfigSchema> existingSchemas) { VtepConfigSchema validSchema = validateVtepConfigSchema(schema); for (VtepConfigSchema existingSchema : emptyIfNull(existingSchemas)) { if (!StringUtils.equalsIgnoreCase(schema.getSchemaName(), existingSchema.getSchemaName()) && schema.getSubnet().equals(existingSchema.getSubnet())) { String subnetCidr = getSubnetCidrAsString(schema.getSubnet()); Preconditions.checkArgument(false, new StringBuilder("VTEP schema with subnet [").append(subnetCidr) .append("] already exists. Multiple VTEP schemas with same subnet is not allowed.").toString()); } } if (isNotEmpty(getDpnIdList(validSchema.getDpnIds()))) { String tzone = validSchema.getTransportZoneName(); List<BigInteger> lstDpns = getConflictingDpnsAlreadyConfiguredWithTz(validSchema.getSchemaName(), tzone, getDpnIdList(validSchema.getDpnIds()), existingSchemas); if (!lstDpns.isEmpty()) { Preconditions.checkArgument(false, new StringBuilder("DPN's ").append(lstDpns).append(" already configured for transport zone ") .append(tzone).append(". Only one end point per transport Zone per Dpn is allowed.") .toString()); } if (schema.getTunnelType().equals(TunnelTypeGre.class)){ validateForSingleGreTep(validSchema.getSchemaName(), getDpnIdList(validSchema.getDpnIds()), existingSchemas); } } return validSchema; } private static void validateForSingleGreTep(String schemaName, List<BigInteger> lstDpnsForAdd,
/** * Does delete and add schema required. * * @param original * the original * @param updated * the updated * @return true, if successful */ private boolean doesDeleteAndAddSchemaRequired(VtepConfigSchema original, VtepConfigSchema updated) { boolean delnAddRequired = false; if (!StringUtils.equalsIgnoreCase(original.getPortName(), updated.getPortName())) { delnAddRequired = true; } else if (original.getVlanId() != updated.getVlanId()) { delnAddRequired = true; } else if (original.getSubnet() != null && !original.getSubnet().equals(updated.getSubnet())) { delnAddRequired = true; } else if (original.getGatewayIp() != null && !original.getGatewayIp().equals(updated.getGatewayIp())) { delnAddRequired = true; } else if (!StringUtils.equalsIgnoreCase(original.getTransportZoneName(), updated.getTransportZoneName())) { delnAddRequired = true; } else if (!(original.getTunnelType().equals(updated.getTunnelType()) )) { delnAddRequired = true; } return delnAddRequired; }
tunTypeStr) ; IpAddress gatewayIpObj = new IpAddress("0.0.0.0".toCharArray()); IpAddress gwyIpAddress = ( srcte.getSubnetMask().equals(dstte.getSubnetMask()) ) ? gatewayIpObj : srcte.getGwIpAddress() ; logger.debug( " Creating Trunk Interface with parameters trunk I/f Name - {}, parent I/f name - {}, source IP - {}, destination IP - {} gateway IP - {}",trunkInterfaceName, interfaceName, srcte.getIpAddress(), dstte.getIpAddress(), gwyIpAddress ) ; Boolean monitorEnabled = ItmUtils.readMonitoringStateFromDS(dataBroker);
return false; } else if (!_prefix.equals(other.get_prefix())) { return false;