]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[65-libyang-generic] Addressed comments about watcher.h
authorFrancis Dupont <fdupont@isc.org>
Wed, 12 Sep 2018 10:16:47 +0000 (12:16 +0200)
committerFrancis Dupont <fdupont@isc.org>
Wed, 12 Sep 2018 13:38:20 +0000 (15:38 +0200)
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]

diff --git a/src/lib/yang/sysrepo_connection.cc b/src/lib/yang/sysrepo_connection.cc
deleted file mode 100644 (file)
index df8ed3d..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 e4b816e..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() {
-}
-
-string
-Watcher::getXPath() {
-    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 7e86b1e..0000000
+++ /dev/null
@@ -1,59 +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:
-    // Constructor (requires xpath to install a callback)
-    Watcher(SysrepoConnection &connection, const std::string &xpath);
-
-    virtual ~Watcher();
-
-    virtual std::string getXPath();
-
-    // This method will be called when the callback returns.
-    // Need to figure out the type used.
-    void setYangData(void *data);
-
-    // This method translates Netconf data to JSON format
-    // understood by Kea.
-    virtual void translate() = 0;
-
-    // Once setYangData is called,
-    isc::data::ElementPtr getJSON();
-
-protected:
-    std::string xpath_;
-
-    void *netconf_data_;
-
-    isc::data::ElementPtr json_;
-
-    SysrepoConnection &connection_;
-};
-
-typedef boost::shared_ptr<Watcher> WatcherPtr;
-
-}  // namespace isc::yang
-}  // namespace isc
-
-#endif /* ISC_WATCHER_H */