MdsalApiManager cleanup - aclservice 70/76170/5
authorStephen Kitt <skitt@redhat.com>
Mon, 17 Sep 2018 13:12:50 +0000 (15:12 +0200)
committerStephen Kitt <skitt@redhat.com>
Tue, 2 Oct 2018 15:59:05 +0000 (15:59 +0000)
This removes all calls to deprecated methods in MdsalManager, so that
they can be removed in the near future.

Change-Id: Ic4e5503be562b5d9fa008c3ff2b59ddf55760c3b
Signed-off-by: Stephen Kitt <skitt@redhat.com>
aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/AbstractAclServiceImpl.java

index a2083b65b6ddeb56abf97905fb3a63650064d6ba..d33c4653722c71a81140b150d8dcfc56d715e969 100644 (file)
@@ -21,6 +21,7 @@ import java.util.Set;
 import java.util.SortedSet;
 import java.util.stream.Collectors;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.genius.infra.Datastore;
 import org.opendaylight.genius.infra.ManagedNewTransactionRunner;
 import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl;
 import org.opendaylight.genius.mdsalutil.ActionInfo;
@@ -561,17 +562,16 @@ public abstract class AbstractAclServiceImpl implements AclServiceListener {
             List<InstructionInfo> instructions, int addOrRemove) {
         jobCoordinator.enqueueJob(flowName, () -> {
             if (addOrRemove == NwConstants.DEL_FLOW) {
-                FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, tableId, flowId, priority, flowName,
-                        idleTimeOut, hardTimeOut, cookie, matches, null);
                 LOG.trace("Removing Acl Flow DpnId {}, flowId {}", dpId, flowId);
-
-                return Collections.singletonList(mdsalManager.removeFlow(dpId, flowEntity));
-
+                return Collections.singletonList(txRunner.callWithNewReadWriteTransactionAndSubmit(
+                    Datastore.CONFIGURATION, tx -> mdsalManager.removeFlow(tx, dpId, flowId, tableId)));
             } else {
                 FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, tableId, flowId, priority, flowName,
                         idleTimeOut, hardTimeOut, cookie, matches, instructions);
                 LOG.trace("Installing DpnId {}, flowId {}", dpId, flowId);
-                return Collections.singletonList(mdsalManager.installFlow(dpId, flowEntity));
+                return Collections.singletonList(
+                    txRunner.callWithNewWriteOnlyTransactionAndSubmit(Datastore.CONFIGURATION,
+                        tx -> mdsalManager.addFlow(tx, flowEntity)));
             }
         });
     }