ONOS-5937

 - created enum for target config and replaced all appropiate usages
 - added old methods and had them pointing to new implementation
 - added deprecated annotation to old methods

Change-Id: I2562588d32c7ab944eb44a13e9b25a342196edf2
diff --git a/protocols/netconf/api/src/main/java/org/onosproject/netconf/NetconfSession.java b/protocols/netconf/api/src/main/java/org/onosproject/netconf/NetconfSession.java
index 172d53c..e2d435d 100644
--- a/protocols/netconf/api/src/main/java/org/onosproject/netconf/NetconfSession.java
+++ b/protocols/netconf/api/src/main/java/org/onosproject/netconf/NetconfSession.java
@@ -17,6 +17,7 @@
 package org.onosproject.netconf;
 
 import com.google.common.annotations.Beta;
+
 import java.util.List;
 import java.util.concurrent.CompletableFuture;
 
@@ -88,26 +89,57 @@
     /**
      * Retrives the specified configuration.
      *
-     * @param targetConfiguration the type of configuration to retrieve.
+     * @param netconfTargetConfig the type of configuration to retrieve.
      * @return specified configuration.
      * @throws NetconfException when there is a problem in the communication process on
      * the underlying connection
      */
-    String getConfig(String targetConfiguration) throws NetconfException;
+    String getConfig(TargetConfig netconfTargetConfig) throws NetconfException;
+
+    /**
+     * Retrives the specified configuration.
+     *
+     * @param netconfTargetConfig the type of configuration to retrieve.
+     * @return specified configuration.
+     * @throws NetconfException when there is a problem in the communication process on
+     * the underlying connection
+     * @deprecated - 1.10.0 Kingfisher use method overload that accepts
+     * org.onosproject.netconf.TargetConfig enum parameter instead
+     */
+    @Deprecated
+    String getConfig(String netconfTargetConfig) throws NetconfException;
+
 
     /**
      * Retrives part of the specivied configuration based on the filterSchema.
      *
-     * @param targetConfiguration       the type of configuration to retrieve.
+     * @param netconfTargetConfig       the type of configuration to retrieve.
+     * @param configurationFilterSchema XML schema to filter the configuration
+     *                                  elements we are interested in
+     * @return device running configuration.
+     * @throws NetconfException when there is a problem in the communication process on
+     * the underlying connection
+     * @deprecated - 1.10.0 Kingfisher use method overload that accepts
+     * org.onosproject.netconf.TargetConfig enum parameter instead
+     */
+    @Deprecated
+    String getConfig(String netconfTargetConfig, String configurationFilterSchema)
+            throws NetconfException;
+
+    /**
+     * Retrives part of the specivied configuration based on the filterSchema.
+     *
+     * @param netconfTargetConfig       the type of configuration to retrieve.
      * @param configurationFilterSchema XML schema to filter the configuration
      *                                  elements we are interested in
      * @return device running configuration.
      * @throws NetconfException when there is a problem in the communication process on
      * the underlying connection
      */
-    String getConfig(String targetConfiguration, String configurationFilterSchema)
+    String getConfig(TargetConfig netconfTargetConfig, String configurationFilterSchema)
             throws NetconfException;
 
+
     /**
      * Retrives part of the specified configuration based on the filterSchema.
      *
@@ -122,14 +154,30 @@
     /**
      * Retrives part of the specified configuration based on the filterSchema.
      *
-     * @param targetConfiguration the targetConfiguration to change
+     * @param netconfTargetConfig the targetConfiguration to change
+     * @param mode                selected mode to change the configuration
+     * @param newConfiguration    configuration to set
+     * @return true if the configuration was edited correctly
+     * @throws NetconfException when there is a problem in the communication process on
+     * the underlying connection
+     * @deprecated - 1.10.0 Kingfisher use method overload that accepts
+     * org.onosproject.netconf.TargetConfig enum parameter instead
+     */
+    @Deprecated
+    boolean editConfig(String netconfTargetConfig, String mode, String newConfiguration)
+            throws NetconfException;
+
+    /**
+     * Retrives part of the specified configuration based on the filterSchema.
+     *
+     * @param netconfTargetConfig the targetConfiguration to change
      * @param mode                selected mode to change the configuration
      * @param newConfiguration    configuration to set
      * @return true if the configuration was edited correctly
      * @throws NetconfException when there is a problem in the communication process on
      * the underlying connection
      */
