void
NetconfAgent::init(NetconfCfgMgrPtr cfg_mgr) {
- if (NetconfProcess::shut_down || !cfg_mgr) {
+ // If there is no configuration manager and/or we're shutting down.
+ if (!cfg_mgr || NetconfProcess::shut_down) {
return;
}
const CfgServersMapPtr& servers =
void
NetconfAgent::keaConfig(const CfgServersMapPair& service_pair) {
+ // If the boot-update flag is not set.
if (!service_pair.second->getBootUpdate()) {
return;
}
void
NetconfAgent::subscribeConfig(const CfgServersMapPair& service_pair) {
+ // If we're shutting down, or the subscribe-changes flag is not set or
+ // the model associated with it is not specified.
if (NetconfProcess::shut_down ||
!service_pair.second->getSubscribeChanges() ||
service_pair.second->getModel().empty()) {
int
NetconfAgent::validate(S_Session sess, const CfgServersMapPair& service_pair) {
+ // If we're shutting down, or the subscribe-changes or the
+ // validate-changes flag is not set or the model associated with
+ // it is not specified.
if (NetconfProcess::shut_down ||
!service_pair.second->getSubscribeChanges() ||
- !service_pair.second->getValidateChanges()) {
+ !service_pair.second->getValidateChanges() ||
+ service_pair.second->getModel().empty()) {
return (SR_ERR_OK);
}
CfgControlSocketPtr ctrl_sock = service_pair.second->getCfgControlSocket();
NetconfAgent::update(S_Session sess, const CfgServersMapPair& service_pair) {
// Check if we should and can process this update.
if (NetconfProcess::shut_down ||
- !service_pair.second->getSubscribeChanges()) {
+ !service_pair.second->getSubscribeChanges() ||
+ service_pair.second->getModel().empty()) {
return (SR_ERR_OK);
}
CfgControlSocketPtr ctrl_sock = service_pair.second->getCfgControlSocket();
/// @return return code for sysrepo.
static int update(S_Session sess, const CfgServersMapPair& service_pair);
- /// @brief Print changes.
+ /// @brief Log changes.
+ ///
+ /// Iterate on changes logging them. Sysrepo changes are an operation
+ /// (created, modified, deleted or moved) with old and new values
+ /// (cf sr_change_oper_e sysrepo documentation).
///
/// @param sess The sysrepo running datastore session.
/// @param model The model name.
S_Val s_pool2(new Val("2001:db8::2:0/112"));
EXPECT_NO_THROW(sess_->set_item(prefix2.c_str(), s_pool2));
-#if 0
- S_Tree tree = sess_->get_subtree("/ietf-dhcpv6-server:server");
- cerr << "tree:\n" << tree->to_string(100) << "\n";
-#endif
+ // Uncomment this for debugging.
+ // S_Tree tree = sess_->get_subtree("/ietf-dhcpv6-server:server");
+ // cerr << "tree:\n" << tree->to_string(100) << "\n";
// Get the subnet.
ConstElementPtr subnet;
S_Val s_pool2;
EXPECT_NO_THROW(sess_->set_item(prefix2.c_str(), s_pool2));
-#if 0
- S_Tree tree = sess_->get_subtree("/kea-dhcp6-server:config");
- cerr << "tree:\n" << tree->to_string(100) << "\n";
-#endif
+ // Uncomment this for debugging.
+ // S_Tree tree = sess_->get_subtree("/kea-dhcp6-server:config");
+ // cerr << "tree:\n" << tree->to_string(100) << "\n";
// Get the subnet.
ConstElementPtr subnet;