Making number of components configurable using the central component configuration subsystem.
Change-Id: Ia32c51480913689339a766d9849e792d62f7d133
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 25af7ff..1e0ca6b 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
@@ -203,9 +203,8 @@
// Loads existing property values that may have been set.
private void loadExistingValues(String componentName) {
- // FIXME: implement this by talking to the config admin.
try {
- Configuration cfg = cfgAdmin.getConfiguration(componentName);
+ Configuration cfg = cfgAdmin.getConfiguration(componentName, null);
Map<String, ConfigProperty> map = properties.get(componentName);
Dictionary<String, Object> props = cfg.getProperties();
if (props != null) {
@@ -229,7 +228,7 @@
// after each other.
private void triggerUpdate(String componentName) {
try {
- Configuration cfg = cfgAdmin.getConfiguration(componentName);
+ Configuration cfg = cfgAdmin.getConfiguration(componentName, null);
Map<String, ConfigProperty> map = properties.get(componentName);
Dictionary<String, Object> props = new Hashtable<>();
map.values().forEach(p -> props.put(p.name(), p.value()));
diff --git a/core/net/src/main/java/org/onosproject/net/topology/impl/DefaultTopologyProvider.java b/core/net/src/main/java/org/onosproject/net/topology/impl/DefaultTopologyProvider.java
index 03a7169..956102c 100644
--- a/core/net/src/main/java/org/onosproject/net/topology/impl/DefaultTopologyProvider.java
+++ b/core/net/src/main/java/org/onosproject/net/topology/impl/DefaultTopologyProvider.java
@@ -17,6 +17,7 @@
import static com.google.common.base.Strings.isNullOrEmpty;
import static java.util.concurrent.Executors.newFixedThreadPool;
+import static org.onlab.util.Tools.get;
import static org.onlab.util.Tools.groupedThreads;
import static org.onosproject.core.CoreService.CORE_PROVIDER_ID;
import static org.onosproject.net.device.DeviceEvent.Type.DEVICE_ADDED;
@@ -162,16 +163,16 @@
return;
}
- Dictionary properties = context.getProperties();
+ Dictionary<?, ?> properties = context.getProperties();
int newMaxEvents, newMaxBatchMs, newMaxIdleMs;
try {
- String s = (String) properties.get("maxEvents");
+ String s = get(properties, "maxEvents");
newMaxEvents = isNullOrEmpty(s) ? maxEvents : Integer.parseInt(s.trim());
- s = (String) properties.get("maxBatchMs");
+ s = get(properties, "maxBatchMs");
newMaxBatchMs = isNullOrEmpty(s) ? maxBatchMs : Integer.parseInt(s.trim());
- s = (String) properties.get("maxIdleMs");
+ s = get(properties, "maxIdleMs");
newMaxIdleMs = isNullOrEmpty(s) ? maxIdleMs : Integer.parseInt(s.trim());
} catch (NumberFormatException | ClassCastException e) {