public static List<Neutron_IPs> convertMDSalIpToNeutronIp(List<FixedIps> fixedIps) { List<Neutron_IPs> ips = null; if (fixedIps != null) { ips = new ArrayList<>(); for (FixedIps mdIP : fixedIps) { Neutron_IPs ip = new Neutron_IPs(); ip.setIpAddress(String.valueOf(mdIP.getIpAddress().getValue())); ip.setSubnetUUID(mdIP.getSubnetId().getValue()); ips.add(ip); } } return ips; }
String ipaddress = null; if (null != vmIp) { ipaddress = vmIp.getIpAddress(); try { InetAddress address = InetAddress.getByName(vmIp.getIpAddress()); if (isIpv6 && address instanceof Inet4Address || !isIpv6 && address instanceof Inet6Address) { LOG.debug("programPortSecurityRule: Remote vmIP {} does not match "
/** * 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) {
public NeutronPort createNeutronPort(String networkId, String subnetId, String id, String owner, String ipaddr, String mac, NeutronSecurityGroup... secGroups) { INeutronPortCRUD iNeutronPortCRUD = (INeutronPortCRUD) ServiceHelper.getGlobalInstance(INeutronPortCRUD.class, this); NeutronPort np = new NeutronPort(); np.initDefaults(); np.setID(id); np.setDeviceOwner(owner); np.setMacAddress(mac); np.setNetworkUUID(networkId); List<org.opendaylight.netvirt.openstack.netvirt.translator.Neutron_IPs> srcAddressList = new ArrayList<>(); org.opendaylight.netvirt.openstack.netvirt.translator.Neutron_IPs nip = new org.opendaylight.netvirt.openstack.netvirt.translator.Neutron_IPs(); nip.setIpAddress(ipaddr); nip.setSubnetUUID(subnetId); srcAddressList.add(nip); np.setFixedIPs(srcAddressList); List<NeutronSecurityGroup> nsgs = Arrays.asList(secGroups); np.setSecurityGroups(nsgs); iNeutronPortCRUD.addPort(np); return np; }
String ipaddress = null; if (null != vmIp) { ipaddress = vmIp.getIpAddress(); try { InetAddress address = InetAddress.getByName(ipaddress);
for (Neutron_IPs eIP : externalGatewayInfos.getExternalFixedIPs()) { ExternalFixedIpsBuilder eFixedIpBuilder = new ExternalFixedIpsBuilder(); eFixedIpBuilder.setIpAddress(new IpAddress(eIP.getIpAddress().toCharArray())); eFixedIpBuilder.setSubnetId(toUuid(eIP.getSubnetUUID())); externalFixedIps.add(eFixedIpBuilder.build());
return false; if (portFixedIp.iterator().next().getSubnetUUID() .equals(neutronPort.getFixedIPs().iterator().next().getSubnetUUID())) { LOG.trace("isLastPortinSubnet: Port is not the only port."); return false;
List<Neutron_IPs> fixedIPs = new ArrayList<>(); for (ExternalFixedIps mdFixedIP : router.getExternalGatewayInfo().getExternalFixedIps()) { Neutron_IPs fixedIP = new Neutron_IPs(); fixedIP.setSubnetUUID(String.valueOf(mdFixedIP.getSubnetId().getValue())); fixedIP.setIpAddress(String.valueOf(mdFixedIP.getIpAddress().getValue())); fixedIPs.add(fixedIP);
final String tenantIpStr = neutronIP.getIpAddress(); if (tenantIpStr.isEmpty()) { continue;
for (Neutron_IPs neutron_IPs : neutronPort.getFixedIPs()) { FixedIpsBuilder fixedIpsBuilder = new FixedIpsBuilder(); fixedIpsBuilder.setIpAddress(new IpAddress(neutron_IPs.getIpAddress().toCharArray())); fixedIpsBuilder.setSubnetId(toUuid(neutron_IPs.getSubnetUUID())); listNeutronIPs.add(fixedIpsBuilder.build());
if (neutronPort.getFixedIPs() != null) { for (Neutron_IPs neutronIP : neutronPort.getFixedIPs()) { if (neutronRouterInterface.getSubnetUUID().equalsIgnoreCase(neutronIP.getSubnetUUID())) { currPortShouldBeDeleted = true; break;
List<Neutron_IPs> fixedIPs = new ArrayList<>(); for (ExternalFixedIps mdFixedIP : router.getExternalGatewayInfo().getExternalFixedIps()) { Neutron_IPs fixedIP = new Neutron_IPs(); fixedIP.setSubnetUUID(String.valueOf(mdFixedIP.getSubnetId().getValue())); fixedIP.setIpAddress(String.valueOf(mdFixedIP.getIpAddress().getValue())); fixedIPs.add(fixedIP);
final String ipStr2 = neutronIP2.getIpAddress(); if (ipStr2.isEmpty()) { continue;
if (ip.getSubnetUUID().equals(result.getID())) { allPorts.add(port);
List<Neutron_IPs> ips = new ArrayList<>(); for (FixedIps mdIP : port.getFixedIps()) { Neutron_IPs ip = new Neutron_IPs(); ip.setIpAddress(String.valueOf(mdIP.getIpAddress().getValue())); ip.setSubnetUUID(mdIP.getSubnetId().getValue()); ips.add(ip);
InetAddress ipAddress; try { ipAddress = InetAddress.getByName(nIP.getIpAddress()); } catch (UnknownHostException e) { LOG.warn("unknown host exception {}", e); new Ipv4Address(neutronIP.getIpAddress()), new MacAddress(gatewayPort.getMacAddress()), true /* periodicRefresh */);
if (port.getFixedIPs() != null) { for (Neutron_IPs ip : port.getFixedIPs()) { if (ip.getSubnetUUID().equals(result.getID())) { allPorts.add(port);
List<Neutron_IPs> ips = new ArrayList<>(); for (FixedIps mdIP : port.getFixedIps()) { Neutron_IPs ip = new Neutron_IPs(); ip.setIpAddress(String.valueOf(mdIP.getIpAddress().getValue())); ip.setSubnetUUID(mdIP.getSubnetId().getValue()); ips.add(ip);