summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomek Mrugalski <tomasz@isc.org>2018-09-12 12:05:19 +0200
committerFrancis Dupont <fdupont@isc.org>2018-09-12 15:37:38 +0200
commit0b85236cacf738d5dede638f715d087dbd44eafe (patch)
treebcff4bbd4f9d0494d337f9667442c3467b6cc65b
parent[#65,!18] Docs updated. (diff)
downloadkea-0b85236cacf738d5dede638f715d087dbd44eafe.tar.xz
kea-0b85236cacf738d5dede638f715d087dbd44eafe.zip
[#65,!18] Minor changes after review.
# Conflicts: # src/lib/yang/sysrepo_connection.cc # src/lib/yang/sysrepo_connection.h
-rw-r--r--src/lib/yang/sysrepo_connection.cc2
-rw-r--r--src/lib/yang/sysrepo_connection.h20
-rw-r--r--src/lib/yang/translator.cc4
-rw-r--r--src/lib/yang/translator.h4
4 files changed, 19 insertions, 11 deletions
diff --git a/src/lib/yang/sysrepo_connection.cc b/src/lib/yang/sysrepo_connection.cc
index d3ffd4613a..df8ed3dee8 100644
--- a/src/lib/yang/sysrepo_connection.cc
+++ b/src/lib/yang/sysrepo_connection.cc
@@ -18,7 +18,7 @@ SysrepoConnection::~SysrepoConnection() {
session_->unlock_datastore();
session_->session_stop();
- // @todo: how to call disconnect?
+ /// @todo: how to call disconnect?
}
}
diff --git a/src/lib/yang/sysrepo_connection.h b/src/lib/yang/sysrepo_connection.h
index b17e99e7bc..2ed211125c 100644
--- a/src/lib/yang/sysrepo_connection.h
+++ b/src/lib/yang/sysrepo_connection.h
@@ -13,30 +13,38 @@
namespace isc {
namespace yang {
-/// @brief Exception from the sysrepo library for connection.
+/// @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 Connection to the sysrepo library. Provision, i.e. currently unused.
+/// @brief A class that represents a connection to Sysrepo
class SysrepoConnection {
public:
- // @brief Constructor.
+
+ /// @brief constructor
+ ///
+ /// Currently does nothing. You need to explicitly call connect()
SysrepoConnection();
- // @brief Destructor.
+ /// @brief Destructor
+ ///
+ /// Discards any pending data, unlocks datastore and stops session.
virtual ~SysrepoConnection();
// @brief Get a connection and a session.
void connect();
- // @brief Commit a session.
+ /// @brief Commits any pending data.
void commit();
private:
- // @brief The session.
+
+ /// @brief pointer to a session
+ ///
+ /// May be null if the session is not established.
S_Session session_;
};
diff --git a/src/lib/yang/translator.cc b/src/lib/yang/translator.cc
index 1613bba019..082adbd280 100644
--- a/src/lib/yang/translator.cc
+++ b/src/lib/yang/translator.cc
@@ -63,6 +63,7 @@ TranslatorBasic::value(S_Val s_val) {
case SR_UINT8_T:
return (Element::create(static_cast<long long>(s_val->data()->get_uint8())));
+
case SR_UINT16_T:
return (Element::create(static_cast<long long>(s_val->data()->get_uint16())));
@@ -99,8 +100,7 @@ TranslatorBasic::getItem(const string& xpath) {
try {
s_val = session_->get_item(xpath.c_str());
} catch (const sysrepo_exception& ex) {
- isc_throw(SysrepoError,
- "sysrepo error getting item at '" << xpath
+ isc_throw(SysrepoError, "sysrepo error getting item at '" << xpath
<< "': " << ex.what());
}
if (!s_val) {
diff --git a/src/lib/yang/translator.h b/src/lib/yang/translator.h
index d1c8449e90..a72124a841 100644
--- a/src/lib/yang/translator.h
+++ b/src/lib/yang/translator.h
@@ -84,8 +84,8 @@ public:
/// @brief Get xpath of the next Yang list item.
///
- /// @param iter The iterator.
- /// @return The xpath of the next element. Null when at the end of the list.
+ /// @param iter The iterator pointing to the previous element
+ /// @return The xpath of the next element. Empty string when at the end of the list.
std::string getNext(S_Iter_Value iter);
protected: