Constants for core/net OSGI properties
Change-Id: I43c27f7d513167da29eaf8a851989263e5d4db66
diff --git a/core/net/src/main/java/org/onosproject/cluster/impl/MastershipManager.java b/core/net/src/main/java/org/onosproject/cluster/impl/MastershipManager.java
index 2a9096a..c36f2b2 100644
--- a/core/net/src/main/java/org/onosproject/cluster/impl/MastershipManager.java
+++ b/core/net/src/main/java/org/onosproject/cluster/impl/MastershipManager.java
@@ -75,14 +75,25 @@
import static org.onosproject.security.AppPermission.Type.CLUSTER_READ;
import static org.onosproject.security.AppPermission.Type.CLUSTER_WRITE;
import static org.slf4j.LoggerFactory.getLogger;
+import static org.onosproject.net.OsgiPropertyConstants.*;
/**
* Component providing the node-device mastership service.
*/
-@Component(immediate = true,
- service = {MastershipService.class, MastershipAdminService.class, MastershipTermService.class,
- MetricsHelper.class})
+@Component(
+ immediate = true,
+ service = {
+ MastershipService.class,
+ MastershipAdminService.class,
+ MastershipTermService.class,
+ MetricsHelper.class
+ },
+ property = {
+ USE_REGION_FOR_BALANCE_ROLES + "=" + USE_REGION_FOR_BALANCE_ROLES_DEFAULT,
+ REBALANCE_ROLES_ON_UPGRADE + "=" + REBALANCE_ROLES_ON_UPGRADE_DEFAULT
+ }
+)
public class MastershipManager
extends AbstractListenerManager<MastershipEvent, MastershipListener>
implements MastershipService, MastershipAdminService, MastershipTermService,
@@ -118,16 +129,14 @@
private NodeId localNodeId;
private Timer requestRoleTimer;
- static final boolean DEFAULT_USE_REGION_FOR_BALANCE_ROLES = false;
//@Property(name = "useRegionForBalanceRoles", boolValue = DEFAULT_USE_REGION_FOR_BALANCE_ROLES,
// label = "Use Regions for balancing roles")
- protected boolean useRegionForBalanceRoles;
+ protected boolean useRegionForBalanceRoles = USE_REGION_FOR_BALANCE_ROLES_DEFAULT;
- private static final boolean DEFAULT_REBALANCE_ROLES_ON_UPGRADE = true;
//@Property(name = "rebalanceRolesOnUpgrade",
// boolValue = DEFAULT_REBALANCE_ROLES_ON_UPGRADE,
// label = "Automatically rebalance roles following an upgrade")
- protected boolean rebalanceRolesOnUpgrade = DEFAULT_REBALANCE_ROLES_ON_UPGRADE;
+ protected boolean rebalanceRolesOnUpgrade = REBALANCE_ROLES_ON_UPGRADE_DEFAULT;
@Activate
public void activate() {
diff --git a/core/net/src/main/java/org/onosproject/core/impl/CoreManager.java b/core/net/src/main/java/org/onosproject/core/impl/CoreManager.java
index 733da9c..4f72ef3 100644
--- a/core/net/src/main/java/org/onosproject/core/impl/CoreManager.java
+++ b/core/net/src/main/java/org/onosproject/core/impl/CoreManager.java
@@ -43,6 +43,12 @@
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
+import static org.onosproject.net.OsgiPropertyConstants.CALCULATE_PERFORMANCE_CHECK;
+import static org.onosproject.net.OsgiPropertyConstants.CALCULATE_PERFORMANCE_CHECK_DEFAULT;
+import static org.onosproject.net.OsgiPropertyConstants.MAX_EVENT_TIME_LIMIT;
+import static org.onosproject.net.OsgiPropertyConstants.MAX_EVENT_TIME_LIMIT_DEFAULT;
+import static org.onosproject.net.OsgiPropertyConstants.SHARED_THREAD_POOL_SIZE;
+import static org.onosproject.net.OsgiPropertyConstants.SHARED_THREAD_POOL_SIZE_DEFAULT;
import static org.onosproject.security.AppGuard.checkPermission;
import static org.onosproject.security.AppPermission.Type.APP_READ;
import static org.onosproject.security.AppPermission.Type.APP_WRITE;
@@ -50,7 +56,15 @@
/**
* Core service implementation.
*/
-@Component(immediate = true, service = CoreService.class)
+@Component(
+ immediate = true,
+ service = CoreService.class,
+ property = {
+ SHARED_THREAD_POOL_SIZE + "=" + SHARED_THREAD_POOL_SIZE_DEFAULT,
+ MAX_EVENT_TIME_LIMIT + "=" + MAX_EVENT_TIME_LIMIT_DEFAULT,
+ CALCULATE_PERFORMANCE_CHECK + "=" + CALCULATE_PERFORMANCE_CHECK_DEFAULT
+ }
+)
public class CoreManager implements CoreService {
private final Logger log = LoggerFactory.getLogger(getClass());
@@ -76,20 +90,17 @@
@Reference(cardinality = ReferenceCardinality.MANDATORY)
protected MetricsService metricsService;
- private static final int DEFAULT_POOL_SIZE = 30;
//@Property(name = "sharedThreadPoolSize", intValue = DEFAULT_POOL_SIZE,
// label = "Configure shared pool maximum size ")
- private int sharedThreadPoolSize = DEFAULT_POOL_SIZE;
+ private int sharedThreadPoolSize = SHARED_THREAD_POOL_SIZE_DEFAULT;
- private static final int DEFAULT_EVENT_TIME = 2000;
//@Property(name = "maxEventTimeLimit", intValue = DEFAULT_EVENT_TIME,
// label = "Maximum number of millis an event sink has to process an event")
- private int maxEventTimeLimit = DEFAULT_EVENT_TIME;
+ private int maxEventTimeLimit = MAX_EVENT_TIME_LIMIT_DEFAULT;
- private static final boolean DEFAULT_PERFORMANCE_CHECK = false;
//@Property(name = "sharedThreadPerformanceCheck", boolValue = DEFAULT_PERFORMANCE_CHECK,
// label = "Enable queue performance check on shared pool")
- private boolean calculatePoolPerformance = DEFAULT_PERFORMANCE_CHECK;
+ private boolean calculatePoolPerformance = CALCULATE_PERFORMANCE_CHECK_DEFAULT;
@Activate
diff --git a/core/net/src/main/java/org/onosproject/net/OsgiPropertyConstants.java b/core/net/src/main/java/org/onosproject/net/OsgiPropertyConstants.java
new file mode 100644
index 0000000..110beed
--- /dev/null
+++ b/core/net/src/main/java/org/onosproject/net/OsgiPropertyConstants.java
@@ -0,0 +1,209 @@
+/*
+ * 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.net;
+
+public final class OsgiPropertyConstants {
+ private OsgiPropertyConstants() {
+ }
+
+ //@Property(name = "useRegionForBalanceRoles", boolValue = DEFAULT_USE_REGION_FOR_BALANCE_ROLES,
+ // label = "Use Regions for balancing roles")
+ public static final String USE_REGION_FOR_BALANCE_ROLES = "useRegionForBalanceRoles:Boolean";
+ public static final boolean USE_REGION_FOR_BALANCE_ROLES_DEFAULT = false;
+
+ //@Property(name = "rebalanceRolesOnUpgrade",
+ // boolValue = DEFAULT_REBALANCE_ROLES_ON_UPGRADE,
+ // label = "Automatically rebalance roles following an upgrade")
+ public static final String REBALANCE_ROLES_ON_UPGRADE = "rebalanceRolesOnUpgrade:Boolean";
+ public static final boolean REBALANCE_ROLES_ON_UPGRADE_DEFAULT = true;
+
+ //@Property(name = "sharedThreadPoolSize", intValue = DEFAULT_POOL_SIZE,
+ // label = "Configure shared pool maximum size ")
+ public static final String SHARED_THREAD_POOL_SIZE = "sharedThreadPoolSize:Integer";
+ public static final int SHARED_THREAD_POOL_SIZE_DEFAULT = 30;
+
+ //@Property(name = "maxEventTimeLimit", intValue = DEFAULT_EVENT_TIME,
+ // label = "Maximum number of millis an event sink has to process an event")
+ public static final String MAX_EVENT_TIME_LIMIT = "maxEventTimeLimit:Integer";
+ public static final int MAX_EVENT_TIME_LIMIT_DEFAULT = 2000;
+
+ //@Property(name = "sharedThreadPerformanceCheck", boolValue = DEFAULT_PERFORMANCE_CHECK,
+ // label = "Enable queue performance check on shared pool")
+ public static final String CALCULATE_PERFORMANCE_CHECK = "calculatePoolPerformance:Boolean";
+ public static final boolean CALCULATE_PERFORMANCE_CHECK_DEFAULT = false;
+
+ //@Property(name = "allowExtraneousRules", boolValue = ALLOW_EXTRANEOUS_RULES,
+ // label = "Allow flow rules in switch not installed by ONOS")
+ public static final String ALLOW_EXTRANEOUS_RULES = "allowExtraneousRules:Boolean";
+ public static final boolean ALLOW_EXTRANEOUS_RULES_DEFAULT = false;
+
+ //@Property(name = "purgeOnDisconnection", boolValue = false,
+ // label = "Purge entries associated with a device when the device goes offline")
+ public static final String PURGE_ON_DISCONNECTION = "purgeOnDisconnection:Boolean";
+ public static final boolean PURGE_ON_DISCONNECTION_DEFAULT = false;
+
+ //@Property(name = "fallbackFlowPollFrequency", intValue = DEFAULT_POLL_FREQUENCY,
+ // label = "Frequency (in seconds) for polling flow statistics via fallback provider")
+ public static final String POLL_FREQUENCY = "fallbackFlowPollFrequency:Integer";
+ public static final int POLL_FREQUENCY_DEFAULT = 30;
+
+ //@Property(name = NUM_THREAD,
+ // intValue = DEFAULT_NUM_THREADS,
+ // label = "Number of worker threads")
+ public static final String FOM_NUM_THREADS = "FOMNumThreads:Integer";
+ public static final int FOM_NUM_THREADS_DEFAULT = 4;
+
+ //@Property(name = "fallbackGroupPollFrequency", intValue = DEFAULT_POLL_FREQUENCY,
+ // label = "Frequency (in seconds) for polling groups via fallback provider")
+ public static final String GM_POLL_FREQUENCY = "fallbackGroupPollFrequency:Integer";
+ public static final int GM_POLL_FREQUENCY_DEFAULT = 30;
+
+ //@Property(name = "purgeOnDisconnection", boolValue = false,
+ // label = "Purge entries associated with a device when the device goes offline")
+ public static final String GM_PURGE_ON_DISCONNECTION = "purgeOnDisconnection:Boolean";
+ public static final boolean GM_PURGE_ON_DISCONNECTION_DEFAULT = false;
+
+ //@Property(name = "allowDuplicateIps", boolValue = true,
+ // label = "Enable removal of duplicate ip address")
+ public static final String HM_ALLOW_DUPLICATE_IPS = "allowDuplicateIps:Boolean";
+ public static final boolean HM_ALLOW_DUPLICATE_IPS_DEFAULT = true;
+
+ //@Property(name = "monitorHosts", boolValue = false,
+ // label = "Enable/Disable monitoring of hosts")
+ public static final String HM_MONITOR_HOSTS = "monitorHosts:Boolean";
+ public static final boolean HM_MONITOR_HOSTS_DEFAULT = false;
+
+ //@Property(name = "probeRate", longValue = 30000,
+ // label = "Set the probe Rate in milli seconds")
+ public static final String HM_PROBE_RATE = "probeRate:Integer";
+ public static final long HM_PROBE_RATE_DEFAULT = 30000;
+
+ //@Property(name = "greedyLearningIpv6", boolValue = false,
+ // label = "Enable/Disable greedy learning of IPv6 link local address")
+ public static final String HM_GREEDY_LEARNING_IPV6 = "greedyLearningIpv6:Boolean";
+ public static final boolean HM_GREEDY_LEARNING_IPV6_DEFAULT = false;
+
+ //@Property(name = "useFlowObjectives",
+ // boolValue = DEFAULT_FLOW_OBJECTIVES,
+ // label = "Indicates whether or not to use flow objective-based compilers")
+ public static final String ICR_USE_FLOW_OBJECTIVES = "useFlowObjectives:Boolean";
+ public static final boolean ICR_USE_FLOW_OBJECTIVES_DEFAULT = false;
+
+ //@Property(name = "labelSelection",
+ // value = DEFAULT_LABEL_SELECTION,
+ // label = "Defines the label selection algorithm - RANDOM or FIRST_FIT")
+ public static final String ICR_LABEL_SELECTION = "labelSelection";
+ public static final String ICR_LABEL_SELECTION_DEFAULT = "RANDOM";
+
+ //@Property(name = "optLabelSelection",
+ // value = DEFAULT_OPT_LABEL_SELECTION,
+ // label = "Defines the optimization for label selection algorithm - NONE, NO_SWAP, MIN_SWAP")
+ public static final String ICR_OPT_LABEL_SELECTION = "optLabelSelection";
+ public static final String ICR_OPT_LABEL_SELECTION_DEFAULT = "NONE";
+
+ //@Property(name = "optimizeInstructions",
+ // boolValue = DEFAULT_FLOW_OPTIMIZATION,
+ // label = "Indicates whether or not to optimize the flows in the link collection compiler")
+ public static final String ICR_FLOW_OPTIMIZATION = "optimizeInstructions:Boolean";
+ public static final boolean ICR_FLOW_OPTIMIZATION_DEFAULT = false;
+
+ //@Property(name = "useCopyTtl",
+ // boolValue = DEFAULT_COPY_TTL,
+ // label = "Indicates whether or not to use copy ttl in the link collection compiler")
+ public static final String ICR_COPY_TTL = "useCopyTtl:Boolean";
+ public static final boolean ICR_COPY_TTL_DEFAULT = false;
+
+ //@Property(name = "enabled", boolValue = true,
+ // label = "Enables/disables the intent cleanup component")
+ public static final String ICU_ENABLED = "enabled:Boolean";
+ public static final boolean ICU_ENABLED_DEFAULT = true;
+
+ //@Property(name = "period", intValue = DEFAULT_PERIOD,
+ // label = "Frequency in ms between cleanup runs")
+ public static final String ICU_PERIOD = "period:Integer";
+ public static final int ICU_PERIOD_DEFAULT = 5; //seconds
+
+ //@Property(name = "retryThreshold", intValue = DEFAULT_THRESHOLD,
+ // label = "Number of times to retry CORRUPT intent without delay")
+ public static final String ICU_RETRY_THRESHOLD = "retryThreshold:Integer";
+ public static final int ICU_RETRY_THRESHOLD_DEFAULT = 5; //tries
+
+ //@Property(name = "nonDisruptiveInstallationWaitingTime",
+ // intValue = DEFAULT_NON_DISRUPTIVE_INSTALLATION_WAITING_TIME,
+ // label = "Number of seconds to wait during the non-disruptive installation phases")
+ public static final String NON_DISRUPTIVE_INSTALLATION_WAITING_TIME =
+ "nonDisruptiveInstallationWaitingTime:Integer";
+ public static final int NON_DISRUPTIVE_INSTALLATION_WAITING_TIME_DEFAULT = 1;
+
+ //@Property(name = "skipReleaseResourcesOnWithdrawal",
+ // boolValue = DEFAULT_SKIP_RELEASE_RESOURCES_ON_WITHDRAWAL,
+ // label = "Indicates whether skipping resource releases on withdrawal is enabled or not")
+ public static final String IM_SKIP_RELEASE_RESOURCES_ON_WITHDRAWAL = "skipReleaseResourcesOnWithdrawal:Boolean";
+ public static final boolean IM_SKIP_RELEASE_RESOURCES_ON_WITHDRAWAL_DEFAULT = false;
+
+ //@Property(name = "numThreads",
+ // intValue = DEFAULT_NUM_THREADS,
+ // label = "Number of worker threads")
+ public static final String IM_NUM_THREADS = "IMNumThreads:Integer";
+ public static final int IM_NUM_THREADS_DEFAULT = 12;
+
+ //@Property(name = NUM_THREAD,
+ // intValue = DEFAULT_NUM_THREADS,
+ // label = "Number of worker threads")
+ public static final String MM_NUM_THREADS = "NMNumThreads:Integer";
+ public static final int MM_NUM_THREADS_DEFAULT = 12;
+
+ //@Property(name = "fallbackMeterPollFrequency", intValue = DEFAULT_POLL_FREQUENCY,
+ // label = "Frequency (in seconds) for polling meters via fallback provider")
+ public static final String MM_FALLBACK_METER_POLL_FREQUENCY = "fallbackMeterPollFrequency:Integer";
+ public static final int MM_FALLBACK_METER_POLL_FREQUENCY_DEFAULT = 30;
+
+ //@Property(name = "arpEnabled", boolValue = true,
+ // label = "Enable Address resolution protocol")
+ public static final String NRM_ARP_ENABLED = "arpEnabled:Boolean";
+ public static final boolean NRM_ARP_ENABLED_DEFAULT = true;
+
+ //@Property(name = "ndpEnabled", boolValue = false,
+ // label = "Enable IPv6 neighbour discovery")
+ public static final String NRM_NDP_ENABLED = "ndpEnabled:Boolean";
+ public static final boolean NRM_NDP_ENABLED_DEFAULT = false;
+
+ //@Property(name = "requestInterceptsEnabled", boolValue = true,
+ // label = "Enable requesting packet intercepts")
+ public static final String NRM_REQUEST_INTERCEPTS_ENABLED = "requestInterceptsEnabled:Boolean";
+ public static final boolean NRM_REQUEST_INTERCEPTS_ENABLED_DEFAULT = true;
+
+ //@Property(name = PROBE_INTERVAL, intValue = DEFAULT_PROBE_INTERVAL,
+ // label = "Configure interval in seconds for device pipeconf probing")
+ public static final String PWM_PROBE_INTERVAL = "probeInterval:Integer";
+ public static final int PWM_PROBE_INTERVAL_DEFAULT = 15;
+
+ //@Property(name = "maxEvents", intValue = DEFAULT_MAX_EVENTS,
+ // label = "Maximum number of events to accumulate")
+ public static final String DTP_MAX_EVENTS = "maxEvents:Integer";
+ public static final int DTP_MAX_EVENTS_DEFAULT = 1000;
+
+ //@Property(name = "maxIdleMs", intValue = DEFAULT_MAX_IDLE_MS,
+ // label = "Maximum number of millis between events")
+ public static final String DTP_MAX_IDLE_MS = "maxIdleMs:Integer";
+ public static final int DTP_MAX_IDLE_MS_DEFAULT = 10;
+
+ //@Property(name = "maxBatchMs", intValue = DEFAULT_MAX_BATCH_MS,
+ // label = "Maximum number of millis for whole batch")
+ public static final String DTP_MAX_BATCH_MS = "maxBatchMs:Integer";
+ public static final int DTP_MAX_BATCH_MS_DEFAULT = 50;
+}
diff --git a/core/net/src/main/java/org/onosproject/net/flow/impl/FlowRuleManager.java b/core/net/src/main/java/org/onosproject/net/flow/impl/FlowRuleManager.java
index 65cbd99..9285ebc 100644
--- a/core/net/src/main/java/org/onosproject/net/flow/impl/FlowRuleManager.java
+++ b/core/net/src/main/java/org/onosproject/net/flow/impl/FlowRuleManager.java
@@ -80,6 +80,12 @@
import static com.google.common.base.Strings.isNullOrEmpty;
import static org.onlab.util.Tools.get;
import static org.onlab.util.Tools.groupedThreads;
+import static org.onosproject.net.OsgiPropertyConstants.ALLOW_EXTRANEOUS_RULES;
+import static org.onosproject.net.OsgiPropertyConstants.ALLOW_EXTRANEOUS_RULES_DEFAULT;
+import static org.onosproject.net.OsgiPropertyConstants.POLL_FREQUENCY;
+import static org.onosproject.net.OsgiPropertyConstants.POLL_FREQUENCY_DEFAULT;
+import static org.onosproject.net.OsgiPropertyConstants.PURGE_ON_DISCONNECTION;
+import static org.onosproject.net.OsgiPropertyConstants.PURGE_ON_DISCONNECTION_DEFAULT;
import static org.onosproject.net.flow.FlowRuleEvent.Type.RULE_ADD_REQUESTED;
import static org.onosproject.net.flow.FlowRuleEvent.Type.RULE_REMOVE_REQUESTED;
import static org.onosproject.security.AppGuard.checkPermission;
@@ -90,7 +96,18 @@
/**
* Provides implementation of the flow NB & SB APIs.
*/
-@Component(immediate = true, service = { FlowRuleService.class, FlowRuleProviderRegistry.class })
+@Component(
+ immediate = true,
+ service = {
+ FlowRuleService.class,
+ FlowRuleProviderRegistry.class
+ },
+ property = {
+ ALLOW_EXTRANEOUS_RULES + "=" + ALLOW_EXTRANEOUS_RULES_DEFAULT,
+ PURGE_ON_DISCONNECTION + "=" + PURGE_ON_DISCONNECTION_DEFAULT,
+ POLL_FREQUENCY + "=" + POLL_FREQUENCY_DEFAULT
+ }
+)
public class FlowRuleManager
extends AbstractListenerProviderRegistry<FlowRuleEvent, FlowRuleListener,
FlowRuleProvider, FlowRuleProviderService>
@@ -100,20 +117,18 @@
private static final String DEVICE_ID_NULL = "Device ID cannot be null";
private static final String FLOW_RULE_NULL = "FlowRule cannot be null";
- private static final boolean ALLOW_EXTRANEOUS_RULES = false;
//@Property(name = "allowExtraneousRules", boolValue = ALLOW_EXTRANEOUS_RULES,
// label = "Allow flow rules in switch not installed by ONOS")
- private boolean allowExtraneousRules = ALLOW_EXTRANEOUS_RULES;
+ private boolean allowExtraneousRules = ALLOW_EXTRANEOUS_RULES_DEFAULT;
//@Property(name = "purgeOnDisconnection", boolValue = false,
// label = "Purge entries associated with a device when the device goes offline")
- private boolean purgeOnDisconnection = false;
+ private boolean purgeOnDisconnection = PURGE_ON_DISCONNECTION_DEFAULT;
- private static final int DEFAULT_POLL_FREQUENCY = 30;
//@Property(name = "fallbackFlowPollFrequency", intValue = DEFAULT_POLL_FREQUENCY,
// label = "Frequency (in seconds) for polling flow statistics via fallback provider")
- private int fallbackFlowPollFrequency = DEFAULT_POLL_FREQUENCY;
+ private int fallbackFlowPollFrequency = POLL_FREQUENCY_DEFAULT;
private final FlowRuleStoreDelegate delegate = new InternalStoreDelegate();
private final DeviceListener deviceListener = new InternalDeviceListener();
diff --git a/core/net/src/main/java/org/onosproject/net/flowobjective/impl/FlowObjectiveManager.java b/core/net/src/main/java/org/onosproject/net/flowobjective/impl/FlowObjectiveManager.java
index 5bb0d40..e973da1 100644
--- a/core/net/src/main/java/org/onosproject/net/flowobjective/impl/FlowObjectiveManager.java
+++ b/core/net/src/main/java/org/onosproject/net/flowobjective/impl/FlowObjectiveManager.java
@@ -72,13 +72,21 @@
import static java.util.concurrent.Executors.newFixedThreadPool;
import static org.onlab.util.Tools.groupedThreads;
import static org.onosproject.net.AnnotationKeys.DRIVER;
+import static org.onosproject.net.OsgiPropertyConstants.FOM_NUM_THREADS;
+import static org.onosproject.net.OsgiPropertyConstants.FOM_NUM_THREADS_DEFAULT;
import static org.onosproject.security.AppGuard.checkPermission;
import static org.onosproject.security.AppPermission.Type.FLOWRULE_WRITE;
/**
* Provides implementation of the flow objective programming service.
*/
-@Component(enabled = false, service = FlowObjectiveService.class)
+@Component(
+ enabled = false,
+ service = FlowObjectiveService.class,
+ property = {
+ FOM_NUM_THREADS + "=" + FOM_NUM_THREADS_DEFAULT
+ }
+)
public class FlowObjectiveManager implements FlowObjectiveService {
private static final int INSTALL_RETRY_ATTEMPTS = 5;
@@ -90,11 +98,10 @@
private final Logger log = LoggerFactory.getLogger(getClass());
- private static final int DEFAULT_NUM_THREADS = 4;
//@Property(name = NUM_THREAD,
// intValue = DEFAULT_NUM_THREADS,
// label = "Number of worker threads")
- private int numThreads = DEFAULT_NUM_THREADS;
+ private int numThreads = FOM_NUM_THREADS_DEFAULT;
@Reference(cardinality = ReferenceCardinality.MANDATORY)
protected DriverService driverService;
diff --git a/core/net/src/main/java/org/onosproject/net/group/impl/GroupManager.java b/core/net/src/main/java/org/onosproject/net/group/impl/GroupManager.java
index 9946f5f..a160ae0 100644
--- a/core/net/src/main/java/org/onosproject/net/group/impl/GroupManager.java
+++ b/core/net/src/main/java/org/onosproject/net/group/impl/GroupManager.java
@@ -59,6 +59,10 @@
import static com.google.common.base.Strings.isNullOrEmpty;
import static org.onlab.util.Tools.get;
import static org.onlab.util.Tools.groupedThreads;
+import static org.onosproject.net.OsgiPropertyConstants.GM_POLL_FREQUENCY;
+import static org.onosproject.net.OsgiPropertyConstants.GM_POLL_FREQUENCY_DEFAULT;
+import static org.onosproject.net.OsgiPropertyConstants.GM_PURGE_ON_DISCONNECTION;
+import static org.onosproject.net.OsgiPropertyConstants.GM_PURGE_ON_DISCONNECTION_DEFAULT;
import static org.onosproject.security.AppGuard.checkPermission;
import static org.onosproject.security.AppPermission.Type.GROUP_READ;
import static org.onosproject.security.AppPermission.Type.GROUP_WRITE;
@@ -67,7 +71,17 @@
/**
* Provides implementation of the group service APIs.
*/
-@Component(immediate = true, service = { GroupService.class, GroupProviderRegistry.class })
+@Component(
+ immediate = true,
+ service = {
+ GroupService.class,
+ GroupProviderRegistry.class
+ },
+ property = {
+ GM_POLL_FREQUENCY + "=" + GM_POLL_FREQUENCY_DEFAULT,
+ GM_PURGE_ON_DISCONNECTION + "=" + GM_PURGE_ON_DISCONNECTION_DEFAULT
+ }
+)
public class GroupManager
extends AbstractListenerProviderRegistry<GroupEvent, GroupListener,
GroupProvider, GroupProviderService>
@@ -98,14 +112,13 @@
@Reference(cardinality = ReferenceCardinality.MANDATORY)
protected MastershipService mastershipService;
- private static final int DEFAULT_POLL_FREQUENCY = 30;
//@Property(name = "fallbackGroupPollFrequency", intValue = DEFAULT_POLL_FREQUENCY,
// label = "Frequency (in seconds) for polling groups via fallback provider")
- private int fallbackGroupPollFrequency = DEFAULT_POLL_FREQUENCY;
+ private int fallbackGroupPollFrequency = GM_POLL_FREQUENCY_DEFAULT;
//@Property(name = "purgeOnDisconnection", boolValue = false,
// label = "Purge entries associated with a device when the device goes offline")
- private boolean purgeOnDisconnection = false;
+ private boolean purgeOnDisconnection = GM_PURGE_ON_DISCONNECTION_DEFAULT;
@Activate
@@ -164,9 +177,9 @@
}
String s = get(properties, "fallbackGroupPollFrequency");
try {
- fallbackGroupPollFrequency = isNullOrEmpty(s) ? DEFAULT_POLL_FREQUENCY : Integer.parseInt(s);
+ fallbackGroupPollFrequency = isNullOrEmpty(s) ? GM_POLL_FREQUENCY_DEFAULT : Integer.parseInt(s);
} catch (NumberFormatException e) {
- fallbackGroupPollFrequency = DEFAULT_POLL_FREQUENCY;
+ fallbackGroupPollFrequency = GM_POLL_FREQUENCY_DEFAULT;
}
}
diff --git a/core/net/src/main/java/org/onosproject/net/host/impl/HostManager.java b/core/net/src/main/java/org/onosproject/net/host/impl/HostManager.java
index b135e80..37a37b0 100644
--- a/core/net/src/main/java/org/onosproject/net/host/impl/HostManager.java
+++ b/core/net/src/main/java/org/onosproject/net/host/impl/HostManager.java
@@ -62,6 +62,14 @@
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
import static org.onlab.packet.IPv6.getLinkLocalAddress;
+import static org.onosproject.net.OsgiPropertyConstants.HM_ALLOW_DUPLICATE_IPS;
+import static org.onosproject.net.OsgiPropertyConstants.HM_ALLOW_DUPLICATE_IPS_DEFAULT;
+import static org.onosproject.net.OsgiPropertyConstants.HM_GREEDY_LEARNING_IPV6;
+import static org.onosproject.net.OsgiPropertyConstants.HM_GREEDY_LEARNING_IPV6_DEFAULT;
+import static org.onosproject.net.OsgiPropertyConstants.HM_MONITOR_HOSTS;
+import static org.onosproject.net.OsgiPropertyConstants.HM_MONITOR_HOSTS_DEFAULT;
+import static org.onosproject.net.OsgiPropertyConstants.HM_PROBE_RATE;
+import static org.onosproject.net.OsgiPropertyConstants.HM_PROBE_RATE_DEFAULT;
import static org.onosproject.security.AppGuard.checkPermission;
import static org.onosproject.security.AppPermission.Type.HOST_EVENT;
import static org.onosproject.security.AppPermission.Type.HOST_READ;
@@ -70,7 +78,20 @@
/**
* Provides basic implementation of the host SB & NB APIs.
*/
-@Component(immediate = true, service = {HostService.class, HostAdminService.class, HostProviderRegistry.class })
+@Component(
+ immediate = true,
+ service = {
+ HostService.class,
+ HostAdminService.class,
+ HostProviderRegistry.class
+ },
+ property = {
+ HM_ALLOW_DUPLICATE_IPS + "=" + HM_ALLOW_DUPLICATE_IPS_DEFAULT,
+ HM_MONITOR_HOSTS + "=" + HM_MONITOR_HOSTS_DEFAULT,
+ HM_PROBE_RATE + "=" + HM_PROBE_RATE_DEFAULT,
+ HM_GREEDY_LEARNING_IPV6 + "=" + HM_GREEDY_LEARNING_IPV6_DEFAULT
+ }
+)
public class HostManager
extends AbstractListenerProviderRegistry<HostEvent, HostListener, HostProvider, HostProviderService>
implements HostService, HostAdminService, HostProviderRegistry {
@@ -106,19 +127,19 @@
//@Property(name = "allowDuplicateIps", boolValue = true,
// label = "Enable removal of duplicate ip address")
- private boolean allowDuplicateIps = true;
+ private boolean allowDuplicateIps = HM_ALLOW_DUPLICATE_IPS_DEFAULT;
//@Property(name = "monitorHosts", boolValue = false,
// label = "Enable/Disable monitoring of hosts")
- private boolean monitorHosts = false;
+ private boolean monitorHosts = HM_MONITOR_HOSTS_DEFAULT;
//@Property(name = "probeRate", longValue = 30000,
// label = "Set the probe Rate in milli seconds")
- private long probeRate = 30000;
+ private long probeRate = HM_PROBE_RATE_DEFAULT;
//@Property(name = "greedyLearningIpv6", boolValue = false,
// label = "Enable/Disable greedy learning of IPv6 link local address")
- private boolean greedyLearningIpv6 = false;
+ private boolean greedyLearningIpv6 = HM_GREEDY_LEARNING_IPV6_DEFAULT;
private HostMonitor monitor;
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentCleanup.java b/core/net/src/main/java/org/onosproject/net/intent/impl/IntentCleanup.java
index bb08cd8..e33ab82 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentCleanup.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/IntentCleanup.java
@@ -42,6 +42,12 @@
import static java.util.concurrent.Executors.newSingleThreadExecutor;
import static org.onlab.util.Tools.get;
import static org.onlab.util.Tools.groupedThreads;
+import static org.onosproject.net.OsgiPropertyConstants.ICU_ENABLED;
+import static org.onosproject.net.OsgiPropertyConstants.ICU_ENABLED_DEFAULT;
+import static org.onosproject.net.OsgiPropertyConstants.ICU_PERIOD;
+import static org.onosproject.net.OsgiPropertyConstants.ICU_PERIOD_DEFAULT;
+import static org.onosproject.net.OsgiPropertyConstants.ICU_RETRY_THRESHOLD;
+import static org.onosproject.net.OsgiPropertyConstants.ICU_RETRY_THRESHOLD_DEFAULT;
import static org.slf4j.LoggerFactory.getLogger;
/**
@@ -53,7 +59,14 @@
* notifications, which signify errors in processing, and retries.
* </p>
*/
-@Component(immediate = true)
+@Component(
+ immediate = true,
+ property = {
+ ICU_ENABLED + "=" + ICU_ENABLED_DEFAULT,
+ ICU_PERIOD + "=" + ICU_PERIOD_DEFAULT,
+ ICU_RETRY_THRESHOLD + "=" + ICU_RETRY_THRESHOLD_DEFAULT
+ }
+)
public class IntentCleanup implements Runnable, IntentListener {
private static final Logger log = getLogger(IntentCleanup.class);
@@ -61,22 +74,22 @@
// Logical timeout for stuck Intents in INSTALLING or WITHDRAWING. The unit is seconds
private static final int INSTALLING_WITHDRAWING_PERIOD = 120;
- private static final int DEFAULT_PERIOD = 5; //seconds
- private static final int DEFAULT_THRESHOLD = 5; //tries
+
+
//@Property(name = "enabled", boolValue = true,
// label = "Enables/disables the intent cleanup component")
- private boolean enabled = true;
+ private boolean enabled = ICU_ENABLED_DEFAULT;
//@Property(name = "period", intValue = DEFAULT_PERIOD,
// label = "Frequency in ms between cleanup runs")
- protected int period = DEFAULT_PERIOD;
+ protected int period = ICU_PERIOD_DEFAULT;
private long periodMs;
private long periodMsForStuck;
//@Property(name = "retryThreshold", intValue = DEFAULT_THRESHOLD,
// label = "Number of times to retry CORRUPT intent without delay")
- protected int retryThreshold = DEFAULT_THRESHOLD;
+ protected int retryThreshold = ICU_RETRY_THRESHOLD_DEFAULT;
@Reference(cardinality = ReferenceCardinality.MANDATORY)
protected IntentService service;
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentManager.java b/core/net/src/main/java/org/onosproject/net/intent/impl/IntentManager.java
index aee685e..80c9897 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentManager.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/IntentManager.java
@@ -75,6 +75,10 @@
import static java.util.concurrent.Executors.newFixedThreadPool;
import static java.util.concurrent.Executors.newSingleThreadExecutor;
import static org.onlab.util.Tools.groupedThreads;
+import static org.onosproject.net.OsgiPropertyConstants.IM_NUM_THREADS;
+import static org.onosproject.net.OsgiPropertyConstants.IM_NUM_THREADS_DEFAULT;
+import static org.onosproject.net.OsgiPropertyConstants.IM_SKIP_RELEASE_RESOURCES_ON_WITHDRAWAL;
+import static org.onosproject.net.OsgiPropertyConstants.IM_SKIP_RELEASE_RESOURCES_ON_WITHDRAWAL_DEFAULT;
import static org.onosproject.net.intent.IntentState.FAILED;
import static org.onosproject.net.intent.IntentState.INSTALL_REQ;
import static org.onosproject.net.intent.IntentState.WITHDRAWING;
@@ -90,8 +94,18 @@
/**
* An implementation of intent service.
*/
-@Component(immediate = true,
- service = { IntentService.class, IntentExtensionService.class, IntentInstallCoordinator.class })
+@Component(
+ immediate = true,
+ service = {
+ IntentService.class,
+ IntentExtensionService.class,
+ IntentInstallCoordinator.class
+ },
+ property = {
+ IM_SKIP_RELEASE_RESOURCES_ON_WITHDRAWAL + "=" + IM_SKIP_RELEASE_RESOURCES_ON_WITHDRAWAL_DEFAULT,
+ IM_NUM_THREADS + "=" + IM_NUM_THREADS_DEFAULT
+ }
+)
public class IntentManager
extends AbstractListenerManager<IntentEvent, IntentListener>
implements IntentService, IntentExtensionService, IntentInstallCoordinator {
@@ -106,17 +120,15 @@
private static final EnumSet<IntentState> WITHDRAW
= EnumSet.of(WITHDRAW_REQ, WITHDRAWING, WITHDRAWN);
- private static final boolean DEFAULT_SKIP_RELEASE_RESOURCES_ON_WITHDRAWAL = false;
//@Property(name = "skipReleaseResourcesOnWithdrawal",
// boolValue = DEFAULT_SKIP_RELEASE_RESOURCES_ON_WITHDRAWAL,
// label = "Indicates whether skipping resource releases on withdrawal is enabled or not")
- private boolean skipReleaseResourcesOnWithdrawal = DEFAULT_SKIP_RELEASE_RESOURCES_ON_WITHDRAWAL;
+ private boolean skipReleaseResourcesOnWithdrawal = IM_SKIP_RELEASE_RESOURCES_ON_WITHDRAWAL_DEFAULT;
- private static final int DEFAULT_NUM_THREADS = 12;
//@Property(name = "numThreads",
// intValue = DEFAULT_NUM_THREADS,
// label = "Number of worker threads")
- private int numThreads = DEFAULT_NUM_THREADS;
+ private int numThreads = IM_NUM_THREADS_DEFAULT;
@Reference(cardinality = ReferenceCardinality.MANDATORY)
protected CoreService coreService;
@@ -201,7 +213,7 @@
@Modified
public void modified(ComponentContext context) {
if (context == null) {
- skipReleaseResourcesOnWithdrawal = DEFAULT_SKIP_RELEASE_RESOURCES_ON_WITHDRAWAL;
+ skipReleaseResourcesOnWithdrawal = IM_SKIP_RELEASE_RESOURCES_ON_WITHDRAWAL_DEFAULT;
logConfig("Default config");
return;
}
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/IntentConfigurableRegistrator.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/IntentConfigurableRegistrator.java
index b6e74b7..0712d46 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/IntentConfigurableRegistrator.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/IntentConfigurableRegistrator.java
@@ -35,13 +35,32 @@
import java.util.Map;
import static com.google.common.base.Strings.isNullOrEmpty;
+import static org.onosproject.net.OsgiPropertyConstants.ICR_COPY_TTL;
+import static org.onosproject.net.OsgiPropertyConstants.ICR_COPY_TTL_DEFAULT;
+import static org.onosproject.net.OsgiPropertyConstants.ICR_FLOW_OPTIMIZATION;
+import static org.onosproject.net.OsgiPropertyConstants.ICR_LABEL_SELECTION;
+import static org.onosproject.net.OsgiPropertyConstants.ICR_OPT_LABEL_SELECTION;
+import static org.onosproject.net.OsgiPropertyConstants.ICR_USE_FLOW_OBJECTIVES;
+import static org.onosproject.net.OsgiPropertyConstants.ICR_USE_FLOW_OBJECTIVES_DEFAULT;
+import static org.onosproject.net.OsgiPropertyConstants.ICR_FLOW_OPTIMIZATION_DEFAULT;
+import static org.onosproject.net.OsgiPropertyConstants.ICR_LABEL_SELECTION_DEFAULT;
+import static org.onosproject.net.OsgiPropertyConstants.ICR_OPT_LABEL_SELECTION_DEFAULT;
import static org.slf4j.LoggerFactory.getLogger;
/**
* Auxiliary utility to register either flow-rule compilers or flow-objective
* compilers.
*/
-@Component(service = IntentConfigurableRegistrator.class)
+@Component(
+ service = IntentConfigurableRegistrator.class,
+ property = {
+ ICR_USE_FLOW_OBJECTIVES + "=" + ICR_USE_FLOW_OBJECTIVES_DEFAULT,
+ ICR_LABEL_SELECTION + "=" + ICR_LABEL_SELECTION_DEFAULT,
+ ICR_OPT_LABEL_SELECTION + "=" + ICR_LABEL_SELECTION_DEFAULT,
+ ICR_FLOW_OPTIMIZATION + "=" + ICR_FLOW_OPTIMIZATION_DEFAULT,
+ ICR_COPY_TTL + "=" + ICR_COPY_TTL_DEFAULT
+ }
+)
public class IntentConfigurableRegistrator {
private final Logger log = getLogger(getClass());
@@ -52,35 +71,30 @@
@Reference(cardinality = ReferenceCardinality.MANDATORY)
protected ComponentConfigService cfgService;
- private static final boolean DEFAULT_FLOW_OBJECTIVES = false;
//@Property(name = "useFlowObjectives",
// boolValue = DEFAULT_FLOW_OBJECTIVES,
// label = "Indicates whether or not to use flow objective-based compilers")
- private boolean useFlowObjectives = DEFAULT_FLOW_OBJECTIVES;
+ private boolean useFlowObjectives = ICR_USE_FLOW_OBJECTIVES_DEFAULT;
- private static final String DEFAULT_LABEL_SELECTION = "RANDOM";
//@Property(name = "labelSelection",
// value = DEFAULT_LABEL_SELECTION,
// label = "Defines the label selection algorithm - RANDOM or FIRST_FIT")
- private String labelSelection = DEFAULT_LABEL_SELECTION;
+ private String labelSelection = ICR_LABEL_SELECTION_DEFAULT;
- private static final String DEFAULT_OPT_LABEL_SELECTION = "NONE";
//@Property(name = "optLabelSelection",
// value = DEFAULT_OPT_LABEL_SELECTION,
// label = "Defines the optimization for label selection algorithm - NONE, NO_SWAP, MIN_SWAP")
- private String optLabelSelection = DEFAULT_OPT_LABEL_SELECTION;
+ private String optLabelSelection = ICR_OPT_LABEL_SELECTION_DEFAULT;
- private static final boolean DEFAULT_FLOW_OPTIMIZATION = false;
//@Property(name = "optimizeInstructions",
// boolValue = DEFAULT_FLOW_OPTIMIZATION,
// label = "Indicates whether or not to optimize the flows in the link collection compiler")
- private boolean optimizeInstructions = DEFAULT_FLOW_OPTIMIZATION;
+ private boolean optimizeInstructions = ICR_FLOW_OPTIMIZATION_DEFAULT;
- private static final boolean DEFAULT_COPY_TTL = false;
//@Property(name = "useCopyTtl",
// boolValue = DEFAULT_COPY_TTL,
// label = "Indicates whether or not to use copy ttl in the link collection compiler")
- private boolean useCopyTtl = DEFAULT_COPY_TTL;
+ private boolean useCopyTtl = ICR_COPY_TTL_DEFAULT;
private final Map<Class<Intent>, IntentCompiler<Intent>> flowRuleBased = Maps.newConcurrentMap();
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/installer/FlowRuleIntentInstaller.java b/core/net/src/main/java/org/onosproject/net/intent/impl/installer/FlowRuleIntentInstaller.java
index 7b12a07..12d1891 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/installer/FlowRuleIntentInstaller.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/installer/FlowRuleIntentInstaller.java
@@ -61,6 +61,8 @@
import static com.google.common.base.Strings.isNullOrEmpty;
import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor;
import static org.onlab.util.Tools.groupedThreads;
+import static org.onosproject.net.OsgiPropertyConstants.NON_DISRUPTIVE_INSTALLATION_WAITING_TIME;
+import static org.onosproject.net.OsgiPropertyConstants.NON_DISRUPTIVE_INSTALLATION_WAITING_TIME_DEFAULT;
import static org.onosproject.net.intent.IntentInstaller.Direction.ADD;
import static org.onosproject.net.intent.IntentInstaller.Direction.REMOVE;
import static org.onosproject.net.intent.IntentState.INSTALLED;
@@ -71,7 +73,12 @@
/**
* Installer for FlowRuleIntent.
*/
-@Component(immediate = true)
+@Component(
+ immediate = true,
+ property = {
+ NON_DISRUPTIVE_INSTALLATION_WAITING_TIME + "=" + NON_DISRUPTIVE_INSTALLATION_WAITING_TIME_DEFAULT
+ }
+)
public class FlowRuleIntentInstaller implements IntentInstaller<FlowRuleIntent> {
@Reference(cardinality = ReferenceCardinality.MANDATORY)
protected IntentExtensionService intentExtensionService;
@@ -93,11 +100,10 @@
private ScheduledExecutorService nonDisruptiveIntentInstaller;
- private static final int DEFAULT_NON_DISRUPTIVE_INSTALLATION_WAITING_TIME = 1;
//@Property(name = "nonDisruptiveInstallationWaitingTime",
// intValue = DEFAULT_NON_DISRUPTIVE_INSTALLATION_WAITING_TIME,
// label = "Number of seconds to wait during the non-disruptive installation phases")
- private int nonDisruptiveInstallationWaitingTime = DEFAULT_NON_DISRUPTIVE_INSTALLATION_WAITING_TIME;
+ private int nonDisruptiveInstallationWaitingTime = NON_DISRUPTIVE_INSTALLATION_WAITING_TIME_DEFAULT;
protected final Logger log = getLogger(IntentManager.class);
@@ -123,7 +129,7 @@
public void modified(ComponentContext context) {
if (context == null) {
- nonDisruptiveInstallationWaitingTime = DEFAULT_NON_DISRUPTIVE_INSTALLATION_WAITING_TIME;
+ nonDisruptiveInstallationWaitingTime = NON_DISRUPTIVE_INSTALLATION_WAITING_TIME_DEFAULT;
log.info("Restored default installation time for non-disruptive reallocation (1 sec.)");
return;
}
diff --git a/core/net/src/main/java/org/onosproject/net/meter/impl/MeterManager.java b/core/net/src/main/java/org/onosproject/net/meter/impl/MeterManager.java
index 35ad493..721cf15 100644
--- a/core/net/src/main/java/org/onosproject/net/meter/impl/MeterManager.java
+++ b/core/net/src/main/java/org/onosproject/net/meter/impl/MeterManager.java
@@ -62,12 +62,26 @@
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.net.OsgiPropertyConstants.MM_FALLBACK_METER_POLL_FREQUENCY;
+import static org.onosproject.net.OsgiPropertyConstants.MM_FALLBACK_METER_POLL_FREQUENCY_DEFAULT;
+import static org.onosproject.net.OsgiPropertyConstants.MM_NUM_THREADS;
+import static org.onosproject.net.OsgiPropertyConstants.MM_NUM_THREADS_DEFAULT;
import static org.slf4j.LoggerFactory.getLogger;
/**
* Provides implementation of the meter service APIs.
*/
-@Component(immediate = true, service = { MeterService.class, MeterProviderRegistry.class })
+@Component(
+ immediate = true,
+ service = {
+ MeterService.class,
+ MeterProviderRegistry.class
+ },
+ property = {
+ MM_NUM_THREADS + "=" + MM_NUM_THREADS_DEFAULT,
+ MM_FALLBACK_METER_POLL_FREQUENCY + "=" + MM_FALLBACK_METER_POLL_FREQUENCY_DEFAULT
+ }
+)
public class MeterManager
extends AbstractListenerProviderRegistry<MeterEvent, MeterListener, MeterProvider, MeterProviderService>
implements MeterService, MeterProviderRegistry {
@@ -80,7 +94,7 @@
//@Property(name = NUM_THREAD,
// intValue = DEFAULT_NUM_THREADS,
// label = "Number of worker threads")
- private int numThreads = DEFAULT_NUM_THREADS;
+ private int numThreads = MM_NUM_THREADS_DEFAULT;
private final Logger log = getLogger(getClass());
private final MeterStoreDelegate delegate = new InternalMeterStoreDelegate();
@@ -100,10 +114,9 @@
@Reference(cardinality = ReferenceCardinality.MANDATORY)
protected MastershipService mastershipService;
- private static final int DEFAULT_POLL_FREQUENCY = 30;
//@Property(name = "fallbackMeterPollFrequency", intValue = DEFAULT_POLL_FREQUENCY,
// label = "Frequency (in seconds) for polling meters via fallback provider")
- private int fallbackMeterPollFrequency = DEFAULT_POLL_FREQUENCY;
+ private int fallbackMeterPollFrequency = MM_FALLBACK_METER_POLL_FREQUENCY_DEFAULT;
private TriConsumer<MeterRequest, MeterStoreResult, Throwable> onComplete;
@@ -167,9 +180,10 @@
String s = get(properties, "fallbackMeterPollFrequency");
try {
- fallbackMeterPollFrequency = isNullOrEmpty(s) ? DEFAULT_POLL_FREQUENCY : Integer.parseInt(s);
+ fallbackMeterPollFrequency = isNullOrEmpty(s) ?
+ MM_FALLBACK_METER_POLL_FREQUENCY_DEFAULT : Integer.parseInt(s);
} catch (NumberFormatException e) {
- fallbackMeterPollFrequency = DEFAULT_POLL_FREQUENCY;
+ fallbackMeterPollFrequency = MM_FALLBACK_METER_POLL_FREQUENCY_DEFAULT;
}
}
diff --git a/core/net/src/main/java/org/onosproject/net/neighbour/impl/NeighbourResolutionManager.java b/core/net/src/main/java/org/onosproject/net/neighbour/impl/NeighbourResolutionManager.java
index d403255..c0ee1a7 100644
--- a/core/net/src/main/java/org/onosproject/net/neighbour/impl/NeighbourResolutionManager.java
+++ b/core/net/src/main/java/org/onosproject/net/neighbour/impl/NeighbourResolutionManager.java
@@ -68,12 +68,26 @@
import static org.onlab.packet.ICMP6.NEIGHBOR_ADVERTISEMENT;
import static org.onlab.packet.ICMP6.NEIGHBOR_SOLICITATION;
import static org.onlab.packet.IPv6.PROTOCOL_ICMP6;
+import static org.onosproject.net.OsgiPropertyConstants.NRM_ARP_ENABLED;
+import static org.onosproject.net.OsgiPropertyConstants.NRM_ARP_ENABLED_DEFAULT;
+import static org.onosproject.net.OsgiPropertyConstants.NRM_NDP_ENABLED;
+import static org.onosproject.net.OsgiPropertyConstants.NRM_NDP_ENABLED_DEFAULT;
+import static org.onosproject.net.OsgiPropertyConstants.NRM_REQUEST_INTERCEPTS_ENABLED;
+import static org.onosproject.net.OsgiPropertyConstants.NRM_REQUEST_INTERCEPTS_ENABLED_DEFAULT;
import static org.onosproject.net.packet.PacketPriority.CONTROL;
/**
* Manages handlers for neighbour messages.
*/
-@Component(immediate = true, service = NeighbourResolutionService.class)
+@Component(
+ immediate = true,
+ service = NeighbourResolutionService.class,
+ property = {
+ NRM_ARP_ENABLED + "=" + NRM_ARP_ENABLED_DEFAULT,
+ NRM_NDP_ENABLED + "=" + NRM_NDP_ENABLED,
+ NRM_REQUEST_INTERCEPTS_ENABLED + "=" + NRM_REQUEST_INTERCEPTS_ENABLED_DEFAULT
+ }
+)
public class NeighbourResolutionManager implements NeighbourResolutionService {
private final Logger log = LoggerFactory.getLogger(getClass());
@@ -95,15 +109,15 @@
//@Property(name = "arpEnabled", boolValue = true,
// label = "Enable Address resolution protocol")
- protected boolean arpEnabled = true;
+ protected boolean arpEnabled = NRM_ARP_ENABLED_DEFAULT;
//@Property(name = "ndpEnabled", boolValue = false,
// label = "Enable IPv6 neighbour discovery")
- protected boolean ndpEnabled = false;
+ protected boolean ndpEnabled = NRM_NDP_ENABLED_DEFAULT;
//@Property(name = "requestInterceptsEnabled", boolValue = true,
// label = "Enable requesting packet intercepts")
- private boolean requestInterceptsEnabled = true;
+ private boolean requestInterceptsEnabled = NRM_REQUEST_INTERCEPTS_ENABLED_DEFAULT;
private static final String APP_NAME = "org.onosproject.neighbour";
private ApplicationId appId;
diff --git a/core/net/src/main/java/org/onosproject/net/package-info.java b/core/net/src/main/java/org/onosproject/net/package-info.java
new file mode 100644
index 0000000..ada4d32
--- /dev/null
+++ b/core/net/src/main/java/org/onosproject/net/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Constants for OSGi properties in the core/net components.
+ */
+package org.onosproject.net;
diff --git a/core/net/src/main/java/org/onosproject/net/pi/impl/PiPipeconfWatchdogManager.java b/core/net/src/main/java/org/onosproject/net/pi/impl/PiPipeconfWatchdogManager.java
index 0b1daf1..998ca61 100644
--- a/core/net/src/main/java/org/onosproject/net/pi/impl/PiPipeconfWatchdogManager.java
+++ b/core/net/src/main/java/org/onosproject/net/pi/impl/PiPipeconfWatchdogManager.java
@@ -67,6 +67,8 @@
import java.util.concurrent.locks.Lock;
import static org.onlab.util.Tools.groupedThreads;
+import static org.onosproject.net.OsgiPropertyConstants.PWM_PROBE_INTERVAL;
+import static org.onosproject.net.OsgiPropertyConstants.PWM_PROBE_INTERVAL_DEFAULT;
import static org.slf4j.LoggerFactory.getLogger;
/**
@@ -74,7 +76,13 @@
* pipeline probe task and listens for device events to update the status of the
* pipeline.
*/
-@Component(immediate = true, service = PiPipeconfWatchdogService.class)
+@Component(
+ immediate = true,
+ service = PiPipeconfWatchdogService.class,
+ property = {
+ PWM_PROBE_INTERVAL + "=" + PWM_PROBE_INTERVAL_DEFAULT
+ }
+)
public class PiPipeconfWatchdogManager
extends AbstractListenerManager<PiPipeconfWatchdogEvent, PiPipeconfWatchdogListener>
implements PiPipeconfWatchdogService {
@@ -104,11 +112,9 @@
@Reference(cardinality = ReferenceCardinality.MANDATORY)
private ComponentConfigService componentConfigService;
- private static final String PROBE_INTERVAL = "probeInterval";
- private static final int DEFAULT_PROBE_INTERVAL = 15;
//@Property(name = PROBE_INTERVAL, intValue = DEFAULT_PROBE_INTERVAL,
// label = "Configure interval in seconds for device pipeconf probing")
- private int probeInterval = DEFAULT_PROBE_INTERVAL;
+ private int probeInterval = PWM_PROBE_INTERVAL_DEFAULT;
protected ExecutorService executor = Executors.newFixedThreadPool(
30, groupedThreads("onos/pipeconf-watchdog", "%d", log));
@@ -155,9 +161,9 @@
Dictionary<?, ?> properties = context.getProperties();
final int oldProbeInterval = probeInterval;
probeInterval = Tools.getIntegerProperty(
- properties, PROBE_INTERVAL, DEFAULT_PROBE_INTERVAL);
+ properties, PWM_PROBE_INTERVAL, PWM_PROBE_INTERVAL_DEFAULT);
log.info("Configured. {} is configured to {} seconds",
- PROBE_INTERVAL, probeInterval);
+ PWM_PROBE_INTERVAL_DEFAULT, probeInterval);
if (oldProbeInterval != probeInterval) {
rescheduleProbeTask();
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 20692df..0c33512 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
@@ -52,6 +52,12 @@
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.OsgiPropertyConstants.DTP_MAX_BATCH_MS;
+import static org.onosproject.net.OsgiPropertyConstants.DTP_MAX_BATCH_MS_DEFAULT;
+import static org.onosproject.net.OsgiPropertyConstants.DTP_MAX_EVENTS;
+import static org.onosproject.net.OsgiPropertyConstants.DTP_MAX_EVENTS_DEFAULT;
+import static org.onosproject.net.OsgiPropertyConstants.DTP_MAX_IDLE_MS;
+import static org.onosproject.net.OsgiPropertyConstants.DTP_MAX_IDLE_MS_DEFAULT;
import static org.onosproject.net.device.DeviceEvent.Type.DEVICE_ADDED;
import static org.onosproject.net.device.DeviceEvent.Type.DEVICE_AVAILABILITY_CHANGED;
import static org.onosproject.net.device.DeviceEvent.Type.DEVICE_REMOVED;
@@ -62,14 +68,19 @@
* device and link subsystem events to trigger assembly and computation of
* new topology snapshots.
*/
-@Component(immediate = true, service = TopologyProvider.class)
+@Component(
+ immediate = true,
+ service = TopologyProvider.class,
+ property = {
+ DTP_MAX_EVENTS + "=" + DTP_MAX_EVENTS_DEFAULT,
+ DTP_MAX_IDLE_MS + "=" + DTP_MAX_IDLE_MS_DEFAULT,
+ DTP_MAX_BATCH_MS + "=" + DTP_MAX_BATCH_MS_DEFAULT
+ }
+)
public class DefaultTopologyProvider extends AbstractProvider
implements TopologyProvider {
private static final int MAX_THREADS = 8;
- private static final int DEFAULT_MAX_EVENTS = 1000;
- private static final int DEFAULT_MAX_IDLE_MS = 10;
- private static final int DEFAULT_MAX_BATCH_MS = 50;
// FIXME: Replace with a system-wide timer instance;
// TODO: Convert to use HashedWheelTimer or produce a variant of that; then decide which we want to adopt
@@ -77,15 +88,15 @@
//@Property(name = "maxEvents", intValue = DEFAULT_MAX_EVENTS,
// label = "Maximum number of events to accumulate")
- private int maxEvents = DEFAULT_MAX_EVENTS;
+ private int maxEvents = DTP_MAX_EVENTS_DEFAULT;
//@Property(name = "maxIdleMs", intValue = DEFAULT_MAX_IDLE_MS,
// label = "Maximum number of millis between events")
- private int maxIdleMs = DEFAULT_MAX_IDLE_MS;
+ private int maxIdleMs = DTP_MAX_IDLE_MS_DEFAULT;
//@Property(name = "maxBatchMs", intValue = DEFAULT_MAX_BATCH_MS,
// label = "Maximum number of millis for whole batch")
- private int maxBatchMs = DEFAULT_MAX_BATCH_MS;
+ private int maxBatchMs = DTP_MAX_BATCH_MS_DEFAULT;
private final Logger log = getLogger(getClass());
@@ -172,9 +183,9 @@
newMaxIdleMs = isNullOrEmpty(s) ? maxIdleMs : Integer.parseInt(s.trim());
} catch (NumberFormatException | ClassCastException e) {
- newMaxEvents = DEFAULT_MAX_EVENTS;
- newMaxBatchMs = DEFAULT_MAX_BATCH_MS;
- newMaxIdleMs = DEFAULT_MAX_IDLE_MS;
+ newMaxEvents = DTP_MAX_EVENTS_DEFAULT;
+ newMaxBatchMs = DTP_MAX_BATCH_MS_DEFAULT;
+ newMaxIdleMs = DTP_MAX_IDLE_MS_DEFAULT;
}
if (newMaxEvents != maxEvents || newMaxBatchMs != maxBatchMs || newMaxIdleMs != maxIdleMs) {