Bug 5463 : Fixing datapath-id changing behaviour seen while testing with mininet
[vpnservice.git] / interfacemgr / interfacemgr-impl / src / main / java / org / opendaylight / vpnservice / interfacemgr / renderer / ovs / statehelpers / OvsInterfaceTopologyStateRemoveHelper.java
index dd4f25db0712bd1c118d37175d63a1bd7f21e866..ca03320cfd43e56aab62c37d2e6aef7a1cf7cf3d 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,
@@ -31,22 +31,21 @@ public class OvsInterfaceTopologyStateRemoveHelper {
     public static List<ListenableFuture<Void>> removePortFromBridge(InstanceIdentifier<OvsdbBridgeAugmentation> bridgeIid,
                                                                OvsdbBridgeAugmentation bridgeOld, DataBroker dataBroker) {
         List<ListenableFuture<Void>> futures = new ArrayList<>();
-        WriteTransaction t = dataBroker.newWriteOnlyTransaction();;
+        WriteTransaction transaction = dataBroker.newWriteOnlyTransaction();;
         BigInteger dpnId = IfmUtil.getDpnId(bridgeOld.getDatapathId());
 
         if (dpnId == null) {
             LOG.warn("Got Null DPID for Bridge: {}", bridgeOld);
             return futures;
         }
-        BridgeRefEntryKey bridgeRefEntryKey = new BridgeRefEntryKey(dpnId);
-        InstanceIdentifier<BridgeRefEntry> bridgeEntryId =
-                InterfaceMetaUtils.getBridgeRefEntryIdentifier(bridgeRefEntryKey);
-        t.delete(LogicalDatastoreType.OPERATIONAL, bridgeEntryId);
+
+        //delete bridge reference entry in interface meta operational DS
+        InterfaceMetaUtils.deleteBridgeRefEntry(dpnId, transaction);
 
         // FIX for ovsdb bug for delete TEP
         SouthboundUtils.deleteBridge(bridgeIid, dataBroker, futures);
 
-        futures.add(t.submit());
+        futures.add(transaction.submit());
         return futures;
     }
 }
\ No newline at end of file