]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[65-libyang-generic] Removed sysrepo_connection and watcher files
authorFrancis Dupont <fdupont@isc.org>
Wed, 12 Sep 2018 13:23:44 +0000 (15:23 +0200)
committerFrancis Dupont <fdupont@isc.org>
Wed, 12 Sep 2018 13:23:44 +0000 (15:23 +0200)
src/lib/yang/Makefile.am
src/lib/yang/sysrepo_connection.cc [deleted file]
src/lib/yang/sysrepo_connection.h [deleted file]
src/lib/yang/watcher.cc [deleted file]
src/lib/yang/watcher.h [deleted file]

index 0e5df09505504138e748d76d8e6ee753d8a83f06..01b3a633afbfb8df9ff014a2abcdd6323c8c2823 100644 (file)
@@ -6,9 +6,7 @@ AM_CXXFLAGS = $(KEA_CXXFLAGS)
 
 lib_LTLIBRARIES = libkea-yang.la
 libkea_yang_la_SOURCES = sysrepo_error.h
-libkea_yang_la_SOURCES += sysrepo_connection.cc sysrepo_connection.h
 libkea_yang_la_SOURCES += translator.cc translator.h
-libkea_yang_la_SOURCES += watcher.cc watcher.h
 
 libkea_yang_la_LIBADD =  $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
 libkea_yang_la_LIBADD += $(top_builddir)/src/lib/cc/libkea-cc.la
@@ -23,10 +21,8 @@ libkea_yang_la_LDFLAGS = -no-undefined -version-info 0:0:0
 # Specify the headers for copying into the installation directory tree.
 libkea_yang_includedir = $(pkgincludedir)/yang
 libkea_yang_include_HEADERS = \
-       sysrepo_connection.h \
        sysrepo_error.h \
-       translator.h \
-       watcher.h
+       translator.h
 
 EXTRA_DIST = yang.dox
 
