Removing commented out @Property annotations from the drivers, protocols, pipelines and providers.
Change-Id: I4cabc5a53c93b778824c72cebbce0ec49700eade
diff --git a/protocols/grpc/ctl/src/main/java/org/onosproject/grpc/ctl/GrpcControllerImpl.java b/protocols/grpc/ctl/src/main/java/org/onosproject/grpc/ctl/GrpcControllerImpl.java
index 232885c..7d038ce 100644
--- a/protocols/grpc/ctl/src/main/java/org/onosproject/grpc/ctl/GrpcControllerImpl.java
+++ b/protocols/grpc/ctl/src/main/java/org/onosproject/grpc/ctl/GrpcControllerImpl.java
@@ -60,11 +60,16 @@
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 @@
// 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 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");
}
diff --git a/protocols/grpc/ctl/src/main/java/org/onosproject/grpc/ctl/OsgiPropertyConstants.java b/protocols/grpc/ctl/src/main/java/org/onosproject/grpc/ctl/OsgiPropertyConstants.java
new file mode 100644
index 0000000..576d1da
--- /dev/null
+++ b/protocols/grpc/ctl/src/main/java/org/onosproject/grpc/ctl/OsgiPropertyConstants.java
@@ -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;
+
+}
diff --git a/protocols/lisp/ctl/src/main/java/org/onosproject/lisp/ctl/impl/LispControllerImpl.java b/protocols/lisp/ctl/src/main/java/org/onosproject/lisp/ctl/impl/LispControllerImpl.java
index 779e6c2..9fd5200 100644
--- a/protocols/lisp/ctl/src/main/java/org/onosproject/lisp/ctl/impl/LispControllerImpl.java
+++ b/protocols/lisp/ctl/src/main/java/org/onosproject/lisp/ctl/impl/LispControllerImpl.java
@@ -51,42 +51,45 @@
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 @@
* @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 @@
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 @@
}
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 @@
@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 @@
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 @@
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 @@
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 @@
* 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 @@
* 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);
}
}
diff --git a/protocols/lisp/ctl/src/main/java/org/onosproject/lisp/ctl/impl/OsgiPropertyConstants.java b/protocols/lisp/ctl/src/main/java/org/onosproject/lisp/ctl/impl/OsgiPropertyConstants.java
new file mode 100644
index 0000000..9295734
--- /dev/null
+++ b/protocols/lisp/ctl/src/main/java/org/onosproject/lisp/ctl/impl/OsgiPropertyConstants.java
@@ -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;
+
+}
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfControllerImpl.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfControllerImpl.java
index e18714c..0395dee 100644
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfControllerImpl.java
+++ b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfControllerImpl.java
@@ -61,39 +61,33 @@
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 @@
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 @@
@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 @@
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 @@
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);
}
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/OsgiPropertyConstants.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/OsgiPropertyConstants.java
new file mode 100644
index 0000000..6fcdcfd
--- /dev/null
+++ b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/OsgiPropertyConstants.java
@@ -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";
+}
diff --git a/protocols/netconf/ctl/src/test/java/org/onosproject/netconf/ctl/impl/NetconfControllerImplTest.java b/protocols/netconf/ctl/src/test/java/org/onosproject/netconf/ctl/impl/NetconfControllerImplTest.java
index 459559c..44011f1 100644
--- a/protocols/netconf/ctl/src/test/java/org/onosproject/netconf/ctl/impl/NetconfControllerImplTest.java
+++ b/protocols/netconf/ctl/src/test/java/org/onosproject/netconf/ctl/impl/NetconfControllerImplTest.java
@@ -58,6 +58,9 @@
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 @@
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 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;
}
/**
diff --git a/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OpenFlowControllerImpl.java b/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OpenFlowControllerImpl.java
index e3d16da..2d5213d 100644
--- a/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OpenFlowControllerImpl.java
+++ b/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OpenFlowControllerImpl.java
@@ -125,33 +125,26 @@
@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));
diff --git a/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OsgiPropertyConstants.java b/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OsgiPropertyConstants.java
index 186b85e..a152239 100644
--- a/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OsgiPropertyConstants.java
+++ b/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OsgiPropertyConstants.java
@@ -25,38 +25,24 @@
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 = "";
diff --git a/protocols/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbConstant.java b/protocols/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbConstant.java
index ddd93eb..ee13e4c 100644
--- a/protocols/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbConstant.java
+++ b/protocols/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbConstant.java
@@ -127,9 +127,4 @@
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";
}
diff --git a/protocols/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/OsgiPropertyConstants.java b/protocols/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/OsgiPropertyConstants.java
new file mode 100644
index 0000000..44630c9
--- /dev/null
+++ b/protocols/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/OsgiPropertyConstants.java
@@ -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";
+
+}
diff --git a/protocols/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/OvsdbControllerImpl.java b/protocols/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/OvsdbControllerImpl.java
index dde2416..428a411 100644
--- a/protocols/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/OvsdbControllerImpl.java
+++ b/protocols/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/OvsdbControllerImpl.java
@@ -81,16 +81,21 @@
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 @@
@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 @@
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 @@
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;
diff --git a/protocols/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/TlsParams.java b/protocols/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/TlsParams.java
index dfe7fa9..f71f8fa 100644
--- a/protocols/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/TlsParams.java
+++ b/protocols/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/TlsParams.java
@@ -29,8 +29,7 @@
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 @@
*/
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);
}
diff --git a/protocols/xmpp/core/ctl/src/main/java/org/onosproject/xmpp/core/ctl/OsgiPropertyConstants.java b/protocols/xmpp/core/ctl/src/main/java/org/onosproject/xmpp/core/ctl/OsgiPropertyConstants.java
new file mode 100644
index 0000000..24a3b7c
--- /dev/null
+++ b/protocols/xmpp/core/ctl/src/main/java/org/onosproject/xmpp/core/ctl/OsgiPropertyConstants.java
@@ -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";
+
+}
diff --git a/protocols/xmpp/core/ctl/src/main/java/org/onosproject/xmpp/core/ctl/XmppControllerImpl.java b/protocols/xmpp/core/ctl/src/main/java/org/onosproject/xmpp/core/ctl/XmppControllerImpl.java
index 178018a..da42c1c 100644
--- a/protocols/xmpp/core/ctl/src/main/java/org/onosproject/xmpp/core/ctl/XmppControllerImpl.java
+++ b/protocols/xmpp/core/ctl/src/main/java/org/onosproject/xmpp/core/ctl/XmppControllerImpl.java
@@ -49,6 +49,9 @@
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 @@
* 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 @@
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>();
diff --git a/protocols/xmpp/core/ctl/src/main/java/org/onosproject/xmpp/core/ctl/XmppServer.java b/protocols/xmpp/core/ctl/src/main/java/org/onosproject/xmpp/core/ctl/XmppServer.java
index 2bc96fd..0970d82 100644
--- a/protocols/xmpp/core/ctl/src/main/java/org/onosproject/xmpp/core/ctl/XmppServer.java
+++ b/protocols/xmpp/core/ctl/src/main/java/org/onosproject/xmpp/core/ctl/XmppServer.java
@@ -35,6 +35,7 @@
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 @@
* @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);
}