mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-29 04:57:52 +00:00
[204-move-models-] Addressing comments (checkpoint)
This commit is contained in:
parent
8472305306
commit
c3f4584a8b
@ -114,27 +114,35 @@ ietf-ip | 2014-06-16 | Installed | |
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Installing Kea YANG modules. There are two major modules that Kea is able to
|
Installing Kea YANG modules. There are two major modules that Kea is
|
||||||
support: kea-dhcp4-server and kea-dhcp6-server. Note that while there is an
|
able to support: kea-dhcp4-server and kea-dhcp6-server. Note that
|
||||||
active effort at DHC working group at IETF to develop an DHCPv6 YANG model,
|
while there is an active effort at DHC working group at IETF to
|
||||||
similar initiative for DHCPv4 died long time ago. As such, Kea uses its own
|
develop an DHCPv6 YANG model, similar initiative for DHCPv4 died long
|
||||||
dedicated models for DHCPv4 and DHCPv6 but partially supports the IETF model
|
time ago. As such, Kea uses its own dedicated models for DHCPv4 and
|
||||||
for DHCPv6. Those three models have extra
|
DHCPv6 but partially supports the IETF model for DHCPv6. Those three
|
||||||
models as dependencies. The dependency models are also provided in
|
models have extra modules as dependencies. The dependency modules are
|
||||||
src/lib/libyang/models. To install models from sources, do the following:
|
also provided in <filename>src/share/yang/modules</filename> in sources
|
||||||
|
and <filename>share/kea/yang/modules</filename> after installation.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
To install modules from sources, do the following:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
cd src/share/yang/modules
|
cd src/share/yang/modules
|
||||||
sudo sysrepoctl -i -s /home/thomson/devel/sysrepo-0.7.6/build/repository/yang -s . -g ietf-dhcpv6-server*.yang
|
sudo sysrepoctl -i -s /home/thomson/devel/sysrepo-0.7.6/build/repository/yang -s . -g ietf-dhcpv6-server*.yang
|
||||||
sudo sysrepoctl -i -s /home/thomson/devel/sysrepo-0.7.6/build/repository/yang -s . -g kea-dhcp4-server*.yang
|
sudo sysrepoctl -i -s /home/thomson/devel/sysrepo-0.7.6/build/repository/yang -s . -g kea-dhcp4-server*.yang
|
||||||
sudo sysrepoctl -i -s /home/thomson/devel/sysrepo-0.7.6/build/repository/yang -s . -g kea-dhcp6-server*.yang
|
sudo sysrepoctl -i -s /home/thomson/devel/sysrepo-0.7.6/build/repository/yang -s . -g kea-dhcp6-server*.yang
|
||||||
|
...
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
Note the first -s parameter specifies the location of your YANG schema
|
Note the first -s parameter specifies the location of your YANG schema
|
||||||
repository. You can check it with sysrepoctl -l. This is a parameter that is
|
repository. You can check it with sysrepoctl -l. This is a parameter that is
|
||||||
configured during sysrepo compilation and is detected by Kea configure
|
configured during sysrepo compilation and is detected by Kea configure
|
||||||
under the SYSREPO_REPO name.
|
under the SYSREPO_REPO name.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
The installation should look similar to the following:
|
The installation should look similar to the following:
|
||||||
<screen>
|
<screen>
|
||||||
$ sudo sysrepoctl -i -s /home/thomson/devel/sysrepo-0.7.6/build/repository/yang -s . -g ietf-dhcpv6-server*.yang
|
$ sudo sysrepoctl -i -s /home/thomson/devel/sysrepo-0.7.6/build/repository/yang -s . -g ietf-dhcpv6-server*.yang
|
||||||
@ -242,6 +250,9 @@ done in dependency order and reverse dependency order accordingly.
|
|||||||
Check that used (not essential) and required (essential)
|
Check that used (not essential) and required (essential)
|
||||||
modules are installed in the sysrepo repository at the
|
modules are installed in the sysrepo repository at the
|
||||||
right revision.
|
right revision.
|
||||||
|
If an essential module, i.e. a module where the configuration
|
||||||
|
schema for a managed server is defined, is not installed
|
||||||
|
then a fatal error is raised.
|
||||||
</simpara>
|
</simpara>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
|
@ -103,20 +103,20 @@ public:
|
|||||||
/// This callback is called by sysrepo when a module is (un)installed.
|
/// This callback is called by sysrepo when a module is (un)installed.
|
||||||
///
|
///
|
||||||
/// @param module_name The module name.
|
/// @param module_name The module name.
|
||||||
/// @param revision The module revision.
|
/// @param revision The module revision (NULL for uninstallation).
|
||||||
/// @param state The new state of the module (ignored).
|
/// @param state The new state of the module (ignored).
|
||||||
/// @param private_ctx The private context.
|
/// @param private_ctx The private context.
|
||||||
void module_install(const char* module_name,
|
void module_install(const char* module_name,
|
||||||
const char* revision,
|
const char* revision,
|
||||||
sr_module_state_t /*state*/,
|
sr_module_state_t /*state*/,
|
||||||
void* /*private_ctx*/) {
|
void* /*private_ctx*/) {
|
||||||
if (!module_name || !revision) {
|
if (!module_name) {
|
||||||
// Not for us...
|
// Not for us...
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LOG_WARN(netconf_logger, NETCONF_MODULE_INSTALL)
|
LOG_WARN(netconf_logger, NETCONF_MODULE_INSTALL)
|
||||||
.arg(module_name)
|
.arg(module_name)
|
||||||
.arg(revision);
|
.arg(revision ? revision : "unknown");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ NetconfAgent::init(NetconfCfgMgrPtr cfg_mgr) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!can_start) {
|
if (!can_start) {
|
||||||
cerr << "An essential YNAG module / revision is missing."
|
cerr << "An essential YANG module / revision is missing."
|
||||||
<< endl
|
<< endl
|
||||||
<< "The environment is not suitable for running kea-netconf."
|
<< "The environment is not suitable for running kea-netconf."
|
||||||
<< endl;
|
<< endl;
|
||||||
@ -327,13 +327,16 @@ NetconfAgent::initSysrepo() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Subscribe to the module (un)installation callback.
|
||||||
|
// When a module is (un)installed the callback is called.
|
||||||
|
// Note this requires a system test (vs. unit test).
|
||||||
try {
|
try {
|
||||||
S_Subscribe subs(new Subscribe(startup_sess_));
|
S_Subscribe subs(new Subscribe(startup_sess_));
|
||||||
S_Callback cb(new NetconfAgentInstallCallback());
|
S_Callback cb(new NetconfAgentInstallCallback());
|
||||||
subs->module_install_subscribe(cb);
|
subs->module_install_subscribe(cb);
|
||||||
subscriptions_.insert(make_pair("__install__", subs));
|
subscriptions_.insert(make_pair("__install__", subs));
|
||||||
} catch (const sysrepo_exception& ex) {
|
} catch (const sysrepo_exception& ex) {
|
||||||
isc_throw(Unexpected, "Can't subscribe moduel install: "
|
isc_throw(Unexpected, "Can't subscribe module install: "
|
||||||
<< ex.what());
|
<< ex.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -345,17 +348,19 @@ NetconfAgent::checkModule(const string& module_name) const {
|
|||||||
}
|
}
|
||||||
auto module = modules_.find(module_name);
|
auto module = modules_.find(module_name);
|
||||||
if (module == modules_.end()) {
|
if (module == modules_.end()) {
|
||||||
LOG_ERROR(netconf_logger, METCONF_MODULE_MISSING_ERR)
|
LOG_ERROR(netconf_logger, NETCONF_MODULE_MISSING_ERR)
|
||||||
.arg(module_name);
|
.arg(module_name);
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
auto modrev = YANG_REVISIONS.find(module_name);
|
auto modrev = YANG_REVISIONS.find(module_name);
|
||||||
if (modrev == YANG_REVISIONS.end()) {
|
if (modrev == YANG_REVISIONS.end()) {
|
||||||
// Can't check revision?!
|
// Can't check revision?!
|
||||||
|
// It can happen only with a module which is not in
|
||||||
|
// YANG_REVISIONS but installed so likely on purpose.
|
||||||
return (true);
|
return (true);
|
||||||
}
|
}
|
||||||
if (modrev->second != module->second) {
|
if (modrev->second != module->second) {
|
||||||
LOG_ERROR(netconf_logger, METCONF_MODULE_REVISION_ERR)
|
LOG_ERROR(netconf_logger, NETCONF_MODULE_REVISION_ERR)
|
||||||
.arg(module_name)
|
.arg(module_name)
|
||||||
.arg(modrev->second)
|
.arg(modrev->second)
|
||||||
.arg(module->second);
|
.arg(module->second);
|
||||||
@ -372,12 +377,12 @@ NetconfAgent::checkModules() const {
|
|||||||
}
|
}
|
||||||
auto module = modules_.find(modrev.first);
|
auto module = modules_.find(modrev.first);
|
||||||
if (module == modules_.end()) {
|
if (module == modules_.end()) {
|
||||||
LOG_WARN(netconf_logger, METCONF_MODULE_MISSING_WARN)
|
LOG_WARN(netconf_logger, NETCONF_MODULE_MISSING_WARN)
|
||||||
.arg(modrev.first);
|
.arg(modrev.first);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (modrev.second != module->second) {
|
if (modrev.second != module->second) {
|
||||||
LOG_WARN(netconf_logger, METCONF_MODULE_REVISION_WARN)
|
LOG_WARN(netconf_logger, NETCONF_MODULE_REVISION_WARN)
|
||||||
.arg(modrev.first)
|
.arg(modrev.first)
|
||||||
.arg(modrev.second)
|
.arg(modrev.second)
|
||||||
.arg(module->second);
|
.arg(module->second);
|
||||||
|
@ -57,21 +57,21 @@ This warning message indicates that sysrepo reports the installation
|
|||||||
or uninstallation of a module used by Kea. The name and revision of
|
or uninstallation of a module used by Kea. The name and revision of
|
||||||
the module are printed.
|
the module are printed.
|
||||||
|
|
||||||
% METCONF_MODULE_MISSING_ERR Missing essential module %1 in sysrepo
|
% NETCONF_MODULE_MISSING_ERR Missing essential module %1 in sysrepo
|
||||||
This fatal error message indicates that a module required by Netconf
|
This fatal error message indicates that a module required by Netconf
|
||||||
configuration is not available in the sysrepo repository. The name of
|
configuration is not available in the sysrepo repository. The name of
|
||||||
the module is printed.
|
the module is printed.
|
||||||
|
|
||||||
% METCONF_MODULE_MISSING_WARN Missing module %1 in sysrepo
|
% NETCONF_MODULE_MISSING_WARN Missing module %1 in sysrepo
|
||||||
This warning message indicates that a module used by Kea is not
|
This warning message indicates that a module used by Kea is not
|
||||||
available in the sysrepo repository. The name of the module is printed.
|
available in the sysrepo repository. The name of the module is printed.
|
||||||
|
|
||||||
% METCONF_MODULE_REVISION_ERR Essential module %1 does have the right revision: expected %2, got %3
|
% NETCONF_MODULE_REVISION_ERR Essential module %1 does have the right revision: expected %2, got %3
|
||||||
This fatal error message indicates that a module required by Netconf
|
This fatal error message indicates that a module required by Netconf
|
||||||
configuration is not at the right revision in the sysrepo repository.
|
configuration is not at the right revision in the sysrepo repository.
|
||||||
The name, expected and available revisions of the module are printed.
|
The name, expected and available revisions of the module are printed.
|
||||||
|
|
||||||
% METCONF_MODULE_REVISION_WARN Module %1 does have the right revision: expected %2, got %3
|
% NETCONF_MODULE_REVISION_WARN Module %1 does have the right revision: expected %2, got %3
|
||||||
This warning message indicates that a module used by Kea is not at the
|
This warning message indicates that a module used by Kea is not at the
|
||||||
right revision in the sysrepo repository. The name, expected and
|
right revision in the sysrepo repository. The name, expected and
|
||||||
available revisions of the module are printed.
|
available revisions of the module are printed.
|
||||||
|
@ -323,7 +323,7 @@ TEST_F(NetconfAgentTest, initSysrepo) {
|
|||||||
EXPECT_TRUE(agent_->running_sess_);
|
EXPECT_TRUE(agent_->running_sess_);
|
||||||
EXPECT_EQ(1, agent_->subscriptions_.size());
|
EXPECT_EQ(1, agent_->subscriptions_.size());
|
||||||
EXPECT_LE(16, agent_->modules_.size());
|
EXPECT_LE(16, agent_->modules_.size());
|
||||||
// No way to check the module_install callback (BTW is ther
|
// No way to check the module_install callback (BTW is there
|
||||||
// an API to install modules? If none only system tests can
|
// an API to install modules? If none only system tests can
|
||||||
// do something)...
|
// do something)...
|
||||||
}
|
}
|
||||||
@ -346,7 +346,7 @@ TEST_F(NetconfAgentLogTest, checkModule) {
|
|||||||
// Unknown module should emit a missing error.
|
// Unknown module should emit a missing error.
|
||||||
EXPECT_EQ(0, agent_->modules_.count("does-not-exist"));
|
EXPECT_EQ(0, agent_->modules_.count("does-not-exist"));
|
||||||
EXPECT_FALSE(agent_->checkModule("does-not-exist"));
|
EXPECT_FALSE(agent_->checkModule("does-not-exist"));
|
||||||
addString("METCONF_MODULE_MISSING_ERR Missing essential module "
|
addString("NETCONF_MODULE_MISSING_ERR Missing essential module "
|
||||||
"does-not-exist in sysrepo");
|
"does-not-exist in sysrepo");
|
||||||
|
|
||||||
// Patch the found revision to get a revision error.
|
// Patch the found revision to get a revision error.
|
||||||
@ -360,7 +360,7 @@ TEST_F(NetconfAgentLogTest, checkModule) {
|
|||||||
agent_->modules_.insert(make_pair(module, bad_revision));
|
agent_->modules_.insert(make_pair(module, bad_revision));
|
||||||
EXPECT_FALSE(agent_->checkModule(module));
|
EXPECT_FALSE(agent_->checkModule(module));
|
||||||
ostringstream msg;
|
ostringstream msg;
|
||||||
msg << "METCONF_MODULE_REVISION_ERR Essential module " << module
|
msg << "NETCONF_MODULE_REVISION_ERR Essential module " << module
|
||||||
<< " does have the right revision: expected "
|
<< " does have the right revision: expected "
|
||||||
<< YANG_REVISIONS.at(module) << ", got " << bad_revision;
|
<< YANG_REVISIONS.at(module) << ", got " << bad_revision;
|
||||||
addString(msg.str());
|
addString(msg.str());
|
||||||
@ -393,7 +393,7 @@ TEST_F(NetconfAgentLogTest, checkModules) {
|
|||||||
}
|
}
|
||||||
ASSERT_NO_THROW(agent_->checkModules());
|
ASSERT_NO_THROW(agent_->checkModules());
|
||||||
ostringstream mmsg;
|
ostringstream mmsg;
|
||||||
mmsg << "METCONF_MODULE_MISSING_WARN Missing module " << module
|
mmsg << "NETCONF_MODULE_MISSING_WARN Missing module " << module
|
||||||
<< " in sysrepo";
|
<< " in sysrepo";
|
||||||
addString(mmsg.str());
|
addString(mmsg.str());
|
||||||
|
|
||||||
@ -402,7 +402,7 @@ TEST_F(NetconfAgentLogTest, checkModules) {
|
|||||||
agent_->modules_.insert(make_pair(module, bad_revision));
|
agent_->modules_.insert(make_pair(module, bad_revision));
|
||||||
ASSERT_NO_THROW(agent_->checkModules());
|
ASSERT_NO_THROW(agent_->checkModules());
|
||||||
ostringstream rmsg;
|
ostringstream rmsg;
|
||||||
rmsg << "METCONF_MODULE_REVISION_WARN Module " << module
|
rmsg << "NETCONF_MODULE_REVISION_WARN Module " << module
|
||||||
<< " does have the right revision: expected "
|
<< " does have the right revision: expected "
|
||||||
<< YANG_REVISIONS.at(module) << ", got " << bad_revision;
|
<< YANG_REVISIONS.at(module) << ", got " << bad_revision;
|
||||||
addString(rmsg.str());
|
addString(rmsg.str());
|
||||||
|
@ -151,7 +151,7 @@ Those models depend on the following modules:
|
|||||||
- kea-logging
|
- kea-logging
|
||||||
- kea-dhcp-types
|
- kea-dhcp-types
|
||||||
|
|
||||||
Those models are extracted from the IETF DHCPv6 YNAG draft too:
|
Those modules are extracted from the IETF DHCPv6 YANG draft too:
|
||||||
- ietf-dhcpv6-client
|
- ietf-dhcpv6-client
|
||||||
- ietf-dhcpv6-relay
|
- ietf-dhcpv6-relay
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user