Use property constants for OSGi components for stores
Change-Id: I5d21075abb453d5bc54e02653d5a96746e6a074e
diff --git a/core/store/dist/src/main/java/org/onosproject/store/OsgiPropertyConstants.java b/core/store/dist/src/main/java/org/onosproject/store/OsgiPropertyConstants.java
new file mode 100644
index 0000000..4a9d041
--- /dev/null
+++ b/core/store/dist/src/main/java/org/onosproject/store/OsgiPropertyConstants.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.store;
+
+/**
+ * Name/Value constants for properties.
+ */
+public final class OsgiPropertyConstants {
+ private OsgiPropertyConstants() {
+ }
+
+ //@Property(name = "msgHandlerPoolSize", intValue = MESSAGE_HANDLER_THREAD_POOL_SIZE,
+ // label = "Number of threads in the message handler pool")
+ public static final String MESSAGE_HANDLER_THREAD_POOL_SIZE = "msgHandlerPoolSize:Integer";
+ public static final int MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT = 8;
+
+ //@Property(name = "backupPeriod", intValue = BACKUP_PERIOD_MILLIS,
+ // label = "Delay in ms between successive backup runs")
+ public static final String BACKUP_PERIOD_MILLIS = "backupPeriod:Integer";
+ public static final int BACKUP_PERIOD_MILLIS_DEFAULT = 2000;
+
+ //@Property(name = "antiEntropyPeriod", intValue = ANTI_ENTROPY_PERIOD_MILLIS,
+ // label = "Delay in ms between anti-entropy runs")
+ public static final String ANTI_ENTROPY_PERIOD_MILLIS = "antiEntropyPeriod:Integer";
+ public static final int ANTI_ENTROPY_PERIOD_MILLIS_DEFAULT = 5000;
+
+ //@Property(name = "persistenceEnabled", boolValue = false,
+ // label = "Indicates whether or not changes in the flow table should be persisted to disk.")
+ public static final String EC_FLOW_RULE_STORE_PERSISTENCE_ENABLED = "ECFlowRuleStorePersistenceEnabled:Boolean";
+ public static final boolean EC_FLOW_RULE_STORE_PERSISTENCE_ENABLED_DEFAULT = false;
+
+ //@Property(name = "backupCount", intValue = DEFAULT_MAX_BACKUP_COUNT,
+ // label = "Max number of backup copies for each device")
+ public static final String MAX_BACKUP_COUNT = "backupCount:Integer";
+ public static final int MAX_BACKUP_COUNT_DEFAULT = 2;
+
+ //@Property(name = "heartbeatInterval", intValue = DEFAULT_HEARTBEAT_INTERVAL,
+ // label = "Interval time to send heartbeat to other controller nodes (millisecond)")
+ public static final String HEARTBEAT_INTERVAL = "heartbeatInterval:Integer";
+ public static final int HEARTBEAT_INTERVAL_DEFAULT = 100;
+
+ //@Property(name = "phiFailureThreshold", intValue = DEFAULT_PHI_FAILURE_THRESHOLD,
+ // label = "the value of Phi threshold to detect accrual failure")
+ public static final String PHI_FAILURE_THRESHOLD = "phiFailureThreshold:Integer";
+ public static final int PHI_FAILURE_THRESHOLD_DEFAULT = 10;
+
+ //@Property(name = "minStandardDeviationMillis", longValue = DEFAULT_MIN_STANDARD_DEVIATION_MILLIS,
+ // label = "The minimum standard deviation to take into account when computing the Phi value")
+ public static final String MIN_STANDARD_DEVIATION_MILLIS = "minStandardDeviationMillis:Long";
+ public static final long MIN_STANDARD_DEVIATION_MILLIS_DEFAULT = 50;
+
+ //@Property(name = "electionTimeoutMillis", longValue = DEFAULT_ELECTION_TIMEOUT_MILLIS,
+ // label = "the leader election timeout in milliseconds")
+ public static final String ELECTION_TIMEOUT_MILLIS = "electionTimeoutMillis:Long";
+ public static final long ELECTION_TIMEOUT_MILLIS_DEFAULT = 2500;
+
+ //@Property(name = "garbageCollect", boolValue = GARBAGE_COLLECT,
+ // label = "Enable group garbage collection")
+ public static final String GARBAGE_COLLECT = "garbageCollect:Boolean";
+ public static final boolean GARBAGE_COLLECT_DEFAULT = false;
+
+ //@Property(name = "gcThresh", intValue = GC_THRESH,
+ // label = "Number of rounds for group garbage collection")
+ public static final String GARBAGE_COLLECT_THRESH = "gcThresh:Integer";
+ public static final int GARBAGE_COLLECT_THRESH_DEFAULT = 6;
+
+ //@Property(name = "allowExtraneousGroups", boolValue = ALLOW_EXTRANEOUS_GROUPS,
+ // label = "Allow groups in switches not installed by ONOS")
+ public static final String ALLOW_EXTRANEOUS_GROUPS = "garbageCollect:Boolean";
+ public static final boolean ALLOW_EXTRANEOUS_GROUPS_DEFAULT = false;
+
+ //@Property(name = "persistenceEnabled", boolValue = PERSIST,
+ // label = "EXPERIMENTAL: Enable intent persistence")
+ public static final String GIS_PERSISTENCE_ENABLED = "GISPersistenceEnabled:Boolean";
+ public static final boolean GIS_PERSISTENCE_ENABLED_DEFAULT = false;
+
+ //@Property(name = "messageHandlerThreadPoolSize", intValue = DEFAULT_MESSAGE_HANDLER_THREAD_POOL_SIZE,
+ // label = "Size of thread pool to assign message handler")
+ public static final String DPS_MESSAGE_HANDLER_THREAD_POOL_SIZE = "DPSMessageHandlerThreadPoolSize:Integer";
+ public static final int DPS_MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT = 4;
+
+ //@Property(name = "messageHandlerThreadPoolSize", intValue = DEFAULT_MESSAGE_HANDLER_THREAD_POOL_SIZE,
+ // label = "Size of thread pool to assign message handler")
+ public static final String DFS_MESSAGE_HANDLER_THREAD_POOL_SIZE = "DFSMessageHandlerThreadPoolSize:Integer";
+ public static final int DFS_MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT = 4;
+
+ //@Property(name = "messageHandlerThreadPoolSize", intValue = DEFAULT_MESSAGE_HANDLER_THREAD_POOL_SIZE,
+ // label = "Size of thread pool to assign message handler")
+ public static final String DSS_MESSAGE_HANDLER_THREAD_POOL_SIZE = "DFSMessageHandlerThreadPoolSize:Integer";
+ public static final int DSS_MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT = 4;
+
+ //@Property(name = "linkWeightFunction", value = DEFAULT_LINK_WEIGHT_FUNCTION,
+ // label = "Default link-weight function: hopCount, linkMetric, geoDistance")
+ public static final String LINK_WEIGHT_FUNCTION = "linkWeightFunction";
+ public static final String LINK_WEIGHT_FUNCTION_DEFAULT = "hopCount";
+}
diff --git a/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/DistributedClusterStore.java b/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/DistributedClusterStore.java
index f50ddbb..823bcba 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/DistributedClusterStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/DistributedClusterStore.java
@@ -67,11 +67,23 @@
import static org.onosproject.cluster.ClusterEvent.Type.INSTANCE_DEACTIVATED;
import static org.onosproject.cluster.ClusterEvent.Type.INSTANCE_READY;
import static org.slf4j.LoggerFactory.getLogger;
-@Component(enabled = false, service = ClusterStore.class)
+import static org.onosproject.store.OsgiPropertyConstants.*;
+
/**
* Distributed cluster nodes store that employs an accrual failure
* detector to identify cluster member up/down status.
*/
+
+@Component(
+ enabled = false,
+ service = ClusterStore.class,
+ property = {
+ HEARTBEAT_INTERVAL + "=" + HEARTBEAT_INTERVAL_DEFAULT,
+ PHI_FAILURE_THRESHOLD + "=" + PHI_FAILURE_THRESHOLD_DEFAULT,
+ MIN_STANDARD_DEVIATION_MILLIS + "=" + MIN_STANDARD_DEVIATION_MILLIS_DEFAULT
+ }
+)
+
public class DistributedClusterStore
extends AbstractStore<ClusterEvent, ClusterStoreDelegate>
implements ClusterStore {
@@ -80,20 +92,17 @@
public static final String HEARTBEAT_MESSAGE = "onos-cluster-heartbeat";
- private static final int DEFAULT_HEARTBEAT_INTERVAL = 100;
//@Property(name = "heartbeatInterval", intValue = DEFAULT_HEARTBEAT_INTERVAL,
// label = "Interval time to send heartbeat to other controller nodes (millisecond)")
- private int heartbeatInterval = DEFAULT_HEARTBEAT_INTERVAL;
+ private int heartbeatInterval = HEARTBEAT_INTERVAL_DEFAULT;
- private static final int DEFAULT_PHI_FAILURE_THRESHOLD = 10;
//@Property(name = "phiFailureThreshold", intValue = DEFAULT_PHI_FAILURE_THRESHOLD,
// label = "the value of Phi threshold to detect accrual failure")
- private int phiFailureThreshold = DEFAULT_PHI_FAILURE_THRESHOLD;
+ private int phiFailureThreshold = PHI_FAILURE_THRESHOLD_DEFAULT;
- private static final long DEFAULT_MIN_STANDARD_DEVIATION_MILLIS = 50;
//@Property(name = "minStandardDeviationMillis", longValue = DEFAULT_MIN_STANDARD_DEVIATION_MILLIS,
// label = "The minimum standard deviation to take into account when computing the Phi value")
- private long minStandardDeviationMillis = DEFAULT_MIN_STANDARD_DEVIATION_MILLIS;
+ private long minStandardDeviationMillis = MIN_STANDARD_DEVIATION_MILLIS_DEFAULT;
private static final Serializer SERIALIZER = Serializer.using(
KryoNamespace.newBuilder()
@@ -383,11 +392,11 @@
if ("heartbeatInterval".equals(property.name())) {
String s = property.value();
if (s == null) {
- setHeartbeatInterval(DEFAULT_HEARTBEAT_INTERVAL);
+ setHeartbeatInterval(HEARTBEAT_INTERVAL_DEFAULT);
log.info("Heartbeat interval time is not configured, default value is {}",
- DEFAULT_HEARTBEAT_INTERVAL);
+ HEARTBEAT_INTERVAL_DEFAULT);
} else {
- int newHeartbeatInterval = isNullOrEmpty(s) ? DEFAULT_HEARTBEAT_INTERVAL
+ int newHeartbeatInterval = isNullOrEmpty(s) ? HEARTBEAT_INTERVAL_DEFAULT
: Integer.parseInt(s.trim());
if (newHeartbeatInterval > 0 && heartbeatInterval != newHeartbeatInterval) {
heartbeatInterval = newHeartbeatInterval;
@@ -400,11 +409,11 @@
if ("phiFailureThreshold".equals(property.name())) {
String s = property.value();
if (s == null) {
- setPhiFailureThreshold(DEFAULT_PHI_FAILURE_THRESHOLD);
+ setPhiFailureThreshold(PHI_FAILURE_THRESHOLD_DEFAULT);
log.info("Phi failure threshold is not configured, default value is {}",
- DEFAULT_PHI_FAILURE_THRESHOLD);
+ PHI_FAILURE_THRESHOLD_DEFAULT);
} else {
- int newPhiFailureThreshold = isNullOrEmpty(s) ? DEFAULT_HEARTBEAT_INTERVAL
+ int newPhiFailureThreshold = isNullOrEmpty(s) ? HEARTBEAT_INTERVAL_DEFAULT
: Integer.parseInt(s.trim());
setPhiFailureThreshold(newPhiFailureThreshold);
log.info("Configured. Phi failure threshold is configured to {}",
@@ -414,12 +423,12 @@
if ("minStandardDeviationMillis".equals(property.name())) {
String s = property.value();
if (s == null) {
- setMinStandardDeviationMillis(DEFAULT_MIN_STANDARD_DEVIATION_MILLIS);
+ setMinStandardDeviationMillis(MIN_STANDARD_DEVIATION_MILLIS_DEFAULT);
log.info("Minimum standard deviation is not configured, default value is {}",
- DEFAULT_MIN_STANDARD_DEVIATION_MILLIS);
+ MIN_STANDARD_DEVIATION_MILLIS_DEFAULT);
} else {
long newMinStandardDeviationMillis = isNullOrEmpty(s)
- ? DEFAULT_MIN_STANDARD_DEVIATION_MILLIS
+ ? MIN_STANDARD_DEVIATION_MILLIS_DEFAULT
: Long.parseLong(s.trim());
setMinStandardDeviationMillis(newMinStandardDeviationMillis);
log.info("Configured. Minimum standard deviation is configured to {}",
@@ -441,7 +450,7 @@
heartbeatInterval = interval;
} catch (IllegalArgumentException e) {
log.warn(e.getMessage());
- heartbeatInterval = DEFAULT_HEARTBEAT_INTERVAL;
+ heartbeatInterval = HEARTBEAT_INTERVAL_DEFAULT;
}
}
@@ -466,7 +475,7 @@
failureDetector = new PhiAccrualFailureDetector(minStandardDeviationMillis);
} catch (IllegalArgumentException e) {
log.warn(e.getMessage());
- this.minStandardDeviationMillis = DEFAULT_MIN_STANDARD_DEVIATION_MILLIS;
+ this.minStandardDeviationMillis = MIN_STANDARD_DEVIATION_MILLIS_DEFAULT;
failureDetector = new PhiAccrualFailureDetector(this.minStandardDeviationMillis);
}
}
diff --git a/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/DistributedLeadershipStore.java b/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/DistributedLeadershipStore.java
index 92ef75a..f8a07fb 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/DistributedLeadershipStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/DistributedLeadershipStore.java
@@ -54,12 +54,19 @@
import static org.onlab.util.Tools.groupedThreads;
import static org.osgi.service.component.annotations.ReferenceCardinality.MANDATORY;
import static org.slf4j.LoggerFactory.getLogger;
+import static org.onosproject.store.OsgiPropertyConstants.*;
/**
* Implementation of {@code LeadershipStore} that makes use of a {@link LeaderElector}
* primitive.
*/
-@Component(immediate = true, service = LeadershipStore.class)
+@Component(
+ immediate = true,
+ service = LeadershipStore.class,
+ property = {
+ ELECTION_TIMEOUT_MILLIS + "=" + ELECTION_TIMEOUT_MILLIS_DEFAULT
+ }
+)
public class DistributedLeadershipStore
extends AbstractStore<LeadershipEvent, LeadershipStoreDelegate>
implements LeadershipStore {
@@ -83,10 +90,9 @@
@Reference(cardinality = MANDATORY)
protected UpgradeService upgradeService;
- private static final long DEFAULT_ELECTION_TIMEOUT_MILLIS = 2500;
//@Property(name = "electionTimeoutMillis", longValue = DEFAULT_ELECTION_TIMEOUT_MILLIS,
// label = "the leader election timeout in milliseconds")
- private long electionTimeoutMillis = DEFAULT_ELECTION_TIMEOUT_MILLIS;
+ private long electionTimeoutMillis = ELECTION_TIMEOUT_MILLIS_DEFAULT;
private ExecutorService statusChangeHandler;
private NodeId localNodeId;
@@ -190,7 +196,7 @@
newElectionTimeoutMillis = isNullOrEmpty(s) ? electionTimeoutMillis : Long.parseLong(s.trim());
} catch (NumberFormatException | ClassCastException e) {
log.warn("Malformed configuration detected; using defaults", e);
- newElectionTimeoutMillis = DEFAULT_ELECTION_TIMEOUT_MILLIS;
+ newElectionTimeoutMillis = ELECTION_TIMEOUT_MILLIS_DEFAULT;
}
if (newElectionTimeoutMillis != electionTimeoutMillis) {
diff --git a/core/store/dist/src/main/java/org/onosproject/store/flow/impl/ECFlowRuleStore.java b/core/store/dist/src/main/java/org/onosproject/store/flow/impl/ECFlowRuleStore.java
index b24414b..9084ede 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/flow/impl/ECFlowRuleStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/flow/impl/ECFlowRuleStore.java
@@ -105,42 +105,49 @@
import static org.onosproject.store.flow.impl.ECFlowRuleStoreMessageSubjects.REMOVE_FLOW_ENTRY;
import static org.slf4j.LoggerFactory.getLogger;
+import static org.onosproject.store.OsgiPropertyConstants.*;
+
/**
* Manages inventory of flow rules using a distributed state management protocol.
*/
-@Component(immediate = true, service = FlowRuleStore.class)
+@Component(
+ immediate = true,
+ service = FlowRuleStore.class,
+ property = {
+ MESSAGE_HANDLER_THREAD_POOL_SIZE + "=" + MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT,
+ BACKUP_PERIOD_MILLIS + "=" + BACKUP_PERIOD_MILLIS_DEFAULT,
+ ANTI_ENTROPY_PERIOD_MILLIS + "=" + ANTI_ENTROPY_PERIOD_MILLIS_DEFAULT,
+ EC_FLOW_RULE_STORE_PERSISTENCE_ENABLED + "=" + EC_FLOW_RULE_STORE_PERSISTENCE_ENABLED_DEFAULT,
+ MAX_BACKUP_COUNT + "=" + MAX_BACKUP_COUNT_DEFAULT
+ }
+)
public class ECFlowRuleStore
extends AbstractStore<FlowRuleBatchEvent, FlowRuleStoreDelegate>
implements FlowRuleStore {
private final Logger log = getLogger(getClass());
- private static final int MESSAGE_HANDLER_THREAD_POOL_SIZE = 8;
- private static final int DEFAULT_MAX_BACKUP_COUNT = 2;
- private static final boolean DEFAULT_PERSISTENCE_ENABLED = false;
- private static final int DEFAULT_BACKUP_PERIOD_MILLIS = 2000;
- private static final int DEFAULT_ANTI_ENTROPY_PERIOD_MILLIS = 5000;
private static final long FLOW_RULE_STORE_TIMEOUT_MILLIS = 5000;
//@Property(name = "msgHandlerPoolSize", intValue = MESSAGE_HANDLER_THREAD_POOL_SIZE,
// label = "Number of threads in the message handler pool")
- private int msgHandlerPoolSize = MESSAGE_HANDLER_THREAD_POOL_SIZE;
+ private int msgHandlerPoolSize = MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT;
- //@Property(name = "backupPeriod", intValue = DEFAULT_BACKUP_PERIOD_MILLIS,
+ //@Property(name = "backupPeriod", intValue = BACKUP_PERIOD_MILLIS,
// label = "Delay in ms between successive backup runs")
- private int backupPeriod = DEFAULT_BACKUP_PERIOD_MILLIS;
+ private int backupPeriod = BACKUP_PERIOD_MILLIS_DEFAULT;
- //@Property(name = "antiEntropyPeriod", intValue = DEFAULT_ANTI_ENTROPY_PERIOD_MILLIS,
+ //@Property(name = "antiEntropyPeriod", intValue = ANTI_ENTROPY_PERIOD_MILLIS,
// label = "Delay in ms between anti-entropy runs")
- private int antiEntropyPeriod = DEFAULT_ANTI_ENTROPY_PERIOD_MILLIS;
+ private int antiEntropyPeriod = ANTI_ENTROPY_PERIOD_MILLIS_DEFAULT;
//@Property(name = "persistenceEnabled", boolValue = false,
// label = "Indicates whether or not changes in the flow table should be persisted to disk.")
- private boolean persistenceEnabled = DEFAULT_PERSISTENCE_ENABLED;
+ private boolean persistenceEnabled = EC_FLOW_RULE_STORE_PERSISTENCE_ENABLED_DEFAULT;
//@Property(name = "backupCount", intValue = DEFAULT_MAX_BACKUP_COUNT,
// label = "Max number of backup copies for each device")
- private volatile int backupCount = DEFAULT_MAX_BACKUP_COUNT;
+ private volatile int backupCount = MAX_BACKUP_COUNT_DEFAULT;
private InternalFlowTable flowTable = new InternalFlowTable();
@@ -272,10 +279,10 @@
s = get(properties, "antiEntropyPeriod");
newAntiEntropyPeriod = isNullOrEmpty(s) ? antiEntropyPeriod : Integer.parseInt(s.trim());
} catch (NumberFormatException | ClassCastException e) {
- newPoolSize = MESSAGE_HANDLER_THREAD_POOL_SIZE;
- newBackupPeriod = DEFAULT_BACKUP_PERIOD_MILLIS;
- newBackupCount = DEFAULT_MAX_BACKUP_COUNT;
- newAntiEntropyPeriod = DEFAULT_ANTI_ENTROPY_PERIOD_MILLIS;
+ newPoolSize = MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT;
+ newBackupPeriod = BACKUP_PERIOD_MILLIS_DEFAULT;
+ newBackupCount = MAX_BACKUP_COUNT_DEFAULT;
+ newAntiEntropyPeriod = ANTI_ENTROPY_PERIOD_MILLIS_DEFAULT;
}
if (newBackupPeriod != backupPeriod) {
diff --git a/core/store/dist/src/main/java/org/onosproject/store/group/impl/DistributedGroupStore.java b/core/store/dist/src/main/java/org/onosproject/store/group/impl/DistributedGroupStore.java
index 98a3f02..27d8ed7 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/group/impl/DistributedGroupStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/group/impl/DistributedGroupStore.java
@@ -93,22 +93,33 @@
import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor;
import static org.onlab.util.Tools.get;
import static org.onlab.util.Tools.groupedThreads;
+import static org.onosproject.store.OsgiPropertyConstants.ALLOW_EXTRANEOUS_GROUPS;
+import static org.onosproject.store.OsgiPropertyConstants.ALLOW_EXTRANEOUS_GROUPS_DEFAULT;
+import static org.onosproject.store.OsgiPropertyConstants.GARBAGE_COLLECT;
+import static org.onosproject.store.OsgiPropertyConstants.GARBAGE_COLLECT_DEFAULT;
+import static org.onosproject.store.OsgiPropertyConstants.GARBAGE_COLLECT_THRESH;
+import static org.onosproject.store.OsgiPropertyConstants.GARBAGE_COLLECT_THRESH_DEFAULT;
import static org.slf4j.LoggerFactory.getLogger;
/**
* Manages inventory of group entries using distributed group stores from the
* storage service.
*/
-@Component(immediate = true, service = GroupStore.class)
+@Component(
+ immediate = true,
+ service = GroupStore.class,
+ property = {
+ GARBAGE_COLLECT + "=" + GARBAGE_COLLECT_DEFAULT,
+ GARBAGE_COLLECT_THRESH + "=" + GARBAGE_COLLECT_THRESH_DEFAULT,
+ ALLOW_EXTRANEOUS_GROUPS + "=" + ALLOW_EXTRANEOUS_GROUPS_DEFAULT
+ }
+)
public class DistributedGroupStore
extends AbstractStore<GroupEvent, GroupStoreDelegate>
implements GroupStore {
private final Logger log = getLogger(getClass());
- private static final boolean GARBAGE_COLLECT = false;
- private static final int GC_THRESH = 6;
- private static final boolean ALLOW_EXTRANEOUS_GROUPS = true;
private static final int MAX_FAILED_ATTEMPTS = 3;
private final int dummyId = 0xffffffff;
@@ -161,15 +172,15 @@
//@Property(name = "garbageCollect", boolValue = GARBAGE_COLLECT,
// label = "Enable group garbage collection")
- private boolean garbageCollect = GARBAGE_COLLECT;
+ private boolean garbageCollect = GARBAGE_COLLECT_DEFAULT;
//@Property(name = "gcThresh", intValue = GC_THRESH,
// label = "Number of rounds for group garbage collection")
- private int gcThresh = GC_THRESH;
+ private int gcThresh = GARBAGE_COLLECT_THRESH_DEFAULT;
//@Property(name = "allowExtraneousGroups", boolValue = ALLOW_EXTRANEOUS_GROUPS,
// label = "Allow groups in switches not installed by ONOS")
- private boolean allowExtraneousGroups = ALLOW_EXTRANEOUS_GROUPS;
+ private boolean allowExtraneousGroups = ALLOW_EXTRANEOUS_GROUPS_DEFAULT;
@Activate
public void activate(ComponentContext context) {
@@ -259,17 +270,17 @@
try {
String s = get(properties, "garbageCollect");
- garbageCollect = isNullOrEmpty(s) ? GARBAGE_COLLECT : Boolean.parseBoolean(s.trim());
+ garbageCollect = isNullOrEmpty(s) ? GARBAGE_COLLECT_DEFAULT : Boolean.parseBoolean(s.trim());
s = get(properties, "gcThresh");
- gcThresh = isNullOrEmpty(s) ? GC_THRESH : Integer.parseInt(s.trim());
+ gcThresh = isNullOrEmpty(s) ? GARBAGE_COLLECT_THRESH_DEFAULT : Integer.parseInt(s.trim());
s = get(properties, "allowExtraneousGroups");
- allowExtraneousGroups = isNullOrEmpty(s) ? ALLOW_EXTRANEOUS_GROUPS : Boolean.parseBoolean(s.trim());
+ allowExtraneousGroups = isNullOrEmpty(s) ? ALLOW_EXTRANEOUS_GROUPS_DEFAULT : Boolean.parseBoolean(s.trim());
} catch (Exception e) {
- gcThresh = GC_THRESH;
- garbageCollect = GARBAGE_COLLECT;
- allowExtraneousGroups = ALLOW_EXTRANEOUS_GROUPS;
+ gcThresh = GARBAGE_COLLECT_THRESH_DEFAULT;
+ garbageCollect = GARBAGE_COLLECT_DEFAULT;
+ allowExtraneousGroups = ALLOW_EXTRANEOUS_GROUPS_DEFAULT;
}
}
diff --git a/core/store/dist/src/main/java/org/onosproject/store/intent/impl/GossipIntentStore.java b/core/store/dist/src/main/java/org/onosproject/store/intent/impl/GossipIntentStore.java
index f139f47..b8bf434 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/intent/impl/GossipIntentStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/intent/impl/GossipIntentStore.java
@@ -65,15 +65,22 @@
import static com.google.common.base.Strings.isNullOrEmpty;
import static org.onlab.util.Tools.get;
import static org.onosproject.net.intent.IntentState.PURGE_REQ;
+import static org.onosproject.store.OsgiPropertyConstants.GIS_PERSISTENCE_ENABLED;
+import static org.onosproject.store.OsgiPropertyConstants.GIS_PERSISTENCE_ENABLED_DEFAULT;
import static org.slf4j.LoggerFactory.getLogger;
-
/**
* Manages inventory of Intents in a distributed data store that uses optimistic
* replication and gossip based techniques.
*/
//FIXME we should listen for leadership changes. if the local instance has just
// ... become a leader, scan the pending map and process those
-@Component(immediate = true, service = IntentStore.class)
+@Component(
+ immediate = true,
+ service = IntentStore.class,
+ property = {
+ GIS_PERSISTENCE_ENABLED + "=" + GIS_PERSISTENCE_ENABLED_DEFAULT
+ }
+)
public class GossipIntentStore
extends AbstractStore<IntentEvent, IntentStoreDelegate>
implements IntentStore {
@@ -117,7 +124,7 @@
// intents on cluster restart
//@Property(name = "persistenceEnabled", boolValue = PERSIST,
// label = "EXPERIMENTAL: Enable intent persistence")
- private boolean persistenceEnabled;
+ private boolean persistenceEnabled = GIS_PERSISTENCE_ENABLED_DEFAULT;
/**
diff --git a/core/store/dist/src/main/java/org/onosproject/store/package-info.java b/core/store/dist/src/main/java/org/onosproject/store/package-info.java
new file mode 100644
index 0000000..c468154
--- /dev/null
+++ b/core/store/dist/src/main/java/org/onosproject/store/package-info.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Stores used by the core of ONOS.
+ */
+package org.onosproject.store;
\ No newline at end of file
diff --git a/core/store/dist/src/main/java/org/onosproject/store/packet/impl/DistributedPacketStore.java b/core/store/dist/src/main/java/org/onosproject/store/packet/impl/DistributedPacketStore.java
index 95ea1ed..729839b 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/packet/impl/DistributedPacketStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/packet/impl/DistributedPacketStore.java
@@ -59,13 +59,21 @@
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.store.OsgiPropertyConstants.DPS_MESSAGE_HANDLER_THREAD_POOL_SIZE;
+import static org.onosproject.store.OsgiPropertyConstants.DPS_MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT;
import static org.slf4j.LoggerFactory.getLogger;
/**
* Distributed packet store implementation allowing packets to be sent to
* remote instances.
*/
-@Component(immediate = true, service = PacketStore.class)
+@Component(
+ immediate = true,
+ service = PacketStore.class,
+ property = {
+ DPS_MESSAGE_HANDLER_THREAD_POOL_SIZE + "=" + DPS_MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT
+ }
+)
public class DistributedPacketStore
extends AbstractStore<PacketEvent, PacketStoreDelegate>
implements PacketStore {
@@ -98,10 +106,9 @@
private ExecutorService messageHandlingExecutor;
- private static final int DEFAULT_MESSAGE_HANDLER_THREAD_POOL_SIZE = 4;
//@Property(name = "messageHandlerThreadPoolSize", intValue = DEFAULT_MESSAGE_HANDLER_THREAD_POOL_SIZE,
// label = "Size of thread pool to assign message handler")
- private static int messageHandlerThreadPoolSize = DEFAULT_MESSAGE_HANDLER_THREAD_POOL_SIZE;
+ private static int messageHandlerThreadPoolSize = DPS_MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT;
private static final int MAX_BACKOFF = 50;
diff --git a/core/store/dist/src/main/java/org/onosproject/store/statistic/impl/DistributedFlowStatisticStore.java b/core/store/dist/src/main/java/org/onosproject/store/statistic/impl/DistributedFlowStatisticStore.java
index 6f57f19..6a920bc 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/statistic/impl/DistributedFlowStatisticStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/statistic/impl/DistributedFlowStatisticStore.java
@@ -60,13 +60,21 @@
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.store.OsgiPropertyConstants.DFS_MESSAGE_HANDLER_THREAD_POOL_SIZE;
+import static org.onosproject.store.OsgiPropertyConstants.DFS_MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT;
import static org.slf4j.LoggerFactory.getLogger;
/**
* Maintains flow statistics using RPC calls to collect stats from remote instances
* on demand.
*/
-@Component(immediate = true, service = FlowStatisticStore.class)
+@Component(
+ immediate = true,
+ service = FlowStatisticStore.class,
+ property = {
+ DFS_MESSAGE_HANDLER_THREAD_POOL_SIZE + "=" + DFS_MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT
+ }
+)
public class DistributedFlowStatisticStore implements FlowStatisticStore {
private final Logger log = getLogger(getClass());
@@ -98,10 +106,9 @@
private NodeId local;
private ExecutorService messageHandlingExecutor;
- private static final int DEFAULT_MESSAGE_HANDLER_THREAD_POOL_SIZE = 4;
//@Property(name = "messageHandlerThreadPoolSize", intValue = DEFAULT_MESSAGE_HANDLER_THREAD_POOL_SIZE,
// label = "Size of thread pool to assign message handler")
- private static int messageHandlerThreadPoolSize = DEFAULT_MESSAGE_HANDLER_THREAD_POOL_SIZE;
+ private static int messageHandlerThreadPoolSize = DFS_MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT;
private static final long STATISTIC_STORE_TIMEOUT_MILLIS = 3000;
diff --git a/core/store/dist/src/main/java/org/onosproject/store/statistic/impl/DistributedStatisticStore.java b/core/store/dist/src/main/java/org/onosproject/store/statistic/impl/DistributedStatisticStore.java
index c4a7f19..d9902fe 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/statistic/impl/DistributedStatisticStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/statistic/impl/DistributedStatisticStore.java
@@ -59,6 +59,8 @@
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.store.OsgiPropertyConstants.DSS_MESSAGE_HANDLER_THREAD_POOL_SIZE;
+import static org.onosproject.store.OsgiPropertyConstants.DSS_MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT;
import static org.slf4j.LoggerFactory.getLogger;
@@ -66,7 +68,13 @@
* Maintains statistics using RPC calls to collect stats from remote instances
* on demand.
*/
-@Component(immediate = true, service = StatisticStore.class)
+@Component(
+ immediate = true,
+ service = StatisticStore.class,
+ property = {
+ DSS_MESSAGE_HANDLER_THREAD_POOL_SIZE + "=" + DSS_MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT
+ }
+)
public class DistributedStatisticStore implements StatisticStore {
private final Logger log = getLogger(getClass());
@@ -101,10 +109,9 @@
private ExecutorService messageHandlingExecutor;
- private static final int DEFAULT_MESSAGE_HANDLER_THREAD_POOL_SIZE = 4;
//@Property(name = "messageHandlerThreadPoolSize", intValue = DEFAULT_MESSAGE_HANDLER_THREAD_POOL_SIZE,
// label = "Size of thread pool to assign message handler")
- private static int messageHandlerThreadPoolSize = DEFAULT_MESSAGE_HANDLER_THREAD_POOL_SIZE;
+ private static int messageHandlerThreadPoolSize = DSS_MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT;
private static final long STATISTIC_STORE_TIMEOUT_MILLIS = 3000;
diff --git a/core/store/dist/src/main/java/org/onosproject/store/topology/impl/DistributedTopologyStore.java b/core/store/dist/src/main/java/org/onosproject/store/topology/impl/DistributedTopologyStore.java
index 04c9961..fee5d8d 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/topology/impl/DistributedTopologyStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/topology/impl/DistributedTopologyStore.java
@@ -72,6 +72,8 @@
import static org.onlab.util.Tools.get;
import static org.onlab.util.Tools.isNullOrEmpty;
import static org.onosproject.net.topology.TopologyEvent.Type.TOPOLOGY_CHANGED;
+import static org.onosproject.store.OsgiPropertyConstants.LINK_WEIGHT_FUNCTION;
+import static org.onosproject.store.OsgiPropertyConstants.LINK_WEIGHT_FUNCTION_DEFAULT;
import static org.slf4j.LoggerFactory.getLogger;
/**
@@ -81,7 +83,15 @@
* Note: This component is not distributed per-se. It runs on every
* instance and feeds off of other distributed stores.
*/
-@Component(immediate = true, service = { TopologyStore.class, PathAdminService.class })
+@Component(
+ immediate = true,
+ service = {
+ TopologyStore.class, PathAdminService.class
+ },
+ property = {
+ LINK_WEIGHT_FUNCTION + "=" + LINK_WEIGHT_FUNCTION_DEFAULT
+ }
+)
public class DistributedTopologyStore
extends AbstractStore<TopologyEvent, TopologyStoreDelegate>
implements TopologyStore, PathAdminService {
@@ -115,10 +125,9 @@
private static final String LINK_METRIC = "linkMetric";
private static final String GEO_DISTANCE = "geoDistance";
- private static final String DEFAULT_LINK_WEIGHT_FUNCTION = "hopCount";
//@Property(name = "linkWeightFunction", value = DEFAULT_LINK_WEIGHT_FUNCTION,
// label = "Default link-weight function: hopCount, linkMetric, geoDistance")
- private String linkWeightFunction = DEFAULT_LINK_WEIGHT_FUNCTION;
+ private String linkWeightFunction = LINK_WEIGHT_FUNCTION_DEFAULT;
// Cluster root to broadcast points bindings to allow convergence to
// a shared broadcast tree; node that is the master of the cluster root
diff --git a/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/DistributedVirtualFlowRuleStore.java b/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/DistributedVirtualFlowRuleStore.java
index 0ad6ec1..27ca7f7 100644
--- a/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/DistributedVirtualFlowRuleStore.java
+++ b/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/DistributedVirtualFlowRuleStore.java
@@ -138,7 +138,7 @@
// label = "Number of threads in the message handler pool")
private int msgHandlerThreadPoolSize = MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT;
- //@Property(name = "backupPeriod", intValue = DEFAULT_BACKUP_PERIOD_MILLIS,
+ //@Property(name = "backupPeriod", intValue = BACKUP_PERIOD_MILLIS,
// label = "Delay in ms between successive backup runs")
private int backupPeriod = BACKUP_PERIOD_MILLIS_DEFAULT;
//@Property(name = "persistenceEnabled", boolValue = false,
diff --git a/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OsgiPropertyConstants.java b/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OsgiPropertyConstants.java
index 8562686..649bf1f 100644
--- a/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OsgiPropertyConstants.java
+++ b/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OsgiPropertyConstants.java
@@ -14,10 +14,11 @@
* limitations under the License.
*/
+package org.onosproject.openflow.controller.impl;
+
/**
* Name/Value constants for properties.
*/
-package org.onosproject.openflow.controller.impl;
public final class OsgiPropertyConstants {