VNF route did not appear as no parentrefs 71/87371/3
authorKarthikeyan Krishnan <karthikeyan.k@altencalsoftlabs.com>
Mon, 3 Feb 2020 08:33:07 +0000 (14:03 +0530)
committerKarthikeyan Krishnan <karthikeyangceb007@gmail.com>
Tue, 11 Feb 2020 06:01:40 +0000 (06:01 +0000)
Issue:
======
VNF route did not appear in fib/flows due to interface manager did not
update the parentref

Solution:
==========
We are not updating parentrefs for VM interfaces via
northbound calls, but rather via southbound events through
InterfaceManager.
Hence, any missed events for port updates also need not update the
parentrefs.

Signed-off-by: Karthikeyan Krishnan <karthikeyangceb007@gmail.com>
Change-Id: I4824579e997f3fb18033f73d120a8d8dd65024c3

neutronvpn/impl/src/main/java/org/opendaylight/netvirt/neutronvpn/NeutronPortChangeListener.java

index 84a518bb3b33480193c005633b49b8bfddd06d23..52311af4890fd82ab5c123c0271c9d425b8fbcb2 100644 (file)
@@ -896,6 +896,19 @@ public class NeutronPortChangeListener extends AsyncDataTreeChangeListenerBase<P
                             interfaceIdentifier);
             if (!optionalInf.isPresent()) {
                 wrtConfigTxn.put(interfaceIdentifier, inf);
+            } else if (isInterfaceUpdated(inf, optionalInf.get())) {
+               /*
+                Case where an update DTCN wasn't received by this class due to node going down
+                upon cluster reboot or any other unknown reason
+                In such a case, updates contained in the missed DTCN won't be processed and have to be handled
+                explicitly
+                Update of subports (vlanId, splithorizon tag) is handled here
+                Update of portSecurity (PortSecurityEnabled, SecurityGroups, AllowedAddressPairs) add is handled
+                Update of portSecurity update/removed is not handled
+                Update of parentrefs is not handled as parentrefs updation is handled by IFM Oxygen onwards
+                */
+                wrtConfigTxn.put(interfaceIdentifier, inf);
+                LOG.error("Interface {} is already present and is updated", infName);
             } else {
                 LOG.warn("Interface {} is already present", infName);
             }
@@ -905,6 +918,27 @@ public class NeutronPortChangeListener extends AsyncDataTreeChangeListenerBase<P
         return infName;
     }
 
+    // Not for generic use. For a special case where update DTCN isn't received
+    private static boolean isInterfaceUpdated(Interface newInterface, Interface oldInterface) {
+        if (newInterface.augmentation(SplitHorizon.class) != null) {
+            if (oldInterface.augmentation(SplitHorizon.class) == null) {
+                return true;
+            }
+            if (!newInterface.augmentation(SplitHorizon.class).equals(oldInterface
+                    .augmentation(SplitHorizon.class))) {
+                return true;
+            }
+        }
+        if (!newInterface.augmentation(IfL2vlan.class).equals(oldInterface.augmentation(IfL2vlan.class))) {
+            return true;
+        }
+        if (newInterface.augmentation(InterfaceAcl.class) != null && oldInterface
+                .augmentation(InterfaceAcl.class) == null) {
+            return true;
+        }
+        return false;
+    }
+
     private Interface createInterface(Port port) {
         String interfaceName = port.getUuid().getValue();
         IfL2vlan.L2vlanMode l2VlanMode = IfL2vlan.L2vlanMode.Trunk;