Removing commented out @Property annotations from the drivers, protocols, pipelines and providers.

Change-Id: I4cabc5a53c93b778824c72cebbce0ec49700eade
This commit is contained in:
Thomas Vachuska 2018-10-30 15:13:20 -07:00
parent f566fa2503
commit 00b5d4fee0
41 changed files with 533 additions and 336 deletions

View File

@ -50,7 +50,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static java.lang.String.format; import static java.lang.String.format;
import static org.onosproject.drivers.bmv2.ctl.OsgiPropertyDefaults.*; import static org.onosproject.drivers.bmv2.ctl.OsgiPropertyConstants.*;
import static org.slf4j.LoggerFactory.getLogger; import static org.slf4j.LoggerFactory.getLogger;
/** /**
@ -58,9 +58,9 @@ import static org.slf4j.LoggerFactory.getLogger;
*/ */
@Component(immediate = true, service = Bmv2PreController.class, @Component(immediate = true, service = Bmv2PreController.class,
property = { property = {
"numConnectionRetries:Integer=" + NUM_CONNECTION_RETRIES_DEFAULT, NUM_CONNECTION_RETRIES + ":Integer=" + NUM_CONNECTION_RETRIES_DEFAULT,
"timeBetweenRetries:Integer=" + TIME_BETWEEN_RETRIES_DEFAULT, TIME_BETWEEN_RETRIES + ":Integer=" + TIME_BETWEEN_RETRIES_DEFAULT,
"deviceLockWaitingTime:Integer=" + DEVICE_LOCK_WAITING_TIME_IN_SEC_DEFAULT, DEVICE_LOCK_WAITING_TIME_IN_SEC + ":Integer=" + DEVICE_LOCK_WAITING_TIME_IN_SEC_DEFAULT,
}) })
public class Bmv2PreControllerImpl implements Bmv2PreController { public class Bmv2PreControllerImpl implements Bmv2PreController {
@ -79,14 +79,14 @@ public class Bmv2PreControllerImpl implements Bmv2PreController {
}); });
@Reference(cardinality = ReferenceCardinality.MANDATORY) @Reference(cardinality = ReferenceCardinality.MANDATORY)
protected ComponentConfigService cfgService; protected ComponentConfigService cfgService;
//@Property(name = "numConnectionRetries", intValue = DEFAULT_NUM_CONNECTION_RETRIES,
// label = "Number of connection retries after a network error") /** Number of connection retries after a network error. */
private int numConnectionRetries = NUM_CONNECTION_RETRIES_DEFAULT; private int numConnectionRetries = NUM_CONNECTION_RETRIES_DEFAULT;
//@Property(name = "timeBetweenRetries", intValue = DEFAULT_TIME_BETWEEN_RETRIES,
// label = "Time between retries in milliseconds") /** Time between retries in milliseconds. */
private int timeBetweenRetries = TIME_BETWEEN_RETRIES_DEFAULT; private int timeBetweenRetries = TIME_BETWEEN_RETRIES_DEFAULT;
//@Property(name = "deviceLockWaitingTime", intValue = DEVICE_LOCK_WAITING_TIME_IN_SEC,
// label = "Waiting time for a read/write lock in seconds") /** Waiting time for a read/write lock in seconds. */
private int deviceLockWaitingTime = DEVICE_LOCK_WAITING_TIME_IN_SEC_DEFAULT; private int deviceLockWaitingTime = DEVICE_LOCK_WAITING_TIME_IN_SEC_DEFAULT;
@Activate @Activate

View File

@ -19,11 +19,16 @@ package org.onosproject.drivers.bmv2.ctl;
/** /**
* Constants for default values of configurable properties. * Constants for default values of configurable properties.
*/ */
public final class OsgiPropertyDefaults { public final class OsgiPropertyConstants {
private OsgiPropertyDefaults() {} private OsgiPropertyConstants() {}
public static final String DEVICE_LOCK_WAITING_TIME_IN_SEC = "deviceLockWaitingTime";
public static final int DEVICE_LOCK_WAITING_TIME_IN_SEC_DEFAULT = 60; public static final int DEVICE_LOCK_WAITING_TIME_IN_SEC_DEFAULT = 60;
public static final String NUM_CONNECTION_RETRIES = "numConnectionRetries";
public static final int NUM_CONNECTION_RETRIES_DEFAULT = 2; public static final int NUM_CONNECTION_RETRIES_DEFAULT = 2;
public static final int TIME_BETWEEN_RETRIES_DEFAULT = 10;
public static final String TIME_BETWEEN_RETRIES = "timeBetweenRetries";
public static final int TIME_BETWEEN_RETRIES_DEFAULT = 2;
} }

View File

