/** * Look up in the NeutronPortsCRUD cache and return the MAC address for a corresponding IP address * @param neutronPortsCache Reference to port cache to get existing port related data. This interface * basically read data from the md-sal data store. * @param subnetID subnet to which given port is attached * @param ipAddr IP address of a member or VM * @return MAC address registered with that IP address */ public static String getMacAddress(INeutronPortCRUD neutronPortsCache, String subnetID, String ipAddr) { if (ipAddr == null || subnetID == null) { return null; } List<NeutronPort> allPorts = neutronPortsCache.getAllPorts(); for (NeutronPort port : allPorts) { List<Neutron_IPs> fixedIPs = port.getFixedIPs(); if (fixedIPs != null && !fixedIPs.isEmpty()) { for (Neutron_IPs ip : fixedIPs) { if (ip.getIpAddress().equals(ipAddr) && ip.getSubnetUUID().equals(subnetID)) { return port.getMacAddress(); } } } } return null; }
private NeutronSubnet getExternalNetworkSubnet(NeutronPort gatewayPort){ if (gatewayPort.getFixedIPs() == null) { return null; } for (Neutron_IPs neutronIPs : gatewayPort.getFixedIPs()) { String subnetUUID = neutronIPs.getSubnetUUID(); NeutronSubnet extSubnet = neutronSubnetCache.getSubnet(subnetUUID); if (extSubnet != null && extSubnet.getGatewayIP() != null) { return extSubnet; } if (extSubnet == null) { // TODO: when subnet is created, try again. LOG.debug("subnet {} in not found", subnetUUID); } } return null; }
String subnetUuid = fixedIps.iterator().next().getSubnetUUID(); NeutronSubnet neutronSubnet = neutronSubnetCache.getSubnet(subnetUuid); if (neutronSubnet == null) {
return false; if (portFixedIp.iterator().next().getSubnetUUID() .equals(neutronPort.getFixedIPs().iterator().next().getSubnetUUID())) { LOG.trace("isLastPortinSubnet: Port is not the only port."); return false;
if (neutronPort.getFixedIPs() != null) { for (Neutron_IPs neutronIP : neutronPort.getFixedIPs()) { if (neutronRouterInterface.getSubnetUUID().equalsIgnoreCase(neutronIP.getSubnetUUID())) { currPortShouldBeDeleted = true; break;
if (ip.getSubnetUUID().equals(result.getID())) { allPorts.add(port);
for (Neutron_IPs neutronIP : neutronPort.getFixedIPs()) { NeutronRouter_Interface neutronRouterInterface = new NeutronRouter_Interface(neutronIP.getSubnetUUID(), neutronPort.getPortUUID()); neutronRouterInterface.setID(neutronIP.getSubnetUUID()); neutronRouterInterface.setTenantID(neutronPort.getTenantID()); for (Neutron_IPs neutronIP : neutronPort.getFixedIPs()) { NeutronRouter_Interface neutronRouterInterface = subnetIdToRouterInterfaceCache.get(neutronIP.getSubnetUUID()); if (neutronRouterInterface != null) { this.handleNeutronRouterInterfaceEvent(null /*neutronRouter*/, neutronRouterInterface, action);
if (port.getFixedIPs() != null) { for (Neutron_IPs ip : port.getFixedIPs()) { if (ip.getSubnetUUID().equals(result.getID())) { allPorts.add(port);
ExternalFixedIpsBuilder eFixedIpBuilder = new ExternalFixedIpsBuilder(); eFixedIpBuilder.setIpAddress(new IpAddress(eIP.getIpAddress().toCharArray())); eFixedIpBuilder.setSubnetId(toUuid(eIP.getSubnetUUID())); externalFixedIps.add(eFixedIpBuilder.build());
FixedIpsBuilder fixedIpsBuilder = new FixedIpsBuilder(); fixedIpsBuilder.setIpAddress(new IpAddress(neutron_IPs.getIpAddress().toCharArray())); fixedIpsBuilder.setSubnetId(toUuid(neutron_IPs.getSubnetUUID())); listNeutronIPs.add(fixedIpsBuilder.build());