Implement OSGi properties for openflow protocol

Change-Id: I1abee2716909c8d102fcfd53f10515d7e0439a9f
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 3e9b802b..b3942a8 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
@@ -91,13 +91,23 @@
 import java.util.concurrent.locks.ReentrantLock;
 
 import static org.onlab.util.Tools.groupedThreads;
+import static org.onosproject.openflow.controller.impl.OsgiPropertyConstants.*;
 
-
-@Component(immediate = true, service = OpenFlowController.class)
+@Component(
+        immediate = true,
+        service = OpenFlowController.class,
+        property = {
+                OFPORTS + "=" + OFPORTS_DEFAULT,
+                WORKER_THREADS + "=" + WORKER_THREADS_DEFAULT,
+                TLS_MODE + "=" + TLS_MODE_DEFAULT,
+                KEY_STORE + "=" + KEY_STORE_DEFAULT,
+                KEY_STORE_PASSWORD + "=" + KEY_STORE_PASSWORD_DEFAULT,
+                TRUST_STORE + "=" + TRUST_STORE_DEFAULT,
+                TRUST_STORE_PASSWORD + "=" + TRUST_STORE_PASSWORD_DEFAULT,
+        }
+)
 public class OpenFlowControllerImpl implements OpenFlowController {
     private static final String APP_ID = "org.onosproject.openflow-base";
-    private static final String DEFAULT_OFPORT = "6633,6653";
-    private static final int DEFAULT_WORKER_THREADS = 0;
     protected static final String SCHEME = "of";
 
     private static final Logger log =
@@ -117,31 +127,31 @@
 
     //@Property(name = "openflowPorts", value = DEFAULT_OFPORT,
     //        label = "Port numbers (comma separated) used by OpenFlow protocol; default is 6633,6653")
-    private String openflowPorts = DEFAULT_OFPORT;
+    //private String openflowPortsValue = OFPORTS_DEFAULT;
 
     //@Property(name = "workerThreads", intValue = DEFAULT_WORKER_THREADS,
     //        label = "Number of controller worker threads")
-    private int workerThreads = DEFAULT_WORKER_THREADS;
+    //private int workerThreads = DEFAULT_WORKER_THREADS;
 
     //@Property(name = "tlsMode", value = "",
     //          label = "TLS mode for OpenFlow channel; options are: disabled [default], enabled, strict")
-    private String tlsModeString;
+    //private String tlsModeString;
 
     //@Property(name = "keyStore", value = "",
     //        label = "File path to key store for TLS connections")
-    private String keyStore;
+    //private String keyStore;
 
     //@Property(name = "keyStorePassword", value = "",
     //        label = "Key store password")
-    private String keyStorePassword;
+    //private String keyStorePassword;
 
     //@Property(name = "trustStore", value = "",
     //        label = "File path to trust store for TLS connections")
-    private String trustStore;
+    //private String trustStore;
 
     //@Property(name = "trustStorePassword", value = "",
     //        label = "Trust store password")
-    private String trustStorePassword;
+    //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
new file mode 100644
index 0000000..8562686
--- /dev/null
+++ b/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OsgiPropertyConstants.java
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+
+/**
+ * Name/Value constants for properties.
+ */
+package org.onosproject.openflow.controller.impl;
+
+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:Integer";
+    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 = "";
+
+}