Commit 02fccca9 authored by Francis Dupont's avatar Francis Dupont
Browse files

[153-netconf-agent] Addressed more comments

parent fa842323
......@@ -109,7 +109,8 @@ NetconfAgent::~NetconfAgent() {
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 =
......@@ -165,6 +166,7 @@ NetconfAgent::clear() {
void
NetconfAgent::keaConfig(const CfgServersMapPair& service_pair) {
// If the boot-update flag is not set.
if (!service_pair.second->getBootUpdate()) {
return;
}
......@@ -331,6 +333,8 @@ NetconfAgent::yangConfig(const CfgServersMapPair& service_pair) {
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()) {
......@@ -365,9 +369,13 @@ NetconfAgent::subscribeConfig(const CfgServersMapPair& service_pair) {
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();
......@@ -447,7 +455,8 @@ int
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();
......
......@@ -82,7 +82,11 @@ public:
/// @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.
......
......@@ -148,10 +148,9 @@ TEST_F(TranslatorSubnetsTest, getPoolsIetf) {
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;
......@@ -206,10 +205,9 @@ TEST_F(TranslatorSubnetsTest, getPoolsKea) {
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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment