Removing commented out @Property annotations from the drivers, protocols, pipelines and providers.
Change-Id: I4cabc5a53c93b778824c72cebbce0ec49700eade
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";
+}