Make NeutronL3Adapter node filter out non br-int bridges 38/20438/3
authorFlavio Fernandes <ffernand@redhat.com>
Thu, 14 May 2015 21:19:06 +0000 (17:19 -0400)
committerFlavio Fernandes <ffernand@redhat.com>
Thu, 14 May 2015 21:58:22 +0000 (17:58 -0400)
Patch 2: use MdsalUtils.getBridge()
Patch 3: remove unused import

Change-Id: I4daf0d086e156d7540b7dd3b829a9fbf8783cd1f
Signed-off-by: Flavio Fernandes <ffernand@redhat.com>
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/NeutronL3Adapter.java

index 626aefb1d70d40255f980b8ac634652efcd02557..208fe6959fa8431066c95126d5bc60295cbebadc 100644 (file)
@@ -252,7 +252,11 @@ public class NeutronL3Adapter {
             logger.trace("updateL3ForNeutronPort has no nodes to work with");
         }
         for (Node node : nodes) {
-            final Long dpid = getDpid(node);
+            final Long dpid = getDpidForIntegrationBridge(node);
+            if (dpid == null) {
+                continue;
+            }
+
             final boolean tenantNetworkPresentInNode =
                     tenantNetworkManager.isTenantNetworkPresentInNode(node, providerSegmentationId);
             for (Neutron_IPs neutronIP : neutronPort.getFixedIPs()) {
@@ -375,7 +379,11 @@ public class NeutronL3Adapter {
             logger.trace("programFlowsForNeutronRouterInterface has no nodes to work with");
         }
         for (Node node : nodes) {
-            final Long dpid = getDpid(node);
+            final Long dpid = getDpidForIntegrationBridge(node);
+            if (dpid == null) {
+                continue;
+            }
+
             final Action actionForNode =
                     tenantNetworkManager.isTenantNetworkPresentInNode(node, destinationSegmentationId) ?
                     action : Action.DELETE;
@@ -806,7 +814,11 @@ public class NeutronL3Adapter {
             logger.trace("programFlowsForFloatingIP has no nodes to work with");
         }
         for (Node node : nodes) {
-            final Long dpid = getDpid(node);
+            final Long dpid = getDpidForIntegrationBridge(node);
+            if (dpid == null) {
+                continue;
+            }
+
             final Action actionForNode =
                     tenantNetworkManager.isTenantNetworkPresentInNode(node, providerSegmentationId) ?
                     action : Action.DELETE;
@@ -925,10 +937,11 @@ public class NeutronL3Adapter {
         return result;
     }
 
-    private Long getDpid(Node node) {
-        /* TODO SB_MIGRATION */
-        // may need to go from OvsdbNode to BridgeNode
-        // get integration bridge on this node and then get dpid
-        return MdsalUtils.getDataPathId(node);
+    private Long getDpidForIntegrationBridge(Node node) {
+        // Check if node is integration bridge; and only then return its dpid
+        if (MdsalUtils.getBridge(node, configurationService.getIntegrationBridgeName()) != null) {
+            return MdsalUtils.getDataPathId(node);
+        }
+        return null;
     }
 }