Bug 1730: L3: Trigger processing of neutron port updates based on events from southbound 62/10862/2
authorFlavio Fernandes <ffernand@redhat.com>
Fri, 5 Sep 2014 19:56:12 +0000 (15:56 -0400)
committerFlavio Fernandes <ffernand@redhat.com>
Sat, 6 Sep 2014 20:29:44 +0000 (16:29 -0400)
When interface events originate from the southbound side of ovsdb, the L3 forwarding
feature in ovsdb expects to be notified. W/out this code, flows needed to program L3
functionality will get skipped.

Due to my mistake, the logic for connecting the southbound event to the
already implemented neutron port handler is missing. This bug is created
to account for the the small code missing in L3 handler; past the code
freeze.

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

index f11ae09af60d74373bf2623f9f38b787b4f91df2..21fdd4f3d5edc0b02de697c966552a17a0e8a67c 100644 (file)
@@ -25,6 +25,7 @@ import org.opendaylight.controller.sal.utils.HexEncode;
 import org.opendaylight.controller.sal.utils.Status;
 import org.opendaylight.controller.sal.utils.StatusCode;
 import org.opendaylight.ovsdb.lib.notation.Row;
+import org.opendaylight.ovsdb.openstack.netvirt.api.Constants;
 import org.opendaylight.ovsdb.openstack.netvirt.api.MultiTenantAwareRouter;
 import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProviderManager;
 import org.opendaylight.ovsdb.openstack.netvirt.api.TenantNetworkManager;
@@ -181,6 +182,27 @@ public class NeutronL3Adapter {
                                      Action action) {
         logger.debug("southbound interface {} node:{} interface:{}, neutronNetwork:{}",
                      action, node, intf.getName(), neutronNetwork);
+
+        // Deletes are handled in this.handleNeutronPortEvent()
+        if (action == Action.DELETE) {
+            return;
+        }
+        // See if there is an external uuid, so we can find the respective neutronPort
+        Map<String, String> externalIds = intf.getExternalIdsColumn().getData();
+        if (externalIds == null) {
+            return;
+        }
+        String neutronPortId = externalIds.get(Constants.EXTERNAL_ID_INTERFACE_ID);
+        if (neutronPortId == null) {
+            return;
+        }
+        final NeutronPort neutronPort = neutronPortCache.getPort(neutronPortId);
+        if (neutronPort == null) {
+            logger.warn("southbound interface {} node:{} interface:{}, neutronNetwork:{} did not find port:{}",
+                         action, node, intf.getName(), neutronNetwork, neutronPortId);
+            return;
+        }
+        updateL3ForNeutronPort(neutronPort, null /*neutronRouterInterfaceFilter*/, false /*isDelete*/);
     }
 
     //