Uploaded image for project: 'controller'
  1. controller
  2. CONTROLLER-1803

WriteTransaction's merge method deletes container data node

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Medium Medium
    • None
    • None
    • mdsal
    • None

      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>

       

            gu.min1 Min GU
            gu.min1 Min GU
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: