L3 Bugfix: routing table needs to add rules when destination net is not local
authorFlavio Fernandes <ffernand@redhat.com>
Tue, 26 May 2015 16:20:34 +0000 (12:20 -0400)
committerFlavio Fernandes <ffernand@redhat.com>
Tue, 26 May 2015 16:20:34 +0000 (12:20 -0400)
Because L3 routes at ingress, it is possible that the dest neutron network is
not present at the the ingress node.

Fix cache so only id of node is used.

Fix logging format, so only node id is provided.

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

index bb2b8fac448fc7f4d95400a5270aa23cbd1b0b50..fb19447eee8e8c3aef92d85b2b3b4a3a7900933d 100644 (file)
@@ -161,7 +161,7 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider {
         logger.info("addTunnelPort enter: portName: {}", portName);
         if (MdsalUtils.extractTerminationPointAugmentation(node, portName) != null
                 || MdsalUtils.isTunnelTerminationPointExist(node,tunnelBridgeName,portName)) {
-            logger.info("Tunnel {} is present in {} of {}", portName, tunnelBridgeName, node);
+            logger.info("Tunnel {} is present in {} of {}", portName, tunnelBridgeName, node.getNodeId().getValue());
             return true;
         }
 
index 50c4e93f5ffae46c1f24856d57940cac8b3d3c61..0a9ab33023afd8cfc4f83f3e2d50d196ebf6d5b1 100644 (file)
@@ -281,7 +281,7 @@ public class NeutronL3Adapter implements ConfigInterface {
         // Based on the local cache, figure out whether programming needs to occur. To do this, we
         // will look at desired action for node.
         //
-        final String cacheKey = node.toString() + ":" + providerSegmentationId + ":" + ipStr;
+        final String cacheKey = node.getNodeId().getValue() + ":" + providerSegmentationId + ":" + ipStr;
         final Boolean isProgrammed = l3ForwardingCache.contains(cacheKey);
 
         if (actionForNode == Action.DELETE && isProgrammed == Boolean.FALSE) {
@@ -364,7 +364,7 @@ public class NeutronL3Adapter implements ConfigInterface {
             return;  // done: go no further w/out all the info needed...
         }
 
-        final Action action = isDelete ? Action.DELETE : Action.ADD;
+        final Action actionForNode = isDelete ? Action.DELETE : Action.ADD;
 
         // Keep cache for finding router's mac from network uuid -- add
         //
@@ -383,10 +383,6 @@ public class NeutronL3Adapter implements ConfigInterface {
                 continue;
             }
 
-            final Action actionForNode =
-                    tenantNetworkManager.isTenantNetworkPresentInNode(node, destinationSegmentationId) ?
-                    action : Action.DELETE;
-
             for (Neutron_IPs neutronIP : ipList) {
                 final String ipStr = neutronIP.getIpAddress();
                 if (ipStr.isEmpty()) {
@@ -526,22 +522,23 @@ public class NeutronL3Adapter implements ConfigInterface {
         // Based on the local cache, figure out whether programming needs to occur. To do this, we
         // will look at desired action for node.
         //
-        final String cacheKey = node.toString() + ":" + sourceSegmentationId + ":" + destinationSegmentationId + ":" +
+        final String cacheKey = node.getNodeId().getValue() + ":" +
+                                sourceSegmentationId + ":" + destinationSegmentationId + ":" +
                                 ipStr + "/" + Integer.toString(mask);
         final Boolean isProgrammed = routerInterfacesCache.contains(cacheKey);
 
         if (actionForNode == Action.DELETE && isProgrammed == Boolean.FALSE) {
             logger.trace("programRouterInterfaceStage1 for node {} sourceSegId {} destSegId {} mac {} ip {} mask {}" +
-                         "action {} is already done",
+                         " action {} is already done",
                          node.getNodeId().getValue(), sourceSegmentationId, destinationSegmentationId,
-                         ipStr, mask, actionForNode);
+                         macAddress, ipStr, mask, actionForNode);
             return;
         }
         if (actionForNode == Action.ADD && isProgrammed == Boolean.TRUE) {
             logger.trace("programRouterInterfaceStage1 for node {} sourceSegId {} destSegId {} mac {} ip {} mask {}" +
-                         "action {} is already done",
+                         " action {} is already done",
                          node.getNodeId().getValue(), sourceSegmentationId, destinationSegmentationId,
-                         ipStr, mask, actionForNode);
+                         macAddress, ipStr, mask, actionForNode);
             return;
         }
 
@@ -594,7 +591,7 @@ public class NeutronL3Adapter implements ConfigInterface {
         // Based on the local cache, figure out whether programming needs to occur. To do this, we
         // will look at desired action for node.
         //
-        final String cacheKey = node.toString() + ":" + providerSegmentationId + ":" + ipStr;
+        final String cacheKey = node.getNodeId().getValue() + ":" + providerSegmentationId + ":" + ipStr;
         final Boolean isProgrammed = staticArpEntryCache.contains(cacheKey);
 
         if (actionForNode == Action.DELETE && isProgrammed == Boolean.FALSE) {
@@ -652,7 +649,7 @@ public class NeutronL3Adapter implements ConfigInterface {
         // Based on the local cache, figure out whether programming needs to occur. To do this, we
         // will look at desired action for node.
         //
-        final String cacheKey = node.toString() + ":" + providerSegmentationId + ":" + cidr;
+        final String cacheKey = node.getNodeId().getValue() + ":" + providerSegmentationId + ":" + cidr;
         final Boolean isProgrammed = isInbound ?
                                      inboundIpRewriteExclusionCache.contains(cacheKey):
                                      outboundIpRewriteExclusionCache.contains(cacheKey);
@@ -721,7 +718,7 @@ public class NeutronL3Adapter implements ConfigInterface {
         // Based on the local cache, figure out whether programming needs to occur. To do this, we
         // will look at desired action for node.
         //
-        final String cacheKey = node.toString() + ":" + providerSegmentationId + ":" + gatewayIp;
+        final String cacheKey = node.getNodeId().getValue() + ":" + providerSegmentationId + ":" + gatewayIp;
         final Boolean isProgrammed = defaultRouteCache.contains(cacheKey);
 
         if (actionForNodeDefaultRoute == Action.DELETE && isProgrammed == Boolean.FALSE) {
@@ -843,7 +840,7 @@ public class NeutronL3Adapter implements ConfigInterface {
         // Based on the local cache, figure out whether programming needs to occur. To do this, we
         // will look at desired action for node.
         //
-        final String cacheKey = node.toString() + ":" + providerSegmentationId + ":" +
+        final String cacheKey = node.getNodeId().getValue() + ":" + providerSegmentationId + ":" +
                                 matchAddress + ":" + rewriteAddress;
         final Boolean isProgrammed = isInbound ?
                                      inboundIpRewriteCache.contains(cacheKey) :