Do not store empty node list 67/82167/5
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 20 May 2019 06:36:52 +0000 (08:36 +0200)
committerAnil Vishnoi <vishnoianil@gmail.com>
Thu, 1 Aug 2019 22:43:33 +0000 (22:43 +0000)
Empty node list does not have a semantic meaning and will be
turned into a non-existent list when it becomes empty again.

Do not store it in the datastore.

Change-Id: I8d85650ffe51ec96e243482230c91da9f9e8f402
JIRA: OPNFLWPLUG-1052
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
applications/forwardingrules-manager/src/test/java/test/mock/util/FRMTest.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/DeviceInitializationUtil.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/DeviceInitializationUtilTest.java

index fc3768289a605f53a9fb1c082c6bc25d350f866e..125678fc1843b5c1dd15f913ebc3c7409f4527a2 100644 (file)
@@ -9,7 +9,6 @@ package test.mock.util;
 
 import com.google.common.util.concurrent.FluentFuture;
 import com.google.common.util.concurrent.ListenableFuture;
-import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutionException;
@@ -35,7 +34,7 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 public abstract class FRMTest extends AbstractDataBrokerTest {
 
     public void addFlowCapableNode(NodeKey nodeKey) {
-        Nodes nodes = new NodesBuilder().setNode(Collections.emptyList()).build();
+        Nodes nodes = new NodesBuilder().build();
 
         FlowCapableNodeBuilder fcnBuilder = new FlowCapableNodeBuilder();
         NodeBuilder nodeBuilder = new NodeBuilder();
@@ -67,7 +66,7 @@ public abstract class FRMTest extends AbstractDataBrokerTest {
 
     public void addTable(final TableKey tableKey, final NodeKey nodeKey) {
         addFlowCapableNode(nodeKey);
-        final Table table = new TableBuilder().withKey(tableKey).setFlow(Collections.emptyList()).build();
+        final Table table = new TableBuilder().withKey(tableKey).build();
         WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
         InstanceIdentifier<Table> tableII = InstanceIdentifier.create(Nodes.class).child(Node.class, nodeKey)
                 .augmentation(FlowCapableNode.class).child(Table.class, tableKey);
index cc1de1297788775d3853412cb7572b3aecebaae6..551d65a0dabbafbb91c4e001600b8604e69274ac 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.openflowplugin.impl.util;
 
 import java.net.InetSocketAddress;
-import java.util.Collections;
 import java.util.Optional;
 import java.util.concurrent.ExecutionException;
 import org.opendaylight.mdsal.binding.api.DataBroker;
@@ -53,7 +52,6 @@ public final class DeviceInitializationUtil {
 
         try {
             tx.merge(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(Nodes.class), new NodesBuilder()
-                    .setNode(Collections.emptyList())
                     .build());
             tx.commit().get();
         } catch (ExecutionException | InterruptedException e) {
index cbceb9e8f25f48e86e0dd1432a6bbc790a1fce44..e59364f3a6e74bedab600ce35cb4d52242feacb4 100644 (file)
@@ -16,7 +16,6 @@ import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
 import java.net.InetSocketAddress;
-import java.util.Collections;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -88,7 +87,6 @@ public class DeviceInitializationUtilTest {
         verify(dataBroker).newWriteOnlyTransaction();
         verify(writeTransaction).merge(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier
                 .create(Nodes.class), new NodesBuilder()
-                .setNode(Collections.emptyList())
                 .build());
         verify(writeTransaction).commit();
     }
@@ -118,4 +116,4 @@ public class DeviceInitializationUtilTest {
         assertEquals(TABLES, switchFeatures.getMaxTables().shortValue());
     }
 
-}
\ No newline at end of file
+}