Add DCS root node as leaf of immutable root of Atomix Tree
Change-Id: If813fa4337250171c08e604df4a45d2aa9b7d32b
(cherry picked from commit 2bdcb5f8ed221c31eaf5809265f47968e9b59387)
diff --git a/apps/config/src/main/java/org/onosproject/config/impl/DistributedDynamicConfigStore.java b/apps/config/src/main/java/org/onosproject/config/impl/DistributedDynamicConfigStore.java
index a143fca..f74e26c 100644
--- a/apps/config/src/main/java/org/onosproject/config/impl/DistributedDynamicConfigStore.java
+++ b/apps/config/src/main/java/org/onosproject/config/impl/DistributedDynamicConfigStore.java
@@ -29,6 +29,7 @@
import org.onosproject.config.FailedException;
import org.onosproject.config.Filter;
import org.onosproject.config.ResourceIdParser;
+import org.onosproject.d.config.DeviceResourceIds;
import org.onosproject.d.config.ResourceIds;
import org.onosproject.store.AbstractStore;
import org.onosproject.store.serializers.KryoNamespaces;
@@ -69,6 +70,7 @@
import static org.onosproject.config.DynamicConfigEvent.Type.NODE_DELETED;
import static org.onosproject.config.DynamicConfigEvent.Type.NODE_UPDATED;
import static org.onosproject.config.DynamicConfigEvent.Type.UNKNOWN_OPRN;
+import static org.onosproject.d.config.DeviceResourceIds.DCS_NAMESPACE;
/**
* Implementation of the dynamic config store.
@@ -146,6 +148,13 @@
throw new FailedException("Invalid ResourceId, cannot create Node");
}
if (spath.equals(ResourceIdParser.ROOT)) {
+ //If not present, adding static ROOT node after immutable documentTree root.
+ if (complete(keystore.get(DocumentPath.from(spath))) == null) {
+ addLeaf(spath, LeafNode.builder(DeviceResourceIds.ROOT_NAME, DCS_NAMESPACE)
+ .type(DataNode.Type.SINGLE_INSTANCE_NODE).build());
+ }
+ ResourceId abs = ResourceIds.resourceId(parent, node);
+ parseNode(ResourceIdParser.parseResId(abs), node);
return CompletableFuture.completedFuture(true);
} else if (complete(keystore.get(DocumentPath.from(spath))) == null) {
throw new FailedException("Node or parent does not exist for " + spath);