[CONTROLLER-1803] WriteTransaction's merge method deletes container data node Created: 13/Dec/17  Updated: 15/Mar/19  Resolved: 15/Mar/19

Status: Resolved
Project: controller
Component/s: mdsal
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Medium
Reporter: Min GU Assignee: Min GU
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File bier-bgp-config.yang    

 Description   

1. version info
we use version 1.6.1-SNAPSHOT
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>odl-mdsal-broker</artifactId>
<version>1.6.1-SNAPSHOT</version>
<type>xml</type>
<classifier>features</classifier>
</dependency>

2. steps
1) Yang file is in the Attachment
2) We use restclient to PUT data ,the red node is a container
http://10.46.45.30:8181/restconf/config/bier-bgp-config:config-bgp-info

<config-bgp-info xmlns="urn:bier:bgp:config">
<local>
<address>192.168.50.20</address>
<as>1</as>
<test-merge/>
</local>
<neighbour>
<address>192.168.50.11</address>
<as>1</as>
</neighbour>
</config-bgp-info>

3) The following code is exectued:

 

----------------------------------------------------------------------------------

// read config-bgp-info from datastroe and populate the result to "configBgpInfo"
ConfigBgpInfo configBgpInfo = null;
final ReadOnlyTransaction transaction = topoManager.getDataBroker().newReadOnlyTransaction();
Optional<ConfigBgpInfo> optionalData;
try {
optionalData = transaction.read(org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType.CONFIGURATION,
configBgpInfoInstanceIdentifier).checkedGet();
if (optionalData.isPresent()) {
configBgpInfo = optionalData.get();
LOG.info("Test merge configBgpInfo---------------{}",configBgpInfo);
} else

{ LOG.info("Test merge : Failed to read "); }

} catch (ReadFailedException e) {
LOG.warn("Test merge failed to read {} ", e);
}
transaction.close();

// use merge to write "configBgpInfo" to datastore
writeTransaction.merge(org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType.CONFIGURATION,
configBgpInfoInstanceIdentifier,configBgpInfo,true);
final CheckedFuture<Void, TransactionCommitFailedException> submitResult = writeTransaction.submit();

try

{ submitResult.get(); }

catch (InterruptedException e)

{ LOG.error("Test merge Test merge Test merge ", e); } catch (ExecutionException e) { LOG.error("Test merge Test merge Test merge ", e); }

LOG.info("Test merge Test merge Test merge Test merge Test merge Test merge Test merge Test merge Test merge");

------------------------------------------------------------------------

4) We use restclient to GET data ,the red node disappears. (The result is estimated to be the same as step2)

http://10.46.45.30:8181/restconf/config/bier-bgp-config:config-bgp-info
<config-bgp-info xmlns="urn:bier:bgp:config">
<local>
<address>192.168.50.20</address>
<as>1</as>
</local>
<neighbour>
<address>192.168.50.11</address>
<as>1</as>
</neighbour>
</config-bgp-info>

 



 Comments   
Comment by Robert Varga [ 14/Nov/18 ]

gu.min1 is this still present?

Generated at Wed Feb 07 19:56:29 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.