// Template class flag that holds the expression used to generate the names for all
// the spawned subclasses. In this case, the classes are named after the client ID.
- "template-test": "substring(option[1].hex, 0, all)"
+ "template-test": "substring(option[61].hex, 0, all)"
}
],
// Unsigned 64 bit integer.
xpath = "/keatest-module:main/ui64";
- uint32_t u64(64);
+ uint64_t u64(64);
value = to_string(u64);
EXPECT_NO_THROW_LOG(sess.setItem(xpath, value));
sess.applyChanges();
// Signed 64 bit integer.
xpath = "/keatest-module:main/i64";
- int32_t s64(64);
+ int64_t s64(64);
value = to_string(s64);
EXPECT_NO_THROW_LOG(sess.setItem(xpath, value));
sess.applyChanges();
EXPECT_NO_THROW_LOG(sess.applyChanges());
xpath = "/keatest-module:main/ui64";
- uint32_t u64(64);
+ uint64_t u64(64);
value = to_string(u64);
EXPECT_NO_THROW_LOG(sess.setItem(xpath, value));
EXPECT_NO_THROW_LOG(sess.applyChanges());
EXPECT_NO_THROW_LOG(sess.applyChanges());
xpath = "/keatest-module:main/i64";
- int32_t s64(64);
+ int64_t s64(64);
value = to_string(s64);
EXPECT_NO_THROW_LOG(sess.setItem(xpath, value));
EXPECT_NO_THROW_LOG(sess.applyChanges());
}
}
-void Translator::checkAndSetLeaf(ConstElementPtr const& from,
- string const& xpath,
- string const& name,
- LeafBaseType const type) {
+void
+Translator::checkAndSetLeaf(ConstElementPtr const& from,
+ string const& xpath,
+ string const& name,
+ LeafBaseType const type) {
ConstElementPtr const& x(from->get(name));
if (x) {
setItem(xpath + "/" + name, x, type);
}
}
-void Translator::checkAndSetDivergingLeaf(ConstElementPtr const& from,
- string const& xpath,
- string const& name,
- string const& yang_name,
- LeafBaseType const type) {
+void
+Translator::checkAndSetDivergingLeaf(ConstElementPtr const& from,
+ string const& xpath,
+ string const& name,
+ string const& yang_name,
+ LeafBaseType const type) {
ConstElementPtr const& x(from->get(name));
if (x) {
setItem(xpath + "/" + yang_name, x, type);
}
}
-void Translator::checkAndSetLeafList(ConstElementPtr const& from,
- string const& xpath,
- string const& name,
- LeafBaseType const type) {
+void
+Translator::checkAndSetLeafList(ConstElementPtr const& from,
+ string const& xpath,
+ string const& name,
+ LeafBaseType const type) {
ConstElementPtr const& leaf_list(from->get(name));
if (leaf_list && !leaf_list->empty()) {
for (ElementPtr const& leaf : leaf_list->listValue()) {
}
}
-void Translator::checkAndSetUserContext(ConstElementPtr const& from,
- string const& xpath) {
+void
+Translator::checkAndSetUserContext(ConstElementPtr const& from,
+ string const& xpath) {
ConstElementPtr const& user_context(Adaptor::getContext(from));
if (user_context) {
setItem(xpath + "/user-context", Element::create(user_context->str()),
storage->set(name, x);
}
-bool Translator::schemaNodeExists(string const& xpath) const {
+bool
+Translator::schemaNodeExists(string const& xpath) const {
Context const& context(session_.getContext());
try {
context.findPath(xpath);
///
/// @param storage ElementMap where result will be stored
/// @param data_node parent data node of container type
- /// @param name name of the parameter
+ /// @param name the name of the YANG node which should also match the map
+ /// key in the JSON configuration
///
/// @throw MissingNode if leaf is not found
void getMandatoryLeaf(isc::data::ElementPtr& storage,
///
/// @param storage ElementMap where result will be stored
/// @param data_node parent data node of container type
- /// @param name name of the parameter
+ /// @param name the map key in the JSON configuration
/// @param yang_name the name by which to find the parameter in the YANG data node
///
+
/// @throw MissingNode if leaf is not found
void getMandatoryDivergingLeaf(isc::data::ElementPtr& storage,
libyang::DataNode const& data_node,
///
/// @param from the parent configuration node from which to take the value
/// @param xpath the xpath to the YANG node without the last node
- /// @param name the name of the YANG node which should also match the map
- /// key in the JSON configuration
+ /// @param name the map key in the JSON configuration
/// @param yang_name the name by which to find the parameter in the YANG data node
/// @param type the YANG node type
void setMandatoryDivergingLeaf(isc::data::ConstElementPtr const& from,
if (options) {
result->set("option-data", options);
}
- ConstElementPtr defs = getOptionDefList(data_node);
- if (defs) {
- result->set("option-def", defs);
- }
if (model_ == KEA_DHCP4_SERVER) {
checkAndGetLeaf(result, data_node, "boot-file-name");
checkAndGetLeaf(result, data_node, "next-server");
checkAndGetLeaf(result, data_node, "server-hostname");
+
+ ConstElementPtr defs = getOptionDefList(data_node);
+ if (defs) {
+ result->set("option-def", defs);
+ }
} else if (model_ == KEA_DHCP6_SERVER) {
checkAndGetLeaf(result, data_node, "max-preferred-lifetime");
checkAndGetLeaf(result, data_node, "min-preferred-lifetime");
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);
- checkAndSetLeaf(elem, xpath, "valid-lifetime", LeafBaseType::Uint32);
- 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, "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);
from YANG to Element.
- @c isc::yang::Translator::getList() retrieves a list from sysrepo and
- translates it form YANG to Element.
+ translates it from YANG to Element.
- @c isc::yang::Translator::getMandatoryLeaf() fetches a leaf that is expected
to be present in the YANG data node, most of the time a YANG key.