</para>
<para>
-Installing Kea YANG modules. There are two major modules that Kea is able to
-support: kea-dhcp4-server and kea-dhcp6-server. Note that while there is an
-active effort at DHC working group at IETF to develop an DHCPv6 YANG model,
-similar initiative for DHCPv4 died long time ago. As such, Kea uses its own
-dedicated models for DHCPv4 and DHCPv6 but partially supports the IETF model
-for DHCPv6. Those three models have extra
-models as dependencies. The dependency models are also provided in
-src/lib/libyang/models. To install models from sources, do the following:
+Installing Kea YANG modules. There are two major modules that Kea is
+able to support: kea-dhcp4-server and kea-dhcp6-server. Note that
+while there is an active effort at DHC working group at IETF to
+develop an DHCPv6 YANG model, similar initiative for DHCPv4 died long
+time ago. As such, Kea uses its own dedicated models for DHCPv4 and
+DHCPv6 but partially supports the IETF model for DHCPv6. Those three
+models have extra modules as dependencies. The dependency modules are
+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>
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 kea-dhcp4-server*.yang
sudo sysrepoctl -i -s /home/thomson/devel/sysrepo-0.7.6/build/repository/yang -s . -g kea-dhcp6-server*.yang
+...
</screen>
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
configured during sysrepo compilation and is detected by Kea configure
under the SYSREPO_REPO name.
+ </para>
+ <para>
The installation should look similar to the following:
<screen>
$ sudo sysrepoctl -i -s /home/thomson/devel/sysrepo-0.7.6/build/repository/yang -s . -g ietf-dhcpv6-server*.yang
Check that used (not essential) and required (essential)
modules are installed in the sysrepo repository at the
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>
</listitem>
/// This callback is called by sysrepo when a module is (un)installed.
///
/// @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 private_ctx The private context.
void module_install(const char* module_name,
const char* revision,
sr_module_state_t /*state*/,
void* /*private_ctx*/) {
- if (!module_name || !revision) {
+ if (!module_name) {
// Not for us...
return;
}
LOG_WARN(netconf_logger, NETCONF_MODULE_INSTALL)
.arg(module_name)
- .arg(revision);
+ .arg(revision ? revision : "unknown");
}
};
}
}
if (!can_start) {
- cerr << "An essential YNAG module / revision is missing."
+ cerr << "An essential YANG module / revision is missing."
<< endl
<< "The environment is not suitable for running kea-netconf."
<< endl;
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 {
S_Subscribe subs(new Subscribe(startup_sess_));
S_Callback cb(new NetconfAgentInstallCallback());
subs->module_install_subscribe(cb);
subscriptions_.insert(make_pair("__install__", subs));
} catch (const sysrepo_exception& ex) {
- isc_throw(Unexpected, "Can't subscribe moduel install: "
+ isc_throw(Unexpected, "Can't subscribe module install: "
<< ex.what());
}
}
}
auto module = modules_.find(module_name);
if (module == modules_.end()) {
- LOG_ERROR(netconf_logger, METCONF_MODULE_MISSING_ERR)
+ LOG_ERROR(netconf_logger, NETCONF_MODULE_MISSING_ERR)
.arg(module_name);
return (false);
}
auto modrev = YANG_REVISIONS.find(module_name);
if (modrev == YANG_REVISIONS.end()) {
// 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);
}
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(modrev->second)
.arg(module->second);
}
auto module = modules_.find(modrev.first);
if (module == modules_.end()) {
- LOG_WARN(netconf_logger, METCONF_MODULE_MISSING_WARN)
+ LOG_WARN(netconf_logger, NETCONF_MODULE_MISSING_WARN)
.arg(modrev.first);
continue;
}
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.second)
.arg(module->second);
or uninstallation of a module used by Kea. The name and revision of
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
configuration is not available in the sysrepo repository. The name of
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
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
configuration is not at the right revision in the sysrepo repository.
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
right revision in the sysrepo repository. The name, expected and
available revisions of the module are printed.
EXPECT_TRUE(agent_->running_sess_);
EXPECT_EQ(1, agent_->subscriptions_.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
// do something)...
}
// Unknown module should emit a missing error.
EXPECT_EQ(0, agent_->modules_.count("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");
// Patch the found revision to get a revision error.
agent_->modules_.insert(make_pair(module, bad_revision));
EXPECT_FALSE(agent_->checkModule(module));
ostringstream msg;
- msg << "METCONF_MODULE_REVISION_ERR Essential module " << module
+ msg << "NETCONF_MODULE_REVISION_ERR Essential module " << module
<< " does have the right revision: expected "
<< YANG_REVISIONS.at(module) << ", got " << bad_revision;
addString(msg.str());
}
ASSERT_NO_THROW(agent_->checkModules());
ostringstream mmsg;
- mmsg << "METCONF_MODULE_MISSING_WARN Missing module " << module
+ mmsg << "NETCONF_MODULE_MISSING_WARN Missing module " << module
<< " in sysrepo";
addString(mmsg.str());
agent_->modules_.insert(make_pair(module, bad_revision));
ASSERT_NO_THROW(agent_->checkModules());
ostringstream rmsg;
- rmsg << "METCONF_MODULE_REVISION_WARN Module " << module
+ rmsg << "NETCONF_MODULE_REVISION_WARN Module " << module
<< " does have the right revision: expected "
<< YANG_REVISIONS.at(module) << ", got " << bad_revision;
addString(rmsg.str());
- kea-logging
- 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-relay