Commit caa78e34 authored by Francis Dupont's avatar Francis Dupont Committed by Tomek Mrugalski

[65-libyang-config-adaptor] Added removal of empty relay supplied option list

parent 0600f7c4
......@@ -390,6 +390,16 @@ AdaptorConfig::updateDatabase(ConstElementPtr dhcp) {
mutable_dhcp->set("hosts-databases", list);
}
void
AdaptorConfig::relaySuppliedOptions(ConstElementPtr dhcp) {
ConstElementPtr options = dhcp->get("relay-supplied-options");
if (!options || (options->size() > 0)) {
return;
}
ElementPtr mutable_dhcp = boost::const_pointer_cast<Element>(dhcp);
mutable_dhcp->remove("relay-supplied-options");
}
void
AdaptorConfig::preProcess(ConstElementPtr dhcp, const string& subsel,
const string& space) {
......@@ -473,6 +483,10 @@ AdaptorConfig::preProcess(ConstElementPtr dhcp, const string& subsel,
requireClassesSharedNetworks(networks, subsel);
updateDatabase(dhcp);
if (space == "dhcp6") {
relaySuppliedOptions(dhcp);
}
}
void
......
......@@ -165,16 +165,22 @@ protected:
/// @brief Process require client classes in a pool list.
///
/// Remove empty require client class list.
///
/// @param pools The pool list.
static void requireClassesPools(isc::data::ConstElementPtr pools);
/// @brief Process require client classes in a subnet list.
///
/// Remove empty require client class lists.
///
/// @param subnets The subnet list.
static void requireClassesSubnets(isc::data::ConstElementPtr subnets);
/// @brief Process require client classes in a shared network list.
///
/// Remove empty require client class lists.
///
/// @param networks The shared network list.
/// @param subsel The subnet list name.
static void requireClassesSharedNetworks(isc::data::ConstElementPtr networks,
......@@ -216,6 +222,13 @@ protected:
/// @param dhcp The DHCP server.
static void updateDatabase(isc::data::ConstElementPtr dhcp);
/// @brief Update relay supplied options.
///
/// Remove empty relay supplied option list.
///
/// @param dhcp The DHCPv6 server.
static void relaySuppliedOptions(isc::data::ConstElementPtr dhcp);
/// @brief Pre process a configuration.
///
/// Assign subnet IDs, check and set default in options.
......
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