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 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;
/**
@ -58,9 +58,9 @@ import static org.slf4j.LoggerFactory.getLogger;
*/
@Component(immediate = true, service = Bmv2PreController.class,
property = {
"numConnectionRetries:Integer=" + NUM_CONNECTION_RETRIES_DEFAULT,
"timeBetweenRetries:Integer=" + TIME_BETWEEN_RETRIES_DEFAULT,
"deviceLockWaitingTime:Integer=" + DEVICE_LOCK_WAITING_TIME_IN_SEC_DEFAULT,
NUM_CONNECTION_RETRIES + ":Integer=" + NUM_CONNECTION_RETRIES_DEFAULT,
TIME_BETWEEN_RETRIES + ":Integer=" + TIME_BETWEEN_RETRIES_DEFAULT,
DEVICE_LOCK_WAITING_TIME_IN_SEC + ":Integer=" + DEVICE_LOCK_WAITING_TIME_IN_SEC_DEFAULT,
})
public class Bmv2PreControllerImpl implements Bmv2PreController {
@ -79,14 +79,14 @@ public class Bmv2PreControllerImpl implements Bmv2PreController {
});
@Reference(cardinality = ReferenceCardinality.MANDATORY)
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;
//@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;
//@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;
@Activate

View File

@ -19,11 +19,16 @@ package org.onosproject.drivers.bmv2.ctl;
/**
* 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 String NUM_CONNECTION_RETRIES = "numConnectionRetries";
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
discover the port hosting gRPC services.
*/
@Property(name = PORT_PROPERTY_NAME, intValue = DEFAULT_SERVER_PORT,
label = "The port number which ONOS will use to host gRPC services.")
/** The port number which ONOS will use to host gRPC services. */
private int listeningPort = DEFAULT_SERVER_PORT;
@Activate

View File