@ -65,8 +65,7 @@ public class GrpcServiceRegistryImpl implements GrpcServiceRegistry {
clients of nonstandard port usage as there is no mechanism available to clients of nonstandard port usage as there is no mechanism available to
discover the port hosting gRPC services. discover the port hosting gRPC services.
*/ */
@Property(name = PORT_PROPERTY_NAME, intValue = DEFAULT_SERVER_PORT, /** The port number which ONOS will use to host gRPC services. */
label = "The port number which ONOS will use to host gRPC services.")
private int listeningPort = DEFAULT_SERVER_PORT; private int listeningPort = DEFAULT_SERVER_PORT;
@Activate @Activate

View File

@ -99,9 +99,7 @@ public class GrpcRemoteServiceServer {
@Reference(cardinality = ReferenceCardinality.MANDATORY) @Reference(cardinality = ReferenceCardinality.MANDATORY)
protected LinkProviderRegistry linkProviderRegistry; protected LinkProviderRegistry linkProviderRegistry;
/** Port to listen on */
@Property(name = "listenPort", intValue = DEFAULT_LISTEN_PORT,
label = "Port to listen on")
protected int listenPort = DEFAULT_LISTEN_PORT; protected int listenPort = DEFAULT_LISTEN_PORT;
private Server server; private Server server;

View File

@ -94,7 +94,7 @@ import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Strings.isNullOrEmpty; import static com.google.common.base.Strings.isNullOrEmpty;
import static org.onlab.util.Tools.get; import static org.onlab.util.Tools.get;
import static org.onlab.util.Tools.groupedThreads; import static org.onlab.util.Tools.groupedThreads;
import static org.onosproject.incubator.store.virtual.impl.OsgiPropertyDefaults.*; import static org.onosproject.incubator.store.virtual.impl.OsgiPropertyConstants.*;
import static org.onosproject.net.flow.FlowRuleEvent.Type.RULE_REMOVED; import static org.onosproject.net.flow.FlowRuleEvent.Type.RULE_REMOVED;
import static org.slf4j.LoggerFactory.getLogger; import static org.slf4j.LoggerFactory.getLogger;
@ -105,9 +105,9 @@ import static org.slf4j.LoggerFactory.getLogger;
//TODO: support backup and persistent mechanism //TODO: support backup and persistent mechanism
@Component(immediate = true, enabled = false, service = VirtualNetworkFlowRuleStore.class, @Component(immediate = true, enabled = false, service = VirtualNetworkFlowRuleStore.class,
property = { property = {
"messageHandlerThreadPoolSize:Integer=" + MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT, MESSAGE_HANDLER_THREAD_POOL_SIZE + ":Integer=" + MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT,
"pendingFutureTimeoutMinutes:Integer=" + BACKUP_PERIOD_MILLIS_DEFAULT, BACKUP_PERIOD_MILLIS + ":Integer=" + BACKUP_PERIOD_MILLIS_DEFAULT,
"persistenceEnabled:Boolean=" + PERSISTENCE_ENABLED_DEFAULT, PERSISTENCE_ENABLED + ":Boolean=" + PERSISTENCE_ENABLED_DEFAULT,
}) })
public class DistributedVirtualFlowRuleStore public class DistributedVirtualFlowRuleStore
@ -117,7 +117,6 @@ public class DistributedVirtualFlowRuleStore
private final Logger log = getLogger(getClass()); private final Logger log = getLogger(getClass());
//TODO: confirm this working fine with multiple thread more than 1 //TODO: confirm this working fine with multiple thread more than 1
private static final int MESSAGE_HANDLER_THREAD_POOL_SIZE = 1;
private static final long FLOW_RULE_STORE_TIMEOUT_MILLIS = 5000; private static final long FLOW_RULE_STORE_TIMEOUT_MILLIS = 5000;
private static final String FLOW_OP_TOPIC = "virtual-flow-ops-ids"; private static final String FLOW_OP_TOPIC = "virtual-flow-ops-ids";
@ -134,15 +133,13 @@ public class DistributedVirtualFlowRuleStore
private static final MessageSubject REMOTE_APPLY_COMPLETED private static final MessageSubject REMOTE_APPLY_COMPLETED
= new MessageSubject("virtual-peer-apply-completed"); = new MessageSubject("virtual-peer-apply-completed");
//@Property(name = "msgHandlerThreadPoolSize", intValue = MESSAGE_HANDLER_THREAD_POOL_SIZE, /** Number of threads in the message handler pool. */
// label = "Number of threads in the message handler pool")
private int msgHandlerThreadPoolSize = MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT; private int msgHandlerThreadPoolSize = MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT;
//@Property(name = "backupPeriod", intValue = BACKUP_PERIOD_MILLIS, /** Delay in ms between successive backup runs. */
// label = "Delay in ms between successive backup runs")
private int backupPeriod = BACKUP_PERIOD_MILLIS_DEFAULT; private int backupPeriod = BACKUP_PERIOD_MILLIS_DEFAULT;
//@Property(name = "persistenceEnabled", boolValue = false,
// label = "Indicates whether or not changes in the flow table should be persisted to disk.") /** Indicates whether or not changes in the flow table should be persisted to disk.. */
private boolean persistenceEnabled = PERSISTENCE_ENABLED_DEFAULT; private boolean persistenceEnabled = PERSISTENCE_ENABLED_DEFAULT;
private InternalFlowTable flowTable = new InternalFlowTable(); private InternalFlowTable flowTable = new InternalFlowTable();
@ -240,13 +237,13 @@ public class DistributedVirtualFlowRuleStore
int newPoolSize; int newPoolSize;
int newBackupPeriod; int newBackupPeriod;
try { try {
String s = get(properties, "msgHandlerPoolSize"); String s = get(properties, MESSAGE_HANDLER_THREAD_POOL_SIZE);
newPoolSize = isNullOrEmpty(s) ? msgHandlerThreadPoolSize : Integer.parseInt(s.trim()); newPoolSize = isNullOrEmpty(s) ? msgHandlerThreadPoolSize : Integer.parseInt(s.trim());
s = get(properties, "backupPeriod"); s = get(properties, BACKUP_PERIOD_MILLIS);
newBackupPeriod = isNullOrEmpty(s) ? backupPeriod : Integer.parseInt(s.trim()); newBackupPeriod = isNullOrEmpty(s) ? backupPeriod : Integer.parseInt(s.trim());
} catch (NumberFormatException | ClassCastException e) { } catch (NumberFormatException | ClassCastException e) {
newPoolSize = MESSAGE_HANDLER_THREAD_POOL_SIZE; newPoolSize = MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT;
newBackupPeriod = BACKUP_PERIOD_MILLIS_DEFAULT; newBackupPeriod = BACKUP_PERIOD_MILLIS_DEFAULT;
} }

View File

@ -63,7 +63,8 @@ import static com.google.common.base.Strings.isNullOrEmpty;
import static java.util.concurrent.Executors.newFixedThreadPool; import static java.util.concurrent.Executors.newFixedThreadPool;
import static org.onlab.util.Tools.get; import static org.onlab.util.Tools.get;
import static org.onlab.util.Tools.groupedThreads; import static org.onlab.util.Tools.groupedThreads;
import static org.onosproject.incubator.store.virtual.impl.OsgiPropertyDefaults.MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT; import static org.onosproject.incubator.store.virtual.impl.OsgiPropertyConstants.MESSAGE_HANDLER_THREAD_POOL_SIZE;
import static org.onosproject.incubator.store.virtual.impl.OsgiPropertyConstants.MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT;
import static org.onosproject.net.packet.PacketEvent.Type.EMIT; import static org.onosproject.net.packet.PacketEvent.Type.EMIT;
import static org.slf4j.LoggerFactory.getLogger; import static org.slf4j.LoggerFactory.getLogger;
@ -73,7 +74,7 @@ import static org.slf4j.LoggerFactory.getLogger;
*/ */
@Component(immediate = true, enabled = false, service = VirtualNetworkPacketStore.class, @Component(immediate = true, enabled = false, service = VirtualNetworkPacketStore.class,
property = { property = {
"messageHandlerThreadPoolSize:Integer=" + MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT, MESSAGE_HANDLER_THREAD_POOL_SIZE + ":Integer=" + MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT,
}) })
public class DistributedVirtualPacketStore public class DistributedVirtualPacketStore
extends AbstractVirtualStore<PacketEvent, PacketStoreDelegate> extends AbstractVirtualStore<PacketEvent, PacketStoreDelegate>
@ -107,8 +108,7 @@ public class DistributedVirtualPacketStore
private ExecutorService messageHandlingExecutor; private ExecutorService messageHandlingExecutor;
//@Property(name = "messageHandlerThreadPoolSize", intValue = DEFAULT_MESSAGE_HANDLER_THREAD_POOL_SIZE, /** Size of thread pool to assign message handler. */
// label = "Size of thread pool to assign message handler")
private static int messageHandlerThreadPoolSize = MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT; private static int messageHandlerThreadPoolSize = MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT;
@Activate @Activate
@ -149,7 +149,7 @@ public class DistributedVirtualPacketStore
int newMessageHandlerThreadPoolSize; int newMessageHandlerThreadPoolSize;
try { try {
String s = get(properties, "messageHandlerThreadPoolSize"); String s = get(properties, MESSAGE_HANDLER_THREAD_POOL_SIZE);
newMessageHandlerThreadPoolSize = newMessageHandlerThreadPoolSize =
isNullOrEmpty(s) ? messageHandlerThreadPoolSize : Integer.parseInt(s.trim()); isNullOrEmpty(s) ? messageHandlerThreadPoolSize : Integer.parseInt(s.trim());

View File

@ -19,13 +19,20 @@ package org.onosproject.incubator.store.virtual.impl;
/** /**
* Constants for default values of configurable properties. * Constants for default values of configurable properties.
*/ */
public final class OsgiPropertyDefaults { public final class OsgiPropertyConstants {
private OsgiPropertyDefaults() {} private OsgiPropertyConstants() {}
public static final String MESSAGE_HANDLER_THREAD_POOL_SIZE = "messageHandlerThreadPoolSize";
public static final int MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT = 4; public static final int MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT = 4;
public static final String BACKUP_PERIOD_MILLIS = "backupPeriod";
public static final int BACKUP_PERIOD_MILLIS_DEFAULT = 2000; public static final int BACKUP_PERIOD_MILLIS_DEFAULT = 2000;
public static final String PERSISTENCE_ENABLED = "persistenceEnabled";
public static final boolean PERSISTENCE_ENABLED_DEFAULT = false; public static final boolean PERSISTENCE_ENABLED_DEFAULT = false;
public static final String PENDING_FUTURE_TIMEOUT_MINUTES = "pendingFutureTimeoutMinutes";
public static final int PENDING_FUTURE_TIMEOUT_MINUTES_DEFAULT = 5; public static final int PENDING_FUTURE_TIMEOUT_MINUTES_DEFAULT = 5;
} }

View File

@ -62,7 +62,8 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import static org.onosproject.incubator.store.virtual.impl.OsgiPropertyDefaults.PENDING_FUTURE_TIMEOUT_MINUTES_DEFAULT; import static org.onosproject.incubator.store.virtual.impl.OsgiPropertyConstants.PENDING_FUTURE_TIMEOUT_MINUTES;
import static org.onosproject.incubator.store.virtual.impl.OsgiPropertyConstants.PENDING_FUTURE_TIMEOUT_MINUTES_DEFAULT;
import static org.onosproject.net.flow.FlowRuleEvent.Type.RULE_REMOVED; import static org.onosproject.net.flow.FlowRuleEvent.Type.RULE_REMOVED;
import static org.slf4j.LoggerFactory.getLogger; import static org.slf4j.LoggerFactory.getLogger;
@ -74,7 +75,7 @@ import static org.slf4j.LoggerFactory.getLogger;
@Component(immediate = true, service = VirtualNetworkFlowRuleStore.class, @Component(immediate = true, service = VirtualNetworkFlowRuleStore.class,
property = { property = {
"pendingFutureTimeoutMinutes:Integer=" + PENDING_FUTURE_TIMEOUT_MINUTES_DEFAULT, PENDING_FUTURE_TIMEOUT_MINUTES + ":Integer=" + PENDING_FUTURE_TIMEOUT_MINUTES_DEFAULT,
}) })
public class SimpleVirtualFlowRuleStore public class SimpleVirtualFlowRuleStore
extends AbstractVirtualStore<FlowRuleBatchEvent, FlowRuleStoreDelegate> extends AbstractVirtualStore<FlowRuleBatchEvent, FlowRuleStoreDelegate>
@ -92,8 +93,7 @@ public class SimpleVirtualFlowRuleStore
private final AtomicInteger localBatchIdGen = new AtomicInteger(); private final AtomicInteger localBatchIdGen = new AtomicInteger();
//@Property(name = "pendingFutureTimeoutMinutes", intValue = DEFAULT_PENDING_FUTURE_TIMEOUT_MINUTES, /** Expiration time after an entry is created that it should be automatically removed. */
// label = "Expiration time after an entry is created that it should be automatically removed")
private int pendingFutureTimeoutMinutes = PENDING_FUTURE_TIMEOUT_MINUTES_DEFAULT; private int pendingFutureTimeoutMinutes = PENDING_FUTURE_TIMEOUT_MINUTES_DEFAULT;
private Cache<Integer, SettableFuture<CompletedBatchOperation>> pendingFutures = private Cache<Integer, SettableFuture<CompletedBatchOperation>> pendingFutures =

View File

@ -60,11 +60,16 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.Lock;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.onosproject.grpc.ctl.OsgiPropertyConstants.ENABLE_MESSAGE_LOG;
import static org.onosproject.grpc.ctl.OsgiPropertyConstants.ENABLE_MESSAGE_LOG_DEFAULT;
/** /**
* Default implementation of the GrpcController. * Default implementation of the GrpcController.
*/ */
@Component(immediate = true, service = GrpcController.class) @Component(immediate = true, service = GrpcController.class,
property = {
ENABLE_MESSAGE_LOG + ":Boolean=" + ENABLE_MESSAGE_LOG_DEFAULT,
})
public class GrpcControllerImpl implements GrpcController { public class GrpcControllerImpl implements GrpcController {
private static final String SET_FORWARDING_PIPELINE_CONFIG_METHOD = "p4.P4Runtime/SetForwardingPipelineConfig"; private static final String SET_FORWARDING_PIPELINE_CONFIG_METHOD = "p4.P4Runtime/SetForwardingPipelineConfig";
@ -75,8 +80,8 @@ public class GrpcControllerImpl implements GrpcController {
// Hint: set to true to log all gRPC messages received/sent on all channels // Hint: set to true to log all gRPC messages received/sent on all channels
// Does not enable log on existing channels // Does not enable log on existing channels
private static final boolean DEFAULT_LOG_LEVEL = false; private static final boolean DEFAULT_LOG_LEVEL = false;
//@Property(name = "enableMessageLog", boolValue = DEFAULT_LOG_LEVEL,
// label = "Indicates whether to log all gRPC messages sent and received on all channels") /** Indicates whether to log all gRPC messages sent and received on all channels. */
public static boolean enableMessageLog = DEFAULT_LOG_LEVEL; public static boolean enableMessageLog = DEFAULT_LOG_LEVEL;
private final Logger log = LoggerFactory.getLogger(getClass()); private final Logger log = LoggerFactory.getLogger(getClass());
@ -95,7 +100,7 @@ public class GrpcControllerImpl implements GrpcController {
public void modified(ComponentContext context) { public void modified(ComponentContext context) {
if (context != null) { if (context != null) {
Dictionary<?, ?> properties = context.getProperties(); Dictionary<?, ?> properties = context.getProperties();
enableMessageLog = Tools.isPropertyEnabled(properties, "enableMessageLog", enableMessageLog = Tools.isPropertyEnabled(properties, ENABLE_MESSAGE_LOG,
DEFAULT_LOG_LEVEL); DEFAULT_LOG_LEVEL);
log.info("Configured. Log of gRPC messages is {}", enableMessageLog ? "enabled" : "disabled"); log.info("Configured. Log of gRPC messages is {}", enableMessageLog ? "enabled" : "disabled");
} }

View File

@ -0,0 +1,29 @@
/*
* 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.grpc.ctl;
/**
* Constants for default values of configurable properties.
*/
public final class OsgiPropertyConstants {
private OsgiPropertyConstants() {}
public static final String ENABLE_MESSAGE_LOG = "enableMessageLog";
public static final boolean ENABLE_MESSAGE_LOG_DEFAULT = false;
}

View File

@ -51,42 +51,45 @@ import static java.util.stream.Collectors.toConcurrentMap;
import static org.onlab.util.Tools.get; import static org.onlab.util.Tools.get;
import static org.onlab.util.Tools.getIntegerProperty; import static org.onlab.util.Tools.getIntegerProperty;
import static org.onlab.util.Tools.groupedThreads; import static org.onlab.util.Tools.groupedThreads;
import static org.onosproject.lisp.ctl.impl.OsgiPropertyConstants.*;
import static org.slf4j.LoggerFactory.getLogger; import static org.slf4j.LoggerFactory.getLogger;
/** /**
* LISP controller initiation class. * LISP controller initiation class.
*/ */
@Component(immediate = true, service = LispController.class) @Component(immediate = true, service = LispController.class,
property = {
LISP_AUTH_KEY + "=" + LISP_AUTH_KEY_DEFAULT,
LISP_AUTH_KEY_ID + ":Integer=" + LISP_AUTH_KEY_ID_DEFAULT,
ENABLE_SMR + ":Boolean=" + ENABLE_SMR_DEFAULT,
})
public class LispControllerImpl implements LispController { public class LispControllerImpl implements LispController {
private static final String APP_ID = "org.onosproject.lisp-base"; private static final String APP_ID = "org.onosproject.lisp-base";
private static final Logger log = getLogger(LispControllerImpl.class); private static final Logger log = getLogger(LispControllerImpl.class);
private static final String DEFAULT_LISP_AUTH_KEY = "onos";
private static final short DEFAULT_LISP_AUTH_KEY_ID = 1;
@Reference(cardinality = ReferenceCardinality.MANDATORY) @Reference(cardinality = ReferenceCardinality.MANDATORY)
protected CoreService coreService; protected CoreService coreService;
@Reference(cardinality = ReferenceCardinality.MANDATORY) @Reference(cardinality = ReferenceCardinality.MANDATORY)
protected ComponentConfigService cfgService; protected ComponentConfigService cfgService;
//@Property(name = "lispAuthKey", value = DEFAULT_LISP_AUTH_KEY, /**
// label = "Authentication key which is used to calculate authentication " + * Authentication key which is used to calculate authentication data for
// "data for LISP control message; default value is onos") * LISP control message; default value is onos.
private String lispAuthKey = DEFAULT_LISP_AUTH_KEY; */
private String lispAuthKey = LISP_AUTH_KEY_DEFAULT;
//@Property(name = "lispAuthKeyId", intValue = DEFAULT_LISP_AUTH_KEY_ID, /**
// label = "Authentication key id which denotes the authentication method " + * Authentication key id which denotes the authentication method
// "that ONOS uses to calculate the authentication data; " + * that ONOS uses to calculate the authentication data;
// "1 denotes HMAC SHA1 encryption, 2 denotes HMAC SHA256 encryption; " + * 1 denotes HMAC SHA1 encryption, 2 denotes HMAC SHA256 encryption;
// "default value is 1") * default value is 1.
private int lispAuthKeyId = DEFAULT_LISP_AUTH_KEY_ID; */
private int lispAuthKeyId = LISP_AUTH_KEY_ID_DEFAULT;
//@Property(name = "enableSmr", boolValue = false, /** Enable to send SMR(Solicit Map Request) by map server; by default SMR is not activated. */
// label = "Enable to send SMR(Solicit Map Request) by map server; " +
// "By default SMR is not activated")
private boolean enableSmr = false; private boolean enableSmr = false;
ExecutorService executorMessages = ExecutorService executorMessages =
@ -145,8 +148,8 @@ public class LispControllerImpl implements LispController {
* @param properties a set of properties that contained in component context * @param properties a set of properties that contained in component context
*/ */
private void initAuthConfig(Dictionary<?, ?> properties) { private void initAuthConfig(Dictionary<?, ?> properties) {
authConfig.updateLispAuthKey(get(properties, "lispAuthKey")); authConfig.updateLispAuthKey(get(properties, LISP_AUTH_KEY));
authConfig.updateLispAuthKeyId(getIntegerProperty(properties, "lispAuthKeyId")); authConfig.updateLispAuthKeyId(getIntegerProperty(properties, LISP_AUTH_KEY_ID));
} }
/** /**
@ -157,14 +160,14 @@ public class LispControllerImpl implements LispController {
private void readComponentConfiguration(ComponentContext context) { private void readComponentConfiguration(ComponentContext context) {
Dictionary<?, ?> properties = context.getProperties(); Dictionary<?, ?> properties = context.getProperties();
String lispAuthKeyStr = Tools.get(properties, "lispAuthKey"); String lispAuthKeyStr = Tools.get(properties, LISP_AUTH_KEY);
lispAuthKey = lispAuthKeyStr != null ? lispAuthKeyStr : DEFAULT_LISP_AUTH_KEY; lispAuthKey = lispAuthKeyStr != null ? lispAuthKeyStr : LISP_AUTH_KEY_DEFAULT;
authConfig.updateLispAuthKey(lispAuthKey); authConfig.updateLispAuthKey(lispAuthKey);
log.info("Configured. LISP authentication key is {}", lispAuthKey); log.info("Configured. LISP authentication key is {}", lispAuthKey);
Integer lispAuthMethodInt = Tools.getIntegerProperty(properties, "lispAuthKeyId"); Integer lispAuthMethodInt = Tools.getIntegerProperty(properties, LISP_AUTH_KEY_ID);
if (lispAuthMethodInt == null) { if (lispAuthMethodInt == null) {
lispAuthKeyId = DEFAULT_LISP_AUTH_KEY_ID; lispAuthKeyId = LISP_AUTH_KEY_ID_DEFAULT;
log.info("LISP authentication method is not configured, default value is {}", lispAuthKeyId); log.info("LISP authentication method is not configured, default value is {}", lispAuthKeyId);
} else { } else {
lispAuthKeyId = lispAuthMethodInt; lispAuthKeyId = lispAuthMethodInt;
@ -172,14 +175,14 @@ public class LispControllerImpl implements LispController {
} }
authConfig.updateLispAuthKeyId(lispAuthKeyId); authConfig.updateLispAuthKeyId(lispAuthKeyId);
Boolean enableSmr = Tools.isPropertyEnabled(properties, "enableSmr"); Boolean enableSmr = Tools.isPropertyEnabled(properties, ENABLE_SMR);
if (enableSmr == null) { if (enableSmr == null) {
log.info("Enable SMR is not configured, " + log.info("Enable SMR is not configured, " +
"using current value of {}", this.enableSmr); "using current value of {}", this.enableSmr);
} else { } else {
this.enableSmr = enableSmr; this.enableSmr = enableSmr;
log.info("Configured. Sending SMR through map server is {}", log.info("Configured. Sending SMR through map server is {}",
this.enableSmr ? "enabled" : "disabled"); this.enableSmr ? "enabled" : "disabled");
} }
} }
@ -191,9 +194,9 @@ public class LispControllerImpl implements LispController {
@Override @Override
public Iterable<LispRouter> getSubscribedRouters() { public Iterable<LispRouter> getSubscribedRouters() {
return connectedRouters.entrySet() return connectedRouters.entrySet()
.stream() .stream()
.filter(e -> e.getValue().isSubscribed()) .filter(e -> e.getValue().isSubscribed())
.collect(toConcurrentMap(Map.Entry::getKey, .collect(toConcurrentMap(Map.Entry::getKey,
Map.Entry::getValue)).values(); Map.Entry::getValue)).values();
} }
@ -269,7 +272,7 @@ public class LispControllerImpl implements LispController {
if (connectedRouters.get(routerId) != null) { if (connectedRouters.get(routerId) != null) {
log.warn("Trying to add connectedRouter but found a previous " + log.warn("Trying to add connectedRouter but found a previous " +
"value for routerId: {}", routerId); "value for routerId: {}", routerId);
return false; return false;
} else { } else {
log.info("Added router {}", routerId); log.info("Added router {}", routerId);
@ -286,7 +289,7 @@ public class LispControllerImpl implements LispController {
if (connectedRouters.get(routerId) == null) { if (connectedRouters.get(routerId) == null) {
log.error("Trying to remove router {} from connectedRouter " + log.error("Trying to remove router {} from connectedRouter " +
"list but no element was found", routerId); "list but no element was found", routerId);
} else { } else {
log.info("Removed router {}", routerId); log.info("Removed router {}", routerId);
connectedRouters.remove(routerId); connectedRouters.remove(routerId);
@ -353,7 +356,7 @@ public class LispControllerImpl implements LispController {
private final boolean isIncoming; private final boolean isIncoming;
LispMessageHandler(LispRouterId routerId, LispMessageHandler(LispRouterId routerId,
LispMessage message, boolean isIncoming) { LispMessage message, boolean isIncoming) {
this.routerId = routerId; this.routerId = routerId;
this.message = message; this.message = message;
this.isIncoming = isIncoming; this.isIncoming = isIncoming;
@ -375,10 +378,10 @@ public class LispControllerImpl implements LispController {
* LISP incoming message handler. * LISP incoming message handler.
*/ */
protected final class LispIncomingMessageHandler protected final class LispIncomingMessageHandler
extends LispMessageHandler implements Runnable { extends LispMessageHandler implements Runnable {
LispIncomingMessageHandler(LispRouterId routerId, LispIncomingMessageHandler(LispRouterId routerId,
LispMessage message) { LispMessage message) {
super(routerId, message, true); super(routerId, message, true);
} }
} }
@ -387,10 +390,10 @@ public class LispControllerImpl implements LispController {
* LISP outgoing message handler. * LISP outgoing message handler.
*/ */
protected final class LispOutgoingMessageHandler protected final class LispOutgoingMessageHandler
extends LispMessageHandler implements Runnable { extends LispMessageHandler implements Runnable {
LispOutgoingMessageHandler(LispRouterId routerId, LispOutgoingMessageHandler(LispRouterId routerId,
LispMessage message) { LispMessage message) {
super(routerId, message, false); super(routerId, message, false);
} }
} }

View File

@ -0,0 +1,35 @@
/*
* 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.lisp.ctl.impl;
/**
* Constants for default values of configurable properties.
*/
public final class OsgiPropertyConstants {
private OsgiPropertyConstants() {}
public static final String LISP_AUTH_KEY = "lispAuthKey";
public static final String LISP_AUTH_KEY_DEFAULT = "onos";
public static final String LISP_AUTH_KEY_ID = "lispAuthKeyId";
public static final int LISP_AUTH_KEY_ID_DEFAULT = 1;
public static final String ENABLE_SMR = "enableSmr";
public static final boolean ENABLE_SMR_DEFAULT = false;
}

View File

@ -61,39 +61,33 @@ import java.util.concurrent.Executors;
import static org.onlab.util.Tools.get; import static org.onlab.util.Tools.get;
import static org.onlab.util.Tools.getIntegerProperty; import static org.onlab.util.Tools.getIntegerProperty;
import static org.onlab.util.Tools.groupedThreads; import static org.onlab.util.Tools.groupedThreads;
import static org.onosproject.netconf.ctl.impl.OsgiPropertyConstants.*;
/** /**
* The implementation of NetconfController. * The implementation of NetconfController.
*/ */
@Component(immediate = true, service = NetconfController.class) @Component(immediate = true, service = NetconfController.class,
property = {
NETCONF_CONNECT_TIMEOUT + ":Integer=" + NETCONF_CONNECT_TIMEOUT_DEFAULT,
NETCONF_REPLY_TIMEOUT + ":Integer=" + NETCONF_REPLY_TIMEOUT_DEFAULT,
NETCONF_IDLE_TIMEOUT + ":Integer=" + NETCONF_IDLE_TIMEOUT_DEFAULT,
SSH_LIBRARY + "=" + SSH_LIBRARY_DEFAULT,
})
public class NetconfControllerImpl implements NetconfController { public class NetconfControllerImpl implements NetconfController {
protected static final int DEFAULT_CONNECT_TIMEOUT_SECONDS = 5; /** Time (in seconds) to wait for a NETCONF connect. */
private static final String PROP_NETCONF_CONNECT_TIMEOUT = "netconfConnectTimeout"; protected static int netconfConnectTimeout = NETCONF_CONNECT_TIMEOUT_DEFAULT;
// FIXME @Property should not be static
//@Property(name = PROP_NETCONF_CONNECT_TIMEOUT, intValue = DEFAULT_CONNECT_TIMEOUT_SECONDS,
// label = "Time (in seconds) to wait for a NETCONF connect.")
protected static int netconfConnectTimeout = DEFAULT_CONNECT_TIMEOUT_SECONDS;
private static final String PROP_NETCONF_REPLY_TIMEOUT = "netconfReplyTimeout"; /** Time (in seconds) waiting for a NetConf reply. */
protected static final int DEFAULT_REPLY_TIMEOUT_SECONDS = 5; protected static int netconfReplyTimeout = NETCONF_REPLY_TIMEOUT_DEFAULT;
// FIXME @Property should not be static
//@Property(name = PROP_NETCONF_REPLY_TIMEOUT, intValue = DEFAULT_REPLY_TIMEOUT_SECONDS,
// label = "Time (in seconds) waiting for a NetConf reply")
protected static int netconfReplyTimeout = DEFAULT_REPLY_TIMEOUT_SECONDS;
private static final String PROP_NETCONF_IDLE_TIMEOUT = "netconfIdleTimeout"; /** Time (in seconds) SSH session will close if no traffic seen. */
protected static final int DEFAULT_IDLE_TIMEOUT_SECONDS = 300; protected static int netconfIdleTimeout = NETCONF_IDLE_TIMEOUT_DEFAULT;
// FIXME @Property should not be static
//@Property(name = PROP_NETCONF_IDLE_TIMEOUT, intValue = DEFAULT_IDLE_TIMEOUT_SECONDS,
// label = "Time (in seconds) SSH session will close if no traffic seen")
protected static int netconfIdleTimeout = DEFAULT_IDLE_TIMEOUT_SECONDS;
private static final String SSH_LIBRARY = "sshLibrary"; /** SSH client library to use. */
private static final String APACHE_MINA_STR = "apache-mina"; protected static String sshLibrary = SSH_LIBRARY_DEFAULT;
//@Property(name = SSH_LIBRARY, value = APACHE_MINA_STR,
// label = "Ssh client library to use") protected NetconfSshClientLib sshClientLib = NetconfSshClientLib.APACHE_MINA;
protected NetconfSshClientLib sshLibrary = NetconfSshClientLib.APACHE_MINA;
@Reference(cardinality = ReferenceCardinality.MANDATORY) @Reference(cardinality = ReferenceCardinality.MANDATORY)
protected ComponentConfigService cfgService; protected ComponentConfigService cfgService;
@ -115,7 +109,7 @@ public class NetconfControllerImpl implements NetconfController {
private final NetconfDeviceOutputEventListener downListener = new DeviceDownEventListener(); private final NetconfDeviceOutputEventListener downListener = new DeviceDownEventListener();
protected Set<NetconfDeviceListener> netconfDeviceListeners = new CopyOnWriteArraySet<>(); protected Set<NetconfDeviceListener> netconfDeviceListeners = new CopyOnWriteArraySet<>();
protected NetconfDeviceFactory deviceFactory = (deviceInfo) -> new DefaultNetconfDevice(deviceInfo); protected NetconfDeviceFactory deviceFactory = DefaultNetconfDevice::new;
protected final ExecutorService executor = protected final ExecutorService executor =
Executors.newCachedThreadPool(groupedThreads("onos/netconfdevicecontroller", Executors.newCachedThreadPool(groupedThreads("onos/netconfdevicecontroller",
@ -145,10 +139,11 @@ public class NetconfControllerImpl implements NetconfController {
@Modified @Modified
public void modified(ComponentContext context) { public void modified(ComponentContext context) {
if (context == null) { if (context == null) {
netconfReplyTimeout = DEFAULT_REPLY_TIMEOUT_SECONDS; netconfReplyTimeout = NETCONF_REPLY_TIMEOUT_DEFAULT;
netconfConnectTimeout = DEFAULT_CONNECT_TIMEOUT_SECONDS; netconfConnectTimeout = NETCONF_CONNECT_TIMEOUT_DEFAULT;
netconfIdleTimeout = DEFAULT_IDLE_TIMEOUT_SECONDS; netconfIdleTimeout = NETCONF_IDLE_TIMEOUT_DEFAULT;
sshLibrary = NetconfSshClientLib.APACHE_MINA; sshLibrary = SSH_LIBRARY_DEFAULT;
sshClientLib = NetconfSshClientLib.APACHE_MINA;
log.info("No component configuration"); log.info("No component configuration");
return; return;
} }
@ -158,11 +153,11 @@ public class NetconfControllerImpl implements NetconfController {
String newSshLibrary; String newSshLibrary;
int newNetconfReplyTimeout = getIntegerProperty( int newNetconfReplyTimeout = getIntegerProperty(
properties, PROP_NETCONF_REPLY_TIMEOUT, netconfReplyTimeout); properties, NETCONF_REPLY_TIMEOUT, netconfReplyTimeout);
int newNetconfConnectTimeout = getIntegerProperty( int newNetconfConnectTimeout = getIntegerProperty(
properties, PROP_NETCONF_CONNECT_TIMEOUT, netconfConnectTimeout); properties, NETCONF_CONNECT_TIMEOUT, netconfConnectTimeout);
int newNetconfIdleTimeout = getIntegerProperty( int newNetconfIdleTimeout = getIntegerProperty(
properties, PROP_NETCONF_IDLE_TIMEOUT, netconfIdleTimeout); properties, NETCONF_IDLE_TIMEOUT, netconfIdleTimeout);
newSshLibrary = get(properties, SSH_LIBRARY); newSshLibrary = get(properties, SSH_LIBRARY);
@ -181,12 +176,13 @@ public class NetconfControllerImpl implements NetconfController {
netconfConnectTimeout = newNetconfConnectTimeout; netconfConnectTimeout = newNetconfConnectTimeout;
netconfIdleTimeout = newNetconfIdleTimeout; netconfIdleTimeout = newNetconfIdleTimeout;
if (newSshLibrary != null) { if (newSshLibrary != null) {
sshLibrary = NetconfSshClientLib.getEnum(newSshLibrary); sshLibrary = newSshLibrary;
sshClientLib = NetconfSshClientLib.getEnum(newSshLibrary);
} }
log.info("Settings: {} = {}, {} = {}, {} = {}, {} = {}", log.info("Settings: {} = {}, {} = {}, {} = {}, {} = {}",
PROP_NETCONF_REPLY_TIMEOUT, netconfReplyTimeout, NETCONF_REPLY_TIMEOUT, netconfReplyTimeout,
PROP_NETCONF_CONNECT_TIMEOUT, netconfConnectTimeout, NETCONF_CONNECT_TIMEOUT, netconfConnectTimeout,
PROP_NETCONF_IDLE_TIMEOUT, netconfIdleTimeout, NETCONF_IDLE_TIMEOUT, netconfIdleTimeout,
SSH_LIBRARY, sshLibrary); SSH_LIBRARY, sshLibrary);
} }

View File

@ -0,0 +1,37 @@
/*
* 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.netconf.ctl.impl;
/**
* Constants for default values of configurable properties.
*/
public final class OsgiPropertyConstants {
private OsgiPropertyConstants() {}
public static final String NETCONF_CONNECT_TIMEOUT = "netconfConnectTimeout";
public static final int NETCONF_CONNECT_TIMEOUT_DEFAULT = 5;
public static final String NETCONF_REPLY_TIMEOUT = "netconfReplyTimeout";
public static final int NETCONF_REPLY_TIMEOUT_DEFAULT = 5;
public static final String NETCONF_IDLE_TIMEOUT = "netconfIdleTimeout";
public static final int NETCONF_IDLE_TIMEOUT_DEFAULT = 300;
public static final String SSH_LIBRARY = "sshLibrary";
public static final String SSH_LIBRARY_DEFAULT = "apache-mina";
}

View File

@ -58,6 +58,9 @@ import java.util.Set;
import static org.hamcrest.Matchers.*; import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import static org.onosproject.netconf.ctl.impl.OsgiPropertyConstants.NETCONF_CONNECT_TIMEOUT_DEFAULT;
import static org.onosproject.netconf.ctl.impl.OsgiPropertyConstants.NETCONF_IDLE_TIMEOUT_DEFAULT;
import static org.onosproject.netconf.ctl.impl.OsgiPropertyConstants.NETCONF_REPLY_TIMEOUT_DEFAULT;
/** /**
* Unit tests for the Netconf controller implementation test. * Unit tests for the Netconf controller implementation test.
@ -125,9 +128,9 @@ public class NetconfControllerImplTest {
ctrl.deviceService = deviceService; ctrl.deviceService = deviceService;
ctrl.deviceKeyService = deviceKeyService; ctrl.deviceKeyService = deviceKeyService;
ctrl.netCfgService = netCfgService; ctrl.netCfgService = netCfgService;
NetconfControllerImpl.netconfConnectTimeout = NetconfControllerImpl.DEFAULT_CONNECT_TIMEOUT_SECONDS; NetconfControllerImpl.netconfConnectTimeout = NETCONF_CONNECT_TIMEOUT_DEFAULT;
NetconfControllerImpl.netconfIdleTimeout = NetconfControllerImpl.DEFAULT_IDLE_TIMEOUT_SECONDS; NetconfControllerImpl.netconfIdleTimeout = NETCONF_IDLE_TIMEOUT_DEFAULT;
NetconfControllerImpl.netconfReplyTimeout = NetconfControllerImpl.DEFAULT_REPLY_TIMEOUT_SECONDS; NetconfControllerImpl.netconfReplyTimeout = NETCONF_REPLY_TIMEOUT_DEFAULT;
//Creating mock devices //Creating mock devices
deviceInfo1 = new NetconfDeviceInfo("device1", "001", IpAddress.valueOf(DEVICE_1_IP), DEVICE_1_PORT); deviceInfo1 = new NetconfDeviceInfo("device1", "001", IpAddress.valueOf(DEVICE_1_IP), DEVICE_1_PORT);
@ -183,9 +186,9 @@ public class NetconfControllerImplTest {
public void tearDown() { public void tearDown() {
ctrl.deactivate(); ctrl.deactivate();
// resetting static variables.. // resetting static variables..
NetconfControllerImpl.netconfConnectTimeout = NetconfControllerImpl.DEFAULT_CONNECT_TIMEOUT_SECONDS; NetconfControllerImpl.netconfConnectTimeout = NETCONF_CONNECT_TIMEOUT_DEFAULT;
NetconfControllerImpl.netconfIdleTimeout = NetconfControllerImpl.DEFAULT_IDLE_TIMEOUT_SECONDS; NetconfControllerImpl.netconfIdleTimeout = NETCONF_IDLE_TIMEOUT_DEFAULT;
NetconfControllerImpl.netconfReplyTimeout = NetconfControllerImpl.DEFAULT_REPLY_TIMEOUT_SECONDS; NetconfControllerImpl.netconfReplyTimeout = NETCONF_REPLY_TIMEOUT_DEFAULT;
} }
/** /**

View File

@ -125,33 +125,26 @@ public class OpenFlowControllerImpl implements OpenFlowController {
@Reference(cardinality = ReferenceCardinality.MANDATORY) @Reference(cardinality = ReferenceCardinality.MANDATORY)
protected NetworkConfigRegistry netCfgService; protected NetworkConfigRegistry netCfgService;
//@Property(name = "openflowPorts", value = DEFAULT_OFPORT, /** Port numbers (comma separated) used by OpenFlow protocol; default is 6633,6653. */
// label = "Port numbers (comma separated) used by OpenFlow protocol; default is 6633,6653") private String openflowPortsValue = OFPORTS_DEFAULT;
//private String openflowPortsValue = OFPORTS_DEFAULT;
//@Property(name = "workerThreads", intValue = DEFAULT_WORKER_THREADS, /** Number of controller worker threads. */
// label = "Number of controller worker threads") private int workerThreads = WORKER_THREADS_DEFAULT;
//private int workerThreads = DEFAULT_WORKER_THREADS;
//@Property(name = "tlsMode", value = "", /** TLS mode for OpenFlow channel; options are: disabled [default], enabled, strict. */
// label = "TLS mode for OpenFlow channel; options are: disabled [default], enabled, strict") private String tlsModeString;
//private String tlsModeString;
//@Property(name = "keyStore", value = "", /** File path to key store for TLS connections. */
// label = "File path to key store for TLS connections") private String keyStore;
//private String keyStore;
//@Property(name = "keyStorePassword", value = "", /** Key store password. */
// label = "Key store password") private String keyStorePassword;
//private String keyStorePassword;
//@Property(name = "trustStore", value = "", /** File path to trust store for TLS connections. */
// label = "File path to trust store for TLS connections") private String trustStore;
//private String trustStore;
//@Property(name = "trustStorePassword", value = "", /** Trust store password. */
// label = "Trust store password") private String trustStorePassword;
//private String trustStorePassword;
protected ExecutorService executorMsgs = protected ExecutorService executorMsgs =
Executors.newFixedThreadPool(32, groupedThreads("onos/of", "event-stats-%d", log)); Executors.newFixedThreadPool(32, groupedThreads("onos/of", "event-stats-%d", log));

View File

@ -25,38 +25,24 @@ public final class OsgiPropertyConstants {
private OsgiPropertyConstants() { private OsgiPropertyConstants() {
} }
//@Property(name = "openflowPorts", value = DEFAULT_OFPORT,
// label = "Port numbers (comma separated) used by OpenFlow protocol; default is 6633,6653")
public static final String OFPORTS = "openflowPorts"; public static final String OFPORTS = "openflowPorts";
public static final String OFPORTS_DEFAULT = "6633,6653"; public static final String OFPORTS_DEFAULT = "6633,6653";
//@Property(name = "workerThreads", intValue = DEFAULT_WORKER_THREADS,
// label = "Number of controller worker threads")
public static final String WORKER_THREADS = "workerThreads"; public static final String WORKER_THREADS = "workerThreads";
public static final int WORKER_THREADS_DEFAULT = 0; public static final int WORKER_THREADS_DEFAULT = 0;
//@Property(name = "tlsMode", value = "",
// label = "TLS mode for OpenFlow channel; options are: disabled [default], enabled, strict")
public static final String TLS_MODE = "tlsMode"; public static final String TLS_MODE = "tlsMode";
public static final String TLS_MODE_DEFAULT = ""; public static final String TLS_MODE_DEFAULT = "";
//@Property(name = "keyStore", value = "",
// label = "File path to key store for TLS connections")
public static final String KEY_STORE = "keyStore"; public static final String KEY_STORE = "keyStore";
public static final String KEY_STORE_DEFAULT = ""; public static final String KEY_STORE_DEFAULT = "";
//@Property(name = "keyStorePassword", value = "",
// label = "Key store password")
public static final String KEY_STORE_PASSWORD = "keyStorePassword"; public static final String KEY_STORE_PASSWORD = "keyStorePassword";
public static final String KEY_STORE_PASSWORD_DEFAULT = ""; public static final String KEY_STORE_PASSWORD_DEFAULT = "";
//@Property(name = "trustStore", value = "",
// label = "File path to trust store for TLS connections")
public static final String TRUST_STORE = "trustStore"; public static final String TRUST_STORE = "trustStore";
public static final String TRUST_STORE_DEFAULT = ""; public static final String TRUST_STORE_DEFAULT = "";
//@Property(name = "trustStorePassword", value = "",
// label = "Trust store password")
public static final String TRUST_STORE_PASSWORD = "trustStorePassword"; public static final String TRUST_STORE_PASSWORD = "trustStorePassword";
public static final String TRUST_STORE_PASSWORD_DEFAULT = ""; public static final String TRUST_STORE_PASSWORD_DEFAULT = "";

View File

@ -127,9 +127,4 @@ public final class OvsdbConstant {
public static final boolean OVSDB_TLS_FLAG = false; public static final boolean OVSDB_TLS_FLAG = false;
//TODO CONFIG_DIR is duplicated from ConfigFileBasedClusterMetadataProvider
public static final String CONFIG_DIR = "../config/";
public static final String KS_FILE_NAME = "onos.jks";
public static final String DEFAULT_KS_FILE = CONFIG_DIR + KS_FILE_NAME;
public static final String DEFAULT_KS_PASSWORD = "222222";
} }

View File

@ -0,0 +1,44 @@
/*
* 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.ovsdb.controller.impl;
/**
* Constants for default values of configurable properties.
*/
public final class OsgiPropertyConstants {
private OsgiPropertyConstants() {}
public static final String SERVER_MODE = "";
public static final boolean SERVER_MODE_DEFAULT = false;
public static final String OVSDB_TLS_FLAG = "enableOvsdbTls";
public static final boolean OVSDB_TLS_FLAG_DEFAULT = false;
public static final String KS_FILE = "keyStoreLocation";
public static final String KS_FILE_DEFAULT = "../config/onos.jks";
public static final String TS_FILE = "trustStoreLocation";
public static final String TS_FILE_DEFAULT = "../config/onos.jks";
public static final String KS_PASSWORD = "keyStorePassword";
public static final String KS_PASSWORD_DEFAULT = "222222";
public static final String TS_PASSWORD = "trustStorePassword";
public static final String TS_PASSWORD_DEFAULT = "222222";
}

View File

@ -81,16 +81,21 @@ import java.util.function.Consumer;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.onlab.util.Tools.get; import static org.onlab.util.Tools.get;
import static org.onosproject.ovsdb.controller.OvsdbConstant.DEFAULT_KS_FILE;
import static org.onosproject.ovsdb.controller.OvsdbConstant.DEFAULT_KS_PASSWORD;
import static org.onosproject.ovsdb.controller.OvsdbConstant.OVSDB_TLS_FLAG;
import static org.onosproject.ovsdb.controller.OvsdbConstant.SERVER_MODE;
import static org.onosproject.ovsdb.controller.impl.Controller.MIN_KS_LENGTH; import static org.onosproject.ovsdb.controller.impl.Controller.MIN_KS_LENGTH;
import static org.onosproject.ovsdb.controller.impl.OsgiPropertyConstants.*;
/** /**
* The implementation of OvsdbController. * The implementation of OvsdbController.
*/ */
@Component(immediate = true, service = OvsdbController.class) @Component(immediate = true, service = OvsdbController.class,
property = {
"serverMode" + ":Boolean=" + SERVER_MODE_DEFAULT,
"enableOvsdbTls" + ":Boolean=" + OVSDB_TLS_FLAG_DEFAULT,
"keyStoreLocation" + "=" + KS_FILE_DEFAULT,
"keyStorePassword" + "=" + KS_PASSWORD_DEFAULT,
"trustStoreLocation" + "=" + TS_FILE_DEFAULT,
"trustStorePassword" + "=" + TS_PASSWORD_DEFAULT,
})
public class OvsdbControllerImpl implements OvsdbController { public class OvsdbControllerImpl implements OvsdbController {
public static final Logger log = LoggerFactory public static final Logger log = LoggerFactory
@ -110,29 +115,23 @@ public class OvsdbControllerImpl implements OvsdbController {
@Reference(cardinality = ReferenceCardinality.MANDATORY) @Reference(cardinality = ReferenceCardinality.MANDATORY)
protected ComponentConfigService configService; protected ComponentConfigService configService;
//@Property(name = "serverMode", boolValue = SERVER_MODE, /** Run as server mode, listen on 6640 port. */
// label = "Run as server mode, listen on 6640 port") private boolean serverMode = SERVER_MODE_DEFAULT;
private boolean serverMode = SERVER_MODE;
//@Property(name = "enableOvsdbTls", boolValue = OVSDB_TLS_FLAG, /** TLS mode for OVSDB channel; options are: true false. */
// label = "TLS mode for OVSDB channel; options are: true false") private boolean enableOvsdbTls = OVSDB_TLS_FLAG_DEFAULT;
private boolean enableOvsdbTls = OVSDB_TLS_FLAG;
//@Property(name = "keyStoreLocation", value = DEFAULT_KS_FILE, /** File path to KeyStore for Ovsdb TLS Connections. */
// label = "File path to KeyStore for Ovsdb TLS Connections") protected String keyStoreLocation = KS_FILE_DEFAULT;
protected String keyStoreLocation = DEFAULT_KS_FILE;
//@Property(name = "trustStoreLocation", value = DEFAULT_KS_FILE, /** File path to TrustStore for Ovsdb TLS Connections. */
// label = "File path to TrustStore for Ovsdb TLS Connections") protected String trustStoreLocation = TS_FILE_DEFAULT;
protected String trustStoreLocation = DEFAULT_KS_FILE;
//@Property(name = "keyStorePassword", value = DEFAULT_KS_PASSWORD, /** KeyStore Password. */
// label = "KeyStore Password") protected String keyStorePassword = KS_PASSWORD_DEFAULT;
protected String keyStorePassword = DEFAULT_KS_PASSWORD;
//@Property(name = "trustStorePassword", value = DEFAULT_KS_PASSWORD, /** TrustStore Password. */
// label = "TrustStore Password") protected String trustStorePassword = TS_PASSWORD_DEFAULT;
protected String trustStorePassword = DEFAULT_KS_PASSWORD;
@Activate @Activate
public void activate(ComponentContext context) { public void activate(ComponentContext context) {
@ -180,7 +179,7 @@ public class OvsdbControllerImpl implements OvsdbController {
private TlsParams getTlsParams(Dictionary<?, ?> properties) { private TlsParams getTlsParams(Dictionary<?, ?> properties) {
TlsMode mode = null; TlsMode mode = null;
boolean flag = Tools.isPropertyEnabled(properties, "enableOvsdbTls"); boolean flag = Tools.isPropertyEnabled(properties, OVSDB_TLS_FLAG);
if (Objects.isNull(flag) || !flag) { if (Objects.isNull(flag) || !flag) {
log.warn("OvsdbTLS Disabled"); log.warn("OvsdbTLS Disabled");
mode = TlsMode.DISABLED; mode = TlsMode.DISABLED;
@ -191,25 +190,25 @@ public class OvsdbControllerImpl implements OvsdbController {
String ksLocation = null, tsLocation = null, ksPwd = null, tsPwd = null; String ksLocation = null, tsLocation = null, ksPwd = null, tsPwd = null;
ksLocation = get(properties, "keyStoreLocation"); ksLocation = get(properties, KS_FILE);
if (Strings.isNullOrEmpty(ksLocation)) { if (Strings.isNullOrEmpty(ksLocation)) {
log.warn("trustStoreLocation is not configured"); log.warn("trustStoreLocation is not configured");
mode = TlsMode.DISABLED; mode = TlsMode.DISABLED;
} }
tsLocation = get(properties, "trustStoreLocation"); tsLocation = get(properties, TS_FILE);
if (Strings.isNullOrEmpty(tsLocation)) { if (Strings.isNullOrEmpty(tsLocation)) {
log.warn("trustStoreLocation is not configured"); log.warn("trustStoreLocation is not configured");
mode = TlsMode.DISABLED; mode = TlsMode.DISABLED;
} }
ksPwd = get(properties, "keyStorePassword"); ksPwd = get(properties, KS_PASSWORD);
if (Strings.isNullOrEmpty(ksPwd) || MIN_KS_LENGTH > ksPwd.length()) { if (Strings.isNullOrEmpty(ksPwd) || MIN_KS_LENGTH > ksPwd.length()) {
log.warn("keyStorePassword is not configured or Password length too small"); log.warn("keyStorePassword is not configured or Password length too small");
mode = TlsMode.DISABLED; mode = TlsMode.DISABLED;
} }
tsPwd = get(properties, "trustStorePassword"); tsPwd = get(properties, TS_PASSWORD);
if (Strings.isNullOrEmpty(tsPwd) || MIN_KS_LENGTH > tsPwd.length()) { if (Strings.isNullOrEmpty(tsPwd) || MIN_KS_LENGTH > tsPwd.length()) {
log.warn("trustStorePassword is not configured or Password length too small"); log.warn("trustStorePassword is not configured or Password length too small");
mode = TlsMode.DISABLED; mode = TlsMode.DISABLED;

View File

@ -29,8 +29,7 @@ import java.util.Arrays;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.Objects; import java.util.Objects;
import static org.onosproject.ovsdb.controller.OvsdbConstant.DEFAULT_KS_FILE; import static org.onosproject.ovsdb.controller.impl.OsgiPropertyConstants.*;
import static org.onosproject.ovsdb.controller.OvsdbConstant.DEFAULT_KS_PASSWORD;
/** /**
* TlsParams Class for properties required for configuring OVSDB TLS Connection. * TlsParams Class for properties required for configuring OVSDB TLS Connection.
@ -69,10 +68,10 @@ public class TlsParams {
*/ */
TlsParams() { TlsParams() {
this.mode = TlsMode.DISABLED; this.mode = TlsMode.DISABLED;
this.ksLocation = DEFAULT_KS_FILE; this.ksLocation = KS_FILE_DEFAULT;
this.tsLocation = DEFAULT_KS_FILE; this.tsLocation = TS_FILE_DEFAULT;
this.ksPwd = DEFAULT_KS_PASSWORD; this.ksPwd = KS_PASSWORD_DEFAULT;
this.tsPwd = DEFAULT_KS_PASSWORD; this.tsPwd = TS_PASSWORD_DEFAULT;
this.ksSignature = getSha1Checksum(ksLocation); this.ksSignature = getSha1Checksum(ksLocation);
this.tsSignature = getSha1Checksum(tsLocation); this.tsSignature = getSha1Checksum(tsLocation);
} }

View File

@ -0,0 +1,29 @@
/*
* 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.xmpp.core.ctl;
/**
* Constants for default values of configurable properties.
*/
public final class OsgiPropertyConstants {
private OsgiPropertyConstants() {}
public static final String XMPP_PORT = "xmppPort";
public static final String XMPP_PORT_DEFAULT = "5269";
}

View File

@ -49,6 +49,9 @@ import java.util.Set;
import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CopyOnWriteArraySet; import java.util.concurrent.CopyOnWriteArraySet;
import static org.onosproject.xmpp.core.ctl.OsgiPropertyConstants.XMPP_PORT;
import static org.onosproject.xmpp.core.ctl.OsgiPropertyConstants.XMPP_PORT_DEFAULT;
/** /**
* The main class (bundle) of XMPP protocol. * The main class (bundle) of XMPP protocol.
@ -58,11 +61,13 @@ import java.util.concurrent.CopyOnWriteArraySet;
* 3. Configuration parameters initialization. * 3. Configuration parameters initialization.
* 4. Notifing listeners about XMPP events/packets. * 4. Notifing listeners about XMPP events/packets.
*/ */
@Component(immediate = true, service = XmppController.class) @Component(immediate = true, service = XmppController.class,
property = {
XMPP_PORT + "=" + XMPP_PORT_DEFAULT,
})
public class XmppControllerImpl implements XmppController { public class XmppControllerImpl implements XmppController {
private static final String APP_ID = "org.onosproject.xmpp"; private static final String APP_ID = "org.onosproject.xmpp";
private static final String XMPP_PORT = "5269";
private static final Logger log = private static final Logger log =
LoggerFactory.getLogger(XmppControllerImpl.class); LoggerFactory.getLogger(XmppControllerImpl.class);
@ -75,10 +80,8 @@ public class XmppControllerImpl implements XmppController {
protected ComponentConfigService cfgService; protected ComponentConfigService cfgService;
// configuration properties definition // configuration properties definition
//@Property(name = "xmppPort", value = XMPP_PORT, /** Port number used by XMPP protocol; default is 5269. */
// label = "Port number used by XMPP protocol; default is 5269") private String xmppPort = XMPP_PORT_DEFAULT;
private String xmppPort = XMPP_PORT;
// listener declaration // listener declaration
protected Set<XmppDeviceListener> xmppDeviceListeners = new CopyOnWriteArraySet<XmppDeviceListener>(); protected Set<XmppDeviceListener> xmppDeviceListeners = new CopyOnWriteArraySet<XmppDeviceListener>();

View File

@ -35,6 +35,7 @@ import java.net.InetSocketAddress;
import java.util.Dictionary; import java.util.Dictionary;
import static org.onlab.util.Tools.get; import static org.onlab.util.Tools.get;
import static org.onosproject.xmpp.core.ctl.OsgiPropertyConstants.XMPP_PORT;
/** /**
* The XMPP server class. Starts XMPP server and listens to new XMPP device TCP connections. * The XMPP server class. Starts XMPP server and listens to new XMPP device TCP connections.
@ -124,7 +125,7 @@ public class XmppServer {
* @param properties properties to be set * @param properties properties to be set
*/ */
public void setConfiguration(Dictionary<?, ?> properties) { public void setConfiguration(Dictionary<?, ?> properties) {
String port = get(properties, "xmppPort"); String port = get(properties, XMPP_PORT);
if (!Strings.isNullOrEmpty(port)) { if (!Strings.isNullOrEmpty(port)) {
this.port = Integer.parseInt(port); this.port = Integer.parseInt(port);
} }

View File

@ -106,9 +106,7 @@ import static java.util.concurrent.Executors.newScheduledThreadPool;
import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor; import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor;
import static org.onlab.util.Tools.groupedThreads; import static org.onlab.util.Tools.groupedThreads;
import static org.onosproject.net.device.DeviceEvent.Type; import static org.onosproject.net.device.DeviceEvent.Type;
import static org.onosproject.provider.general.device.impl.OsgiPropertyDefaults.OP_TIMEOUT_SHORT_DEFAULT; import static org.onosproject.provider.general.device.impl.OsgiPropertyConstants.*;
import static org.onosproject.provider.general.device.impl.OsgiPropertyDefaults.PROBE_FREQUENCY_DEFAULT;
import static org.onosproject.provider.general.device.impl.OsgiPropertyDefaults.STATS_POLL_FREQUENCY_DEFAULT;
import static org.slf4j.LoggerFactory.getLogger; import static org.slf4j.LoggerFactory.getLogger;
/** /**
@ -119,9 +117,9 @@ import static org.slf4j.LoggerFactory.getLogger;
@Beta @Beta
@Component(immediate = true, @Component(immediate = true,
property = { property = {
"deviceStatsPollFrequency:Integer=" + STATS_POLL_FREQUENCY_DEFAULT, STATS_POLL_FREQUENCY + ":Integer=" + STATS_POLL_FREQUENCY_DEFAULT,
"deviceProbeFrequency:Integer=" + PROBE_FREQUENCY_DEFAULT, PROBE_FREQUENCY + ":Integer=" + PROBE_FREQUENCY_DEFAULT,
"deviceOperationTimeoutShort:Integer=" + OP_TIMEOUT_SHORT_DEFAULT, OP_TIMEOUT_SHORT + ":Integer=" + OP_TIMEOUT_SHORT_DEFAULT,
}) })
public class GeneralDeviceProvider extends AbstractProvider public class GeneralDeviceProvider extends AbstractProvider
implements DeviceProvider { implements DeviceProvider {
@ -166,23 +164,20 @@ public class GeneralDeviceProvider extends AbstractProvider
@Reference(cardinality = ReferenceCardinality.MANDATORY) @Reference(cardinality = ReferenceCardinality.MANDATORY)
private PiPipeconfWatchdogService pipeconfWatchdogService; private PiPipeconfWatchdogService pipeconfWatchdogService;
private static final String STATS_POLL_FREQUENCY = "deviceStatsPollFrequency"; /**
//@Property(name = STATS_POLL_FREQUENCY, intValue = DEFAULT_STATS_POLL_FREQUENCY, * Configure poll frequency for port status and statistics; default is 10 sec.
// label = "Configure poll frequency for port status and statistics; " + */
// "default is 10 sec")
private int statsPollFrequency = STATS_POLL_FREQUENCY_DEFAULT; private int statsPollFrequency = STATS_POLL_FREQUENCY_DEFAULT;
private static final String PROBE_FREQUENCY = "deviceProbeFrequency"; /**
//@Property(name = PROBE_FREQUENCY, intValue = DEFAULT_PROBE_FREQUENCY, * Configure probe frequency for checking device availability; default is 10 sec.
// label = "Configure probe frequency for checking device availability; " + */
// "default is 10 sec")
private int probeFrequency = PROBE_FREQUENCY_DEFAULT; private int probeFrequency = PROBE_FREQUENCY_DEFAULT;
private static final String OP_TIMEOUT_SHORT = "deviceOperationTimeoutShort"; /**
//@Property(name = OP_TIMEOUT_SHORT, intValue = DEFAULT_OP_TIMEOUT_SHORT, * Configure timeout in seconds for device operations that are supposed to take a short time
// label = "Configure timeout in seconds for device operations " + * (e.g. checking device reachability); default is 10 seconds.
// "that are supposed to take a short time " + */
// "(e.g. checking device reachability); default is 10 seconds")
private int opTimeoutShort = OP_TIMEOUT_SHORT_DEFAULT; private int opTimeoutShort = OP_TIMEOUT_SHORT_DEFAULT;
//FIXME to be removed when netcfg will issue device events in a bundle or //FIXME to be removed when netcfg will issue device events in a bundle or

View File

@ -19,12 +19,17 @@ package org.onosproject.provider.general.device.impl;
/** /**
* Constants for default values of configurable properties. * Constants for default values of configurable properties.
*/ */
public final class OsgiPropertyDefaults { public final class OsgiPropertyConstants {
private OsgiPropertyDefaults() {} private OsgiPropertyConstants() {}
public static final String STATS_POLL_FREQUENCY = "deviceStatsPollFrequency";
public static final int STATS_POLL_FREQUENCY_DEFAULT = 10; public static final int STATS_POLL_FREQUENCY_DEFAULT = 10;
public static final String PROBE_FREQUENCY = "deviceProbeFrequency";
public static final int PROBE_FREQUENCY_DEFAULT = 10; public static final int PROBE_FREQUENCY_DEFAULT = 10;
public static final String OP_TIMEOUT_SHORT = "deviceOperationTimeoutShort";
public static final int OP_TIMEOUT_SHORT_DEFAULT = 10; public static final int OP_TIMEOUT_SHORT_DEFAULT = 10;
} }

View File

@ -103,6 +103,7 @@ import java.util.stream.Stream;
import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor; import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor;
import static org.onlab.util.Tools.groupedThreads; import static org.onlab.util.Tools.groupedThreads;
import static org.onosproject.provider.host.impl.OsgiPropertyConstants.*;
import static org.slf4j.LoggerFactory.getLogger; import static org.slf4j.LoggerFactory.getLogger;
/** /**
@ -111,13 +112,13 @@ import static org.slf4j.LoggerFactory.getLogger;
*/ */
@Component(immediate = true, service = HostProvider.class, @Component(immediate = true, service = HostProvider.class,
property = { property = {
"hostRemovalEnabled:Boolean=true", HOST_REMOVAL_ENABLED + ":Boolean=" + HOST_REMOVAL_ENABLED_DEFAULT,
"requestArp:Boolean=true", REQUEST_ARP + ":Boolean=" + REQUEST_ARP_DEFAULT,
"requestIpv6ND:Boolean=false", REQUEST_NDP + ":Boolean=" + REQUEST_NDP_DEFAULT,
"useDhcp:Boolean=false", USE_DHCP + ":Boolean=" + USE_DHCP_DEFAULT,
"useDhcp6:Boolean=false", USE_DHCP6 + ":Boolean=" + USE_DHCP6_DEFAULT,
"requestInterceptsEnabled:Boolean=true", REQUEST_INTERCEPTS_ENABLED + ":Boolean=" + REQUEST_INTERCEPTS_ENABLED_DEFAULT,
"multihomingEnabled:Boolean=false", MULTIHOMING_ENABLED + ":Boolean=" + MULTIHOMING_ENABLED_DEFAULT,
}) })
public class HostLocationProvider extends AbstractProvider implements HostProvider { public class HostLocationProvider extends AbstractProvider implements HostProvider {
private final Logger log = getLogger(getClass()); private final Logger log = getLogger(getClass());
@ -155,34 +156,25 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid
private ApplicationId appId; private ApplicationId appId;
//@Property(name = "hostRemovalEnabled", boolValue = true, /** Enable host removal on port/device down events. */
// label = "Enable host removal on port/device down events")
private boolean hostRemovalEnabled = true; private boolean hostRemovalEnabled = true;
//@Property(name = "requestArp", boolValue = true, /** Request ARP packets for neighbor discovery by the Host Location Provider; default is true. */
// label = "Request ARP packets for neighbor discovery by the " +
// "Host Location Provider; default is true")
private boolean requestArp = true; private boolean requestArp = true;
//@Property(name = "requestIpv6ND", boolValue = false, /** Requests IPv6 Neighbor Discovery by the Host Location Provider; default is false. */
// label = "Requests IPv6 Neighbor Discovery by the " +
// "Host Location Provider; default is false")
private boolean requestIpv6ND = false; private boolean requestIpv6ND = false;
//@Property(name = "useDhcp", boolValue = false, /** Use DHCP to update IP address of the host; default is false. */
// label = "Use DHCP to update IP address of the host; default is false")
private boolean useDhcp = false; private boolean useDhcp = false;
//@Property(name = "useDhcp6", boolValue = false, /** Use DHCPv6 to update IP address of the host; default is false. */
// label = "Use DHCPv6 to update IP address of the host; default is false")
private boolean useDhcp6 = false; private boolean useDhcp6 = false;
//@Property(name = "requestInterceptsEnabled", boolValue = true, /** Enable requesting packet intercepts. */
// label = "Enable requesting packet intercepts")
private boolean requestInterceptsEnabled = true; private boolean requestInterceptsEnabled = true;
//@Property(name = "multihomingEnabled", boolValue = false, /** Allow hosts to be multihomed. */
// label = "Allow hosts to be multihomed")
private boolean multihomingEnabled = false; private boolean multihomingEnabled = false;
private HostProviderService providerService; private HostProviderService providerService;
@ -322,7 +314,7 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid
Dictionary<?, ?> properties = context.getProperties(); Dictionary<?, ?> properties = context.getProperties();
Boolean flag; Boolean flag;
flag = Tools.isPropertyEnabled(properties, "hostRemovalEnabled"); flag = Tools.isPropertyEnabled(properties, HOST_REMOVAL_ENABLED);
if (flag == null) { if (flag == null) {
log.info("Host removal on port/device down events is not configured, " + log.info("Host removal on port/device down events is not configured, " +
"using current value of {}", hostRemovalEnabled); "using current value of {}", hostRemovalEnabled);
@ -332,7 +324,7 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid
hostRemovalEnabled ? "enabled" : "disabled"); hostRemovalEnabled ? "enabled" : "disabled");
} }
flag = Tools.isPropertyEnabled(properties, "requestArp"); flag = Tools.isPropertyEnabled(properties, REQUEST_ARP);
if (flag == null) { if (flag == null) {
log.info("Using ARP is not configured, " + log.info("Using ARP is not configured, " +
"using current value of {}", requestArp); "using current value of {}", requestArp);
@ -342,7 +334,7 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid
requestArp ? "enabled" : "disabled"); requestArp ? "enabled" : "disabled");
} }
flag = Tools.isPropertyEnabled(properties, "requestIpv6ND"); flag = Tools.isPropertyEnabled(properties, REQUEST_NDP);
if (flag == null) { if (flag == null) {
log.info("Using IPv6 Neighbor Discovery is not configured, " + log.info("Using IPv6 Neighbor Discovery is not configured, " +
"using current value of {}", requestIpv6ND); "using current value of {}", requestIpv6ND);
@ -352,7 +344,7 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid
requestIpv6ND ? "enabled" : "disabled"); requestIpv6ND ? "enabled" : "disabled");
} }
flag = Tools.isPropertyEnabled(properties, "useDhcp"); flag = Tools.isPropertyEnabled(properties, USE_DHCP);
if (flag == null) { if (flag == null) {
log.info("Using DHCP is not configured, " + log.info("Using DHCP is not configured, " +
"using current value of {}", useDhcp); "using current value of {}", useDhcp);
@ -362,7 +354,17 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid
useDhcp ? "enabled" : "disabled"); useDhcp ? "enabled" : "disabled");
} }
flag = Tools.isPropertyEnabled(properties, "requestInterceptsEnabled"); flag = Tools.isPropertyEnabled(properties, USE_DHCP6);
if (flag == null) {
log.info("Using DHCP6 is not configured, " +
"using current value of {}", useDhcp6);
} else {
useDhcp6 = flag;
log.info("Configured. Using DHCP6 is {}",
useDhcp6 ? "enabled" : "disabled");
}
flag = Tools.isPropertyEnabled(properties, REQUEST_INTERCEPTS_ENABLED);
if (flag == null) { if (flag == null) {
log.info("Request intercepts is not configured, " + log.info("Request intercepts is not configured, " +
"using current value of {}", requestInterceptsEnabled); "using current value of {}", requestInterceptsEnabled);
@ -372,7 +374,7 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid
requestInterceptsEnabled ? "enabled" : "disabled"); requestInterceptsEnabled ? "enabled" : "disabled");
} }
flag = Tools.isPropertyEnabled(properties, "multihomingEnabled"); flag = Tools.isPropertyEnabled(properties, MULTIHOMING_ENABLED);
if (flag == null) { if (flag == null) {
log.info("Multihoming is not configured, " + log.info("Multihoming is not configured, " +
"using current value of {}", multihomingEnabled); "using current value of {}", multihomingEnabled);

View File

@ -0,0 +1,48 @@
/*
* 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.provider.host.impl;
/**
* Name/Value constants for properties.
*/
public final class OsgiPropertyConstants {
private OsgiPropertyConstants() {
}
public static final String HOST_REMOVAL_ENABLED = "hostRemovalEnabled:Boolean=true";
public static final boolean HOST_REMOVAL_ENABLED_DEFAULT = true;
public static final String REQUEST_ARP = "requestArp";
public static final boolean REQUEST_ARP_DEFAULT = true;
public static final String REQUEST_NDP = "requestIpv6ND";
public static final boolean REQUEST_NDP_DEFAULT = false;
public static final String USE_DHCP = "useDhcp";
public static final boolean USE_DHCP_DEFAULT = false;
public static final String USE_DHCP6 = "useDhcp6";
public static final boolean USE_DHCP6_DEFAULT = false;
public static final String REQUEST_INTERCEPTS_ENABLED = "requestInterceptsEnabled";
public static final boolean REQUEST_INTERCEPTS_ENABLED_DEFAULT = true;
public static final String MULTIHOMING_ENABLED = "multihomingEnabled";
public static final boolean MULTIHOMING_ENABLED_DEFAULT = false;
}

View File

@ -58,8 +58,7 @@ import static java.util.concurrent.Executors.newScheduledThreadPool;
import static java.util.concurrent.TimeUnit.SECONDS; import static java.util.concurrent.TimeUnit.SECONDS;
import static org.onlab.util.Tools.get; import static org.onlab.util.Tools.get;
import static org.onlab.util.Tools.groupedThreads; import static org.onlab.util.Tools.groupedThreads;
import static org.onosproject.provider.linkdiscovery.impl.OsgiPropertyDefaults.POLL_DELAY_SECONDS_DEFAULT; import static org.onosproject.provider.linkdiscovery.impl.OsgiPropertyConstants.*;
import static org.onosproject.provider.linkdiscovery.impl.OsgiPropertyDefaults.POLL_FREQUENCY_SECONDS_DEFAULT;
import static org.slf4j.LoggerFactory.getLogger; import static org.slf4j.LoggerFactory.getLogger;
/** /**
@ -68,8 +67,8 @@ import static org.slf4j.LoggerFactory.getLogger;
*/ */
@Component(immediate = true, @Component(immediate = true,
property = { property = {
"linkPollDelaySeconds:Integer=" + POLL_DELAY_SECONDS_DEFAULT, POLL_DELAY_SECONDS + ":Integer=" + POLL_DELAY_SECONDS_DEFAULT,
"linkPollFrequencySeconds:Integer=" + POLL_FREQUENCY_SECONDS_DEFAULT, POLL_FREQUENCY_SECONDS + ":Integer=" + POLL_FREQUENCY_SECONDS_DEFAULT,
}) })
public class LinkDiscoveryProvider extends AbstractProvider public class LinkDiscoveryProvider extends AbstractProvider
implements LinkProvider { implements LinkProvider {
@ -78,12 +77,11 @@ public class LinkDiscoveryProvider extends AbstractProvider
protected static final String SCHEME_NAME = "linkdiscovery"; protected static final String SCHEME_NAME = "linkdiscovery";
private static final String LINK_PROVIDER_PACKAGE = "org.onosproject.provider.linkdiscovery"; private static final String LINK_PROVIDER_PACKAGE = "org.onosproject.provider.linkdiscovery";
private final Logger log = getLogger(getClass()); private final Logger log = getLogger(getClass());
//@Property(name = "linkPollDelaySeconds", intValue = DEFAULT_POLL_DELAY_SECONDS,
// label = "Initial delay (in seconds) for polling link discovery") /** Initial delay (in seconds) for polling link discovery. */
protected static int linkPollDelaySeconds = POLL_DELAY_SECONDS_DEFAULT; protected static int linkPollDelaySeconds = POLL_DELAY_SECONDS_DEFAULT;
//@Property(name = "linkPollFrequencySeconds", intValue = DEFAULT_POLL_FREQUENCY_SECONDS, /** Frequency (in seconds) for polling link discovery. */
// label = "Frequency (in seconds) for polling link discovery")
protected static int linkPollFrequencySeconds = POLL_FREQUENCY_SECONDS_DEFAULT; protected static int linkPollFrequencySeconds = POLL_FREQUENCY_SECONDS_DEFAULT;
@ -171,7 +169,7 @@ public class LinkDiscoveryProvider extends AbstractProvider
private int getNewPollFrequency(Dictionary<?, ?> properties, int pollFrequency) { private int getNewPollFrequency(Dictionary<?, ?> properties, int pollFrequency) {
int newPollFrequency; int newPollFrequency;
try { try {
String s = get(properties, "linkPollFrequencySeconds"); String s = get(properties, POLL_FREQUENCY_SECONDS);
newPollFrequency = isNullOrEmpty(s) ? pollFrequency : Integer.parseInt(s.trim()); newPollFrequency = isNullOrEmpty(s) ? pollFrequency : Integer.parseInt(s.trim());
} catch (NumberFormatException | ClassCastException e) { } catch (NumberFormatException | ClassCastException e) {
newPollFrequency = POLL_FREQUENCY_SECONDS_DEFAULT; newPollFrequency = POLL_FREQUENCY_SECONDS_DEFAULT;
@ -182,7 +180,7 @@ public class LinkDiscoveryProvider extends AbstractProvider
private int getNewPollDealy(Dictionary<?, ?> properties, int pollDelay) { private int getNewPollDealy(Dictionary<?, ?> properties, int pollDelay) {
int newPollFrequency; int newPollFrequency;
try { try {
String s = get(properties, "linkPollDelaySeconds"); String s = get(properties, POLL_DELAY_SECONDS);
newPollFrequency = isNullOrEmpty(s) ? pollDelay : Integer.parseInt(s.trim()); newPollFrequency = isNullOrEmpty(s) ? pollDelay : Integer.parseInt(s.trim());
} catch (NumberFormatException | ClassCastException e) { } catch (NumberFormatException | ClassCastException e) {
newPollFrequency = POLL_DELAY_SECONDS_DEFAULT; newPollFrequency = POLL_DELAY_SECONDS_DEFAULT;

View File

@ -19,11 +19,14 @@ package org.onosproject.provider.linkdiscovery.impl;
/** /**
* Constants for default values of configurable properties. * Constants for default values of configurable properties.
*/ */
public final class OsgiPropertyDefaults { public final class OsgiPropertyConstants {
private OsgiPropertyDefaults() {} private OsgiPropertyConstants() {}
public static final String POLL_DELAY_SECONDS = "linkPollDelaySeconds";
public static final int POLL_DELAY_SECONDS_DEFAULT = 20; public static final int POLL_DELAY_SECONDS_DEFAULT = 20;
public static final String POLL_FREQUENCY_SECONDS = "linkPollFrequencySeconds";
public static final int POLL_FREQUENCY_SECONDS_DEFAULT = 10; public static final int POLL_FREQUENCY_SECONDS_DEFAULT = 10;
} }

View File

@ -155,28 +155,19 @@ public class LldpLinkProvider extends AbstractProvider implements ProbedLinkProv
private static final long DEVICE_SYNC_DELAY = 5; private static final long DEVICE_SYNC_DELAY = 5;
private static final long LINK_PRUNER_DELAY = 3; private static final long LINK_PRUNER_DELAY = 3;
//@Property(name = PROP_ENABLED, boolValue = true,
// label = "If false, link discovery is disabled")
/** If false, link discovery is disabled. */ /** If false, link discovery is disabled. */
protected boolean enabled = false; protected boolean enabled = false;
//@Property(name = PROP_USE_BDDP, boolValue = true,
// label = "Use BDDP for link discovery")
/** Use BDDP for link discovery. */ /** Use BDDP for link discovery. */
protected boolean useBddp = USE_BDDP_DEFAULT; protected boolean useBddp = USE_BDDP_DEFAULT;
//@Property(name = PROP_PROBE_RATE, intValue = DEFAULT_PROBE_RATE,
// label = "LLDP and BDDP probe rate specified in millis")
/** LLDP and BDDP probe rate specified in millis. */ /** LLDP and BDDP probe rate specified in millis. */
protected int probeRate = PROBE_RATE_DEFAULT; protected int probeRate = PROBE_RATE_DEFAULT;
//@Property(name = PROP_STALE_LINK_AGE, intValue = DEFAULT_STALE_LINK_AGE,
// label = "Number of millis beyond which links will be considered stale")
/** Number of millis beyond which links will be considered stale. */ /** Number of millis beyond which links will be considered stale. */
protected int staleLinkAge = STALE_LINK_AGE_DEFAULT; protected int staleLinkAge = STALE_LINK_AGE_DEFAULT;
//@Property(name = PROP_DISCOVERY_DELAY, intValue = DEFAULT_DISCOVERY_DELAY, /** Number of millis beyond which an LLDP packet will not be accepted. */
// label = "Number of millis beyond which an LLDP packet will not be accepted")
private int maxDiscoveryDelayMs = DISCOVERY_DELAY_DEFAULT; private int maxDiscoveryDelayMs = DISCOVERY_DELAY_DEFAULT;
private final LinkDiscoveryContext context = new InternalDiscoveryContext(); private final LinkDiscoveryContext context = new InternalDiscoveryContext();

View File

@ -35,7 +35,7 @@ public final class OsgiPropertyConstants {
public static final String PROP_STALE_LINK_AGE = "staleLinkAge"; public static final String PROP_STALE_LINK_AGE = "staleLinkAge";
public static final int STALE_LINK_AGE_DEFAULT = 10000; public static final int STALE_LINK_AGE_DEFAULT = 10000;
public static final String PROP_DISCOVERY_DELAY = "maxLLDPAge"; public static final String PROP_DISCOVERY_DELAY = "maxDiscoveryDelayMs";
public static final int DISCOVERY_DELAY_DEFAULT = 1000; public static final int DISCOVERY_DELAY_DEFAULT = 1000;
} }

View File

@ -108,12 +108,10 @@ public class NetworkConfigLinksProvider
@Reference(cardinality = ReferenceCardinality.MANDATORY) @Reference(cardinality = ReferenceCardinality.MANDATORY)
protected ClusterMetadataService metadataService; protected ClusterMetadataService metadataService;
//@Property(name = PROP_PROBE_RATE, intValue = DEFAULT_PROBE_RATE, /** LLDP and BDDP probe rate specified in millis. */
// label = "LLDP and BDDP probe rate specified in millis")
private int probeRate = PROBE_RATE_DEFAULT; private int probeRate = PROBE_RATE_DEFAULT;
//@Property(name = PROP_DISCOVERY_DELAY, intValue = DEFAULT_DISCOVERY_DELAY, /** Number of millis beyond which an LLDP packet will not be accepted. */
// label = "Number of millis beyond which an LLDP packet will not be accepted")
private int maxDiscoveryDelayMs = DISCOVERY_DELAY_DEFAULT; private int maxDiscoveryDelayMs = DISCOVERY_DELAY_DEFAULT;
// Device link discovery helpers. // Device link discovery helpers.

View File

@ -145,14 +145,10 @@ public class NetconfDeviceProvider extends AbstractProvider
private static final String PORT = "port"; private static final String PORT = "port";
private static final int CORE_POOL_SIZE = 10; private static final int CORE_POOL_SIZE = 10;
//@Property(name = "pollFrequency", intValue = DEFAULT_POLL_FREQUENCY_SECONDS, /** Configure poll frequency for port status and statistics; default is 30 sec. */
// label = "Configure poll frequency for port status and statistics; " +
// "default is 30 sec")
private int pollFrequency = POLL_FREQUENCY_SECONDS_DEFAULT; private int pollFrequency = POLL_FREQUENCY_SECONDS_DEFAULT;
//@Property(name = "maxRetries", intValue = DEFAULT_MAX_RETRIES, /** Configure maximum allowed number of retries for obtaining list of ports; default is 5 times. */
// label = "Configure maximum allowed number of retries for obtaining list of ports; " +
// "default is 5 times")
private int maxRetries = MAX_RETRIES_DEFAULT; private int maxRetries = MAX_RETRIES_DEFAULT;
protected ExecutorService executor = protected ExecutorService executor =

View File

@ -64,7 +64,7 @@ import static org.onlab.util.Tools.get;
import static org.onosproject.net.DeviceId.deviceId; import static org.onosproject.net.DeviceId.deviceId;
import static org.onosproject.net.MastershipRole.MASTER; import static org.onosproject.net.MastershipRole.MASTER;
import static org.onosproject.net.MastershipRole.NONE; import static org.onosproject.net.MastershipRole.NONE;
import static org.onosproject.provider.nil.OsgiPropertyDefaults.*; import static org.onosproject.provider.nil.OsgiPropertyConstants.*;
import static org.slf4j.LoggerFactory.getLogger; import static org.slf4j.LoggerFactory.getLogger;
/** /**
@ -73,13 +73,13 @@ import static org.slf4j.LoggerFactory.getLogger;
*/ */
@Component(immediate = true, service = NullProviders.class, @Component(immediate = true, service = NullProviders.class,
property = { property = {
"enabled:Boolean=" + false, ENABLED + ":Boolean=" + ENABLED_DEFAULT,
"topoShape=" + TOPO_SHAPE_DEFAULT, TOPO_SHAPE + "=" + TOPO_SHAPE_DEFAULT,
"deviceCount:Integer=" + DEVICE_COUNT_DEFAULT, DEVICE_COUNT + ":Integer=" + DEVICE_COUNT_DEFAULT,
"hostCount:Integer=" + HOST_COUNT_DEFAULT, HOST_COUNT + ":Integer=" + HOST_COUNT_DEFAULT,
"packetRate:Integer=" + PACKET_RATE_DEFAULT, PACKET_RATE + ":Integer=" + PACKET_RATE_DEFAULT,
"mutationRate:Double=" + MUTATION_RATE_DEFAULT, MUTATION_RATE + ":Double=" + MUTATION_RATE_DEFAULT,
"mastership=" + MASTERSHIP_DEFAULT, MASTERSHIP + "=" + MASTERSHIP_DEFAULT,
}) })
public class NullProviders { public class NullProviders {
@ -110,7 +110,6 @@ public class NullProviders {
@Reference(cardinality = ReferenceCardinality.MANDATORY) @Reference(cardinality = ReferenceCardinality.MANDATORY)
protected LinkService linkService; protected LinkService linkService;
@Reference(cardinality = ReferenceCardinality.MANDATORY) @Reference(cardinality = ReferenceCardinality.MANDATORY)
protected DeviceProviderRegistry deviceProviderRegistry; protected DeviceProviderRegistry deviceProviderRegistry;
@ -146,32 +145,25 @@ public class NullProviders {
private TopologySimulator simulator; private TopologySimulator simulator;
//@Property(name = "enabled", boolValue = false, /** Enables or disables the provider. */
// label = "Enables or disables the provider")
private boolean enabled = false; private boolean enabled = false;
//@Property(name = "topoShape", value = DEFAULT_TOPO_SHAPE, /** Topology shape: configured, linear, reroute, tree, spineleaf, mesh, grid. */
// label = "Topology shape: configured, linear, reroute, tree, spineleaf, mesh, grid")
private String topoShape = TOPO_SHAPE_DEFAULT; private String topoShape = TOPO_SHAPE_DEFAULT;
//@Property(name = "deviceCount", intValue = DEFAULT_DEVICE_COUNT, /** Number of devices to generate. */
// label = "Number of devices to generate")
private int deviceCount = DEVICE_COUNT_DEFAULT; private int deviceCount = DEVICE_COUNT_DEFAULT;
//@Property(name = "hostCount", intValue = DEFAULT_HOST_COUNT, /** Number of host to generate per device. */
// label = "Number of host to generate per device")
private int hostCount = HOST_COUNT_DEFAULT; private int hostCount = HOST_COUNT_DEFAULT;
//@Property(name = "packetRate", intValue = DEFAULT_PACKET_RATE, /** Packet-in/s rate; 0 for no packets. */
// label = "Packet-in/s rate; 0 for no packets")
private int packetRate = PACKET_RATE_DEFAULT; private int packetRate = PACKET_RATE_DEFAULT;
//@Property(name = "mutationRate", doubleValue = DEFAULT_MUTATION_RATE, /** Link event/s topology mutation rate; 0 for no mutations. */
// label = "Link event/s topology mutation rate; 0 for no mutations")
private double mutationRate = MUTATION_RATE_DEFAULT; private double mutationRate = MUTATION_RATE_DEFAULT;
//@Property(name = "mastership", value = DEFAULT_MASTERSHIP, /** Mastership given as 'random' or 'node1=dpid,dpid/node2=dpid,...'. */
// label = "Mastership given as 'random' or 'node1=dpid,dpid/node2=dpid,...'")
private String mastership = MASTERSHIP_DEFAULT; private String mastership = MASTERSHIP_DEFAULT;
@ -219,22 +211,22 @@ public class NullProviders {
double newMutationRate; double newMutationRate;
String newTopoShape, newMastership; String newTopoShape, newMastership;
try { try {
String s = get(properties, "enabled"); String s = get(properties, ENABLED);
newEnabled = isNullOrEmpty(s) ? enabled : Boolean.parseBoolean(s.trim()); newEnabled = isNullOrEmpty(s) ? enabled : Boolean.parseBoolean(s.trim());
newTopoShape = get(properties, "topoShape"); newTopoShape = get(properties, TOPO_SHAPE);
newMastership = get(properties, "mastership"); newMastership = get(properties, MASTERSHIP);
s = get(properties, "deviceCount"); s = get(properties, DEVICE_COUNT);
newDeviceCount = isNullOrEmpty(s) ? deviceCount : Integer.parseInt(s.trim()); newDeviceCount = isNullOrEmpty(s) ? deviceCount : Integer.parseInt(s.trim());
s = get(properties, "hostCount"); s = get(properties, HOST_COUNT);
newHostCount = isNullOrEmpty(s) ? hostCount : Integer.parseInt(s.trim()); newHostCount = isNullOrEmpty(s) ? hostCount : Integer.parseInt(s.trim());
s = get(properties, "packetRate"); s = get(properties, PACKET_RATE);
newPacketRate = isNullOrEmpty(s) ? packetRate : Integer.parseInt(s.trim()); newPacketRate = isNullOrEmpty(s) ? packetRate : Integer.parseInt(s.trim());
s = get(properties, "mutationRate"); s = get(properties, MUTATION_RATE);
newMutationRate = isNullOrEmpty(s) ? mutationRate : Double.parseDouble(s.trim()); newMutationRate = isNullOrEmpty(s) ? mutationRate : Double.parseDouble(s.trim());
} catch (NumberFormatException e) { } catch (NumberFormatException e) {

View File

@ -19,15 +19,29 @@ package org.onosproject.provider.nil;
/** /**
* Constants for default values of configurable properties. * Constants for default values of configurable properties.
*/ */
public final class OsgiPropertyDefaults { public final class OsgiPropertyConstants {
private OsgiPropertyDefaults() {} private OsgiPropertyConstants() {}
public static final String ENABLED = "enabled";
public static final boolean ENABLED_DEFAULT = false;
public static final String TOPO_SHAPE = "topoShape";
public static final String TOPO_SHAPE_DEFAULT = "configured"; public static final String TOPO_SHAPE_DEFAULT = "configured";
public static final String DEVICE_COUNT = "deviceCount";
public static final int DEVICE_COUNT_DEFAULT = 10; public static final int DEVICE_COUNT_DEFAULT = 10;
public static final String HOST_COUNT = "hostCount";
public static final int HOST_COUNT_DEFAULT = 5; public static final int HOST_COUNT_DEFAULT = 5;
public static final String PACKET_RATE = "packetRate";
public static final int PACKET_RATE_DEFAULT = 0; public static final int PACKET_RATE_DEFAULT = 0;
public static final String MUTATION_RATE = "mutationRate";
public static final double MUTATION_RATE_DEFAULT = 0; public static final double MUTATION_RATE_DEFAULT = 0;
public static final String MASTERSHIP = "mastership";
public static final String MASTERSHIP_DEFAULT = "random"; public static final String MASTERSHIP_DEFAULT = "random";
} }

View File

@ -453,12 +453,10 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr
private final InternalDeviceProvider listener = new InternalDeviceProvider(); private final InternalDeviceProvider listener = new InternalDeviceProvider();
//@Property(name = POLL_PROP_NAME, intValue = POLL_INTERVAL, /** Frequency (in seconds) for polling switch Port statistics. */
//label = "Frequency (in seconds) for polling switch Port statistics")
private int portStatsPollFrequency = POLL_FREQ_DEFAULT; private int portStatsPollFrequency = POLL_FREQ_DEFAULT;
//@Property(name = PROP_FREQ, boolValue = DEFAULT_PROP_FREQ, /** It indicates frequency must be used instead of wavelength for port tuning. */
//label = "It indicates frequency must be used instead of wavelength for port tuning.")
private static boolean propFreq = PROP_FREQ_DEFAULT; private static boolean propFreq = PROP_FREQ_DEFAULT;
private final Timer timer = new Timer("onos-openflow-portstats-collector"); private final Timer timer = new Timer("onos-openflow-portstats-collector");

View File

@ -135,12 +135,10 @@ public class OpenFlowRuleProvider extends AbstractProvider
private static final int MIN_EXPECTED_BYTE_LEN = 56; private static final int MIN_EXPECTED_BYTE_LEN = 56;
private static final int SKIP_BYTES = 4; private static final int SKIP_BYTES = 4;
//@Property(name = "flowPollFrequency", intValue = DEFAULT_POLL_FREQUENCY, /** Frequency (in seconds) for polling flow statistics. */
// label = "Frequency (in seconds) for polling flow statistics")
private int flowPollFrequency = POLL_FREQUENCY_DEFAULT; private int flowPollFrequency = POLL_FREQUENCY_DEFAULT;
//@Property(name = "adaptiveFlowSampling", boolValue = DEFAULT_ADAPTIVE_FLOW_SAMPLING, /** Adaptive Flow Sampling is on or off. */
// label = "Adaptive Flow Sampling is on or off")
private boolean adaptiveFlowSampling = ADAPTIVE_FLOW_SAMPLING_DEFAULT; private boolean adaptiveFlowSampling = ADAPTIVE_FLOW_SAMPLING_DEFAULT;
private FlowRuleProviderService providerService; private FlowRuleProviderService providerService;

View File

@ -121,8 +121,7 @@ public class OpenFlowGroupProvider extends AbstractProvider implements GroupProv
private static final String COMPONENT = "org.onosproject.provider.of.group.impl.OpenFlowGroupProvider"; private static final String COMPONENT = "org.onosproject.provider.of.group.impl.OpenFlowGroupProvider";
//@Property(name = "groupPollInterval", intValue = DEFAULT_POLL_INTERVAL, /** Frequency (in seconds) for polling group statistics. */
// label = "Frequency (in seconds) for polling group statistics")
private int groupPollInterval = POLL_FREQUENCY_DEFAULT; private int groupPollInterval = POLL_FREQUENCY_DEFAULT;
private final InternalGroupProvider listener = new InternalGroupProvider(); private final InternalGroupProvider listener = new InternalGroupProvider();

View File

@ -183,8 +183,7 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
private static final int WAIT_TIME = 5; private static final int WAIT_TIME = 5;
public static final String LSRID = "lsrId"; public static final String LSRID = "lsrId";
//@Property(name = "tunnelStatsPollFrequency", intValue = POLL_INTERVAL, /** Frequency (in seconds) for polling tunnel statistics. */
// label = "Frequency (in seconds) for polling tunnel statistics")
private int tunnelStatsPollFrequency = POLL_FREQUENCY_DEFAULT; private int tunnelStatsPollFrequency = POLL_FREQUENCY_DEFAULT;
private static final String TUNNLE_NOT_NULL = "Create failed,The given port may be wrong or has been occupied."; private static final String TUNNLE_NOT_NULL = "Create failed,The given port may be wrong or has been occupied.";

View File

@ -137,9 +137,7 @@ public class RestDeviceProvider extends AbstractProvider
@Reference(cardinality = ReferenceCardinality.MANDATORY) @Reference(cardinality = ReferenceCardinality.MANDATORY)
protected DriverService driverService; protected DriverService driverService;
//@Property(name = POLL_FREQUENCY, intValue = DEFAULT_POLL_FREQUENCY_SECONDS, /** Configure poll frequency for port status and statistics; default is 30 seconds. */
// label = "Configure poll frequency for port status and statistics; " +
// "default is 30 seconds")
private int pollFrequency = POLL_FREQUENCY_DEFAULT; private int pollFrequency = POLL_FREQUENCY_DEFAULT;
private DeviceProviderService providerService; private DeviceProviderService providerService;