Separation of ARP Responder from config.ini. Amended to use ConfigurationService... 55/22055/4
authorevvy <dhiraviam.natarajan@gmail.com>
Fri, 12 Jun 2015 20:05:15 +0000 (01:35 +0530)
committerevvy <dhiraviam.natarajan@gmail.com>
Fri, 12 Jun 2015 20:05:38 +0000 (01:35 +0530)
Change-Id: I2dac1bec77bdc9818489dc7773a8804464a7bad5
Signed-off-by: evvy <dhiraviam.natarajan@gmail.com>
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/ConfigurationService.java
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/ConfigurationServiceImpl.java
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/NeutronL3Adapter.java
openstack/net-virt/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/impl/NeutronL3AdapterTest.java

index 782b07057b88eb59a8e88bfe5f5e6ae6b2c7c1d3..5306d202365bcfe31e6b9f618f57815e7b747f82 100644 (file)
@@ -123,6 +123,12 @@ public interface ConfigurationService {
      */
     public boolean isL3ForwardingEnabled();
 
+    /**
+     * Determine if Distributed ARP Responder is enabled
+     * @return true if ovsdb net-virt is configured for distributed arp responder
+     */
+    public boolean isDistributedArpDisabled();
+
     /**
      * Returns the MacAddress to be used for the default gateway by the {@link L3ForwardingProvider}
      * There is no default.
index 5b1e7b88de385fe107a8c9445f6c67bdcc28b0c0..b0c4c494ad7ce77df814348cb69c073201a5de73 100644 (file)
@@ -160,6 +160,12 @@ public class ConfigurationServiceImpl implements ConfigurationService, ConfigInt
         return enabledPropertyStr != null && enabledPropertyStr.equalsIgnoreCase("yes");
     }
 
+    @Override
+    public boolean isDistributedArpDisabled() {
+        final String strARPDisabled = ConfigProperties.getProperty(this.getClass(), "ovsdb.l3.arp.responder.disabled");
+        return (strARPDisabled.equalsIgnoreCase("yes"));
+    }
+
     @Override
     public String getDefaultGatewayMacAddress(Node node) {
         String l3gatewayForNode = null;
index 454374427cd238bb94107699eb1b017d87c42024..f6d0a1f5054316897b4e81faf387320fb1d371c6 100644 (file)
@@ -71,6 +71,7 @@ public class NeutronL3Adapter implements ConfigInterface {
     private Map<String, String> networkIdToRouterMacCache;
     private Map<String, NeutronRouter_Interface> subnetIdToRouterInterfaceCache;
     private Boolean enabled = false;
+    private Boolean flgDistributedARPEnabled = true;
     private Southbound southbound;
 
     public NeutronL3Adapter() {
@@ -91,9 +92,14 @@ public class NeutronL3Adapter implements ConfigInterface {
             this.defaultRouteCache = new HashSet<>();
             this.networkIdToRouterMacCache = new HashMap<>();
             this.subnetIdToRouterInterfaceCache = new HashMap<>();
-
             this.enabled = true;
             logger.info("OVSDB L3 forwarding is enabled");
+            if (configurationService.isDistributedArpDisabled()) {
+                this.flgDistributedARPEnabled = false;
+                logger.info("Distributed ARP responder is disabled");
+            } else {
+                logger.debug("Distributed ARP responder is enabled");
+            }
         } else {
             logger.debug("OVSDB L3 forwarding is disabled");
         }
@@ -272,8 +278,10 @@ public class NeutronL3Adapter implements ConfigInterface {
                 programL3ForwardingStage1(node, dpid, providerSegmentationId, tenantMac, tenantIpStr, action);
 
                 // Configure distributed ARP responder. Only needed if tenant network exists in node.
-                programStaticArpStage1(node, dpid, providerSegmentationId, tenantMac, tenantIpStr,
+                if (true == flgDistributedARPEnabled) {
+                    programStaticArpStage1(node, dpid, providerSegmentationId, tenantMac, tenantIpStr,
                                        tenantNetworkPresentInNode ? action : Action.DELETE);
+                }
             }
         }
     }
@@ -404,7 +412,8 @@ public class NeutronL3Adapter implements ConfigInterface {
                                                               true /*isReflexsive*/);
                 }
 
-                programStaticArpStage1(node, dpid, destinationSegmentationId, macAddress, ipStr, actionForNode);
+                    // Enable ARP responder by default, because router interface needs to be responded always.
+                    programStaticArpStage1(node, dpid, destinationSegmentationId, macAddress, ipStr, actionForNode);
             }
 
             // Compute action to be programmed. In the case of rewrite exclusions, we must never program rules
@@ -829,8 +838,7 @@ public class NeutronL3Adapter implements ConfigInterface {
             programIpRewriteStage1(node, dpid, providerSegmentationId, false /* isInboubd */,
                                    fixedIPAddress, floatingIpAddress, actionForNode);
 
-            // Respond to arps for the floating ip address
-            //
+            // Respond to ARPs for the floating ip address by default
             programStaticArpStage1(node, dpid, providerSegmentationId, routerMacAddress, floatingIpAddress,
                                    actionForNode);
         }
index b419e6151047e84c4bb2ff47d7a94fbd0be86e4c..464a80b70025fb4baa53935731f05f98b453d823 100644 (file)
@@ -94,6 +94,7 @@ public class NeutronL3AdapterTest {
     public void setUp() throws Exception{
         PowerMockito.mockStatic(ConfigProperties.class);
         PowerMockito.when(ConfigProperties.getProperty(neutronL3Adapter.getClass(), "ovsdb.l3.fwd.enabled")).thenReturn("yes");
+        PowerMockito.when(ConfigProperties.getProperty(neutronL3Adapter.getClass(), "ovsdb.l3.arp.responder.disabled")).thenReturn("no");
 
         when(configurationService.isL3ForwardingEnabled()).thenReturn(true);