Include presence containers in NetconfAccess::getItems
This patch also changes how the datastore test works a little bit. Empty
strings are a good indicator of "nothing". In case of presence
containers, an empty string means that it is present, so I make use of
boost::optional to represent "nothing".
Change-Id: I820d517a21f6ee7457f698ea49ae2e6eb5a7d2de
diff --git a/tests/mock/sysrepo_subscription.cpp b/tests/mock/sysrepo_subscription.cpp
index 801ec1c..7cd5cf3 100644
--- a/tests/mock/sysrepo_subscription.cpp
+++ b/tests/mock/sysrepo_subscription.cpp
@@ -28,9 +28,11 @@
return SR_ERR_OK;
while (auto change = sess->get_change_next(it)) {
- m_recorder->write(change->new_val()->xpath(),
- change->old_val() ? change->old_val()->val_to_string() : "",
- change->new_val()->val_to_string());
+ auto xpath = (change->new_val() ? change->new_val() : change->old_val())->xpath();
+
+ auto oldValue = change->old_val() ? std::optional{change->old_val()->val_to_string()} : std::nullopt;
+ auto newValue = change->new_val() ? std::optional{change->new_val()->val_to_string()} : std::nullopt;
+ m_recorder->write(xpath, oldValue, newValue);
}
return SR_ERR_OK;