Commit a85cff7a authored by Razvan Becheriu's avatar Razvan Becheriu
Browse files

fixed pull request

parent ab83d427
......@@ -461,7 +461,7 @@ be followed by a comma and another object definition.</para>
</screen>
For Cassandra, multiple contact points can be provided:
<screen>
"Dhcp4": { "lease-database": { <userinput>"contact_points": "<replaceable>remote-host-name[, ...] </replaceable>"</userinput>, ... }, ... }
"Dhcp4": { "lease-database": { <userinput>"contact-points": "<replaceable>remote-host-name[, ...] </replaceable>"</userinput>, ... }, ... }
</screen>
The usual state of affairs will be to have the database on the same machine as
the DHCPv4 server. In this case, set the value to the empty string:
......@@ -470,7 +470,7 @@ be followed by a comma and another object definition.</para>
</screen>
For Cassandra:
<screen>
"Dhcp4": { "lease-database": { <userinput>"contact_points": ""</userinput>, ... }, ... }
"Dhcp4": { "lease-database": { <userinput>"contact-points": ""</userinput>, ... }, ... }
</screen>
Should the database use a port different than default, it may be
specified as well:
......
......@@ -456,7 +456,7 @@ be followed by a comma and another object definition.</para>
</screen>
For Cassandra, multiple contact points can be provided:
<screen>
"Dhcp6": { "lease-database": { <userinput>"contact_points": "<replaceable>remote-host-name[, ...]</replaceable>" </userinput>, ... }, ... }
"Dhcp6": { "lease-database": { <userinput>"contact-points": "<replaceable>remote-host-name[, ...]</replaceable>" </userinput>, ... }, ... }
</screen>
The usual state of affairs will be to have the database on the same machine as
the DHCPv6 server. In this case, set the value to the empty string:
......@@ -465,7 +465,7 @@ be followed by a comma and another object definition.</para>
</screen>
For Cassandra:
<screen>
"Dhcp6": { "lease-database": { <userinput>"contact_points": ""</userinput>, ... }, ... }
"Dhcp6": { "lease-database": { <userinput>"contact-points": ""</userinput>, ... }, ... }
</screen>
Should the database use a port different than default, it may be
specified as well:
......
......@@ -3204,7 +3204,7 @@ const char* UNPARSED_CONFIGS[] = {
" {\n"
" \"always-send\": false,\n"
" \"code\": 7,\n"
" \"csv-format\": false,\n"
" \"csv-format\": true,\n"
" \"data\": \"01\",\n"
" \"name\": \"preference\",\n"
" \"space\": \"dhcp6\"\n"
......
......@@ -108,7 +108,7 @@ CfgDbAccess::toElementDbAccessString(const std::string& dbaccess) {
(keyword == "password") ||
(keyword == "host") ||
(keyword == "name") ||
(keyword == "contact_points") ||
(keyword == "contact-points") ||
(keyword == "keyspace")) {
result->set(keyword, Element::create(value));
} else {
......
......@@ -169,9 +169,9 @@ CfgOption::mergeInternal(const OptionSpaceContainer<OptionContainer,
// If there is no such option in the destination container,
// add one.
if (std::distance(range.first, range.second) == 0) {
dest_container.addItem(OptionDescriptor(src_opt->option_,
src_opt->persistent_),
*it);
dest_container.addItem(OptionDescriptor(
src_opt->option_, src_opt->persistent_,
src_opt->formatted_value_), *it);
}
}
}
......
......@@ -704,11 +704,12 @@ CqlExchange::~CqlExchange() {
void
CqlExchange::convertToDatabaseTime(const time_t& cltt,
const cass_int64_t& valid_lifetime,
const uint32_t& valid_lifetime,
cass_int64_t& expire) {
// Calculate expiry time. Store it in the 64-bit value so as we can
// Calculate expire time. Store it in the 64-bit value so as we can
// detect overflows.
cass_int64_t expire_time = static_cast<cass_int64_t>(cltt) + valid_lifetime;
cass_int64_t expire_time = static_cast<cass_int64_t>(cltt) +
static_cast<cass_int64_t>(valid_lifetime);
if (expire_time > DatabaseConnection::MAX_DB_TIME) {
isc_throw(BadValue,
......
......@@ -139,7 +139,7 @@ public:
/// @name Time conversion:
/// @{
static void convertToDatabaseTime(const time_t& cltt,
const cass_int64_t& valid_lifetime,
const uint32_t& valid_lifetime,
cass_int64_t& expire);
static void convertFromDatabaseTime(const cass_int64_t& expire,
const cass_int64_t& valid_lifetime,
......
......@@ -33,10 +33,6 @@ namespace dhcp {
static constexpr size_t HOSTNAME_MAX_LEN = 255u;
static constexpr size_t ADDRESS6_TEXT_MAX_LEN = 39u;
static const CassBlob NULL_HWADDR({0x00, 0x00, 0x00, 0x00, 0x00, 0x00});
static const CassBlob NULL_CLIENTID({0x00, 0x00, 0x00, 0x00, 0x00, 0x00});
static const CassBlob NULL_PRIVACY_HASH({0x00, 0x00, 0x00, 0x00, 0x00, 0x00});
/// @brief Common CQL and Lease Data Methods
///
/// The CqlLease4Exchange and CqlLease6Exchange classes provide the
......@@ -343,7 +339,7 @@ CqlLease4Exchange::createBindForInsert(const Lease4Ptr &lease, AnyArray &data) {
}
// valid lifetime: bigint
valid_lifetime_ = static_cast<cass_int32_t>(lease_->valid_lft_);
valid_lifetime_ = static_cast<cass_int64_t>(lease_->valid_lft_);
// expire: bigint
// The lease structure holds the client last transmission time
......@@ -442,7 +438,7 @@ CqlLease4Exchange::createBindForUpdate(
}
// valid lifetime: bigint
valid_lifetime_ = static_cast<cass_int32_t>(lease_->valid_lft_);
valid_lifetime_ = static_cast<cass_int64_t>(lease_->valid_lft_);
// expire: bigint
// The lease structure holds the client last transmission time
......@@ -600,14 +596,6 @@ CqlLease4Exchange::retrieve() {
uint32_t addr4 = static_cast<uint32_t>(address_);
if (hwaddr->hwaddr_ == NULL_HWADDR) {
hwaddr->hwaddr_.clear();
}
if (client_id_ == NULL_CLIENTID) {
client_id_.clear();
}
Lease4Ptr result(new Lease4(addr4, hwaddr, client_id_.data(),
client_id_.size(), valid_lifetime_, 0, 0,
cltt, subnet_id_, fqdn_fwd_, fqdn_rev_,
......@@ -1202,7 +1190,7 @@ CqlLease6Exchange::createBindForDelete(
// Set up the structures for the various components of the lease4
// structure.
try {
// address: int
// address: varchar
// The address in the Lease structure is an IOAddress object.
// Convert this to an integer for storage.
address_ = address.toText();
......@@ -1326,10 +1314,6 @@ CqlLease6Exchange::retrieve() {
hwaddr->source_ = hwaddr_source_;
}
if (hwaddr && hwaddr->hwaddr_ == NULL_HWADDR) {
hwaddr.reset();
}
// Create the lease and set the cltt (after converting from the
// expire time retrieved from the database).
Lease6Ptr result(
......
This diff is collapsed.
......@@ -64,7 +64,6 @@ namespace dhcp {
/// @brief Pair containing major and minor versions
typedef std::pair<uint32_t, uint32_t> VersionPair;
/// @brief Contains a single row of lease statistical data
///
/// The contents of the row consist of a subnet ID, a lease
......
......@@ -1047,12 +1047,6 @@ Memfile_LeaseMgr::getDescription() const {
return (std::string("In memory database with leases stored in a CSV file."));
}
bool Memfile_LeaseMgr::startTransaction() {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MEMFILE_BEGIN_TRANSACTION);
return true;
}
void
Memfile_LeaseMgr::commit() {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MEMFILE_COMMIT);
......
......@@ -420,12 +420,6 @@ public:
return (std::make_pair(MAJOR_VERSION, MINOR_VERSION));
}
/// @brief Start Transaction
///
/// Start transaction for database operations. On databases that don't
/// support transactions, this is a no-op.
virtual bool startTransaction();
/// @brief Commit Transactions
///
/// Commits all pending database operations. On databases that don't
......
......@@ -430,7 +430,7 @@ TEST_F(CqlLeaseMgrTest, getType) {
/// This test checks that the conversion is correct.
TEST_F(CqlLeaseMgrTest, checkTimeConversion) {
const time_t cltt = time(NULL);
const cass_int64_t valid_lft = 86400; // 1 day
const uint32_t valid_lft = 86400; // 1 day
cass_int64_t cql_expire;
// Convert to the database time.
......
......@@ -268,12 +268,6 @@ public:
return (make_pair(uint32_t(0), uint32_t(0)));
}
/// @brief Start Transaction
///
/// Start transaction for database operations. On databases that don't
/// support transactions, this is a no-op.
virtual bool startTransaction() { return true; };
/// @brief Commit transactions
virtual void commit() {
}
......
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