Bug 2092 - Invalid code in LBaaS handlers that extracts MAC address of member without...
[ovsdb.git] / openstack / net-virt / src / main / java / org / opendaylight / ovsdb / openstack / netvirt / NeutronCacheUtils.java
index bed81ab6dccc1057c8986dc152810a6df9a01312..7a5bde1b5450b066cb8c90c366354bfd22119bc2 100755 (executable)
@@ -30,8 +30,8 @@ public class NeutronCacheUtils {
      * @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;
@@ -47,7 +47,7 @@ public class NeutronCacheUtils {
                 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();
                 }
             }