-    boolean editConfig(String targetConfiguration, String mode, String newConfiguration)
+    boolean editConfig(TargetConfig netconfTargetConfig, String mode, String newConfiguration)
             throws NetconfException;
 
     /**
@@ -137,24 +185,54 @@
      * to the target configuration.
      * The target configuration can't be the running one
      *
-     * @param targetConfiguration the type of configuration to retrieve.
+     * @param netconfTargetConfig the type of configuration to retrieve.
+     * @param newConfiguration    configuration to set
+     * @return true if the configuration was copied correctly
+     * @throws NetconfException when there is a problem in the communication process on
+     * the underlying connection
+     * @deprecated - 1.10.0 Kingfisher use method overload that accepts
+     * org.onosproject.netconf.TargetConfig enum parameter instead
+     */
+    @Deprecated
+    boolean copyConfig(String netconfTargetConfig, String newConfiguration)
+            throws NetconfException;
+
+    /**
+     * Copies the new configuration, an Url or a complete configuration xml tree
+     * to the target configuration.
+     * The target configuration can't be the running one
+     *
+     * @param netconfTargetConfig the type of configuration to retrieve.
      * @param newConfiguration    configuration to set
      * @return true if the configuration was copied correctly
      * @throws NetconfException when there is a problem in the communication process on
      * the underlying connection
      */
-    boolean copyConfig(String targetConfiguration, String newConfiguration)
+    boolean copyConfig(TargetConfig netconfTargetConfig, String newConfiguration)
             throws NetconfException;
 
     /**
      * Deletes part of the specified configuration based on the filterSchema.
      *
-     * @param targetConfiguration the name of the configuration to delete
+     * @param netconfTargetConfig the name of the configuration to delete
+     * @return true if the configuration was copied correctly
+     * @throws NetconfException when there is a problem in the communication process on
+     * the underlying connection
+     * @deprecated - 1.10.0 Kingfisher use method overload that accepts
+     * org.onosproject.netconf.TargetConfig enum parameter instead
+     */
+    @Deprecated
+    boolean deleteConfig(String netconfTargetConfig) throws NetconfException;
+
+    /**
+     * Deletes part of the specified configuration based on the filterSchema.
+     *
+     * @param netconfTargetConfig the name of the configuration to delete
      * @return true if the configuration was copied correctly
      * @throws NetconfException when there is a problem in the communication process on
      * the underlying connection
      */
-    boolean deleteConfig(String targetConfiguration) throws NetconfException;
+    boolean deleteConfig(TargetConfig netconfTargetConfig) throws NetconfException;
 
     /**
      * Starts subscription to the device's notifications.
diff --git a/protocols/netconf/api/src/main/java/org/onosproject/netconf/TargetConfig.java b/protocols/netconf/api/src/main/java/org/onosproject/netconf/TargetConfig.java
new file mode 100644
index 0000000..ecc924c
--- /dev/null
+++ b/protocols/netconf/api/src/main/java/org/onosproject/netconf/TargetConfig.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * 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;
+
+public enum TargetConfig {
+    RUNNING("running"),
+    CANDIDATE("candidate"),
+    STARTUP("startup");
+
+    private String name;
+
+    TargetConfig(String name) {
+        this.name = name;
+    }
+
+    TargetConfig toTargetConfig(String targetConfig) {
+        switch (targetConfig) {
+            case "running":
+                return RUNNING;
+            case "candidate":
+                return CANDIDATE;
+            case "startup":
+                return STARTUP;
+            default:
+                return null;
+        }
+    }
+
+    @Override
+    public String toString() {
+        return this.name;
+    }
+}