Migrate to mergeParentStructurePut() 52/82952/1
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 8 Jul 2019 10:37:47 +0000 (12:37 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 8 Jul 2019 10:55:07 +0000 (12:55 +0200)
This is an intermediate step, eliminating use of the multiplexing
method in favor of being explicit.

Change-Id: I7d4616213eb00b0dd7652fe0f0d2ad47e52eb5b9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 files changed:
bgp/cli/src/test/java/org/opendaylight/protocol/bgp/cli/utils/BGPOperationalStateUtilsTest.java
bgp/openconfig-state/src/main/java/org/opendaylight/protocol/bgp/state/StateProviderImpl.java
bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/bgp/topology/provider/AbstractTopologyBuilder.java
bgp/topology-provider/src/test/java/org/opendaylight/bgpcep/bgp/topology/provider/Ipv4ReachabilityTopologyBuilderTest.java
bgp/topology-provider/src/test/java/org/opendaylight/bgpcep/bgp/topology/provider/Ipv6ReachabilityTopologyBuilderTest.java
bgp/topology-provider/src/test/java/org/opendaylight/bgpcep/bgp/topology/provider/LinkstateTopologyBuilderTest.java
config-loader/bmp-monitors-config-loader/src/main/java/org/opendaylight/bgpcep/config/loader/bmp/BmpMonitorConfigFileProcessor.java
config-loader/protocols-config-loader/src/main/java/org/opendaylight/bgpcep/config/loader/protocols/ProtocolsConfigFileProcessor.java
config-loader/topology-config-loader/src/main/java/org/opendaylight/bgpcep/config/loader/topology/NetworkTopologyConfigFileProcessor.java
pcep/topology/cli/src/test/java/org/opendaylight/protocol/pcep/cli/utils/PcepStateUtilsTest.java
pcep/topology/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/ServerSessionManager.java
pcep/tunnel/tunnel-provider/src/main/java/org/opendaylight/bgpcep/pcep/tunnel/provider/PCEPTunnelTopologyProvider.java
pcep/tunnel/tunnel-provider/src/test/java/org/opendaylight/bgpcep/pcep/tunnel/provider/NodeChangedListenerTest.java
pcep/tunnel/tunnel-provider/src/test/java/org/opendaylight/bgpcep/pcep/tunnel/provider/TunnelProgrammingTest.java
testtool-util/src/test/java/org/opendaylight/protocol/util/CheckUtilTest.java

index 64be9cbe32c5e66ec2fc67e89ac5c41e0c51caab..4bfd225ccdcf2b8cc86cb6abf8ff8a5af9c63222 100644 (file)
@@ -63,7 +63,7 @@ public class BGPOperationalStateUtilsTest extends AbstractConcurrentDataBrokerTe
         final InstanceIdentifier<Bgp> bgpIID = PROTOCOLS_IID
                 .child(Protocol.class, new ProtocolKey(BGP.class, RIB_ID))
                 .augmentation(NetworkInstanceProtocol.class).child(Bgp.class);
-        wt.put(LogicalDatastoreType.OPERATIONAL, bgpIID, bgp, true);
+        wt.mergeParentStructurePut(LogicalDatastoreType.OPERATIONAL, bgpIID, bgp);
         wt.commit().get();
     }
 
index 68e1f8e282a26284bf106469bba050e6d690e493..c813bc8f5d2453302ac203e4669930a6abb0562d 100644 (file)
@@ -160,7 +160,7 @@ public final class StateProviderImpl implements TransactionChainListener, AutoCl
         }
 
         final Bgp bgp = new BgpBuilder().setGlobal(global).setNeighbors(neighbors).setPeerGroups(peerGroups).build();
-        wtx.put(LogicalDatastoreType.OPERATIONAL, bgpIID, bgp, WriteTransaction.CREATE_MISSING_PARENTS);
+        wtx.mergeParentStructurePut(LogicalDatastoreType.OPERATIONAL, bgpIID, bgp);
     }
 
     @Override
