- String resourcePath = getDataStorePath("/config/", context);
- addRootPostLink(m, (DataNodeContainer) node, pathParams, resourcePath, apis);
- addApis(node, apis, resourcePath, pathParams, schemaContext, true);
-
+ String resourcePath;
+
+ /*
+ * Only when the node's config statement is true, such apis as
+ * GET/PUT/POST/DELETE config are added for this node.
+ */
+ if (node.isConfiguration()) { // This node's config statement is
+ // true.
+ resourcePath = getDataStorePath("config", context);
+
+ /*
+ * When there are two or more top container or list nodes
+ * whose config statement is true in module, make sure that
+ * only one root post link is added for this module.
+ */
+ if (!hasAddRootPostLink) {
+ LOG.debug("Has added root post link for module {}", m.getName());
+ addRootPostLink(m, (DataNodeContainer) node, pathParams, resourcePath, "config", apis);
+
+ hasAddRootPostLink = true;
+ }
+
+ addApis(node, apis, resourcePath, pathParams, schemaContext, true, m.getName(), "config");
+ }