"ddns-qualifying-suffix": "",
"ddns-update-on-renew": false,
"ddns-use-conflict-resolution": true,
- "ddns-ttl-percent": 0.75,
"hostname-char-set": "",
"hostname-char-replacement": ""
...
"ddns-qualifying-suffix": "",
"ddns-update-on-renew": false,
"ddns-use-conflict-resolution": true,
- "ddns-ttl-percent": 0.75,
"hostname-char-set": "",
"hostname-char-replacement": ""
...
}
}
-// Verify that ddns-ttl-percent can be used to calculate
-// NCR lifetime.
+// Verify that when specified ddns-ttl-percent is used to calculate
+// the lease length in an NCR.
TEST_F(FqdnDhcpv6SrvTest, ddnsTtlPercent) {
// Create Reply message with Client Id and Server id.
Pkt6Ptr answer = generateMessageWithIds(DHCPV6_REPLY);
0, 500, "", false, subnet_->getDdnsTtlPercent());
}
-
} // end of anonymous namespace
/// @param label Client identification information in the textual format.
/// This is used for logging purposes.
/// @param subnet subnet to which the lease belongs.
-/// use conflict resolution.
///
/// @tparam LeasePtrType Pointer to a lease.
/// @tparam IdentifierType HW Address, Client Identifier or DUID.
uint32_t calculateDdnsTtl(uint32_t lease_lft, const util::Optional<double>& ddns_ttl_percent) {
// If we have a configured percentage use it to calculate TTL.
- if (!ddns_ttl_percent.unspecified() && (ddns_ttl_percent.get() > 0.0000)) {
+ if (!ddns_ttl_percent.unspecified() && (ddns_ttl_percent.get() > 0.0)) {
uint32_t new_lft = static_cast<uint32_t>(round(ddns_ttl_percent.get() * lease_lft));
if (new_lft > 0) {
return (new_lft);
/// - ddns-generated-prefix
/// - ddns-qualifying-suffix
/// - ddns-use-conflict-resolution
+ /// - ddns-update-on-renew
/// - ddns-ttl-percent
///
/// @param network_data Data element holding shared network
/// This value, if greater than zero, is used to calculate the lease lifetime
/// passed to D2 in the NCR. Otherwise the value is calculated per RFC 4702.
///
- /// @return True if conflict resolution should be used.
+ /// @return TTL percent as an Optional.
util::Optional<double> getTtlPercent() const;
/// @brief Returns the subnet-id of the subnet associated with these parameters
auto offer_lft = cclass->getOfferLft();
ASSERT_FALSE(offer_lft.unspecified());
- EXPECT_EQ(99, offer_lft);
+ EXPECT_EQ(99, offer_lft.get());
}
// Test verifies that the parser rejects bogus offer-lifetime value.
"000001E356D43E5F0A496D65BCA24D982D646140813E3"
"B03AB370BFF46BFA309AE7BFD", true, ttl_percent);
}
+
+ double dnum = -1.0;
+ uint32_t inum = static_cast<uint32_t>(round(dnum * 3400));
+ std::cout << "inums is: " << inum << std::endl;
}