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();
}
}
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
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) {
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();
}
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();
}
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();
}
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() {
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() {
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);
}
}
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)
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());
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) {
@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);
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();
}
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();
}
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);
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();
}