FIxed netcfg CLI to avoid double-nesting configs.
Change-Id: I4b988cdf437c40059b3f2bbfcff4e216eadea034
diff --git a/cli/src/main/java/org/onosproject/cli/cfg/NetworkConfigCommand.java b/cli/src/main/java/org/onosproject/cli/cfg/NetworkConfigCommand.java
index 9d2e36f..d225248 100644
--- a/cli/src/main/java/org/onosproject/cli/cfg/NetworkConfigCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/cfg/NetworkConfigCommand.java
@@ -63,7 +63,7 @@
if (isNullOrEmpty(configKey)) {
addSubject(root, s);
} else {
- addSubjectConfig(root, getConfig(s, configKey));
+ root = getSubjectConfig(getConfig(s, configKey));
}
}
}
@@ -86,14 +86,11 @@
}
private void addSubject(ObjectNode root, Object s) {
- service.getConfigs(s)
- .forEach(c -> addSubjectConfig(newObject(root, c.key()), getConfig(s, c.key())));
+ service.getConfigs(s).forEach(c -> root.set(c.key(), c.node()));
}
- private void addSubjectConfig(ObjectNode root, Config config) {
- if (config != null) {
- root.set(config.key(), config.node());
- }
+ private ObjectNode getSubjectConfig(Config config) {
+ return config != null ? config.node() : null;
}
private Config getConfig(Object s, String ck) {