VNF route did not appear as no parentrefs
[netvirt.git] / 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;