Adding interfaces for Netconf SB yang adapter
ONOS-6018
Change-Id: I91fe255b1f82666116c0901fe602c93f14fe33ca
diff --git a/apps/netconf/BUCK b/apps/netconf/BUCK
new file mode 100644
index 0000000..c619118
--- /dev/null
+++ b/apps/netconf/BUCK
@@ -0,0 +1,14 @@
+BUNDLES = [
+ '//apps/netconf/client:onos-apps-netconf-client',
+]
+
+onos_app (
+ app_name = 'org.onosproject.netconf',
+ title = 'NETCONF Application Module',
+ category = 'Utility',
+ url = 'http://onosproject.org',
+ description = """This application provides an interface for monitoring and modifying datastores
+ of NETCONF devices using Yang data. It uses the YangRuntime to serialize outbound
+ messages from Yang into NETCONF and deserialize received messages.""",
+ included_bundles = BUNDLES,
+)
diff --git a/apps/netconf/client/BUCK b/apps/netconf/client/BUCK
new file mode 100644
index 0000000..9db9512
--- /dev/null
+++ b/apps/netconf/client/BUCK
@@ -0,0 +1,9 @@
+COMPILE_DEPS = [
+ '//lib:CORE_DEPS',
+ '//lib:onos-yang-runtime-api',
+ '//protocols/netconf/api:onos-protocols-netconf-api'
+]
+
+osgi_jar_with_tests (
+ deps = COMPILE_DEPS,
+)
\ No newline at end of file
diff --git a/apps/netconf/client/src/main/java/org/onosproject/netconf/client/api/NetconfTranslator.java b/apps/netconf/client/src/main/java/org/onosproject/netconf/client/api/NetconfTranslator.java
new file mode 100644
index 0000000..7706896
--- /dev/null
+++ b/apps/netconf/client/src/main/java/org/onosproject/netconf/client/api/NetconfTranslator.java
@@ -0,0 +1,75 @@
+/*
+ * 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.client.api;
+
+import org.onosproject.net.DeviceId;
+import org.onosproject.yang.runtime.api.CompositeData;
+import com.google.common.annotations.Beta;
+
+import java.io.IOException;
+
+/**
+ * Interface for making some standard calls to NETCONF devices with
+ * serialization performed according the appropriate device's YANG model.
+ */
+@Beta
+public interface NetconfTranslator {
+ /**
+ * Retrieves and returns the configuration of the specified device in the scope
+ * specified by the filter provided by the supplied {@link CompositeData}.
+ *
+ * @param deviceId the deviceID of the device to be contacted
+ * @return a {@link CompositeData} containing the requested configuration
+ * @throws IOException if serialization fails or the netconf subsystem is
+ * unable to handle the request
+ */
+ /*FIXME note in the comments I believe that the composite data should
+ provide the filter but I am unsure what data the yang runtime will provide */
+ /*TODO a future version of this API will support an optional filter type.*/
+ CompositeData getDeviceConfig(DeviceId deviceId) throws IOException;
+
+
+ /**
+ * Adds to, overwrites, or deletes the selected device's configuration in the scope
+ * and manner specified by the CompositeData.
+ *
+ * @param deviceId the deviceID fo the device to be contacted
+ * @param compositeData the representation of the configuration to be pushed
+ * to the device via NETCONF as well as the filter to
+ * be used.
+ * @return a boolean, true if the operation succeeded, false otherwise
+ * @throws IOException if serialization fails or the netconf subsystem is
+ * unable to handle the request
+ */
+ boolean editDeviceConfig(DeviceId deviceId, CompositeData compositeData) throws IOException;
+
+ /* FIXME eventually expose the copy, delete, lock and unlock netconf methods */
+
+ /**
+ * Returns the configuration and running statistics from the specified device
+ * in the scope specified by the filter provided by the {@link CompositeData}.
+ *
+ * @param deviceId the deviceID of the device to be contacted.
+ * @return a {@link CompositeData} containing the requested configuration
+ * and statistics
+ * @throws IOException if serialization fails or the netconf subsystem is
+ * unable to handle the request
+ */
+ /*TODO a future version of this API will support an optional filter type.*/
+
+ CompositeData getDeviceState(DeviceId deviceId) throws IOException;
+}