2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-09-01 22:45:18 +00:00

[153-netconf-agent] Updates (include !94)

This commit is contained in:
Francis Dupont
2018-10-23 20:08:37 +02:00
parent 8245b37bb9
commit d44211257a
2 changed files with 18 additions and 6 deletions

View File

@@ -106,6 +106,9 @@ NetconfAgent::~NetconfAgent() {
void void
NetconfAgent::init(NetconfCfgMgrPtr cfg_mgr) { NetconfAgent::init(NetconfCfgMgrPtr cfg_mgr) {
if (NetconfProcess::global_shut_down_flag) {
return;
}
const CfgServersMapPtr& servers = const CfgServersMapPtr& servers =
cfg_mgr->getNetconfConfig()->getCfgServersMap(); cfg_mgr->getNetconfConfig()->getCfgServersMap();
for (auto pair : *servers) { for (auto pair : *servers) {
@@ -113,11 +116,17 @@ NetconfAgent::init(NetconfCfgMgrPtr cfg_mgr) {
return; return;
} }
keaConfig(pair); keaConfig(pair);
if (NetconfProcess::global_shut_down_flag) {
return;
}
} }
if (NetconfProcess::global_shut_down_flag) { if (NetconfProcess::global_shut_down_flag) {
return; return;
} }
initSysrepo(); initSysrepo();
if (NetconfProcess::global_shut_down_flag) {
return;
}
for (auto pair : *servers) { for (auto pair : *servers) {
if (NetconfProcess::global_shut_down_flag) { if (NetconfProcess::global_shut_down_flag) {
return; return;
@@ -127,6 +136,9 @@ NetconfAgent::init(NetconfCfgMgrPtr cfg_mgr) {
return; return;
} }
subscribe(pair); subscribe(pair);
if (NetconfProcess::global_shut_down_flag) {
return;
}
} }
} }

View File

@@ -144,12 +144,12 @@ public:
/// @brief Destructor. /// @brief Destructor.
virtual ~NetconfAgentTest() { virtual ~NetconfAgentTest() {
NetconfProcess::global_shut_down_flag = true; NetconfProcess::global_shut_down_flag = true;
io_service_->stop();
io_service_.reset();
if (thread_) { if (thread_) {
thread_->wait(); thread_->wait();
thread_.reset(); thread_.reset();
} }
io_service_->stop();
io_service_.reset();
if (agent_) { if (agent_) {
clearYang(agent_); clearYang(agent_);
agent_->clear(); agent_->clear();
@@ -230,12 +230,12 @@ public:
/// @brief Destructor. /// @brief Destructor.
virtual ~NetconfAgentLogTest() { virtual ~NetconfAgentLogTest() {
NetconfProcess::global_shut_down_flag = true; NetconfProcess::global_shut_down_flag = true;
io_service_->stop();
io_service_.reset();
if (thread_) { if (thread_) {
thread_->wait(); thread_->wait();
thread_.reset(); thread_.reset();
} }
io_service_->stop();
io_service_.reset();
if (agent_) { if (agent_) {
clearYang(agent_); clearYang(agent_);
agent_->clear(); agent_->clear();
@@ -822,7 +822,7 @@ TEST_F(NetconfAgentTest, subscribe) {
EXPECT_NO_THROW(agent_->subscriptions_.clear()); EXPECT_NO_THROW(agent_->subscriptions_.clear());
} }
/// Verifies the update method works as expected: apply new YNAG configuration /// Verifies the update method works as expected: apply new YANG configuration
/// to the server. Note it is called by the subscription callback. /// to the server. Note it is called by the subscription callback.
TEST_F(NetconfAgentTest, update) { TEST_F(NetconfAgentTest, update) {
// Initial YANG configuration. // Initial YANG configuration.
@@ -963,7 +963,7 @@ TEST_F(NetconfAgentTest, update) {
EXPECT_TRUE(expected->equals(*pruned)); EXPECT_TRUE(expected->equals(*pruned));
} }
/// Verifies the validate method works as expected: test new YNAG configuration /// Verifies the validate method works as expected: test new YANG configuration
/// with the server. Note it is called by the subscription callback and /// with the server. Note it is called by the subscription callback and
/// update is called after. /// update is called after.
TEST_F(NetconfAgentTest, validate) { TEST_F(NetconfAgentTest, validate) {