index 09eb90c68bac139cdd30edb0ff662cd417c754b8..cd51504876baff3fb9f701b9953a7f9eee1d578c 100644 (file)
@@ -238,10 +238,10 @@ public abstract class AbstractTopologyBuilder<T extends Route> implements Cluste
     private synchronized void initOperationalTopology() {
         requireNonNull(this.chain, "A valid transaction chain must be provided.");
         final WriteTransaction trans = this.chain.newWriteOnlyTransaction();
-        trans.put(LogicalDatastoreType.OPERATIONAL, this.topology,
+        trans.mergeParentStructurePut(LogicalDatastoreType.OPERATIONAL, this.topology,
                 new TopologyBuilder().withKey(this.topologyKey).setServerProvided(Boolean.TRUE)
                         .setTopologyTypes(this.topologyTypes)
-                        .setLink(Collections.emptyList()).setNode(Collections.emptyList()).build(), true);
+                        .setLink(Collections.emptyList()).setNode(Collections.emptyList()).build());
         trans.commit().addCallback(new FutureCallback<CommitInfo>() {
             @Override
             public void onSuccess(final CommitInfo result) {
index da9829c8fac1bcc5f13d19511dd9d112e652b680..69d067e26bf976e0f8c9dbfd7b2eaa1fa863486b 100755 (executable)
@@ -109,7 +109,7 @@ public class Ipv4ReachabilityTopologyBuilderTest extends AbstractTopologyBuilder
 
     private void updateIpv4Route(final Ipv4Route data) {
         final WriteTransaction wTx = getDataBroker().newWriteOnlyTransaction();
-        wTx.put(LogicalDatastoreType.OPERATIONAL, this.ipv4RouteIID, data, true);
+        wTx.mergeParentStructurePut(LogicalDatastoreType.OPERATIONAL, this.ipv4RouteIID, data);
         wTx.commit();
     }
 
index 44a53ba4887665db8499623c7c90b4799173848b..c3471f42c61ca31172b3fc90b314b0842dd95662 100755 (executable)
@@ -108,7 +108,7 @@ public class Ipv6ReachabilityTopologyBuilderTest extends AbstractTopologyBuilder
 
     private void updateIpv6Route(final Ipv6Route data) {
         final WriteTransaction wTx = getDataBroker().newWriteOnlyTransaction();
-        wTx.put(LogicalDatastoreType.OPERATIONAL, this.ipv6RouteIID, data, true);
+        wTx.mergeParentStructurePut(LogicalDatastoreType.OPERATIONAL, this.ipv6RouteIID, data);
         wTx.commit();
     }
 
index beafb177cdd5e806dd932d3680fc8c483a11f4b6..6ff151e5908a6bfa6fdeb8df766e8ef0bb3a6e6a 100755 (executable)
@@ -357,7 +357,7 @@ public class LinkstateTopologyBuilderTest extends AbstractTopologyBuilderTest {
 
     private void updateLinkstateRoute(final LinkstateRoute data) {
         final WriteTransaction wTx = getDataBroker().newWriteOnlyTransaction();
-        wTx.put(LogicalDatastoreType.OPERATIONAL, this.linkstateRouteIID, data, true);
+        wTx.mergeParentStructurePut(LogicalDatastoreType.OPERATIONAL, this.linkstateRouteIID, data);
         wTx.commit();
     }
 
index 999312e45bcabaca8008f898a385660a172e9769..9825a72939c35e5768545750f9430e8075a24b55 100644 (file)
@@ -62,7 +62,7 @@ public final class BmpMonitorConfigFileProcessor implements ConfigFileProcessor,
         final KeyedInstanceIdentifier<BmpMonitorConfig, BmpMonitorConfigKey> iid = ODL_BMP_MONITORS_IID
                 .child(BmpMonitorConfig.class, bmpConfig.key());
 
-        wtx.merge(LogicalDatastoreType.CONFIGURATION, iid, bmpConfig, true);
+        wtx.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, iid, bmpConfig);
     }
 
     public synchronized void init() {
index 950608adefeb1103fc393ee832bb0aa34402cd87..81de4075775b59cabcc45060c52ffba72c3a2939 100644 (file)
@@ -66,7 +66,7 @@ public final class ProtocolsConfigFileProcessor implements ConfigFileProcessor,
     private static void processProtocol(final Protocol protocol, final WriteTransaction wtx) {
         final KeyedInstanceIdentifier<Protocol, ProtocolKey> topologyIIdKeyed =
                 BGP_PROTOCOLS_IID.child(Protocol.class, protocol.key());
-        wtx.merge(LogicalDatastoreType.CONFIGURATION, topologyIIdKeyed, protocol, true);
+        wtx.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, topologyIIdKeyed, protocol);
     }
 
     public synchronized void init() {
index 7578eba07b4215faea82fa77006ac84aab3ba327..170262b37d1bb178ed973c32da03c1c705d9c82d 100644 (file)
@@ -102,6 +102,6 @@ public final class NetworkTopologyConfigFileProcessor implements ConfigFileProce
         LOG.info("Storing Topology {}", topology);
         final KeyedInstanceIdentifier<Topology, TopologyKey> topologyIIdKeyed =
                 InstanceIdentifier.create(NetworkTopology.class).child(Topology.class, topology.key());
-        wtx.merge(LogicalDatastoreType.CONFIGURATION, topologyIIdKeyed, topology, true);
+        wtx.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, topologyIIdKeyed, topology);
     }
 }
index 0f44cd398ac705f216490ad1733551482df67f7a..51c7af13423c4549b2103543cbaaf266304cc67c 100644 (file)
@@ -86,11 +86,11 @@ public class PcepStateUtilsTest extends AbstractConcurrentDataBrokerTest {
         final InstanceIdentifier<Node> topology = InstanceIdentifier.builder(NetworkTopology.class)
                 .child(Topology.class, new TopologyKey(new TopologyId(PCEP_TOPOLOGY)))
                 .child(Node.class, new NodeKey(new NodeId(NODE_ID))).build();
-        wt.put(LogicalDatastoreType.OPERATIONAL, topology, node, true);
+        wt.mergeParentStructurePut(LogicalDatastoreType.OPERATIONAL, topology, node);
         wt.commit().get();
     }
 
-    private PcepSessionState createPcepSessionState() {
+    private static PcepSessionState createPcepSessionState() {
         final LocalPref pref = new LocalPrefBuilder()
                 .setKeepalive((short) 30)
                 .setDeadtimer((short) 120)
index 7b3fd017bc8776ace77f1a2cae1d358c25efdccb..9ff5c9a7abc34384d490d68f8ed9cdf298718918 100755 (executable)
@@ -104,11 +104,11 @@ final class ServerSessionManager implements PCEPSessionListenerFactory, Topology
         final TopologyKey key = InstanceIdentifier.keyOf(this.topology);
         final TopologyId topologyId = key.getTopologyId();
         final WriteTransaction tx = this.dependenciesProvider.getDataBroker().newWriteOnlyTransaction();
-        tx.put(LogicalDatastoreType.OPERATIONAL, this.topology, new TopologyBuilder().withKey(key)
+        tx.mergeParentStructurePut(LogicalDatastoreType.OPERATIONAL, this.topology, new TopologyBuilder().withKey(key)
                 .setTopologyId(topologyId).setTopologyTypes(new TopologyTypesBuilder()
                         .addAugmentation(TopologyTypes1.class, new TopologyTypes1Builder().setTopologyPcep(
                                 new TopologyPcepBuilder().build()).build()).build())
-                .setNode(new ArrayList<>()).build(), true);
+                .setNode(new ArrayList<>()).build());
         try {
             tx.commit().get();
             LOG.info("PCEP Topology {} created successfully.", topologyId.getValue());
index 93c6b658e8a98540b65ecf33b166354f4d330894..9c4b438acae89e811ce7c5538b27db1e5fc4ee06 100644 (file)
@@ -57,13 +57,13 @@ public final class PCEPTunnelTopologyProvider extends DefaultTopologyReference i
 
     synchronized void init() {
         final WriteTransaction tx = this.dataBroker.newWriteOnlyTransaction();
-        tx.put(LogicalDatastoreType.OPERATIONAL, getTopologyReference().getInstanceIdentifier(),
+        tx.mergeParentStructurePut(LogicalDatastoreType.OPERATIONAL, getTopologyReference().getInstanceIdentifier(),
                 new TopologyBuilder().setTopologyId(this.tunneltopologyId)
                         .setTopologyTypes(new TopologyTypesBuilder()
                                 .addAugmentation(TopologyTypes1.class, new TopologyTypes1Builder()
                                         .setTopologyTunnelPcep(
                                                 new TopologyTunnelPcepBuilder().build()).build()).build())
-                        .setNode(new ArrayList<>()).build(), true);
+                        .setNode(new ArrayList<>()).build());
         try {
             tx.commit().get();
         } catch (final InterruptedException | ExecutionException e) {
index 1d2785f6f67dc556105af1e527bbb8b77bc9a675..b2436553fc60f733e29ec592d7991eb73a59ca99 100644 (file)
@@ -88,11 +88,11 @@ public class NodeChangedListenerTest extends AbstractConcurrentDataBrokerTest {
     @Before
     public void setUp() throws InterruptedException, ExecutionException {
         final WriteTransaction wTx = getDataBroker().newWriteOnlyTransaction();
-        wTx.put(LogicalDatastoreType.OPERATIONAL, PCEP_TOPO_IID, new TopologyBuilder()
+        wTx.mergeParentStructurePut(LogicalDatastoreType.OPERATIONAL, PCEP_TOPO_IID, new TopologyBuilder()
                 .withKey(new TopologyKey(PCEP_TOPOLOGY_ID)).setNode(Lists.newArrayList())
-                .setTopologyId(PCEP_TOPOLOGY_ID).build(), true);
-        wTx.put(LogicalDatastoreType.OPERATIONAL, TUNNEL_TOPO_IID, new TopologyBuilder()
-                .withKey(new TopologyKey(TUNNEL_TOPOLOGY_ID)).setTopologyId(TUNNEL_TOPOLOGY_ID).build(), true);
+                .setTopologyId(PCEP_TOPOLOGY_ID).build());
+        wTx.mergeParentStructurePut(LogicalDatastoreType.OPERATIONAL, TUNNEL_TOPO_IID, new TopologyBuilder()
+                .withKey(new TopologyKey(TUNNEL_TOPOLOGY_ID)).setTopologyId(TUNNEL_TOPOLOGY_ID).build());
         wTx.commit().get();
         final NodeChangedListener nodeListener = new NodeChangedListener(getDataBroker(),
                 PCEP_TOPOLOGY_ID, TUNNEL_TOPO_IID);
index 55cfb4efec28cc9580ea09393f810327f9779419..aa4d348ce3fc187e43b847444eda0be19262f316 100644 (file)
@@ -303,7 +303,7 @@ public class TunnelProgrammingTest extends AbstractConcurrentDataBrokerTest {
         topologyBuilder.setNode(Lists.newArrayList(createNode(NODE1_ID, TP1_ID, NODE1_IPV4),
                 createNode(NODE2_ID, TP2_ID, NODE2_IPV4)));
         final WriteTransaction wTx = getDataBroker().newWriteOnlyTransaction();
-        wTx.put(LogicalDatastoreType.OPERATIONAL, TOPO_IID, topologyBuilder.build(), true);
+        wTx.mergeParentStructurePut(LogicalDatastoreType.OPERATIONAL, TOPO_IID, topologyBuilder.build());
         wTx.commit().get();
     }
 
@@ -317,8 +317,8 @@ public class TunnelProgrammingTest extends AbstractConcurrentDataBrokerTest {
         linkBuilder.withKey(new LinkKey(LINK1_ID));
         linkBuilder.addAugmentation(Link1.class, new Link1Builder().setSymbolicPathName(LINK1_ID.getValue()).build());
         final WriteTransaction wTx = getDataBroker().newWriteOnlyTransaction();
-        wTx.put(LogicalDatastoreType.OPERATIONAL, TOPO_IID.builder().child(Link.class, new LinkKey(LINK1_ID)).build(),
-                linkBuilder.build(), true);
+        wTx.mergeParentStructurePut(LogicalDatastoreType.OPERATIONAL,
+            TOPO_IID.builder().child(Link.class, new LinkKey(LINK1_ID)).build(), linkBuilder.build());
         wTx.commit().get();
     }
 
index 07e98e4a8260d74b88a5284d276cd363f85297a0..c2944639a5be057d2e6e75cce2b2e3f170190e70 100644 (file)
@@ -72,7 +72,7 @@ public class CheckUtilTest extends AbstractConcurrentDataBrokerTest {
     public void testWaitFutureSuccess() {
         when(this.future.isSuccess()).thenReturn(true);
         doAnswer(invocation -> {
-            ((GenericFutureListener)invocation.getArguments()[0]).operationComplete(CheckUtilTest.this.future);
+            ((GenericFutureListener)invocation.getArgument(0)).operationComplete(CheckUtilTest.this.future);
             return CheckUtilTest.this.future;
         }).when(this.future).addListener(any());
         waitFutureSuccess(this.future);
@@ -126,10 +126,10 @@ public class CheckUtilTest extends AbstractConcurrentDataBrokerTest {
 
     private void storeTopo(final LogicalDatastoreType dsType) throws ExecutionException, InterruptedException {
         final WriteTransaction wt = getDataBroker().newWriteOnlyTransaction();
-        wt.put(dsType, this.topologyIIdKeyed,
+        wt.mergeParentStructurePut(dsType, this.topologyIIdKeyed,
                 new TopologyBuilder()
                         .setTopologyId(TOPOLOGY_ID)
-                        .build(), true);
+                        .build());
         wt.commit().get();
     }