Use NetworkTransactionService to access to the DS 06/105506/3
authorGilles Thouenon <gilles.thouenon@orange.com>
Thu, 23 Feb 2023 11:38:27 +0000 (12:38 +0100)
committerGilles Thouenon <gilles.thouenon@orange.com>
Wed, 19 Apr 2023 17:10:57 +0000 (19:10 +0200)
Adapt one GNPy UT to use NetworkTransactionService instead
of managing the transaction directly from a new databroker, since this
dependency is injected and available.

JIRA: TRNSPRTPCE-727
Signed-off-by: Gilles Thouenon <gilles.thouenon@orange.com>
Change-Id: Ifafa74b69918f584b9a715e55b3140650b615013

pce/src/test/java/org/opendaylight/transportpce/pce/gnpy/GnpyUtilitiesImplTest.java

index 4c94f0628456aa486b3e4b4cb914949c365f93c4..829dff338b1e9a367c8dd7fa60c7155750edfe36 100644 (file)
@@ -28,7 +28,6 @@ import org.junit.Assert;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.opendaylight.mdsal.binding.api.WriteTransaction;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.transportpce.common.NetworkUtils;
 import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
@@ -133,9 +132,8 @@ public class GnpyUtilitiesImplTest extends AbstractTest {
             throws InterruptedException, ExecutionException {
         InstanceIdentifier<Network> nwInstanceIdentifier = InstanceIdentifier.builder(Networks.class)
                 .child(Network.class, new NetworkKey(new NetworkId(networkId))).build();
-        WriteTransaction dataWriteTransaction = getDataBroker().newWriteOnlyTransaction();
-        dataWriteTransaction.put(LogicalDatastoreType.CONFIGURATION, nwInstanceIdentifier, network);
-        dataWriteTransaction.commit().get();
+        networkTransaction.put(LogicalDatastoreType.CONFIGURATION, nwInstanceIdentifier, network);
+        networkTransaction.commit().get();
     }
 
     @Test