package org.opendaylight.ovsdb.openstack.netvirt;
-import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD;
-import org.opendaylight.controller.networkconfig.neutron.INeutronPortCRUD;
-import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetCRUD;
-import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork;
-import org.opendaylight.controller.networkconfig.neutron.NeutronPort;
-import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet;
-import org.opendaylight.controller.networkconfig.neutron.Neutron_IPs;
+import org.opendaylight.neutron.spi.INeutronNetworkCRUD;
+import org.opendaylight.neutron.spi.INeutronPortCRUD;
+import org.opendaylight.neutron.spi.INeutronSubnetCRUD;
+import org.opendaylight.neutron.spi.NeutronNetwork;
+import org.opendaylight.neutron.spi.NeutronPort;
+import org.opendaylight.neutron.spi.NeutronSubnet;
+import org.opendaylight.neutron.spi.Neutron_IPs;
import java.util.AbstractMap;
import java.util.Iterator;
* @param ipAddr IP address of a member or VM
* @return MAC address registered with that IP address
*/
- public static String getMacAddress(INeutronPortCRUD neutronPortsCache, String ipAddr) {
- if (ipAddr == null)
+ public static String getMacAddress(INeutronPortCRUD neutronPortsCache, String subnetID, String ipAddr) {
+ if (ipAddr == null || subnetID == null) {
return null;
+ }
List<Neutron_IPs> fixedIPs;
Iterator<Neutron_IPs> fixedIPIterator;
fixedIPIterator = fixedIPs.iterator();
while (fixedIPIterator.hasNext()) {
ip = fixedIPIterator.next();
- if (ip.getIpAddress().equals(ipAddr))
+ if (ip.getIpAddress().equals(ipAddr) && ip.getSubnetUUID().equals(subnetID)) {
return port.getMacAddress();
+ }
}
}
}
/**
* Look up in the NeutronNetworkCRUD cache and NeutronSubnetCRUD cache for
* extracting the provider segmentation_type and segmentation_id
- * @param subnetId Subnet UUID
+ * @param subnetID Subnet UUID
* @return {Type: ID} pair for that subnet ID
*/
public static Map.Entry<String,String> getProviderInformation(INeutronNetworkCRUD neutronNetworkCache,
break;
}
}
- if (networkID == null)
+ if (networkID == null) {
return null;
+ }
List<NeutronNetwork> allNetworks = neutronNetworkCache.getAllNetworks();
for (NeutronNetwork network: allNetworks) {