Bug 4331 - External bridge used for gateway mac resolver needs to be dynamic (cont.)
authorFlavio Fernandes <ffernand@redhat.com>
Mon, 11 Jan 2016 18:41:31 +0000 (13:41 -0500)
committerFlavio Fernandes <ffernand@redhat.com>
Mon, 11 Jan 2016 18:41:31 +0000 (13:41 -0500)
This is an additional patchset for changes that shuffle list of dpids so that
different br-ex instances are used when mac resolver is not getting an answer.
The other part of this gerrit has been merged via:
https://git.opendaylight.org/gerrit/#/c/32284/

With this change the GatewayMacResolverService will become resilient to the cases
where nodes get deleted or lose br-ex connectivity after the resolver is kicked
off to periodically track a given ip address.

Also made some minor clean up in NeutronL3Adapter, so that it needs not to
duplicate work for tracking ip in the very first iteration. That duplication
is not necessary as the GatewayMacResolverService is already implemented
with thread executors for the periodic monitoring.

Lastly, this gerrit augments the GatewayMacResolver service to provide
an extra boolean param called refreshExternalNetworkBridgeDpidIfNeeded.
That can be used to control whether dpid used gets updated when mac is
not getting resolved.

Change-Id: I142735f875d1a79144c204bec631712de00d9746
Signed-off-by: Flavio Fernandes <ffernand@redhat.com>
openstack/net-virt-providers/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/services/arp/GatewayMacResolverService.java

index da9c2de1f1f625feddccc316e7462af680630362..40a67a520dab609a48b6c2580ef5b65ee9f0f2cb 100644 (file)
@@ -71,6 +71,7 @@ import org.slf4j.LoggerFactory;
 
 import javax.annotation.Nullable;
 import java.math.BigInteger;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map.Entry;
 import java.util.concurrent.Callable;
@@ -281,12 +282,13 @@ public class GatewayMacResolverService extends AbstractServiceInstance
             return unwantedDpid;
         }
 
-        // Pickup the first dpid in list that is different than the unwanted one provided and is in the
-        // operational tree.
+        // Pickup another dpid in list that is different than the unwanted one provided and is in the
+        // operational tree. If none can be found, return the provided dpid as a last resort.
         // NOTE: We are assuming that all the br-ex are serving one external network and gateway ip of
         // the external network is reachable from every br-ex
         // TODO: Consider other deployment scenario, and think of another solution.
         List<Long> dpids =  nodeCacheManager.getBridgeDpids(configurationService.getExternalBridgeName());
+        Collections.shuffle(dpids);
         for (Long dpid : dpids) {
             if (dpid == null || dpid.equals(unwantedDpid) || getExternalBridge(dpid) == null) {
                 continue;