MD-SAL API integration
[ovsdb.git] / hwvtepsouthbound / hwvtepsouthbound-impl / src / main / java / org / opendaylight / ovsdb / hwvtepsouthbound / transactions / md / HwvtepPhysicalLocatorRemoveCommand.java
index 78872c8d45ea2c9f6d60b5aac961b7e89625b38c..2fd4cff240ecf3adb9078d48f572010ce042e1c6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 - 2016 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
+ * Copyright (c) 2015 - 2017 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,
@@ -9,9 +9,7 @@
 package org.opendaylight.ovsdb.hwvtepsouthbound.transactions.md;
 
 import java.util.Collection;
-
-import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.mdsal.binding.api.ReadWriteTransaction;
 import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepConnectionInstance;
 import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundMapper;
 import org.opendaylight.ovsdb.lib.message.TableUpdates;
@@ -24,7 +22,8 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 public class HwvtepPhysicalLocatorRemoveCommand extends AbstractTransactionCommand {
 
-    public HwvtepPhysicalLocatorRemoveCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
+    public HwvtepPhysicalLocatorRemoveCommand(HwvtepConnectionInstance key, TableUpdates updates,
+            DatabaseSchema dbSchema) {
         super(key, updates, dbSchema);
     }
 
@@ -32,14 +31,12 @@ public class HwvtepPhysicalLocatorRemoveCommand extends AbstractTransactionComma
     public void execute(ReadWriteTransaction transaction) {
         Collection<PhysicalLocator> deletedPLRows =
                 TyperUtils.extractRowsRemoved(PhysicalLocator.class, getUpdates(), getDbSchema()).values();
-        for (PhysicalLocator pLoc : deletedPLRows) {
+        for (PhysicalLocator locator : deletedPLRows) {
             final InstanceIdentifier<Node> connectionIId = getOvsdbConnectionInstance().getInstanceIdentifier();
             final InstanceIdentifier<TerminationPoint> nodePath = HwvtepSouthboundMapper
-                    .createInstanceIdentifier(connectionIId, pLoc);
-            transaction.delete(LogicalDatastoreType.OPERATIONAL, nodePath);
-            getOvsdbConnectionInstance().getDeviceInfo().removePhysicalLocator(pLoc.getUuid());
+                    .createInstanceIdentifier(connectionIId, locator);
+            addToDeleteTx(transaction, TerminationPoint.class, nodePath, locator.getUuid());
             //TODO: Check if any cleanup is required
         }
     }
-
 }