@ -99,9 +99,7 @@ public class GrpcRemoteServiceServer {
@Reference(cardinality = ReferenceCardinality.MANDATORY)
protected LinkProviderRegistry linkProviderRegistry;
@Property(name = "listenPort", intValue = DEFAULT_LISTEN_PORT,
label = "Port to listen on")
/** Port to listen on */
protected int listenPort = DEFAULT_LISTEN_PORT;
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 org.onlab.util.Tools.get;
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.slf4j.LoggerFactory.getLogger;
@ -105,9 +105,9 @@ import static org.slf4j.LoggerFactory.getLogger;
//TODO: support backup and persistent mechanism
@Component(immediate = true, enabled = false, service = VirtualNetworkFlowRuleStore.class,
property = {
"messageHandlerThreadPoolSize:Integer=" + MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT,
"pendingFutureTimeoutMinutes:Integer=" + BACKUP_PERIOD_MILLIS_DEFAULT,
"persistenceEnabled:Boolean=" + PERSISTENCE_ENABLED_DEFAULT,
MESSAGE_HANDLER_THREAD_POOL_SIZE + ":Integer=" + MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT,
BACKUP_PERIOD_MILLIS + ":Integer=" + BACKUP_PERIOD_MILLIS_DEFAULT,
PERSISTENCE_ENABLED + ":Boolean=" + PERSISTENCE_ENABLED_DEFAULT,
})
public class DistributedVirtualFlowRuleStore
@ -117,7 +117,6 @@ public class DistributedVirtualFlowRuleStore
private final Logger log = getLogger(getClass());
//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 String FLOW_OP_TOPIC = "virtual-flow-ops-ids";
@ -134,15 +133,13 @@ public class DistributedVirtualFlowRuleStore
private static final MessageSubject REMOTE_APPLY_COMPLETED
= new MessageSubject("virtual-peer-apply-completed");
//@Property(name = "msgHandlerThreadPoolSize", intValue = MESSAGE_HANDLER_THREAD_POOL_SIZE,
// label = "Number of threads in the message handler pool")
/** Number of threads in the message handler pool. */
private int msgHandlerThreadPoolSize = MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT;
//@Property(name = "backupPeriod", intValue = BACKUP_PERIOD_MILLIS,
// label = "Delay in ms between successive backup runs")
/** Delay in ms between successive backup runs. */
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 InternalFlowTable flowTable = new InternalFlowTable();
@ -240,13 +237,13 @@ public class DistributedVirtualFlowRuleStore
int newPoolSize;
int newBackupPeriod;
try {
String s = get(properties, "msgHandlerPoolSize");
String s = get(properties, MESSAGE_HANDLER_THREAD_POOL_SIZE);
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());
} catch (NumberFormatException | ClassCastException e) {
newPoolSize = MESSAGE_HANDLER_THREAD_POOL_SIZE;
newPoolSize = MESSAGE_HANDLER_THREAD_POOL_SIZE_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 org.onlab.util.Tools.get;
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.slf4j.LoggerFactory.getLogger;
@ -73,7 +74,7 @@ import static org.slf4j.LoggerFactory.getLogger;
*/
@Component(immediate = true, enabled = false, service = VirtualNetworkPacketStore.class,
property = {
"messageHandlerThreadPoolSize:Integer=" + MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT,
MESSAGE_HANDLER_THREAD_POOL_SIZE + ":Integer=" + MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT,
})
public class DistributedVirtualPacketStore
extends AbstractVirtualStore<PacketEvent, PacketStoreDelegate>
@ -107,8 +108,7 @@ public class DistributedVirtualPacketStore
private ExecutorService messageHandlingExecutor;
//@Property(name = "messageHandlerThreadPoolSize", intValue = DEFAULT_MESSAGE_HANDLER_THREAD_POOL_SIZE,
// label = "Size of thread pool to assign message handler")
/** Size of thread pool to assign message handler. */
private static int messageHandlerThreadPoolSize = MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT;
@Activate
@ -149,7 +149,7 @@ public class DistributedVirtualPacketStore
int newMessageHandlerThreadPoolSize;
try {
String s = get(properties, "messageHandlerThreadPoolSize");
String s = get(properties, MESSAGE_HANDLER_THREAD_POOL_SIZE);
newMessageHandlerThreadPoolSize =
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.
*/
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 String BACKUP_PERIOD_MILLIS = "backupPeriod";
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 String PENDING_FUTURE_TIMEOUT_MINUTES = "pendingFutureTimeoutMinutes";
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.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.slf4j.LoggerFactory.getLogger;
@ -74,7 +75,7 @@ import static org.slf4j.LoggerFactory.getLogger;
@Component(immediate = true, service = VirtualNetworkFlowRuleStore.class,
property = {
"pendingFutureTimeoutMinutes:Integer=" + PENDING_FUTURE_TIMEOUT_MINUTES_DEFAULT,
PENDING_FUTURE_TIMEOUT_MINUTES + ":Integer=" + PENDING_FUTURE_TIMEOUT_MINUTES_DEFAULT,
})
public class SimpleVirtualFlowRuleStore
extends AbstractVirtualStore<FlowRuleBatchEvent, FlowRuleStoreDelegate>
@ -92,8 +93,7 @@ public class SimpleVirtualFlowRuleStore
private final AtomicInteger localBatchIdGen = new AtomicInteger();
//@Property(name = "pendingFutureTimeoutMinutes", intValue = DEFAULT_PENDING_FUTURE_TIMEOUT_MINUTES,
// label = "Expiration time after an entry is created that it should be automatically removed")
/** Expiration time after an entry is created that it should be automatically removed. */
private int pendingFutureTimeoutMinutes = PENDING_FUTURE_TIMEOUT_MINUTES_DEFAULT;
private Cache<Integer, SettableFuture<CompletedBatchOperation>> pendingFutures =

View File

@ -60,11 +60,16 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
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.
*/
@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 {
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
// Does not enable log on existing channels
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;
private final Logger log = LoggerFactory.getLogger(getClass());
@ -95,7 +100,7 @@ public class GrpcControllerImpl implements GrpcController {
public void modified(ComponentContext context) {
if (context != null) {
Dictionary<?, ?> properties = context.getProperties();
enableMessageLog = Tools.isPropertyEnabled(properties, "enableMessageLog",
enableMessageLog = Tools.isPropertyEnabled(properties, ENABLE_MESSAGE_LOG,
DEFAULT_LOG_LEVEL);
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.getIntegerProperty;
import static org.onlab.util.Tools.groupedThreads;
import static org.onosproject.lisp.ctl.impl.OsgiPropertyConstants.*;
import static org.slf4j.LoggerFactory.getLogger;
/**
* 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 {
private static final String APP_ID = "org.onosproject.lisp-base";
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)
protected CoreService coreService;
@Reference(cardinality = ReferenceCardinality.MANDATORY)
protected ComponentConfigService cfgService;
//@Property(name = "lispAuthKey", value = DEFAULT_LISP_AUTH_KEY,
// label = "Authentication key which is used to calculate authentication " +
// "data for LISP control message; default value is onos")
private String lispAuthKey = DEFAULT_LISP_AUTH_KEY;
/**
* Authentication key which is used to calculate authentication data for
* LISP control message; default value is onos.
*/
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 " +
// "that ONOS uses to calculate the authentication data; " +
// "1 denotes HMAC SHA1 encryption, 2 denotes HMAC SHA256 encryption; " +
// "default value is 1")
private int lispAuthKeyId = DEFAULT_LISP_AUTH_KEY_ID;
/**
* Authentication key id which denotes the authentication method
* that ONOS uses to calculate the authentication data;
* 1 denotes HMAC SHA1 encryption, 2 denotes HMAC SHA256 encryption;
* default value is 1.
*/
private int lispAuthKeyId = LISP_AUTH_KEY_ID_DEFAULT;
//@Property(name = "enableSmr", boolValue = false,
// label = "Enable to send SMR(Solicit Map Request) by map server; " +
// "By default SMR is not activated")
/** Enable to send SMR(Solicit Map Request) by map server; by default SMR is not activated. */
private boolean enableSmr = false;
ExecutorService executorMessages =
@ -145,8 +148,8 @@ public class LispControllerImpl implements LispController {
* @param properties a set of properties that contained in component context
*/
private void initAuthConfig(Dictionary<?, ?> properties) {
authConfig.updateLispAuthKey(get(properties, "lispAuthKey"));
authConfig.updateLispAuthKeyId(getIntegerProperty(properties, "lispAuthKeyId"));
authConfig.updateLispAuthKey(get(properties, LISP_AUTH_KEY));
authConfig.updateLispAuthKeyId(getIntegerProperty(properties, LISP_AUTH_KEY_ID));
}
/**
@ -157,14 +160,14 @@ public class LispControllerImpl implements LispController {
private void readComponentConfiguration(ComponentContext context) {
Dictionary<?, ?> properties = context.getProperties();
String lispAuthKeyStr = Tools.get(properties, "lispAuthKey");
lispAuthKey = lispAuthKeyStr != null ? lispAuthKeyStr : DEFAULT_LISP_AUTH_KEY;
String lispAuthKeyStr = Tools.get(properties, LISP_AUTH_KEY);
lispAuthKey = lispAuthKeyStr != null ? lispAuthKeyStr : LISP_AUTH_KEY_DEFAULT;
authConfig.updateLispAuthKey(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) {
lispAuthKeyId = DEFAULT_LISP_AUTH_KEY_ID;
lispAuthKeyId = LISP_AUTH_KEY_ID_DEFAULT;
log.info("LISP authentication method is not configured, default value is {}", lispAuthKeyId);
} else {
lispAuthKeyId = lispAuthMethodInt;
@ -172,14 +175,14 @@ public class LispControllerImpl implements LispController {
}
authConfig.updateLispAuthKeyId(lispAuthKeyId);
Boolean enableSmr = Tools.isPropertyEnabled(properties, "enableSmr");
Boolean enableSmr = Tools.isPropertyEnabled(properties, ENABLE_SMR);
if (enableSmr == null) {
log.info("Enable SMR is not configured, " +
"using current value of {}", this.enableSmr);
"using current value of {}", this.enableSmr);
} else {
this.enableSmr = enableSmr;
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
public Iterable<LispRouter> getSubscribedRouters() {
return connectedRouters.entrySet()
.stream()
.filter(e -> e.getValue().isSubscribed())
.collect(toConcurrentMap(Map.Entry::getKey,
.stream()
.filter(e -> e.getValue().isSubscribed())
.collect(toConcurrentMap(Map.Entry::getKey,
Map.Entry::getValue)).values();
}
@ -269,7 +272,7 @@ public class LispControllerImpl implements LispController {
if (connectedRouters.get(routerId) != null) {
log.warn("Trying to add connectedRouter but found a previous " +
"value for routerId: {}", routerId);
"value for routerId: {}", routerId);
return false;
} else {
log.info("Added router {}", routerId);
@ -286,7 +289,7 @@ public class LispControllerImpl implements LispController {
if (connectedRouters.get(routerId) == null) {
log.error("Trying to remove router {} from connectedRouter " +
"list but no element was found", routerId);
"list but no element was found", routerId);
} else {
log.info("Removed router {}", routerId);
connectedRouters.remove(routerId);
@ -353,7 +356,7 @@ public class LispControllerImpl implements LispController {
private final boolean isIncoming;
LispMessageHandler(LispRouterId routerId,
LispMessage message, boolean isIncoming) {
LispMessage message, boolean isIncoming) {
this.routerId = routerId;
this.message = message;
this.isIncoming = isIncoming;
@ -375,10 +378,10 @@ public class LispControllerImpl implements LispController {
* LISP incoming message handler.
*/
protected final class LispIncomingMessageHandler
extends LispMessageHandler implements Runnable {
extends LispMessageHandler implements Runnable {
LispIncomingMessageHandler(LispRouterId routerId,
LispMessage message) {
LispMessage message) {
super(routerId, message, true);
}
}
@ -387,10 +390,10 @@ public class LispControllerImpl implements LispController {
* LISP outgoing message handler.
*/
protected final class LispOutgoingMessageHandler
extends LispMessageHandler implements Runnable {
extends LispMessageHandler implements Runnable {
LispOutgoingMessageHandler(LispRouterId routerId,
LispMessage message) {
LispMessage message) {
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.getIntegerProperty;
import static org.onlab.util.Tools.groupedThreads;
import static org.onosproject.netconf.ctl.impl.OsgiPropertyConstants.*;
/**
* 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 {
protected static final int DEFAULT_CONNECT_TIMEOUT_SECONDS = 5;
private static final String PROP_NETCONF_CONNECT_TIMEOUT = "netconfConnectTimeout";
// 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;
/** Time (in seconds) to wait for a NETCONF connect. */
protected static int netconfConnectTimeout = NETCONF_CONNECT_TIMEOUT_DEFAULT;
private static final String PROP_NETCONF_REPLY_TIMEOUT = "netconfReplyTimeout";
protected static final int DEFAULT_REPLY_TIMEOUT_SECONDS = 5;
// 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;
/** Time (in seconds) waiting for a NetConf reply. */
protected static int netconfReplyTimeout = NETCONF_REPLY_TIMEOUT_DEFAULT;
private static final String PROP_NETCONF_IDLE_TIMEOUT = "netconfIdleTimeout";
protected static final int DEFAULT_IDLE_TIMEOUT_SECONDS = 300;
// 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;
/** Time (in seconds) SSH session will close if no traffic seen. */
protected static int netconfIdleTimeout = NETCONF_IDLE_TIMEOUT_DEFAULT;
private static final String SSH_LIBRARY = "sshLibrary";
private static final String APACHE_MINA_STR = "apache-mina";
//@Property(name = SSH_LIBRARY, value = APACHE_MINA_STR,
// label = "Ssh client library to use")
protected NetconfSshClientLib sshLibrary = NetconfSshClientLib.APACHE_MINA;
/** SSH client library to use. */
protected static String sshLibrary = SSH_LIBRARY_DEFAULT;
protected NetconfSshClientLib sshClientLib = NetconfSshClientLib.APACHE_MINA;
@Reference(cardinality = ReferenceCardinality.MANDATORY)
protected ComponentConfigService cfgService;
@ -115,7 +109,7 @@ public class NetconfControllerImpl implements NetconfController {
private final NetconfDeviceOutputEventListener downListener = new DeviceDownEventListener();
protected Set<NetconfDeviceListener> netconfDeviceListeners = new CopyOnWriteArraySet<>();
protected NetconfDeviceFactory deviceFactory = (deviceInfo) -> new DefaultNetconfDevice(deviceInfo);
protected NetconfDeviceFactory deviceFactory = DefaultNetconfDevice::new;
protected final ExecutorService executor =
Executors.newCachedThreadPool(groupedThreads("onos/netconfdevicecontroller",
@ -145,10 +139,11 @@ public class NetconfControllerImpl implements NetconfController {
@Modified
public void modified(ComponentContext context) {
if (context == null) {
netconfReplyTimeout = DEFAULT_REPLY_TIMEOUT_SECONDS;
netconfConnectTimeout = DEFAULT_CONNECT_TIMEOUT_SECONDS;
netconfIdleTimeout = DEFAULT_IDLE_TIMEOUT_SECONDS;
sshLibrary = NetconfSshClientLib.APACHE_MINA;
netconfReplyTimeout = NETCONF_REPLY_TIMEOUT_DEFAULT;
netconfConnectTimeout = NETCONF_CONNECT_TIMEOUT_DEFAULT;
netconfIdleTimeout = NETCONF_IDLE_TIMEOUT_DEFAULT;
sshLibrary = SSH_LIBRARY_DEFAULT;
sshClientLib = NetconfSshClientLib.APACHE_MINA;
log.info("No component configuration");
return;
}
@ -158,11 +153,11 @@ public class NetconfControllerImpl implements NetconfController {
String newSshLibrary;
int newNetconfReplyTimeout = getIntegerProperty(
properties, PROP_NETCONF_REPLY_TIMEOUT, netconfReplyTimeout);
properties, NETCONF_REPLY_TIMEOUT, netconfReplyTimeout);
int newNetconfConnectTimeout = getIntegerProperty(
properties, PROP_NETCONF_CONNECT_TIMEOUT, netconfConnectTimeout);
properties, NETCONF_CONNECT_TIMEOUT, netconfConnectTimeout);
int newNetconfIdleTimeout = getIntegerProperty(
properties, PROP_NETCONF_IDLE_TIMEOUT, netconfIdleTimeout);
properties, NETCONF_IDLE_TIMEOUT, netconfIdleTimeout);
newSshLibrary = get(properties, SSH_LIBRARY);
@ -181,12 +176,13 @@ public class NetconfControllerImpl implements NetconfController {
netconfConnectTimeout = newNetconfConnectTimeout;
netconfIdleTimeout = newNetconfIdleTimeout;
if (newSshLibrary != null) {
sshLibrary = NetconfSshClientLib.getEnum(newSshLibrary);
sshLibrary = newSshLibrary;
sshClientLib = NetconfSshClientLib.getEnum(newSshLibrary);
}
log.info("Settings: {} = {}, {} = {}, {} = {}, {} = {}",
PROP_NETCONF_REPLY_TIMEOUT, netconfReplyTimeout,
PROP_NETCONF_CONNECT_TIMEOUT, netconfConnectTimeout,
PROP_NETCONF_IDLE_TIMEOUT, netconfIdleTimeout,
NETCONF_REPLY_TIMEOUT, netconfReplyTimeout,
NETCONF_CONNECT_TIMEOUT, netconfConnectTimeout,
NETCONF_IDLE_TIMEOUT, netconfIdleTimeout,
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.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.
@ -125,9 +128,9 @@ public class NetconfControllerImplTest {
ctrl.deviceService = deviceService;
ctrl.deviceKeyService = deviceKeyService;
ctrl.netCfgService = netCfgService;
NetconfControllerImpl.netconfConnectTimeout = NetconfControllerImpl.DEFAULT_CONNECT_TIMEOUT_SECONDS;
NetconfControllerImpl.netconfIdleTimeout = NetconfControllerImpl.DEFAULT_IDLE_TIMEOUT_SECONDS;
NetconfControllerImpl.netconfReplyTimeout = NetconfControllerImpl.DEFAULT_REPLY_TIMEOUT_SECONDS;
NetconfControllerImpl.netconfConnectTimeout = NETCONF_CONNECT_TIMEOUT_DEFAULT;
NetconfControllerImpl.netconfIdleTimeout = NETCONF_IDLE_TIMEOUT_DEFAULT;
NetconfControllerImpl.netconfReplyTimeout = NETCONF_REPLY_TIMEOUT_DEFAULT;
//Creating mock devices
deviceInfo1 = new NetconfDeviceInfo("device1", "001", IpAddress.valueOf(DEVICE_1_IP), DEVICE_1_PORT);
@ -183,9 +186,9 @@ public class NetconfControllerImplTest {
public void tearDown() {
ctrl.deactivate();
// resetting static variables..
NetconfControllerImpl.netconfConnectTimeout = NetconfControllerImpl.DEFAULT_CONNECT_TIMEOUT_SECONDS;
NetconfControllerImpl.netconfIdleTimeout = NetconfControllerImpl.DEFAULT_IDLE_TIMEOUT_SECONDS;
NetconfControllerImpl.netconfReplyTimeout = NetconfControllerImpl.DEFAULT_REPLY_TIMEOUT_SECONDS;
NetconfControllerImpl.netconfConnectTimeout = NETCONF_CONNECT_TIMEOUT_DEFAULT;
NetconfControllerImpl.netconfIdleTimeout = NETCONF_IDLE_TIMEOUT_DEFAULT;
NetconfControllerImpl.netconfReplyTimeout = NETCONF_REPLY_TIMEOUT_DEFAULT;
}
/**

View File

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

View File

@ -25,38 +25,24 @@ public final class 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_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 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_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_DEFAULT = "";
//@Property(name = "keyStorePassword", value = "",
// label = "Key store password")
public static final String KEY_STORE_PASSWORD = "keyStorePassword";
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_DEFAULT = "";
//@Property(name = "trustStorePassword", value = "",
// label = "Trust store password")
public static final String TRUST_STORE_PASSWORD = "trustStorePassword";
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;
//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 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.OsgiPropertyConstants.*;
/**
* 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 static final Logger log = LoggerFactory
@ -110,29 +115,23 @@ public class OvsdbControllerImpl implements OvsdbController {
@Reference(cardinality = ReferenceCardinality.MANDATORY)
protected ComponentConfigService configService;
//@Property(name = "serverMode", boolValue = SERVER_MODE,
// label = "Run as server mode, listen on 6640 port")
private boolean serverMode = SERVER_MODE;
/** Run as server mode, listen on 6640 port. */
private boolean serverMode = SERVER_MODE_DEFAULT;
//@Property(name = "enableOvsdbTls", boolValue = OVSDB_TLS_FLAG,
// label = "TLS mode for OVSDB channel; options are: true false")
private boolean enableOvsdbTls = OVSDB_TLS_FLAG;
/** TLS mode for OVSDB channel; options are: true false. */
private boolean enableOvsdbTls = OVSDB_TLS_FLAG_DEFAULT;
//@Property(name = "keyStoreLocation", value = DEFAULT_KS_FILE,
// label = "File path to KeyStore for Ovsdb TLS Connections")
protected String keyStoreLocation = DEFAULT_KS_FILE;
/** File path to KeyStore for Ovsdb TLS Connections. */
protected String keyStoreLocation = KS_FILE_DEFAULT;
//@Property(name = "trustStoreLocation", value = DEFAULT_KS_FILE,
// label = "File path to TrustStore for Ovsdb TLS Connections")
protected String trustStoreLocation = DEFAULT_KS_FILE;
/** File path to TrustStore for Ovsdb TLS Connections. */
protected String trustStoreLocation = TS_FILE_DEFAULT;
//@Property(name = "keyStorePassword", value = DEFAULT_KS_PASSWORD,
// label = "KeyStore Password")
protected String keyStorePassword = DEFAULT_KS_PASSWORD;
/** KeyStore Password. */
protected String keyStorePassword = KS_PASSWORD_DEFAULT;
//@Property(name = "trustStorePassword", value = DEFAULT_KS_PASSWORD,
// label = "TrustStore Password")
protected String trustStorePassword = DEFAULT_KS_PASSWORD;
/** TrustStore Password. */
protected String trustStorePassword = TS_PASSWORD_DEFAULT;
@Activate
public void activate(ComponentContext context) {
@ -180,7 +179,7 @@ public class OvsdbControllerImpl implements OvsdbController {
private TlsParams getTlsParams(Dictionary<?, ?> properties) {
TlsMode mode = null;
boolean flag = Tools.isPropertyEnabled(properties, "enableOvsdbTls");
boolean flag = Tools.isPropertyEnabled(properties, OVSDB_TLS_FLAG);
if (Objects.isNull(flag) || !flag) {
log.warn("OvsdbTLS Disabled");
mode = TlsMode.DISABLED;
@ -191,25 +190,25 @@ public class OvsdbControllerImpl implements OvsdbController {
String ksLocation = null, tsLocation = null, ksPwd = null, tsPwd = null;
ksLocation = get(properties, "keyStoreLocation");
ksLocation = get(properties, KS_FILE);
if (Strings.isNullOrEmpty(ksLocation)) {
log.warn("trustStoreLocation is not configured");
mode = TlsMode.DISABLED;
}
tsLocation = get(properties, "trustStoreLocation");
tsLocation = get(properties, TS_FILE);
if (Strings.isNullOrEmpty(tsLocation)) {
log.warn("trustStoreLocation is not configured");
mode = TlsMode.DISABLED;
}
ksPwd = get(properties, "keyStorePassword");
ksPwd = get(properties, KS_PASSWORD);
if (Strings.isNullOrEmpty(ksPwd) || MIN_KS_LENGTH > ksPwd.length()) {
log.warn("keyStorePassword is not configured or Password length too small");
mode = TlsMode.DISABLED;
}
tsPwd = get(properties, "trustStorePassword");
tsPwd = get(properties, TS_PASSWORD);
if (Strings.isNullOrEmpty(tsPwd) || MIN_KS_LENGTH > tsPwd.length()) {
log.warn("trustStorePassword is not configured or Password length too small");
mode = TlsMode.DISABLED;

View File

@ -29,8 +29,7 @@ import java.util.Arrays;
import java.util.EnumSet;
import java.util.Objects;
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.impl.OsgiPropertyConstants.*;
/**
* TlsParams Class for properties required for configuring OVSDB TLS Connection.
@ -69,10 +68,10 @@ public class TlsParams {
*/
TlsParams() {
this.mode = TlsMode.DISABLED;
this.ksLocation = DEFAULT_KS_FILE;
this.tsLocation = DEFAULT_KS_FILE;
this.ksPwd = DEFAULT_KS_PASSWORD;
this.tsPwd = DEFAULT_KS_PASSWORD;
this.ksLocation = KS_FILE_DEFAULT;
this.tsLocation = TS_FILE_DEFAULT;
this.ksPwd = KS_PASSWORD_DEFAULT;
this.tsPwd = TS_PASSWORD_DEFAULT;
this.ksSignature = getSha1Checksum(ksLocation);
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.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.
@ -58,11 +61,13 @@ import java.util.concurrent.CopyOnWriteArraySet;
* 3. Configuration parameters initialization.
* 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 {
private static final String APP_ID = "org.onosproject.xmpp";
private static final String XMPP_PORT = "5269";
private static final Logger log =
LoggerFactory.getLogger(XmppControllerImpl.class);
@ -75,10 +80,8 @@ public class XmppControllerImpl implements XmppController {
protected ComponentConfigService cfgService;
// configuration properties definition
//@Property(name = "xmppPort", value = XMPP_PORT,
// label = "Port number used by XMPP protocol; default is 5269")
private String xmppPort = XMPP_PORT;
/** Port number used by XMPP protocol; default is 5269. */
private String xmppPort = XMPP_PORT_DEFAULT;
// listener declaration
protected Set<XmppDeviceListener> xmppDeviceListeners = new CopyOnWriteArraySet<XmppDeviceListener>();

View File

@ -35,6 +35,7 @@ import java.net.InetSocketAddress;
import java.util.Dictionary;
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.
@ -124,7 +125,7 @@ public class XmppServer {
* @param properties properties to be set
*/
public void setConfiguration(Dictionary<?, ?> properties) {
String port = get(properties, "xmppPort");
String port = get(properties, XMPP_PORT);
if (!Strings.isNullOrEmpty(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 org.onlab.util.Tools.groupedThreads;
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.OsgiPropertyDefaults.PROBE_FREQUENCY_DEFAULT;
import static org.onosproject.provider.general.device.impl.OsgiPropertyDefaults.STATS_POLL_FREQUENCY_DEFAULT;
import static org.onosproject.provider.general.device.impl.OsgiPropertyConstants.*;
import static org.slf4j.LoggerFactory.getLogger;
/**
@ -119,9 +117,9 @@ import static org.slf4j.LoggerFactory.getLogger;
@Beta
@Component(immediate = true,
property = {
"deviceStatsPollFrequency:Integer=" + STATS_POLL_FREQUENCY_DEFAULT,
"deviceProbeFrequency:Integer=" + PROBE_FREQUENCY_DEFAULT,
"deviceOperationTimeoutShort:Integer=" + OP_TIMEOUT_SHORT_DEFAULT,
STATS_POLL_FREQUENCY + ":Integer=" + STATS_POLL_FREQUENCY_DEFAULT,
PROBE_FREQUENCY + ":Integer=" + PROBE_FREQUENCY_DEFAULT,
OP_TIMEOUT_SHORT + ":Integer=" + OP_TIMEOUT_SHORT_DEFAULT,
})
public class GeneralDeviceProvider extends AbstractProvider
implements DeviceProvider {
@ -166,23 +164,20 @@ public class GeneralDeviceProvider extends AbstractProvider
@Reference(cardinality = ReferenceCardinality.MANDATORY)
private PiPipeconfWatchdogService pipeconfWatchdogService;
private static final String STATS_POLL_FREQUENCY = "deviceStatsPollFrequency";
//@Property(name = STATS_POLL_FREQUENCY, intValue = DEFAULT_STATS_POLL_FREQUENCY,
// label = "Configure poll frequency for port status and statistics; " +
// "default is 10 sec")
/**
* Configure poll frequency for port status and statistics; default is 10 sec.
*/
private int statsPollFrequency = STATS_POLL_FREQUENCY_DEFAULT;
private static final String PROBE_FREQUENCY = "deviceProbeFrequency";
//@Property(name = PROBE_FREQUENCY, intValue = DEFAULT_PROBE_FREQUENCY,
// label = "Configure probe frequency for checking device availability; " +
// "default is 10 sec")
/**
* Configure probe frequency for checking device availability; default is 10 sec.
*/
private int probeFrequency = PROBE_FREQUENCY_DEFAULT;
private static final String OP_TIMEOUT_SHORT = "deviceOperationTimeoutShort";
//@Property(name = OP_TIMEOUT_SHORT, intValue = DEFAULT_OP_TIMEOUT_SHORT,
// label = "Configure timeout in seconds for device operations " +
// "that are supposed to take a short time " +
// "(e.g. checking device reachability); default is 10 seconds")
/**
* Configure timeout in seconds for device operations that are supposed to take a short time
* (e.g. checking device reachability); default is 10 seconds.
*/
private int opTimeoutShort = OP_TIMEOUT_SHORT_DEFAULT;
//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.
*/
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 String PROBE_FREQUENCY = "deviceProbeFrequency";
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;
}

View File

@ -103,6 +103,7 @@ import java.util.stream.Stream;
import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor;
import static org.onlab.util.Tools.groupedThreads;
import static org.onosproject.provider.host.impl.OsgiPropertyConstants.*;
import static org.slf4j.LoggerFactory.getLogger;
/**
@ -111,13 +112,13 @@ import static org.slf4j.LoggerFactory.getLogger;
*/
@Component(immediate = true, service = HostProvider.class,
property = {
"hostRemovalEnabled:Boolean=true",
"requestArp:Boolean=true",
"requestIpv6ND:Boolean=false",
"useDhcp:Boolean=false",
"useDhcp6:Boolean=false",
"requestInterceptsEnabled:Boolean=true",
"multihomingEnabled:Boolean=false",
HOST_REMOVAL_ENABLED + ":Boolean=" + HOST_REMOVAL_ENABLED_DEFAULT,
REQUEST_ARP + ":Boolean=" + REQUEST_ARP_DEFAULT,
REQUEST_NDP + ":Boolean=" + REQUEST_NDP_DEFAULT,
USE_DHCP + ":Boolean=" + USE_DHCP_DEFAULT,
USE_DHCP6 + ":Boolean=" + USE_DHCP6_DEFAULT,
REQUEST_INTERCEPTS_ENABLED + ":Boolean=" + REQUEST_INTERCEPTS_ENABLED_DEFAULT,
MULTIHOMING_ENABLED + ":Boolean=" + MULTIHOMING_ENABLED_DEFAULT,
})
public class HostLocationProvider extends AbstractProvider implements HostProvider {
private final Logger log = getLogger(getClass());
@ -155,34 +156,25 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid
private ApplicationId appId;
//@Property(name = "hostRemovalEnabled", boolValue = true,
// label = "Enable host removal on port/device down events")
/** Enable host removal on port/device down events. */
private boolean hostRemovalEnabled = true;
//@Property(name = "requestArp", boolValue = true,
// label = "Request ARP packets for neighbor discovery by the " +
// "Host Location Provider; default is true")
/** Request ARP packets for neighbor discovery by the Host Location Provider; default is true. */
private boolean requestArp = true;
//@Property(name = "requestIpv6ND", boolValue = false,
// label = "Requests IPv6 Neighbor Discovery by the " +
// "Host Location Provider; default is false")
/** Requests IPv6 Neighbor Discovery by the Host Location Provider; default is false. */
private boolean requestIpv6ND = false;
//@Property(name = "useDhcp", boolValue = false,
// label = "Use DHCP to update IP address of the host; default is false")
/** Use DHCP to update IP address of the host; default is false. */
private boolean useDhcp = false;
//@Property(name = "useDhcp6", boolValue = false,
// label = "Use DHCPv6 to update IP address of the host; default is false")
/** Use DHCPv6 to update IP address of the host; default is false. */
private boolean useDhcp6 = false;
//@Property(name = "requestInterceptsEnabled", boolValue = true,
// label = "Enable requesting packet intercepts")
/** Enable requesting packet intercepts. */
private boolean requestInterceptsEnabled = true;
//@Property(name = "multihomingEnabled", boolValue = false,
// label = "Allow hosts to be multihomed")
/** Allow hosts to be multihomed. */
private boolean multihomingEnabled = false;
private HostProviderService providerService;
@ -322,7 +314,7 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid
Dictionary<?, ?> properties = context.getProperties();
Boolean flag;
flag = Tools.isPropertyEnabled(properties, "hostRemovalEnabled");
flag = Tools.isPropertyEnabled(properties, HOST_REMOVAL_ENABLED);
if (flag == null) {
log.info("Host removal on port/device down events is not configured, " +
"using current value of {}", hostRemovalEnabled);
@ -332,7 +324,7 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid
hostRemovalEnabled ? "enabled" : "disabled");
}
flag = Tools.isPropertyEnabled(properties, "requestArp");
flag = Tools.isPropertyEnabled(properties, REQUEST_ARP);
if (flag == null) {
log.info("Using ARP is not configured, " +
"using current value of {}", requestArp);
@ -342,7 +334,7 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid
requestArp ? "enabled" : "disabled");
}
flag = Tools.isPropertyEnabled(properties, "requestIpv6ND");
flag = Tools.isPropertyEnabled(properties, REQUEST_NDP);
if (flag == null) {
log.info("Using IPv6 Neighbor Discovery is not configured, " +
"using current value of {}", requestIpv6ND);
@ -352,7 +344,7 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid
requestIpv6ND ? "enabled" : "disabled");
}
flag = Tools.isPropertyEnabled(properties, "useDhcp");
flag = Tools.isPropertyEnabled(properties, USE_DHCP);
if (flag == null) {
log.info("Using DHCP is not configured, " +
"using current value of {}", useDhcp);
@ -362,7 +354,17 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid
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) {
log.info("Request intercepts is not configured, " +
"using current value of {}", requestInterceptsEnabled);
@ -372,7 +374,7 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid
requestInterceptsEnabled ? "enabled" : "disabled");
}
flag = Tools.isPropertyEnabled(properties, "multihomingEnabled");
flag = Tools.isPropertyEnabled(properties, MULTIHOMING_ENABLED);
if (flag == null) {
log.info("Multihoming is not configured, " +
"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 org.onlab.util.Tools.get;
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.OsgiPropertyDefaults.POLL_FREQUENCY_SECONDS_DEFAULT;
import static org.onosproject.provider.linkdiscovery.impl.OsgiPropertyConstants.*;
import static org.slf4j.LoggerFactory.getLogger;
/**
@ -68,8 +67,8 @@ import static org.slf4j.LoggerFactory.getLogger;
*/
@Component(immediate = true,
property = {
"linkPollDelaySeconds:Integer=" + POLL_DELAY_SECONDS_DEFAULT,
"linkPollFrequencySeconds:Integer=" + POLL_FREQUENCY_SECONDS_DEFAULT,
POLL_DELAY_SECONDS + ":Integer=" + POLL_DELAY_SECONDS_DEFAULT,
POLL_FREQUENCY_SECONDS + ":Integer=" + POLL_FREQUENCY_SECONDS_DEFAULT,
})
public class LinkDiscoveryProvider extends AbstractProvider
implements LinkProvider {
@ -78,12 +77,11 @@ public class LinkDiscoveryProvider extends AbstractProvider
protected static final String SCHEME_NAME = "linkdiscovery";
private static final String LINK_PROVIDER_PACKAGE = "org.onosproject.provider.linkdiscovery";
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;
//@Property(name = "linkPollFrequencySeconds", intValue = DEFAULT_POLL_FREQUENCY_SECONDS,
// label = "Frequency (in seconds) for polling link discovery")
/** Frequency (in seconds) for polling link discovery. */
protected static int linkPollFrequencySeconds = POLL_FREQUENCY_SECONDS_DEFAULT;
@ -171,7 +169,7 @@ public class LinkDiscoveryProvider extends AbstractProvider
private int getNewPollFrequency(Dictionary<?, ?> properties, int pollFrequency) {
int newPollFrequency;
try {
String s = get(properties, "linkPollFrequencySeconds");
String s = get(properties, POLL_FREQUENCY_SECONDS);
newPollFrequency = isNullOrEmpty(s) ? pollFrequency : Integer.parseInt(s.trim());
} catch (NumberFormatException | ClassCastException e) {
newPollFrequency = POLL_FREQUENCY_SECONDS_DEFAULT;
@ -182,7 +180,7 @@ public class LinkDiscoveryProvider extends AbstractProvider
private int getNewPollDealy(Dictionary<?, ?> properties, int pollDelay) {
int newPollFrequency;
try {
String s = get(properties, "linkPollDelaySeconds");
String s = get(properties, POLL_DELAY_SECONDS);
newPollFrequency = isNullOrEmpty(s) ? pollDelay : Integer.parseInt(s.trim());
} catch (NumberFormatException | ClassCastException e) {
newPollFrequency = POLL_DELAY_SECONDS_DEFAULT;

View File

@ -19,11 +19,14 @@ package org.onosproject.provider.linkdiscovery.impl;
/**
* 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 String POLL_FREQUENCY_SECONDS = "linkPollFrequencySeconds";
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 LINK_PRUNER_DELAY = 3;
//@Property(name = PROP_ENABLED, boolValue = true,
// label = "If false, link discovery is disabled")
/** If false, link discovery is disabled. */
protected boolean enabled = false;
//@Property(name = PROP_USE_BDDP, boolValue = true,
// label = "Use BDDP for link discovery")
/** Use BDDP for link discovery. */
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. */
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. */
protected int staleLinkAge = STALE_LINK_AGE_DEFAULT;
//@Property(name = PROP_DISCOVERY_DELAY, intValue = DEFAULT_DISCOVERY_DELAY,
// label = "Number of millis beyond which an LLDP packet will not be accepted")
/** Number of millis beyond which an LLDP packet will not be accepted. */
private int maxDiscoveryDelayMs = DISCOVERY_DELAY_DEFAULT;
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 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;
}

View File

@ -108,12 +108,10 @@ public class NetworkConfigLinksProvider
@Reference(cardinality = ReferenceCardinality.MANDATORY)
protected ClusterMetadataService metadataService;
//@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. */
private int probeRate = PROBE_RATE_DEFAULT;
//@Property(name = PROP_DISCOVERY_DELAY, intValue = DEFAULT_DISCOVERY_DELAY,
// label = "Number of millis beyond which an LLDP packet will not be accepted")
/** Number of millis beyond which an LLDP packet will not be accepted. */
private int maxDiscoveryDelayMs = DISCOVERY_DELAY_DEFAULT;
// Device link discovery helpers.

View File

@ -145,14 +145,10 @@ public class NetconfDeviceProvider extends AbstractProvider
private static final String PORT = "port";
private static final int CORE_POOL_SIZE = 10;
//@Property(name = "pollFrequency", intValue = DEFAULT_POLL_FREQUENCY_SECONDS,
// label = "Configure poll frequency for port status and statistics; " +
// "default is 30 sec")
/** Configure poll frequency for port status and statistics; default is 30 sec. */
private int pollFrequency = POLL_FREQUENCY_SECONDS_DEFAULT;
//@Property(name = "maxRetries", intValue = DEFAULT_MAX_RETRIES,
// label = "Configure maximum allowed number of retries for obtaining list of ports; " +
// "default is 5 times")
/** Configure maximum allowed number of retries for obtaining list of ports; default is 5 times. */
private int maxRetries = MAX_RETRIES_DEFAULT;
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.MastershipRole.MASTER;
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;
/**
@ -73,13 +73,13 @@ import static org.slf4j.LoggerFactory.getLogger;
*/
@Component(immediate = true, service = NullProviders.class,
property = {
"enabled:Boolean=" + false,
"topoShape=" + TOPO_SHAPE_DEFAULT,
"deviceCount:Integer=" + DEVICE_COUNT_DEFAULT,
"hostCount:Integer=" + HOST_COUNT_DEFAULT,
"packetRate:Integer=" + PACKET_RATE_DEFAULT,
"mutationRate:Double=" + MUTATION_RATE_DEFAULT,
"mastership=" + MASTERSHIP_DEFAULT,
ENABLED + ":Boolean=" + ENABLED_DEFAULT,
TOPO_SHAPE + "=" + TOPO_SHAPE_DEFAULT,
DEVICE_COUNT + ":Integer=" + DEVICE_COUNT_DEFAULT,
HOST_COUNT + ":Integer=" + HOST_COUNT_DEFAULT,
PACKET_RATE + ":Integer=" + PACKET_RATE_DEFAULT,
MUTATION_RATE + ":Double=" + MUTATION_RATE_DEFAULT,
MASTERSHIP + "=" + MASTERSHIP_DEFAULT,
})
public class NullProviders {
@ -110,7 +110,6 @@ public class NullProviders {
@Reference(cardinality = ReferenceCardinality.MANDATORY)
protected LinkService linkService;
@Reference(cardinality = ReferenceCardinality.MANDATORY)
protected DeviceProviderRegistry deviceProviderRegistry;
@ -146,32 +145,25 @@ public class NullProviders {
private TopologySimulator simulator;
//@Property(name = "enabled", boolValue = false,
// label = "Enables or disables the provider")
/** Enables or disables the provider. */
private boolean enabled = false;
//@Property(name = "topoShape", value = DEFAULT_TOPO_SHAPE,
// label = "Topology shape: configured, linear, reroute, tree, spineleaf, mesh, grid")
/** Topology shape: configured, linear, reroute, tree, spineleaf, mesh, grid. */
private String topoShape = TOPO_SHAPE_DEFAULT;
//@Property(name = "deviceCount", intValue = DEFAULT_DEVICE_COUNT,
// label = "Number of devices to generate")
/** Number of devices to generate. */
private int deviceCount = DEVICE_COUNT_DEFAULT;
//@Property(name = "hostCount", intValue = DEFAULT_HOST_COUNT,
// label = "Number of host to generate per device")
/** Number of host to generate per device. */
private int hostCount = HOST_COUNT_DEFAULT;
//@Property(name = "packetRate", intValue = DEFAULT_PACKET_RATE,
// label = "Packet-in/s rate; 0 for no packets")
/** Packet-in/s rate; 0 for no packets. */
private int packetRate = PACKET_RATE_DEFAULT;
//@Property(name = "mutationRate", doubleValue = DEFAULT_MUTATION_RATE,
// label = "Link event/s topology mutation rate; 0 for no mutations")
/** Link event/s topology mutation rate; 0 for no mutations. */
private double mutationRate = MUTATION_RATE_DEFAULT;
//@Property(name = "mastership", value = DEFAULT_MASTERSHIP,
// label = "Mastership given as 'random' or 'node1=dpid,dpid/node2=dpid,...'")
/** Mastership given as 'random' or 'node1=dpid,dpid/node2=dpid,...'. */
private String mastership = MASTERSHIP_DEFAULT;
@ -219,22 +211,22 @@ public class NullProviders {
double newMutationRate;
String newTopoShape, newMastership;
try {
String s = get(properties, "enabled");
String s = get(properties, ENABLED);
newEnabled = isNullOrEmpty(s) ? enabled : Boolean.parseBoolean(s.trim());
newTopoShape = get(properties, "topoShape");
newMastership = get(properties, "mastership");
newTopoShape = get(properties, TOPO_SHAPE);
newMastership = get(properties, MASTERSHIP);
s = get(properties, "deviceCount");
s = get(properties, DEVICE_COUNT);
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());
s = get(properties, "packetRate");
s = get(properties, PACKET_RATE);
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());
} catch (NumberFormatException e) {

View File

@ -19,15 +19,29 @@ package org.onosproject.provider.nil;
/**
* 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 DEVICE_COUNT = "deviceCount";
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 String PACKET_RATE = "packetRate";
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 String MASTERSHIP = "mastership";
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();
//@Property(name = POLL_PROP_NAME, intValue = POLL_INTERVAL,
//label = "Frequency (in seconds) for polling switch Port statistics")
/** Frequency (in seconds) for polling switch Port statistics. */
private int portStatsPollFrequency = POLL_FREQ_DEFAULT;
//@Property(name = PROP_FREQ, boolValue = DEFAULT_PROP_FREQ,
//label = "It indicates frequency must be used instead of wavelength for port tuning.")
/** It indicates frequency must be used instead of wavelength for port tuning. */
private static boolean propFreq = PROP_FREQ_DEFAULT;
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 SKIP_BYTES = 4;
//@Property(name = "flowPollFrequency", intValue = DEFAULT_POLL_FREQUENCY,
// label = "Frequency (in seconds) for polling flow statistics")
/** Frequency (in seconds) for polling flow statistics. */
private int flowPollFrequency = POLL_FREQUENCY_DEFAULT;
//@Property(name = "adaptiveFlowSampling", boolValue = DEFAULT_ADAPTIVE_FLOW_SAMPLING,
// label = "Adaptive Flow Sampling is on or off")
/** Adaptive Flow Sampling is on or off. */
private boolean adaptiveFlowSampling = ADAPTIVE_FLOW_SAMPLING_DEFAULT;
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";
//@Property(name = "groupPollInterval", intValue = DEFAULT_POLL_INTERVAL,
// label = "Frequency (in seconds) for polling group statistics")
/** Frequency (in seconds) for polling group statistics. */
private int groupPollInterval = POLL_FREQUENCY_DEFAULT;
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;
public static final String LSRID = "lsrId";
//@Property(name = "tunnelStatsPollFrequency", intValue = POLL_INTERVAL,
// label = "Frequency (in seconds) for polling tunnel statistics")
/** Frequency (in seconds) for polling tunnel statistics. */
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.";

View File

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