Added one more Component Config REST API; for specified component and variable.
Change-Id: I810aa90636c55c8b05c146780ad28c307cefff33
(cherry picked from commit f31ac6ff9f72d040b2da80b6ee5c630ccf9dcc55)
diff --git a/core/api/src/main/java/org/onosproject/cfg/ComponentConfigService.java b/core/api/src/main/java/org/onosproject/cfg/ComponentConfigService.java
index d93cd91..b167297 100644
--- a/core/api/src/main/java/org/onosproject/cfg/ComponentConfigService.java
+++ b/core/api/src/main/java/org/onosproject/cfg/ComponentConfigService.java
@@ -81,5 +81,14 @@
*/
void unsetProperty(String componentName, String name);
+ /**
+ * Returns configuration property of the named components.
+ *
+ * @param componentName component name
+ * @param attribute component attribute
+ * @return configuration property
+ */
+ ConfigProperty getProperty(String componentName, String attribute);
+
}
diff --git a/core/api/src/test/java/org/onosproject/cfg/ComponentConfigAdapter.java b/core/api/src/test/java/org/onosproject/cfg/ComponentConfigAdapter.java
index e0e2acc..97fa037 100644
--- a/core/api/src/test/java/org/onosproject/cfg/ComponentConfigAdapter.java
+++ b/core/api/src/test/java/org/onosproject/cfg/ComponentConfigAdapter.java
@@ -57,4 +57,9 @@
public void unsetProperty(String componentName, String name) {
}
+
+ @Override
+ public ConfigProperty getProperty(String componentName, String attribute) {
+ return null;
+ }
}
diff --git a/core/net/src/main/java/org/onosproject/cfg/impl/ComponentConfigManager.java b/core/net/src/main/java/org/onosproject/cfg/impl/ComponentConfigManager.java
index 011733c..0a78bcd 100644
--- a/core/net/src/main/java/org/onosproject/cfg/impl/ComponentConfigManager.java
+++ b/core/net/src/main/java/org/onosproject/cfg/impl/ComponentConfigManager.java
@@ -195,6 +195,19 @@
store.unsetProperty(componentName, name);
}
+ @Override
+ public ConfigProperty getProperty(String componentName, String attribute) {
+ checkPermission(CONFIG_READ);
+
+ Map<String, ConfigProperty> map = properties.get(componentName);
+ if (map != null) {
+ return map.get(attribute);
+ } else {
+ log.error("Attribute {} not present in component {}", attribute, componentName);
+ return null;
+ }
+ }
+
private class InternalStoreDelegate implements ComponentConfigStoreDelegate {
@Override
diff --git a/core/store/dist/src/test/java/org/onosproject/store/intent/impl/GossipIntentStoreTest.java b/core/store/dist/src/test/java/org/onosproject/store/intent/impl/GossipIntentStoreTest.java
index 54f361e..149e64b 100644
--- a/core/store/dist/src/test/java/org/onosproject/store/intent/impl/GossipIntentStoreTest.java
+++ b/core/store/dist/src/test/java/org/onosproject/store/intent/impl/GossipIntentStoreTest.java
@@ -276,5 +276,10 @@
public void unsetProperty(String componentName, String name) {
}
+
+ @Override
+ public ConfigProperty getProperty(String componentName, String attribute) {
+ return null;
+ }
}
}