diff --git a/src/lib/yang/sysrepo_connection.cc b/src/lib/yang/sysrepo_connection.cc
deleted file mode 100644 (file)
index bfb3eb8..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
-//
-// This Source Code Form is subject to the terms of the Mozilla Public
-// License, v. 2.0. If a copy of the MPL was not distributed with this
-// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-#include <yang/sysrepo_connection.h>
-
-namespace isc {
-namespace yang {
-
-SysrepoConnection::SysrepoConnection() {
-}
-
-SysrepoConnection::~SysrepoConnection() {
-    if (session_) {
-        session_->discard_changes();
-        session_->unlock_datastore();
-        session_->session_stop();
-
-        /// @todo: how to call disconnect?
-    }
-}
-
-void
-SysrepoConnection::connect() {
-
-    // Get a connection.
-    S_Connection conn(new Connection("kea-netconf"));
-    // Get a session.
-    session_.reset(new Session(conn, SR_DS_CANDIDATE));
-    // Get a from yang object.
-}
-
-void
-SysrepoConnection::commit() {
-    if (!session_) {
-        isc_throw(SysrepoConnectionError, "session not established");
-    }
-    session_->commit();
-}
-
-}
-}
diff --git a/src/lib/yang/sysrepo_connection.h b/src/lib/yang/sysrepo_connection.h
deleted file mode 100644 (file)
index 2ed2111..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
-//
-// This Source Code Form is subject to the terms of the Mozilla Public
-// License, v. 2.0. If a copy of the MPL was not distributed with this
-// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-#ifndef NETCONF_CONNECTION_H
-#define NETCONF_CONNECTION_H
-
-#include <exceptions/exceptions.h>
-#include <sysrepo-cpp/Session.h>
-
-namespace isc {
-namespace yang {
-
-/// @brief An exception thrown when connection with sysrepo is broken
-class SysrepoConnectionError : public Exception {
-public:
-    SysrepoConnectionError(const char* file, size_t line, const char* what) :
-        isc::Exception(file, line, what) {}
-};
-
-/// @brief A class that represents a connection to Sysrepo
-class SysrepoConnection {
-public:
-
-    /// @brief constructor
-    ///
-    /// Currently does nothing. You need to explicitly call connect()
-    SysrepoConnection();
-
-    /// @brief Destructor
-    ///
-    /// Discards any pending data, unlocks datastore and stops session.
-    virtual ~SysrepoConnection();
-
-    // @brief Get a connection and a session.
-    void connect();
-
-    /// @brief Commits any pending data.
-    void commit();
-
- private:
-
-    /// @brief pointer to a session
-    ///
-    /// May be null if the session is not established.
-    S_Session session_;
-};
-
-}  // sysrepo
-}  // isc
-
-#endif /* NETCONF_CONNECTION_H_ */
diff --git a/src/lib/yang/watcher.cc b/src/lib/yang/watcher.cc
deleted file mode 100644 (file)
index 4c96a39..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
-//
-// This Source Code Form is subject to the terms of the Mozilla Public
-// License, v. 2.0. If a copy of the MPL was not distributed with this
-// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-#include <config.h>
-
-#include <yang/watcher.h>
-
-using namespace std;
-using namespace isc::data;
-
-namespace isc {
-namespace yang {
-
-Watcher::Watcher(SysrepoConnection &connection, const string &xpath)
-    : xpath_(xpath), netconf_data_(0), connection_(connection) {
-};
-
-Watcher::~Watcher() {
-}
-
-const string&
-Watcher::getXPath() const {
-    return (xpath_);
-}
-
-ElementPtr
-Watcher::getJSON() {
-    return (json_);
-}
-
-}  // namespace netconf
-}  // namespace isc
diff --git a/src/lib/yang/watcher.h b/src/lib/yang/watcher.h
deleted file mode 100644 (file)
index 7320475..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
-//
-// This Source Code Form is subject to the terms of the Mozilla Public
-// License, v. 2.0. If a copy of the MPL was not distributed with this
-// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-#ifndef ISC_WATCHER_H
-#define ISC_WATCHER_H
-
-#include <config.h>
-
-#include <boost/shared_ptr.hpp>
-#include <cc/data.h>
-#include <yang/sysrepo_connection.h>
-
-namespace isc {
-namespace yang {
-
-/// @brief This represents a base class for all watchers.
-///
-/// Isc_Watcher is an object that receives callback notification
-/// from sysrepo (in YANG format) and converts it to appropriate
-/// JSON that can be sent over control channel and understood by Kea.
-class Watcher {
-public:
-    // @brief Constructor (requires xpath to install a callback).
-    //
-    // @param connection The sysrepo connection.
-    // @param xpath The xpath to watch to.
-    Watcher(SysrepoConnection& connection, const std::string& xpath);
-
-    // @brief Destructor (doing nothing).
-    virtual ~Watcher();
-
-    // @brief Get the xpath.
-    // @return The xpath to watch to.
-    virtual const std::string& getXPath() const;
-
-    // This method will be called when the callback returns.
-    // Need to figure out the type used.
-    //
-    // @param data The yang data.
-    void setYangData(void* data);
-
-    // @brief This method translates Netconf data to JSON format
-    // understood by Kea.
-    virtual void translate() = 0;
-
-    // @brief Get JSON once setYangData is called,
-    // @return The JSON representation of the yang data.
-    isc::data::ElementPtr getJSON();
-
-protected:
-    // @brief The xpath to watch to.
-    const std::string& xpath_;
-
-    // @brief The yang data.
-    void* netconf_data_;
-
-    // @brief The JSON representation of the yang data.
-    isc::data::ElementPtr json_;
-
-    // @brief The sysrepo connection.
-    SysrepoConnection &connection_;
-};
-
-/// @brief The type of shared pointers to watcher objects.
-typedef boost::shared_ptr<Watcher> WatcherPtr;
-
-}  // namespace isc::yang
-}  // namespace isc
-
-#endif /* ISC_WATCHER_H */