Fixes in interface manager and aliveness monitor
[vpnservice.git] / interfacemgr / interfacemgr-impl / src / main / java / org / opendaylight / vpnservice / interfacemgr / renderer / ovs / statehelpers / OvsInterfaceStateRemoveHelper.java
index 6947f4026a1ad25f441feec86da9bdf4f689ca1c..b005d4051c8d1ea818221bb4b58865ef304a8528 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
+ * Copyright (c) 2015 - 2016 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -56,13 +56,10 @@ public class OvsInterfaceStateRemoveHelper {
         WriteTransaction transaction = dataBroker.newWriteOnlyTransaction();
 
         InstanceIdentifier<Interface> ifStateId = IfmUtil.buildStateInterfaceId(portName);
-        /* Remove entry from if-index-interface-name map and deallocate Id from Idmanager. */
+
+        // delete the port entry from interface operational DS
         org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface interfaceState =
                 InterfaceManagerCommonUtils.getInterfaceStateFromOperDS(portName, dataBroker);
-        if(interfaceState != null) {
-            InterfaceMetaUtils.removeLportTagInterfaceMap(transaction, idManager, dataBroker, interfaceState.getName(), interfaceState.getIfIndex());
-        }
-
         transaction.delete(LogicalDatastoreType.OPERATIONAL, ifStateId);
 
         InterfaceKey interfaceKey = new InterfaceKey(portName);
@@ -97,7 +94,7 @@ public class OvsInterfaceStateRemoveHelper {
         InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface>
                 higerLayerChildIfStateId = IfmUtil.buildStateInterfaceId(higherlayerChild.getChildInterface());
         Interface higherLayerIfChildState = InterfaceManagerCommonUtils.getInterfaceStateFromOperDS(higherlayerChild.getChildInterface(), dataBroker);
-        if (interfaceState != null) {
+        if (interfaceState != null && higherLayerIfChildState != null) {
             transaction.delete(LogicalDatastoreType.OPERATIONAL, higerLayerChildIfStateId);
             FlowBasedServicesUtils.removeIngressFlow(higherLayerIfChildState.getName(), dpId, transaction);
         }
@@ -142,4 +139,4 @@ public class OvsInterfaceStateRemoveHelper {
         futures.add(transaction.submit());
         return futures;
     }
-}
\ No newline at end of file
+}