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;
+}
diff --git a/lib/BUCK b/lib/BUCK
index 6268695..f5a792b 100644
--- a/lib/BUCK
+++ b/lib/BUCK
@@ -1115,6 +1115,15 @@
)
remote_jar (
+ name = 'onos-yang-runtime-api',
+ out = 'onos-yang-runtime-api-1.12-b2.jar',
+ url = 'mvn:org.onosproject:onos-yang-runtime-api:jar:1.12-b2',
+ sha1 = 'e3c540648727b13962a67e4ef09252b1b78511ae',
+ maven_coords = 'org.onosproject:onos-yang-runtime-api:jar:NON-OSGI:1.12-b2',
+ visibility = [ 'PUBLIC' ],
+)
+
+remote_jar (
name = 'snmp-core',
out = 'snmp-core-1.3-20161021.1.jar',
url = 'mvn:org.onosproject:snmp-core:jar:1.3-20161021.1',
diff --git a/lib/deps.json b/lib/deps.json
index 625c4ef..5229b48 100644
--- a/lib/deps.json
+++ b/lib/deps.json
@@ -201,6 +201,7 @@
"uri": "mvn:org.onosproject:org.apache.felix.scr.bnd:1.4.1-SNAPSHOT",
"repo": "https://oss.sonatype.org/content/repositories/snapshots"
},
+ "onos-yang-runtime-api": "mvn:org.onosproject:onos-yang-runtime-api:1.12-b2",
"snmp-core": "mvn:org.onosproject:snmp-core:1.3-20161021.1",
"bti7000": "mvn:org.onosproject:mibbler-mibs-bti7000:1.0-20151221.1",
"mibs-net-snmp": "mvn:org.onosproject:mibbler-mibs-net-snmp:1.0-20151221.1",
diff --git a/modules.defs b/modules.defs
index 08de85d..6fa2961 100644
--- a/modules.defs
+++ b/modules.defs
@@ -177,7 +177,8 @@
'//apps/yms:onos-apps-yms-oar',
'//apps/ofagent:onos-apps-ofagent-oar',
'//apps/mappingmanagement:onos-apps-mappingmanagement-oar',
- '//apps/config:onos-apps-config-oar'
+ '//apps/config:onos-apps-config-oar',
+ '//apps/netconf:onos-apps-netconf-oar'
]