summaryrefslogtreecommitdiffstats
path: root/src/lib/yang/translator_subnet.cc
diff options
context:
space:
mode:
authorAndrei Pavel <andrei@isc.org>2022-11-01 15:06:45 +0100
committerRazvan Becheriu <razvan@isc.org>2022-11-25 17:15:33 +0100
commit5891985423a7979cbecf6a8b76cb408e61e0cb8f (patch)
tree2adddadada6e7d6437130865fe7f65c4d840a63c /src/lib/yang/translator_subnet.cc
parent[#2601] make NETCONF_SUBSCRIBE_NOTIFICATIONS_FAILED a warning (diff)
downloadkea-5891985423a7979cbecf6a8b76cb408e61e0cb8f.tar.xz
kea-5891985423a7979cbecf6a8b76cb408e61e0cb8f.zip
[#2601] use checkAnd{Get,Set} where possible
Diffstat (limited to '')
-rw-r--r--src/lib/yang/translator_subnet.cc465
1 files changed, 153 insertions, 312 deletions
diff --git a/src/lib/yang/translator_subnet.cc b/src/lib/yang/translator_subnet.cc
index 429e417aaf..68cc2b4dee 100644
--- a/src/lib/yang/translator_subnet.cc
+++ b/src/lib/yang/translator_subnet.cc
@@ -62,8 +62,9 @@ TranslatorSubnet::getSubnetFromAbsoluteXpath(string const& xpath) {
ElementPtr
TranslatorSubnet::getSubnetIetf6(DataNode const& data_node) {
ElementPtr result = Element::createMap();
- /// @todo timers
- /// @todo: option-data
+ getMandatoryDivergingLeaf(result, data_node, "subnet", "network-prefix");
+ getMandatoryDivergingLeaf(result, data_node, "id", "network-range-id");
+
Set<DataNode> const& address_pools(data_node.findXPath("address-pools"));
if (!address_pools.empty()) {
ConstElementPtr const& pools(getPools(address_pools.front()));
@@ -71,6 +72,7 @@ TranslatorSubnet::getSubnetIetf6(DataNode const& data_node) {
result->set("pools", pools);
}
}
+
Set<DataNode> const& yang_pd_pools(data_node.findXPath("pd-pools"));
if (!yang_pd_pools.empty()) {
ConstElementPtr const& pd_pools(getPdPools(yang_pd_pools.front()));
@@ -78,184 +80,36 @@ TranslatorSubnet::getSubnetIetf6(DataNode const& data_node) {
result->set("pd-pools", pd_pools);
}
}
- ConstElementPtr subnet = getItem(data_node, "network-prefix");
- if (!subnet) {
- isc_throw(BadValue, "getSubnetIetf6 requires network prefix");
- }
- result->set("subnet", subnet);
- ConstElementPtr id = getItem(data_node, "network-range-id");
- if (!id) {
- isc_throw(BadValue, "getSubnetIetf6 requires network range id");
- }
- result->set("id", id);
- /// @todo: reservations
- /// missing a lot of things
+
ConstElementPtr description = getItem(data_node, "network-description");
- /// Adding description if exists.
if (description) {
ElementPtr context = Element::createMap();
context->set("description", description);
result->set("user-context", context);
}
- /// missing a lot of things
+
if (result->get("pools")) {
AdaptorPool::toSubnet(model_, result, result->get("pools"));
}
- return (result);
+
+ /// @todo: timers
+ /// @todo: option-data
+ /// @todo: reservations
+
+ return (result->empty() ? ElementPtr() : result);
}
ElementPtr
TranslatorSubnet::getSubnetKea(DataNode const& data_node) {
ElementPtr result = Element::createMap();
- if (model_ == KEA_DHCP6_SERVER) {
- ConstElementPtr preferred = getItem(data_node, "preferred-lifetime");
- if (preferred) {
- result->set("preferred-lifetime", preferred);
- }
- ConstElementPtr min_pref = getItem(data_node, "min-preferred-lifetime");
- if (min_pref) {
- result->set("min-preferred-lifetime", min_pref);
- }
- ConstElementPtr max_pref = getItem(data_node, "max-preferred-lifetime");
- if (max_pref) {
- result->set("max-preferred-lifetime", max_pref);
- }
- }
- ConstElementPtr valid = getItem(data_node, "valid-lifetime");
- if (valid) {
- result->set("valid-lifetime", valid);
- }
- ConstElementPtr min_valid = getItem(data_node, "min-valid-lifetime");
- if (min_valid) {
- result->set("min-valid-lifetime", min_valid);
- }
- ConstElementPtr max_valid = getItem(data_node, "max-valid-lifetime");
- if (max_valid) {
- result->set("max-valid-lifetime", max_valid);
- }
- ConstElementPtr renew = getItem(data_node, "renew-timer");
- if (renew) {
- result->set("renew-timer", renew);
- }
- ConstElementPtr rebind = getItem(data_node, "rebind-timer");
- if (rebind) {
- result->set("rebind-timer", rebind);
- }
- ConstElementPtr calculate = getItem(data_node, "calculate-tee-times");
- if (calculate) {
- result->set("calculate-tee-times", calculate);
- }
- ConstElementPtr t1_percent = getItem(data_node, "t1-percent");
- if (t1_percent) {
- result->set("t1-percent", t1_percent);
- }
- ConstElementPtr t2_percent = getItem(data_node, "t2-percent");
- if (t2_percent) {
- result->set("t2-percent", t2_percent);
- }
- ConstElementPtr options = getOptionDataList(data_node);
- if (options && (options->size() > 0)) {
- result->set("option-data", options);
- }
- ConstElementPtr pools = getPools(data_node);
- if (pools && (pools->size() > 0)) {
- result->set("pools", pools);
- }
- if (model_ == KEA_DHCP6_SERVER) {
- ElementPtr pd_pools = getPdPools(data_node);
- if (pd_pools && (pd_pools->size() > 0)) {
- result->set("pd-pools", pd_pools);
- }
- }
- ConstElementPtr subnet = getItem(data_node, "subnet");
- if (!subnet) {
- isc_throw(BadValue, "getSubnetKea requires subnet");
- }
- result->set("subnet", subnet);
- ConstElementPtr interface = getItem(data_node, "interface");
- if (interface) {
- result->set("interface", interface);
- }
- if (model_ == KEA_DHCP6_SERVER) {
- ConstElementPtr interface_id = getItem(data_node, "interface-id");
- if (interface_id) {
- result->set("interface-id", interface_id);
- }
- }
- ConstElementPtr id = getItem(data_node, "id");
- if (!id) {
- isc_throw(BadValue, "getSubnetKea requires id");
- }
- result->set("id", id);
- if (model_ == KEA_DHCP6_SERVER) {
- ConstElementPtr rapid_commit = getItem(data_node, "rapid-commit");
- if (rapid_commit) {
- result->set("rapid-commit", rapid_commit);
- }
- }
- ConstElementPtr guard = getItem(data_node, "client-class");
- if (guard) {
- result->set("client-class", guard);
- }
- ConstElementPtr required = getItem(data_node, "require-client-classes");
- if (required && (required->size() > 0)) {
- result->set("require-client-classes", required);
- }
- ConstElementPtr hosts = getHosts(data_node);
- if (hosts && (hosts->size() > 0)) {
- result->set("reservations", hosts);
- }
- ConstElementPtr mode = getItem(data_node, "reservation-mode");
- if (mode) {
- result->set("reservation-mode", mode);
- }
- ConstElementPtr relay = getItem(data_node, "relay/ip-addresses");
- if (relay && (relay->size() > 0)) {
- ElementPtr relay_map = Element::createMap();
- relay_map->set("ip-addresses", relay);
- result->set("relay", relay_map);
- }
- if (model_ == KEA_DHCP4_SERVER) {
- ConstElementPtr match = getItem(data_node, "match-client-id");
- if (match) {
- result->set("match-client-id", match);
- }
- ConstElementPtr auth = getItem(data_node, "authoritative");
- if (auth) {
- result->set("authoritative", auth);
- }
- ConstElementPtr next = getItem(data_node, "next-server");
- if (next) {
- result->set("next-server", next);
- }
- ConstElementPtr hostname = getItem(data_node, "server-hostname");
- if (hostname) {
- result->set("server-hostname", hostname);
- }
- ConstElementPtr boot = getItem(data_node, "boot-file-name");
- if (boot) {
- result->set("boot-file-name", boot);
- }
- ConstElementPtr s4o6_if = getItem(data_node, "subnet-4o6-interface");
- if (s4o6_if) {
- result->set("4o6-interface", s4o6_if);
- }
- ConstElementPtr s4o6_id = getItem(data_node, "subnet-4o6-interface-id");
- if (s4o6_id) {
- result->set("4o6-interface-id", s4o6_id);
- }
- ConstElementPtr s4o6_sub = getItem(data_node, "subnet-4o6-subnet");
- if (s4o6_sub) {
- result->set("4o6-subnet", s4o6_sub);
- }
- }
- ConstElementPtr context = getItem(data_node, "user-context");
- if (context) {
- result->set("user-context", Element::fromJSON(context->stringValue()));
- }
+ getMandatoryLeaf(result, data_node, "id");
+ getMandatoryLeaf(result, data_node, "subnet");
+
checkAndGetLeaf(result, data_node, "cache-max-age");
checkAndGetLeaf(result, data_node, "cache-threshold");
+ checkAndGetLeaf(result, data_node, "calculate-tee-times");
+ checkAndGetLeaf(result, data_node, "client-class");
checkAndGetLeaf(result, data_node, "ddns-generated-prefix");
checkAndGetLeaf(result, data_node, "ddns-override-client-update");
checkAndGetLeaf(result, data_node, "ddns-override-no-update");
@@ -266,11 +120,71 @@ TranslatorSubnet::getSubnetKea(DataNode const& data_node) {
checkAndGetLeaf(result, data_node, "ddns-use-conflict-resolution");
checkAndGetLeaf(result, data_node, "hostname-char-replacement");
checkAndGetLeaf(result, data_node, "hostname-char-set");
+ checkAndGetLeaf(result, data_node, "interface");
+ checkAndGetLeaf(result, data_node, "max-valid-lifetime");
+ checkAndGetLeaf(result, data_node, "min-valid-lifetime");
+ checkAndGetLeaf(result, data_node, "rebind-timer");
+ checkAndGetLeaf(result, data_node, "renew-timer");
+ checkAndGetLeaf(result, data_node, "require-client-classes");
+ checkAndGetLeaf(result, data_node, "reservation-mode");
checkAndGetLeaf(result, data_node, "reservations-global");
checkAndGetLeaf(result, data_node, "reservations-in-subnet");
checkAndGetLeaf(result, data_node, "reservations-out-of-pool");
checkAndGetLeaf(result, data_node, "store-extended-info");
- return (result);
+ checkAndGetLeaf(result, data_node, "t1-percent");
+ checkAndGetLeaf(result, data_node, "t2-percent");
+ checkAndGetLeaf(result, data_node, "valid-lifetime");
+
+ checkAndGetAndJsonifyLeaf(result, data_node, "user-context");
+
+ ConstElementPtr options = getOptionDataList(data_node);
+ if (options) {
+ result->set("option-data", options);
+ }
+
+ ConstElementPtr pools = getPools(data_node);
+ if (pools) {
+ result->set("pools", pools);
+ }
+
+ Set<DataNode> const& yang_relay(data_node.findXPath("relay"));
+ if (!yang_relay.empty()) {
+ ElementPtr relay_map(Element::createMap());
+ checkAndGetLeaf(relay_map, yang_relay.front(), "ip-addresses");
+ if (!relay_map->empty()) {
+ result->set("relay", relay_map);
+ }
+ }
+
+ ConstElementPtr hosts = getHosts(data_node);
+ if (hosts) {
+ result->set("reservations", hosts);
+ }
+
+ if (model_ == KEA_DHCP6_SERVER) {
+ checkAndGetLeaf(result, data_node, "interface-id");
+ checkAndGetLeaf(result, data_node, "max-preferred-lifetime");
+ checkAndGetLeaf(result, data_node, "min-preferred-lifetime");
+ checkAndGetLeaf(result, data_node, "preferred-lifetime");
+ checkAndGetLeaf(result, data_node, "rapid-commit");
+
+ ElementPtr pd_pools = getPdPools(data_node);
+ if (pd_pools) {
+ result->set("pd-pools", pd_pools);
+ }
+ } else if (model_ == KEA_DHCP4_SERVER) {
+ checkAndGetLeaf(result, data_node, "authoritative");
+ checkAndGetLeaf(result, data_node, "boot-file-name");
+ checkAndGetLeaf(result, data_node, "match-client-id");
+ checkAndGetLeaf(result, data_node, "next-server");
+ checkAndGetLeaf(result, data_node, "server-hostname");
+
+ checkAndGetDivergingLeaf(result, data_node, "4o6-interface", "subnet-4o6-interface");
+ checkAndGetDivergingLeaf(result, data_node, "4o6-interface-id", "subnet-4o6-interface-id");
+ checkAndGetDivergingLeaf(result, data_node, "4o6-subnet", "subnet-4o6-subnet");
+ }
+
+ return (result->empty() ? ElementPtr() : result);
}
void
@@ -294,7 +208,10 @@ TranslatorSubnet::setSubnet(string const& xpath, ConstElementPtr elem) {
void
TranslatorSubnet::setSubnetIetf6(string const& xpath, ConstElementPtr elem) {
- /// Skip id as it is the key.
+ /// Skip key "id".
+
+ setMandatoryDivergingLeaf(elem, xpath, "subnet", "network-prefix", LeafBaseType::String);
+
AdaptorPool::fromSubnet(model_, elem, elem->get("pools"));
ConstElementPtr context = elem->get("user-context");
if (context && context->contains("description")) {
@@ -308,134 +225,33 @@ TranslatorSubnet::setSubnetIetf6(string const& xpath, ConstElementPtr elem) {
isc_throw(BadValue, "setSubnetIetf6 requires subnet: " << elem->str());
}
setItem(xpath + "/network-prefix", subnet, LeafBaseType::String);
- /// @todo option-data
ConstElementPtr pools = elem->get("pools");
- if (pools && (pools->size() > 0)) {
+ if (pools && !pools->empty()) {
setPools(xpath + "/address-pools", pools);
}
pools = elem->get("pd-pools");
- if (pools && (pools->size() > 0)) {
+ if (pools && !pools->empty()) {
setPdPools(xpath + "/pd-pools", pools);
}
- /// @todo reservations
+
+ /// @todo: option-data
+ /// @todo: reservations
}
void
TranslatorSubnet::setSubnetKea(string const& xpath, ConstElementPtr elem) {
- /// Skip id as it is the key.
- if (model_ == KEA_DHCP6_SERVER) {
- ConstElementPtr preferred = elem->get("preferred-lifetime");
- if (preferred) {
- setItem(xpath + "/preferred-lifetime", preferred, LeafBaseType::Uint32);
- }
- ConstElementPtr min_pref = elem->get("min-preferred-lifetime");
- if (min_pref) {
- setItem(xpath + "/min-preferred-lifetime", min_pref, LeafBaseType::Uint32);
- }
- ConstElementPtr max_pref = elem->get("max-preferred-lifetime");
- if (max_pref) {
- setItem(xpath + "/max-preferred-lifetime", max_pref, LeafBaseType::Uint32);
- }
- }
- ConstElementPtr valid = elem->get("valid-lifetime");
- if (valid) {
- setItem(xpath + "/valid-lifetime", valid, LeafBaseType::Uint32);
- }
- ConstElementPtr min_valid = elem->get("min-valid-lifetime");
- if (min_valid) {
- setItem(xpath + "/min-valid-lifetime", min_valid, LeafBaseType::Uint32);
- }
- ConstElementPtr max_valid = elem->get("max-valid-lifetime");
- if (max_valid) {
- setItem(xpath + "/max-valid-lifetime", max_valid, LeafBaseType::Uint32);
- }
- ConstElementPtr renew = elem->get("renew-timer");
- if (renew) {
- setItem(xpath + "/renew-timer", renew, LeafBaseType::Uint32);
- }
- ConstElementPtr rebind = elem->get("rebind-timer");
- if (rebind) {
- setItem(xpath + "/rebind-timer", rebind, LeafBaseType::Uint32);
- }
- ConstElementPtr calculate = elem->get("calculate-tee-times");
- if (calculate) {
- setItem(xpath + "/calculate-tee-times", calculate, LeafBaseType::Bool);
- }
- ConstElementPtr t1_percent = elem->get("t1-percent");
- if (t1_percent) {
- setItem(xpath + "/t1-percent", t1_percent, LeafBaseType::Dec64);
- }
- ConstElementPtr t2_percent = elem->get("t2-percent");
- if (t2_percent) {
- setItem(xpath + "/t2-percent", t2_percent, LeafBaseType::Dec64);
- }
- ConstElementPtr options = elem->get("option-data");
- if (options && (options->size() > 0)) {
- setOptionDataList(xpath, options);
- }
- ConstElementPtr pools = elem->get("pools");
- if (pools && (pools->size() > 0)) {
- setPools(xpath, pools);
- }
- if (model_ == KEA_DHCP6_SERVER) {
- pools = elem->get("pd-pools");
- if (pools && (pools->size() > 0)) {
- setPdPools(xpath, pools);
- }
- }
+ /// Skip key "id".
+
ConstElementPtr subnet = elem->get("subnet");
if (!subnet) {
isc_throw(BadValue, "setSubnetKea requires subnet: " << elem->str());
}
setItem(xpath + "/subnet", subnet, LeafBaseType::String);
- ConstElementPtr interface = elem->get("interface");
- if (interface) {
- setItem(xpath + "/interface", interface, LeafBaseType::String);
- }
- if (model_ == KEA_DHCP6_SERVER) {
- ConstElementPtr interface_id = elem->get("interface-id");
- if (interface_id) {
- setItem(xpath + "/interface-id", interface_id, LeafBaseType::String);
- }
- }
- if (model_ == KEA_DHCP6_SERVER) {
- ConstElementPtr rapid_commit = elem->get("rapid-commit");
- if (rapid_commit) {
- setItem(xpath + "/rapid-commit", rapid_commit, LeafBaseType::Bool);
- }
- }
- ConstElementPtr guard = elem->get("client-class");
- if (guard) {
- setItem(xpath + "/client-class", guard, LeafBaseType::String);
- }
- ConstElementPtr required = elem->get("require-client-classes");
- if (required && (required->size() > 0)) {
- for (ConstElementPtr rclass : required->listValue()) {
- setItem(xpath + "/require-client-classes", rclass, LeafBaseType::String);
- }
- }
- ConstElementPtr hosts = elem->get("reservations");
- if (hosts && (hosts->size() > 0)) {
- setHosts(xpath, hosts);
- }
- ConstElementPtr mode = elem->get("reservation-mode");
- if (mode) {
- setItem(xpath + "/reservation-mode", mode, LeafBaseType::Enum);
- }
- ConstElementPtr relay = elem->get("relay");
- if (relay) {
- ConstElementPtr address = relay->get("ip-address");
- ConstElementPtr addresses = relay->get("ip-addresses");
- if (address) {
- setItem(xpath + "/relay/ip-addresses", address, LeafBaseType::String);
- } else if (addresses && (addresses->size() > 0)) {
- for (ConstElementPtr addr : addresses->listValue()) {
- setItem(xpath + "/relay/ip-addresses", addr, LeafBaseType::String);
- }
- }
- }
+
checkAndSetLeaf(elem, xpath, "cache-max-age", LeafBaseType::Uint32);
checkAndSetLeaf(elem, xpath, "cache-threshold", LeafBaseType::Dec64);
+ checkAndSetLeaf(elem, xpath, "calculate-tee-times", LeafBaseType::Bool);
+ checkAndSetLeaf(elem, xpath, "client-class", LeafBaseType::String);
checkAndSetLeaf(elem, xpath, "ddns-generated-prefix", LeafBaseType::String);
checkAndSetLeaf(elem, xpath, "ddns-override-client-update", LeafBaseType::Bool);
checkAndSetLeaf(elem, xpath, "ddns-override-no-update", LeafBaseType::Bool);
@@ -446,49 +262,74 @@ TranslatorSubnet::setSubnetKea(string const& xpath, ConstElementPtr elem) {
checkAndSetLeaf(elem, xpath, "ddns-use-conflict-resolution", LeafBaseType::Bool);
checkAndSetLeaf(elem, xpath, "hostname-char-replacement", LeafBaseType::String);
checkAndSetLeaf(elem, xpath, "hostname-char-set", LeafBaseType::String);
+ checkAndSetLeaf(elem, xpath, "interface", LeafBaseType::String);
+ checkAndSetLeaf(elem, xpath, "max-valid-lifetime", LeafBaseType::Uint32);
+ checkAndSetLeaf(elem, xpath, "min-valid-lifetime", LeafBaseType::Uint32);
+ checkAndSetLeaf(elem, xpath, "rebind-timer", LeafBaseType::Uint32);
+ checkAndSetLeaf(elem, xpath, "renew-timer", LeafBaseType::Uint32);
+ checkAndSetLeaf(elem, xpath, "reservation-mode", LeafBaseType::Enum);
checkAndSetLeaf(elem, xpath, "reservations-global", LeafBaseType::Bool);
checkAndSetLeaf(elem, xpath, "reservations-in-subnet", LeafBaseType::Bool);
checkAndSetLeaf(elem, xpath, "reservations-out-of-pool", LeafBaseType::Bool);
checkAndSetLeaf(elem, xpath, "store-extended-info", LeafBaseType::Bool);
- if (model_ == KEA_DHCP4_SERVER) {
- ConstElementPtr match = elem->get("match-client-id");
- if (match) {
- setItem(xpath + "/match-client-id", match, LeafBaseType::Bool);
- }
- ConstElementPtr auth = elem->get("authoritative");
- if (auth) {
- setItem(xpath + "/authoritative", auth, LeafBaseType::Bool);
- }
- ConstElementPtr next = elem->get("next-server");
- if (next) {
- setItem(xpath + "/next-server", next, LeafBaseType::String);
- }
- ConstElementPtr hostname = elem->get("server-hostname");
- if (hostname) {
- setItem(xpath + "/server-hostname", hostname, LeafBaseType::String);
- }
- ConstElementPtr boot = elem->get("boot-file-name");
- if (boot) {
- setItem(xpath + "/boot-file-name", boot, LeafBaseType::String);
- }
- ConstElementPtr s4o6_if = elem->get("4o6-interface");
- if (s4o6_if) {
- setItem(xpath + "/subnet-4o6-interface", s4o6_if, LeafBaseType::String);
- }
- ConstElementPtr s4o6_id = elem->get("4o6-interface-id");
- if (s4o6_id) {
- setItem(xpath + "/subnet-4o6-interface-id", s4o6_id, LeafBaseType::String);
- }
- ConstElementPtr s4o6_subnet = elem->get("4o6-subnet");
- if (s4o6_subnet) {
- setItem(xpath + "/subnet-4o6-subnet", s4o6_subnet, LeafBaseType::String);
+ checkAndSetLeaf(elem, xpath, "t1-percent", LeafBaseType::Dec64);
+ checkAndSetLeaf(elem, xpath, "t2-percent", LeafBaseType::Dec64);
+ checkAndSetLeaf(elem, xpath, "valid-lifetime", LeafBaseType::Uint32);
+
+ checkAndSetLeafList(elem, xpath, "require-client-classes", LeafBaseType::String);
+
+ ConstElementPtr options = elem->get("option-data");
+ if (options && !options->empty()) {
+ setOptionDataList(xpath, options);
+ }
+ ConstElementPtr pools = elem->get("pools");
+ if (pools && !pools->empty()) {
+ setPools(xpath, pools);
+ }
+ ConstElementPtr relay = elem->get("relay");
+ if (relay) {
+ ConstElementPtr address = relay->get("ip-address");
+ ConstElementPtr addresses = relay->get("ip-addresses");
+ if (address) {
+ setItem(xpath + "/relay/ip-addresses", address, LeafBaseType::String);
+ } else if (addresses && !addresses->empty()) {
+ for (ConstElementPtr addr : addresses->listValue()) {
+ setItem(xpath + "/relay/ip-addresses", addr, LeafBaseType::String);
+ }
}
}
- ConstElementPtr context = Adaptor::getContext(elem);
- if (context) {
- ConstElementPtr repr = Element::create(context->str());
- setItem(xpath + "/user-context", repr, LeafBaseType::String);
+ ConstElementPtr hosts = elem->get("reservations");
+ if (hosts && !hosts->empty()) {
+ setHosts(xpath, hosts);
+ }
+
+ if (model_ == KEA_DHCP6_SERVER) {
+ checkAndSetLeaf(elem, xpath, "interface-id", LeafBaseType::String);
+ checkAndSetLeaf(elem, xpath, "max-preferred-lifetime", LeafBaseType::Uint32);
+ checkAndSetLeaf(elem, xpath, "min-preferred-lifetime", LeafBaseType::Uint32);
+ checkAndSetLeaf(elem, xpath, "preferred-lifetime", LeafBaseType::Uint32);
+ checkAndSetLeaf(elem, xpath, "rapid-commit", LeafBaseType::Bool);
+
+ pools = elem->get("pd-pools");
+ if (pools && !pools->empty()) {
+ setPdPools(xpath, pools);
+ }
+ } else {
+ checkAndSetLeaf(elem, xpath, "authoritative", LeafBaseType::Bool);
+ checkAndSetLeaf(elem, xpath, "boot-file-name", LeafBaseType::String);
+ checkAndSetLeaf(elem, xpath, "match-client-id", LeafBaseType::Bool);
+ checkAndSetLeaf(elem, xpath, "max-preferred-lifetime", LeafBaseType::Uint32);
+ checkAndSetLeaf(elem, xpath, "min-preferred-lifetime", LeafBaseType::Uint32);
+ checkAndSetLeaf(elem, xpath, "next-server", LeafBaseType::String);
+ checkAndSetLeaf(elem, xpath, "preferred-lifetime", LeafBaseType::Uint32);
+ checkAndSetLeaf(elem, xpath, "rapid-commit", LeafBaseType::Bool);
+ checkAndSetLeaf(elem, xpath, "server-hostname", LeafBaseType::String);
+
+ checkAndSetDivergingLeaf(elem, xpath, "4o6-interface", "subnet-4o6-interface", LeafBaseType::String);
+ checkAndSetDivergingLeaf(elem, xpath, "4o6-interface-id", "subnet-4o6-interface-id", LeafBaseType::String);
+ checkAndSetDivergingLeaf(elem, xpath, "4o6-subnet", "subnet-4o6-subnet", LeafBaseType::String);
}
+ checkAndSetUserContext(elem, xpath);
}
TranslatorSubnets::TranslatorSubnets(Session session, const string& model)