private boolean isIpInList(List<IpAddress> ipList, IpAddress newIp) { for (IpAddress ip : ipList) { if (newIp.equals(ip)) { return true; } } return false; }
@Override public boolean equals(java.lang.Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } NeighborKey other = (NeighborKey) obj; if (_address == null) { if (other._address != null) { return false; } } else if(!_address.equals(other._address)) { return false; } return true; }
@Override public boolean equals(java.lang.Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } NeighborKey other = (NeighborKey) obj; if (_neighborAddress == null) { if (other._neighborAddress != null) { return false; } } else if(!_neighborAddress.equals(other._neighborAddress)) { return false; } return true; }
@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); }
return false; } else if(!_address.equals(other._address)) { return false;
return false; } else if(!_ipAddress.equals(other._ipAddress)) { return false;
return false; } else if(!_ipAddress.equals(other._ipAddress)) { return false;
/** * Gets the fixed ips delta. * * @param port1FixedIps the port 1 fixed ips * @param port2FixedIps the port 2 fixed ips * @return the fixed ips delta */ protected static List<FixedIps> getFixedIpsDelta(List<FixedIps> port1FixedIps, List<FixedIps> port2FixedIps) { if (port1FixedIps == null) { return null; } if (port2FixedIps == null) { return port1FixedIps; } List<FixedIps> list1 = new ArrayList<>(port1FixedIps); List<FixedIps> list2 = new ArrayList<>(port2FixedIps); for (Iterator<FixedIps> iterator = list1.iterator(); iterator.hasNext();) { FixedIps fixedIps1 = iterator.next(); for (FixedIps fixedIps2 : list2) { if (fixedIps1.getIpAddress().equals(fixedIps2.getIpAddress())) { iterator.remove(); break; } } } return list1; }
/** * Search the Operation DataStore for a specific UNI. * @param dataBroker The dataBroker instance to create transactions * @param ipAddress The IP address of the UNI * @return An Optional UNI Node */ public static Optional<Node> findUniNode(DataBroker dataBroker, IpAddress ipAddress) { final List<Node> uniNodes = getUniNodes(dataBroker); if (!uniNodes.isEmpty()) { for (final Node uniNode : uniNodes) { final UniAugmentation uniAugmentation = uniNode.getAugmentation(UniAugmentation.class); if (uniAugmentation.getIpAddress().equals(ipAddress)) { LOG.info("Found Uni node"); return Optional.of(uniNode); } } } return Optional.absent(); }
public boolean checkExistingSubnet(Map<SubnetObject, List<Vteps>> subVtepMapTemp, SubnetObject subObCli) { for (SubnetObject subOb : subVtepMapTemp.keySet()) { if (subOb.get_key().equals(subObCli.get_key())) { if (!(subOb.get_vlanId().equals(subObCli.get_vlanId()))) return true; if (!(subOb.get_gatewayIp().equals(subObCli.get_gatewayIp()))) return true; } } return false; }
private ServiceFunctionForwarder findSffByIp(ServiceFunctionForwarders sffs, final IpAddress remoteIp) { List<ServiceFunctionForwarder> serviceFunctionForwarders = sffs.getServiceFunctionForwarder(); if (serviceFunctionForwarders != null && !serviceFunctionForwarders.isEmpty()) for (ServiceFunctionForwarder sff : serviceFunctionForwarders) { List<SffDataPlaneLocator> sffDataPlaneLocator = sff.getSffDataPlaneLocator(); for (SffDataPlaneLocator sffLocator : sffDataPlaneLocator) { LocatorType locatorType = sffLocator.getDataPlaneLocator().getLocatorType(); if (locatorType instanceof Ip) { Ip ip = (Ip) locatorType; if (ip.getIp().equals(remoteIp)) { return sff; } } } } return null; } }
return false; } else if(!_remoteAddress.equals(other.getRemoteAddress())) { return false;
@Override protected void update(InstanceIdentifier<Floatingip> identifier, Floatingip original, Floatingip update) { if (LOG.isTraceEnabled()) { LOG.trace("Handling FloatingIptoFixedIp mapping : key: " + identifier + ", original value=" + original + ", update value=" + update); } IpAddress oldFixedIp = original.getFixedIpAddress(); IpAddress newFixedIp = update.getFixedIpAddress(); if (oldFixedIp != null && !oldFixedIp.equals(newFixedIp)) { clearFromFloatingIpInfo(original.getRouterId().getValue(), original.getPortId().getValue(), oldFixedIp .getIpv4Address().getValue()); } if (newFixedIp != null && !newFixedIp.equals(oldFixedIp)) { addToFloatingIpInfo(update.getRouterId().getValue(), update.getFloatingNetworkId(), update.getPortId() .getValue(), newFixedIp.getIpv4Address().getValue(), update.getFloatingIpAddress ().getIpv4Address().getValue()); } }
/** * 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; }
private InstanceIdentifier<TerminationPoint> getIpTerminationPoint(final ReadWriteTransaction trans, final IpAddress addr, final InstanceIdentifier<Node> sni, final Boolean inControl) throws ReadFailedException { final Topology topo = trans.read(LogicalDatastoreType.OPERATIONAL, this.target).checkedGet().get(); if (topo.getNode() != null) { for (final Node n : topo.getNode()) { if(n.getTerminationPoint() != null) { for (final TerminationPoint tp : n.getTerminationPoint()) { final TerminationPoint1 tpa = tp.getAugmentation(TerminationPoint1.class); if (tpa != null) { final TerminationPointType tpt = tpa.getIgpTerminationPointAttributes().getTerminationPointType(); if (tpt instanceof Ip) { for (final IpAddress a : ((Ip) tpt).getIpAddress()) { if (addr.equals(a)) { handleSni(sni, n, inControl, trans); return this.target.builder().child(Node.class, n.getKey()).child(TerminationPoint.class, tp.getKey()).build(); } } } else { LOG.debug("Ignoring termination point type {}", tpt); } } } } } } LOG.debug("Termination point for {} not found, creating a new one", addr); return createTP(addr, sni, inControl, trans); }
return false; } else if (!_gatewayIp.equals(other.get_gatewayIp())) { return false;
for (DeviceVteps hwVtepDS : sub.getDeviceVteps()) { if(hwVtepDS.getIpAddress().equals(tep.getIpAddress())) continue; String cssID = dpn.getDPNID().toString();
/** * Generates an Instance Identifier for a UNI by querying the datastore. * Query will ask the Operational store by default. * @param dataBroker the data broker * @param ip The IP of the UNI * @return An Instance Identifier of a UNI by using its IP address. */ public static InstanceIdentifier<Node> getUniIid(DataBroker dataBroker, IpAddress ip) { List<Node> uniNodes = UniUtils.getUniNodes(dataBroker, LogicalDatastoreType.OPERATIONAL); for (Node node : uniNodes) { UniAugmentation uniAugmentation = node.getAugmentation(UniAugmentation.class); if (uniAugmentation.getIpAddress().equals(ip)) { InstanceIdentifier<Node> uniNode = InstanceIdentifier .create(NetworkTopology.class) .child(Topology.class, new TopologyKey(UnimgrConstants.UNI_TOPOLOGY_ID)) .child(Node.class, new NodeKey(node.getKey())); return uniNode; } } return null; }
/** * Generates an Instance Identifier for a UNI by querying the datastore * with the IP address of the UNI. * @param dataBroker the data broker * @param ip The IP of the UNI * @param store The store where the query should be sent * @return An Instance Identifier of a UNI by using its IP address. */ public static InstanceIdentifier<Node> getUniIid(DataBroker dataBroker, IpAddress ip, LogicalDatastoreType store) { List<Node> uniNodes = UniUtils.getUniNodes(dataBroker, store); for (Node node : uniNodes) { UniAugmentation uniAugmentation = node.getAugmentation(UniAugmentation.class); if (uniAugmentation.getIpAddress().equals(ip)) { InstanceIdentifier<Node> uniNode = InstanceIdentifier .create(NetworkTopology.class) .child(Topology.class, new TopologyKey(UnimgrConstants.UNI_TOPOLOGY_ID)) .child(Node.class, new NodeKey(node.getKey())); return uniNode; } } return null; }
/** * Compare two addresses. This method is different than equals since it only * compares MAC, VLAN and IP Address. * * @param addr1 * first Address to compare. * @param addr2 * second Address to compare. * @return true if both have the same MAC, VLAN and IP Address, false * otherwise. */ public static boolean Addresses(Addresses addr1, Addresses addr2) { return ((addr1.getMac() == null && addr2.getMac() == null) || (addr1.getMac() != null && addr1.getMac().equals(addr2.getMac()))) && ((addr1.getVlan() == null && addr2.getVlan() == null) || (addr1.getVlan() != null && addr1.getVlan().equals(addr2.getVlan()))) && ((addr1.getIp() == null && addr2.getIp() == null) || (addr1.getIp() != null && addr1.getIp().equals(addr2.getIp()))); }