summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/bin/lfc/tests/lfc_controller_unittests.cc42
-rw-r--r--src/lib/dhcpsrv/csv_lease_file4.cc9
-rw-r--r--src/lib/dhcpsrv/csv_lease_file4.h24
-rw-r--r--src/lib/dhcpsrv/csv_lease_file6.cc22
-rw-r--r--src/lib/dhcpsrv/csv_lease_file6.h44
-rw-r--r--src/lib/dhcpsrv/tests/csv_lease_file4_unittest.cc17
-rw-r--r--src/lib/dhcpsrv/tests/csv_lease_file6_unittest.cc19
-rw-r--r--src/lib/dhcpsrv/tests/lease_file_loader_unittest.cc54
-rw-r--r--src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc214
9 files changed, 212 insertions, 233 deletions
diff --git a/src/bin/lfc/tests/lfc_controller_unittests.cc b/src/bin/lfc/tests/lfc_controller_unittests.cc
index cd7e12ce55..6c734a5412 100644
--- a/src/bin/lfc/tests/lfc_controller_unittests.cc
+++ b/src/bin/lfc/tests/lfc_controller_unittests.cc
@@ -90,11 +90,11 @@ protected:
cstr_ = base_dir + "/" + "config_file"; // config
v4_hdr_ = "address,hwaddr,client_id,valid_lifetime,expire,subnet_id,"
- "fqdn_fwd,fqdn_rev,hostname\n";
+ "fqdn_fwd,fqdn_rev,hostname,state\n";
v6_hdr_ = "address,duid,valid_lifetime,expire,subnet_id,"
"pref_lifetime,lease_type,iaid,prefix_len,fqdn_fwd,"
- "fqdn_rev,hostname,hwaddr\n";
+ "fqdn_rev,hostname,hwaddr,state\n";
// and remove any outstanding test files
removeTestFile();
@@ -402,26 +402,26 @@ TEST_F(LFCControllerTest, launch4) {
// We have several entries for different leases, the naming is:
// <lease letter>_<version#>
string a_1 = "192.0.2.1,06:07:08:09:0a:bc,,"
- "200,200,8,1,1,host.example.com\n";
+ "200,200,8,1,1,host.example.com,1\n";
string a_2 = "192.0.2.1,06:07:08:09:0a:bc,,"
- "200,500,8,1,1,host.example.com\n";
+ "200,500,8,1,1,host.example.com,1\n";
string a_3 = "192.0.2.1,06:07:08:09:0a:bc,,"
- "200,800,8,1,1,host.example.com\n";
+ "200,800,8,1,1,host.example.com,1\n";
string b_1 = "192.0.3.15,dd:de:ba:0d:1b:2e:3e:4f,0a:00:01:04,"
- "100,100,7,0,0,\n";
+ "100,100,7,0,0,,1\n";
string b_2 = "192.0.3.15,dd:de:ba:0d:1b:2e:3e:4f,0a:00:01:04,"
- "100,135,7,0,0,\n";
+ "100,135,7,0,0,,1\n";
string b_3 = "192.0.3.15,dd:de:ba:0d:1b:2e:3e:4f,0a:00:01:04,"
- "100,150,7,0,0,\n";
+ "100,150,7,0,0,,1\n";
string c_1 = "192.0.2.3,,a:11:01:04,"
- "200,200,8,1,1,host.example.com\n";
+ "200,200,8,1,1,host.example.com,1\n";
string d_1 = "192.0.2.5,16:17:18:19:1a:bc,,"
- "200,200,8,1,1,host.example.com\n";
+ "200,200,8,1,1,host.example.com,1\n";
string d_2 = "192.0.2.5,16:17:18:19:1a:bc,,"
- "0,200,8,1,1,host.example.com\n";
+ "0,200,8,1,1,host.example.com,1\n";
// Subtest 1: both previous and copy available.
// Create the test previous file
@@ -556,27 +556,27 @@ TEST_F(LFCControllerTest, launch6) {
// We have several entries for different leases, the naming is:
// <lease letter>_<version#>.
string a_1 = "2001:db8:1::1,00:01:02:03:04:05:06:0a:0b:0c:0d:0e:0f,"
- "200,200,8,100,0,7,0,1,1,host.example.com,\n";
- string a_2 = "2001:db8:1::1,,200,200,8,100,0,7,0,1,1,host.example.com,\n";
+ "200,200,8,100,0,7,0,1,1,host.example.com,,1\n";
+ string a_2 = "2001:db8:1::1,,200,200,8,100,0,7,0,1,1,host.example.com,,1\n";
string a_3 = "2001:db8:1::1,00:01:02:03:04:05:06:0a:0b:0c:0d:0e:0f,"
- "200,400,8,100,0,7,0,1,1,host.example.com,\n";
+ "200,400,8,100,0,7,0,1,1,host.example.com,,1\n";
string a_4 = "2001:db8:1::1,00:01:02:03:04:05:06:0a:0b:0c:0d:0e:0f,"
- "0,200,8,100,0,7,0,1,1,host.example.com,\n";
+ "0,200,8,100,0,7,0,1,1,host.example.com,,1\n";
string b_1 = "2001:db8:2::10,01:01:01:01:0a:01:02:03:04:05,"
- "300,300,6,150,0,8,0,0,0,,\n";
+ "300,300,6,150,0,8,0,0,0,,,1\n";
string b_2 = "2001:db8:2::10,01:01:01:01:0a:01:02:03:04:05,"
- "300,800,6,150,0,8,0,0,0,,\n";
+ "300,800,6,150,0,8,0,0,0,,,1\n";
string b_3 = "2001:db8:2::10,01:01:01:01:0a:01:02:03:04:05,"
- "300,1000,6,150,0,8,0,0,0,,\n";
+ "300,1000,6,150,0,8,0,0,0,,,1\n";
string c_1 = "3000:1::,00:01:02:03:04:05:06:0a:0b:0c:0d:0e:0f,"
- "100,200,8,0,2,16,64,0,0,,\n";
+ "100,200,8,0,2,16,64,0,0,,,1\n";
string c_2 = "3000:1::,00:01:02:03:04:05:06:0a:0b:0c:0d:0e:0f,"
- "100,400,8,0,2,16,64,0,0,,\n";
+ "100,400,8,0,2,16,64,0,0,,,1\n";
string d_1 = "2001:db8:1::3,00:01:02:03:04:05:06:0a:0b:0c:0d:0e:0f,"
- "200,600,8,100,0,7,0,1,1,host.example.com,\n";
+ "200,600,8,100,0,7,0,1,1,host.example.com,,1\n";
// Subtest 1: bot previous and copy available
// Create the test previous file
diff --git a/src/lib/dhcpsrv/csv_lease_file4.cc b/src/lib/dhcpsrv/csv_lease_file4.cc
index 8ed0e82f31..844971e493 100644
--- a/src/lib/dhcpsrv/csv_lease_file4.cc
+++ b/src/lib/dhcpsrv/csv_lease_file4.cc
@@ -59,6 +59,7 @@ CSVLeaseFile4::append(const Lease4& lease) {
row.writeAt(getColumnIndex("fqdn_fwd"), lease.fqdn_fwd_);
row.writeAt(getColumnIndex("fqdn_rev"), lease.fqdn_rev_);
row.writeAt(getColumnIndex("hostname"), lease.hostname_);
+ row.writeAt(getColumnIndex("state"), lease.state_);
try {
CSVFile::append(row);
@@ -115,6 +116,7 @@ CSVLeaseFile4::next(Lease4Ptr& lease) {
readFqdnFwd(row),
readFqdnRev(row),
readHostname(row)));
+ lease->state_ = readState(row);
} catch (std::exception& ex) {
// bump the read error count
@@ -144,6 +146,7 @@ CSVLeaseFile4::initColumns() {
addColumn("fqdn_fwd");
addColumn("fqdn_rev");
addColumn("hostname");
+ addColumn("state");
}
IOAddress
@@ -212,5 +215,11 @@ CSVLeaseFile4::readHostname(const CSVRow& row) {
return (hostname);
}
+uint32_t
+CSVLeaseFile4::readState(const util::CSVRow& row) {
+ uint32_t state = row.readAndConvertAt<uint32_t>(getColumnIndex("state"));
+ return (state);
+}
+
} // end of namespace isc::dhcp
} // end of namespace isc
diff --git a/src/lib/dhcpsrv/csv_lease_file4.h b/src/lib/dhcpsrv/csv_lease_file4.h
index 736316209d..7f302aba8b 100644
--- a/src/lib/dhcpsrv/csv_lease_file4.h
+++ b/src/lib/dhcpsrv/csv_lease_file4.h
@@ -102,6 +102,7 @@ private:
/// - fqdn_fwd
/// - fqdn_rev
/// - hostname
+ /// - state
void initColumns();
///
@@ -111,48 +112,53 @@ private:
///
/// @brief Reads lease address from the CSV file row.
///
- /// @param row CSV file holding lease values.
+ /// @param row CSV file row holding lease information.
asiolink::IOAddress readAddress(const util::CSVRow& row);
/// @brief Reads HW address from the CSV file row.
///
- /// @param row CSV file holding lease values.
+ /// @param row CSV file row holding lease information.
HWAddr readHWAddr(const util::CSVRow& row);
/// @brief Reads client identifier from the CSV file row.
///
- /// @param row CSV file holding lease values.
+ /// @param row CSV file row holding lease information.
ClientIdPtr readClientId(const util::CSVRow& row);
/// @brief Reads valid lifetime from the CSV file row.
///
- /// @param row CSV file holding lease values.
+ /// @param row CSV file row holding lease information.
uint32_t readValid(const util::CSVRow& row);
/// @brief Reads cltt value from the CSV file row.
///
- /// @param row CSV file holding lease values.
+ /// @param row CSV file row holding lease information.
time_t readCltt(const util::CSVRow& row);
/// @brief Reads subnet id from the CSV file row.
///
- /// @param row CSV file holding lease values.
+ /// @param row CSV file row holding lease information.
SubnetID readSubnetID(const util::CSVRow& row);
/// @brief Reads the FQDN forward flag from the CSV file row.
///
- /// @param row CSV file holding lease values.
+ /// @param row CSV file row holding lease information.
bool readFqdnFwd(const util::CSVRow& row);
/// @brief Reads the FQDN reverse flag from the CSV file row.
///
- /// @param row CSV file holding lease values.
+ /// @param row CSV file row holding lease information.
bool readFqdnRev(const util::CSVRow& row);
/// @brief Reads hostname from the CSV file row.
///
- /// @param row CSV file holding lease values.
+ /// @param row CSV file row holding lease information.
std::string readHostname(const util::CSVRow& row);
+
+ /// @brief Reads lease state from the CSV file row.
+ ///
+ /// @param row CSV file row holding lease information.
+ uint32_t readState(const util::CSVRow& row);
//@}
};
diff --git a/src/lib/dhcpsrv/csv_lease_file6.cc b/src/lib/dhcpsrv/csv_lease_file6.cc
index a8c0d50c90..2d0963f4c3 100644
--- a/src/lib/dhcpsrv/csv_lease_file6.cc
+++ b/src/lib/dhcpsrv/csv_lease_file6.cc
@@ -59,6 +59,7 @@ CSVLeaseFile6::append(const Lease6& lease) {
// We may not have hardware information
row.writeAt(getColumnIndex("hwaddr"), lease.hwaddr_->toText(false));
}
+ row.writeAt(getColumnIndex("state"), lease.state_);
try {
CSVFile::append(row);
} catch (const std::exception&) {
@@ -100,6 +101,7 @@ CSVLeaseFile6::next(Lease6Ptr& lease) {
lease->fqdn_fwd_ = readFqdnFwd(row);
lease->fqdn_rev_ = readFqdnRev(row);
lease->hostname_ = readHostname(row);
+ lease->state_ = readState(row);
} catch (std::exception& ex) {
// bump the read error count
@@ -133,6 +135,7 @@ CSVLeaseFile6::initColumns() {
addColumn("fqdn_rev");
addColumn("hostname");
addColumn("hwaddr");
+ addColumn("state");
}
Lease::Type
@@ -239,21 +242,10 @@ CSVLeaseFile6::readHWAddr(const CSVRow& row) {
}
}
-bool
-CSVLeaseFile6::validateHeader(const isc::util::CSVRow& header) {
-
- if (!CSVFile::validateHeader(header)) {
-
- // One possible validation failure is that we're reading Kea 0.9
- // lease file that didn't have hwaddr column. Let's add it and
- // try to revalidate.
- isc::util::CSVRow copy = header;
- copy.append("hwaddr");
- return CSVFile::validateHeader(copy);
- } else {
- return (true);
- }
-
+uint32_t
+CSVLeaseFile6::readState(const util::CSVRow& row) {
+ uint32_t state = row.readAndConvertAt<uint32_t>(getColumnIndex("state"));
+ return (state);
}
} // end of namespace isc::dhcp
diff --git a/src/lib/dhcpsrv/csv_lease_file6.h b/src/lib/dhcpsrv/csv_lease_file6.h
index 2c2a0f6f86..e4b221f72f 100644
--- a/src/lib/dhcpsrv/csv_lease_file6.h
+++ b/src/lib/dhcpsrv/csv_lease_file6.h
@@ -87,18 +87,6 @@ public:
/// ticket http://kea.isc.org/ticket/2405 is implemented.
bool next(Lease6Ptr& lease);
-protected:
- /// @brief This function validates the header of the Lease6 CSV file.
- ///
- /// It works similar to @c CSVFile::validateHeader, but if the validation
- /// fails, it attempts to add hwaddr column and retry validation.
- /// That's useful when attmepting to read CSV file generated in 0.9
- /// (did not have hwaddr field) in 0.9.1 or later code.
- ///
- /// @param header A row holding a header.
- /// @return true if header matches the columns; false otherwise.
- virtual bool validateHeader(const isc::util::CSVRow& header);
-
private:
/// @brief Initializes columns of the CSV file holding leases.
@@ -117,6 +105,7 @@ private:
/// - fqdn_rev
/// - hostname
/// - hwaddr
+ /// - state
void initColumns();
///
@@ -126,69 +115,74 @@ private:
///
/// @brief Reads lease type from the CSV file row.
///
- /// @param row CSV file holding lease values.
+ /// @param row CSV file row holding lease information.
Lease::Type readType(const util::CSVRow& row);
/// @brief Reads lease address from the CSV file row.
///
- /// @param row CSV file holding lease values.
+ /// @param row CSV file row holding lease information.
asiolink::IOAddress readAddress(const util::CSVRow& row);
/// @brief Reads DUID from the CSV file row.
///
- /// @param row CSV file holding lease values.
+ /// @param row CSV file row holding lease information.
DuidPtr readDUID(const util::CSVRow& row);
/// @brief Reads IAID from the CSV file row.
///
- /// @param row CSV file holding lease values.
+ /// @param row CSV file row holding lease information.
uint32_t readIAID(const util::CSVRow& row);
/// @brief Reads preferred lifetime from the CSV file row.
///
- /// @param row CSV file holding lease values.
+ /// @param row CSV file row holding lease information.
uint32_t readPreferred(const util::CSVRow& row);
/// @brief Reads valid lifetime from the CSV file row.
///
- /// @param row CSV file holding lease values.
+ /// @param row CSV file row holding lease information.
uint32_t readValid(const util::CSVRow& row);
/// @brief Reads cltt value from the CSV file row.
///
- /// @param row CSV file holding lease values.
+ /// @param row CSV file row holding lease information.
uint32_t readCltt(const util::CSVRow& row);
/// @brief Reads subnet id from the CSV file row.
///
- /// @param row CSV file holding lease values.
+ /// @param row CSV file row holding lease information.
SubnetID readSubnetID(const util::CSVRow& row);
/// @brief Reads prefix length from the CSV file row.
///
- /// @param row CSV file holding lease values.
+ /// @param row CSV file row holding lease information.
uint8_t readPrefixLen(const util::CSVRow& row);
/// @brief Reads the FQDN forward flag from the CSV file row.
///
- /// @param row CSV file holding lease values.
+ /// @param row CSV file row holding lease information.
bool readFqdnFwd(const util::CSVRow& row);
/// @brief Reads the FQDN reverse flag from the CSV file row.
///
- /// @param row CSV file holding lease values.
+ /// @param row CSV file row holding lease information.
bool readFqdnRev(const util::CSVRow& row);
/// @brief Reads hostname from the CSV file row.
///
- /// @param row CSV file holding lease values.
+ /// @param row CSV file row holding lease information.
std::string readHostname(const util::CSVRow& row);
/// @brief Reads HW address from the CSV file row.
///
- /// @param row CSV file holding lease values.
+ /// @param row CSV file row holding lease information.
/// @return pointer to the HWAddr structure that was read
HWAddrPtr readHWAddr(const util::CSVRow& row);
+
+ /// @brief Reads lease state from the CSV file row.
+ ///
+ /// @param row CSV file row holding lease information.
+ uint32_t readState(const util::CSVRow& row);
//@}
};
diff --git a/src/lib/dhcpsrv/tests/csv_lease_file4_unittest.cc b/src/lib/dhcpsrv/tests/csv_lease_file4_unittest.cc
index d0d16604b9..1ee961db8a 100644
--- a/src/lib/dhcpsrv/tests/csv_lease_file4_unittest.cc
+++ b/src/lib/dhcpsrv/tests/csv_lease_file4_unittest.cc
@@ -111,12 +111,12 @@ CSVLeaseFile4Test::absolutePath(const std::string& filename) {
void
CSVLeaseFile4Test::writeSampleFile() const {
io_.writeFile("address,hwaddr,client_id,valid_lifetime,expire,subnet_id,"
- "fqdn_fwd,fqdn_rev,hostname\n"
+ "fqdn_fwd,fqdn_rev,hostname,state\n"
"192.0.2.1,06:07:08:09:0a:bc,,200,200,8,1,1,"
- "host.example.com\n"
- "192.0.2.1,,a:11:01:04,200,200,8,1,1,host.example.com\n"
+ "host.example.com,1\n"
+ "192.0.2.1,,a:11:01:04,200,200,8,1,1,host.example.com,1\n"
"192.0.3.15,dd:de:ba:0d:1b:2e:3e:4f,0a:00:01:04,100,100,7,"
- "0,0,\n");
+ "0,0,,2\n");
}
// This test checks the capability to read and parse leases from the file.
@@ -153,6 +153,7 @@ TEST_F(CSVLeaseFile4Test, parse) {
EXPECT_TRUE(lease->fqdn_fwd_);
EXPECT_TRUE(lease->fqdn_rev_);
EXPECT_EQ("host.example.com", lease->hostname_);
+ EXPECT_EQ(Lease::STATE_DEFAULT, lease->state_);
}
// Second lease is malformed - HW address is empty.
@@ -182,6 +183,7 @@ TEST_F(CSVLeaseFile4Test, parse) {
EXPECT_FALSE(lease->fqdn_fwd_);
EXPECT_FALSE(lease->fqdn_rev_);
EXPECT_TRUE(lease->hostname_.empty());
+ EXPECT_EQ(Lease::STATE_DECLINED, lease->state_);
}
// There are no more leases. Reading should cause no error, but the returned
@@ -217,6 +219,7 @@ TEST_F(CSVLeaseFile4Test, recreate) {
NULL, 0,
200, 50, 80, 0, 8, true, true,
"host.example.com"));
+ lease->state_ = Lease::STATE_EXPIRED_RECLAIMED;
{
SCOPED_TRACE("First write");
ASSERT_NO_THROW(lf->append(*lease));
@@ -238,10 +241,10 @@ TEST_F(CSVLeaseFile4Test, recreate) {
lf->close();
// Check that the contents of the csv file are correct.
EXPECT_EQ("address,hwaddr,client_id,valid_lifetime,expire,subnet_id,"
- "fqdn_fwd,fqdn_rev,hostname\n"
- "192.0.3.2,00:01:02:03:04:05,,200,200,8,1,1,host.example.com\n"
+ "fqdn_fwd,fqdn_rev,hostname,state\n"
+ "192.0.3.2,00:01:02:03:04:05,,200,200,8,1,1,host.example.com,4\n"
"192.0.3.10,0d:0e:0a:0d:0b:0e:0e:0f,01:02:03:04,100,100,7,0,"
- "0,\n",
+ "0,,1\n",
io_.readFile());
}
diff --git a/src/lib/dhcpsrv/tests/csv_lease_file6_unittest.cc b/src/lib/dhcpsrv/tests/csv_lease_file6_unittest.cc
index 7735f1a15f..a012a1d35f 100644
--- a/src/lib/dhcpsrv/tests/csv_lease_file6_unittest.cc
+++ b/src/lib/dhcpsrv/tests/csv_lease_file6_unittest.cc
@@ -110,14 +110,14 @@ void
CSVLeaseFile6Test::writeSampleFile() const {
io_.writeFile("address,duid,valid_lifetime,expire,subnet_id,"
"pref_lifetime,lease_type,iaid,prefix_len,fqdn_fwd,"
- "fqdn_rev,hostname,hwaddr\n"
+ "fqdn_rev,hostname,hwaddr,state\n"
"2001:db8:1::1,00:01:02:03:04:05:06:0a:0b:0c:0d:0e:0f,"
- "200,200,8,100,0,7,0,1,1,host.example.com\n"
- "2001:db8:1::1,,200,200,8,100,0,7,0,1,1,host.example.com\n"
+ "200,200,8,100,0,7,0,1,1,host.example.com,,1\n"
+ "2001:db8:1::1,,200,200,8,100,0,7,0,1,1,host.example.com,,1\n"
"2001:db8:2::10,01:01:01:01:0a:01:02:03:04:05,300,300,6,150,"
- "0,8,0,0,0,\n"
+ "0,8,0,0,0,,,1\n"
"3000:1::,00:01:02:03:04:05:06:0a:0b:0c:0d:0e:0f,0,200,8,0,2,"
- "16,64,0,0,,\n");
+ "16,64,0,0,,,1\n");
}
// This test checks the capability to read and parse leases from the file.
@@ -277,13 +277,14 @@ TEST_F(CSVLeaseFile6Test, recreate) {
}
EXPECT_EQ("address,duid,valid_lifetime,expire,subnet_id,pref_lifetime,"
- "lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname,hwaddr\n"
+ "lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname,hwaddr,"
+ "state\n"
"2001:db8:1::1,00:01:02:03:04:05:06:0a:0b:0c:0d:0e:0f,"
- "200,200,8,100,0,7,0,1,1,host.example.com,\n"
+ "200,200,8,100,0,7,0,1,1,host.example.com,,1\n"
"2001:db8:2::10,01:01:01:01:0a:01:02:03:04:05"
- ",300,300,6,150,0,8,128,0,0,,\n"
+ ",300,300,6,150,0,8,128,0,0,,,1\n"
"3000:1:1::,00:01:02:03:04:05:06:0a:0b:0c:0d:0e:0f,"
- "300,300,10,150,2,7,64,0,0,,\n",
+ "300,300,10,150,2,7,64,0,0,,,1\n",
io_.readFile());
}
diff --git a/src/lib/dhcpsrv/tests/lease_file_loader_unittest.cc b/src/lib/dhcpsrv/tests/lease_file_loader_unittest.cc
index 76c3b1dea2..e51822a5c5 100644
--- a/src/lib/dhcpsrv/tests/lease_file_loader_unittest.cc
+++ b/src/lib/dhcpsrv/tests/lease_file_loader_unittest.cc
@@ -151,11 +151,11 @@ protected:
/// @brief Sets up the header strings
virtual void SetUp() {
v4_hdr_ = "address,hwaddr,client_id,valid_lifetime,expire,subnet_id,"
- "fqdn_fwd,fqdn_rev,hostname\n";
+ "fqdn_fwd,fqdn_rev,hostname,state\n";
v6_hdr_ = "address,duid,valid_lifetime,expire,subnet_id,"
"pref_lifetime,lease_type,iaid,prefix_len,fqdn_fwd,"
- "fqdn_rev,hostname,hwaddr\n";
+ "fqdn_rev,hostname,hwaddr,state\n";
}
};
@@ -179,17 +179,17 @@ LeaseFileLoaderTest::absolutePath(const std::string& filename) {
TEST_F(LeaseFileLoaderTest, loadWrite4) {
std::string test_str;
std::string a_1 = "192.0.2.1,06:07:08:09:0a:bc,,"
- "200,200,8,1,1,host.example.com\n";
+ "200,200,8,1,1,host.example.com,1\n";
std::string a_2 = "192.0.2.1,06:07:08:09:0a:bc,,"
- "200,500,8,1,1,host.example.com\n";
+ "200,500,8,1,1,host.example.com,1\n";
std::string b_1 = "192.0.3.15,dd:de:ba:0d:1b:2e:3e:4f,0a:00:01:04,"
- "100,100,7,0,0,\n";
+ "100,100,7,0,0,,1\n";
std::string b_2 = "192.0.3.15,dd:de:ba:0d:1b:2e:3e:4f,0a:00:01:04,"
- "100,135,7,0,0,\n";
+ "100,135,7,0,0,,1\n";
std::string c_1 = "192.0.2.3,,a:11:01:04,"
- "200,200,8,1,1,host.example.com\n";
+ "200,200,8,1,1,host.example.com,1\n";
// Create lease file with leases for 192.0.2.1, 192.0.3.15. The lease
// entry for the 192.0.2.3 is invalid (lacks HW address) and should
@@ -250,14 +250,14 @@ TEST_F(LeaseFileLoaderTest, loadWrite4) {
TEST_F(LeaseFileLoaderTest, loadWrite4LeaseRemove) {
std::string test_str;
std::string a_1 = "192.0.2.1,06:07:08:09:0a:bc,,"
- "200,200,8,1,1,host.example.com\n";
+ "200,200,8,1,1,host.example.com,1\n";
std::string a_2 = "192.0.2.1,06:07:08:09:0a:bc,,"
- "0,500,8,1,1,host.example.com\n";
+ "0,500,8,1,1,host.example.com,1\n";
std::string b_1 = "192.0.3.15,dd:de:ba:0d:1b:2e:3e:4f,0a:00:01:04,"
- "100,100,7,0,0,\n";
+ "100,100,7,0,0,,1\n";
std::string b_2 = "192.0.3.15,dd:de:ba:0d:1b:2e:3e:4f,0a:00:01:04,"
- "100,135,7,0,0,\n";
+ "100,135,7,0,0,,1\n";
// Create lease file in which one of the entries for 192.0.2.1
@@ -305,19 +305,19 @@ TEST_F(LeaseFileLoaderTest, loadWrite4LeaseRemove) {
TEST_F(LeaseFileLoaderTest, loadWrite6) {
std::string test_str;
std::string a_1 = "2001:db8:1::1,00:01:02:03:04:05:06:0a:0b:0c:0d:0e:0f,"
- "200,200,8,100,0,7,0,1,1,host.example.com,\n";
+ "200,200,8,100,0,7,0,1,1,host.example.com,,1\n";
std::string a_2 = "2001:db8:1::1,,"
- "200,200,8,100,0,7,0,1,1,host.example.com,\n";
+ "200,200,8,100,0,7,0,1,1,host.example.com,,1\n";
std::string a_3 = "2001:db8:1::1,00:01:02:03:04:05:06:0a:0b:0c:0d:0e:0f,"
- "200,400,8,100,0,7,0,1,1,host.example.com,\n";
+ "200,400,8,100,0,7,0,1,1,host.example.com,,1\n";
std::string b_1 = "2001:db8:2::10,01:01:01:01:0a:01:02:03:04:05,"
- "300,300,6,150,0,8,0,0,0,,\n";
+ "300,300,6,150,0,8,0,0,0,,,1\n";
std::string b_2 = "2001:db8:2::10,01:01:01:01:0a:01:02:03:04:05,"
- "300,800,6,150,0,8,0,0,0,,\n";
+ "300,800,6,150,0,8,0,0,0,,,1\n";
std::string c_1 = "3000:1::,00:01:02:03:04:05:06:0a:0b:0c:0d:0e:0f,"
- "100,200,8,0,2,16,64,0,0,,\n";
+ "100,200,8,0,2,16,64,0,0,,,1\n";
@@ -379,14 +379,14 @@ TEST_F(LeaseFileLoaderTest, loadWrite6) {
TEST_F(LeaseFileLoaderTest, loadWrite6LeaseRemove) {
std::string test_str;
std::string a_1 = "2001:db8:1::1,00:01:02:03:04:05:06:0a:0b:0c:0d:0e:0f,"
- "200,200,8,100,0,7,0,1,1,host.example.com,\n";
+ "200,200,8,100,0,7,0,1,1,host.example.com,,1\n";
std::string a_2 = "2001:db8:1::1,00:01:02:03:04:05:06:0a:0b:0c:0d:0e:0f,"
- "0,400,8,100,0,7,0,1,1,host.example.com,\n";
+ "0,400,8,100,0,7,0,1,1,host.example.com,,1\n";
std::string b_1 = "2001:db8:2::10,01:01:01:01:0a:01:02:03:04:05,"
- "300,300,6,150,0,8,0,0,0,,\n";
+ "300,300,6,150,0,8,0,0,0,,,1\n";
std::string b_2 = "2001:db8:2::10,01:01:01:01:0a:01:02:03:04:05,"
- "300,800,6,150,0,8,0,0,0,,\n";
+ "300,800,6,150,0,8,0,0,0,,,1\n";
// Create lease file in which one of the entries for the 2001:db8:1::1
// has valid lifetime set to 0, in which case the lease should be
@@ -431,13 +431,13 @@ TEST_F(LeaseFileLoaderTest, loadWrite6LeaseRemove) {
TEST_F(LeaseFileLoaderTest, loadMaxErrors) {
std::string test_str;
std::string a_1 = "192.0.2.1,06:07:08:09:0a:bc,,"
- "200,200,8,1,1,host.example.com\n";
+ "200,200,8,1,1,host.example.com,1\n";
std::string a_2 = "192.0.2.1,06:07:08:09:0a:bc,,"
- "200,500,8,1,1,host.example.com\n";
+ "200,500,8,1,1,host.example.com,1\n";
- std::string b_1 = "192.0.2.3,,a:11:01:04,200,200,8,1,1,host.example.com\n";
+ std::string b_1 = "192.0.2.3,,a:11:01:04,200,200,8,1,1,host.example.com,1\n";
- std::string c_1 = "192.0.2.10,01:02:03:04:05:06,,200,300,8,1,1,\n";
+ std::string c_1 = "192.0.2.10,01:02:03:04:05:06,,200,300,8,1,1,,1\n";
// Create a lease file for which there is a number of invalid
// entries. b_1 is invalid and gets used multiple times.
@@ -501,8 +501,8 @@ TEST_F(LeaseFileLoaderTest, loadMaxErrors) {
// and comparing that with the expected value.
TEST_F(LeaseFileLoaderTest, loadWriteLeaseWithZeroLifetime) {
std::string test_str;
- std::string a_1 = "192.0.2.1,06:07:08:09:0a:bc,,200,200,8,1,1,\n";
- std::string b_2 = "192.0.2.3,06:07:08:09:0a:bd,,0,200,8,1,1,\n";
+ std::string a_1 = "192.0.2.1,06:07:08:09:0a:bc,,200,200,8,1,1,,1\n";
+ std::string b_2 = "192.0.2.3,06:07:08:09:0a:bd,,0,200,8,1,1,,1\n";
// Create lease file. The second lease has a valid lifetime of 0.
test_str = v4_hdr_ + a_1 + b_2;
diff --git a/src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc b/src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc
index 1467e353db..51314b6140 100644
--- a/src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc
+++ b/src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc
@@ -404,20 +404,20 @@ TEST_F(MemfileLeaseMgrTest, leaseFileCleanup4) {
// stored.
std::string new_file_contents =
"address,hwaddr,client_id,valid_lifetime,expire,"
- "subnet_id,fqdn_fwd,fqdn_rev,hostname\n";
+ "subnet_id,fqdn_fwd,fqdn_rev,hostname,state\n";
// This string contains the contents of the lease file with exactly
// one lease, but two entries. One of the entries should be removed
// as a result of lease file cleanup.
std::string current_file_contents = new_file_contents +
- "192.0.2.2,02:02:02:02:02:02,,200,200,8,1,1,,\n"
- "192.0.2.2,02:02:02:02:02:02,,200,800,8,1,1,,\n";
+ "192.0.2.2,02:02:02:02:02:02,,200,200,8,1,1,,1\n"
+ "192.0.2.2,02:02:02:02:02:02,,200,800,8,1,1,,1\n";
LeaseFileIO current_file(getLeaseFilePath("leasefile4_0.csv"));
current_file.writeFile(current_file_contents);
std::string previous_file_contents = new_file_contents +
- "192.0.2.3,03:03:03:03:03:03,,200,200,8,1,1,,\n"
- "192.0.2.3,03:03:03:03:03:03,,200,800,8,1,1,,\n";
+ "192.0.2.3,03:03:03:03:03:03,,200,200,8,1,1,,1\n"
+ "192.0.2.3,03:03:03:03:03:03,,200,800,8,1,1,,1\n";
LeaseFileIO previous_file(getLeaseFilePath("leasefile4_0.csv.2"));
previous_file.writeFile(previous_file_contents);
@@ -453,15 +453,15 @@ TEST_F(MemfileLeaseMgrTest, leaseFileCleanup4) {
ASSERT_NO_THROW(lease_mgr->addLease(new_lease));
std::string updated_file_contents = new_file_contents +
- "192.0.2.45,00:00:00:00:00:00,,100,100,1,0,0,\n";
+ "192.0.2.45,00:00:00:00:00:00,,100,100,1,0,0,,1\n";
EXPECT_EQ(updated_file_contents, current_file.readFile());
// This string contains the contents of the lease file we
// expect after the LFC run. It has two leases with one
// entry each.
std::string result_file_contents = new_file_contents +
- "192.0.2.2,02:02:02:02:02:02,,200,800,8,1,1,\n"
- "192.0.2.3,03:03:03:03:03:03,,200,800,8,1,1,\n";
+ "192.0.2.2,02:02:02:02:02:02,,200,800,8,1,1,,1\n"
+ "192.0.2.3,03:03:03:03:03:03,,200,800,8,1,1,,1\n";
// The LFC should have created a file with the two leases and moved it
// to leasefile4_0.csv.2
@@ -480,24 +480,24 @@ TEST_F(MemfileLeaseMgrTest, leaseFileCleanup6) {
std::string new_file_contents =
"address,duid,valid_lifetime,expire,subnet_id,"
"pref_lifetime,lease_type,iaid,prefix_len,fqdn_fwd,"
- "fqdn_rev,hostname,hwaddr\n";
+ "fqdn_rev,hostname,hwaddr,state\n";
// This string contains the contents of the lease file with exactly
// one lease, but two entries. One of the entries should be removed
// as a result of lease file cleanup.
std::string current_file_contents = new_file_contents +
"2001:db8:1::1,00:01:02:03:04:05:06:0a:0b:0c:0d:0e:0f,200,200,"
- "8,100,0,7,0,1,1,,\n"
+ "8,100,0,7,0,1,1,,,1\n"
"2001:db8:1::1,00:01:02:03:04:05:06:0a:0b:0c:0d:0e:0f,200,800,"
- "8,100,0,7,0,1,1,,\n";
+ "8,100,0,7,0,1,1,,,1\n";
LeaseFileIO current_file(getLeaseFilePath("leasefile6_0.csv"));
current_file.writeFile(current_file_contents);
std::string previous_file_contents = new_file_contents +
"2001:db8:1::2,01:01:01:01:01:01:01:01:01:01:01:01:01,200,200,"
- "8,100,0,7,0,1,1,,\n"
+ "8,100,0,7,0,1,1,,,1\n"
"2001:db8:1::2,01:01:01:01:01:01:01:01:01:01:01:01:01,200,800,"
- "8,100,0,7,0,1,1,,\n";
+ "8,100,0,7,0,1,1,,,1\n";
LeaseFileIO previous_file(getLeaseFilePath("leasefile6_0.csv.2"));
previous_file.writeFile(previous_file_contents);
@@ -536,7 +536,7 @@ TEST_F(MemfileLeaseMgrTest, leaseFileCleanup6) {
std::string update_file_contents = new_file_contents +
"3000::1,00:00:00:00:00:00:00:00:00:00:00:00:00,400,"
- "400,2,300,0,123,128,0,0,,\n";
+ "400,2,300,0,123,128,0,0,,,1\n";
EXPECT_EQ(update_file_contents, current_file.readFile());
// This string contains the contents of the lease file we
@@ -544,9 +544,9 @@ TEST_F(MemfileLeaseMgrTest, leaseFileCleanup6) {
// entry each.
std::string result_file_contents = new_file_contents +
"2001:db8:1::1,00:01:02:03:04:05:06:0a:0b:0c:0d:0e:0f,200,800,"
- "8,100,0,7,0,1,1,,\n"
+ "8,100,0,7,0,1,1,,,1\n"
"2001:db8:1::2,01:01:01:01:01:01:01:01:01:01:01:01:01,200,800,"
- "8,100,0,7,0,1,1,,\n";
+ "8,100,0,7,0,1,1,,,1\n";
// The LFC should have created a file with the two leases and moved it
// to leasefile6_0.csv.2
@@ -564,11 +564,11 @@ TEST_F(MemfileLeaseMgrTest, leaseFileCleanupStartFail) {
// stored.
std::string new_file_contents =
"address,hwaddr,client_id,valid_lifetime,expire,"
- "subnet_id,fqdn_fwd,fqdn_rev,hostname\n";
+ "subnet_id,fqdn_fwd,fqdn_rev,hostname,state\n";
// Create the lease file to be used by the backend.
std::string current_file_contents = new_file_contents +
- "192.0.2.2,02:02:02:02:02:02,,200,200,8,1,1,,\n";
+ "192.0.2.2,02:02:02:02:02:02,,200,200,8,1,1,,1\n";
LeaseFileIO current_file(getLeaseFilePath("leasefile4_0.csv"));
current_file.writeFile(current_file_contents);
@@ -605,15 +605,15 @@ TEST_F(MemfileLeaseMgrTest, leaseFileFinish) {
std::string new_file_contents =
"address,duid,valid_lifetime,expire,subnet_id,"
"pref_lifetime,lease_type,iaid,prefix_len,fqdn_fwd,"
- "fqdn_rev,hostname,hwaddr\n";
+ "fqdn_rev,hostname,hwaddr,state\n";
// This string contains the contents of the current lease file.
// It should not be moved.
std::string current_file_contents = new_file_contents +
"2001:db8:1::1,00:01:02:03:04:05:06:0a:0b:0c:0d:0e:0f,200,200,"
- "8,100,0,7,0,1,1,,\n"
+ "8,100,0,7,0,1,1,,,1\n"
"2001:db8:1::1,00:01:02:03:04:05:06:0a:0b:0c:0d:0e:0f,200,800,"
- "8,100,0,7,0,1,1,,\n";
+ "8,100,0,7,0,1,1,,,1\n";
LeaseFileIO current_file(getLeaseFilePath("leasefile6_0.csv"));
current_file.writeFile(current_file_contents);
@@ -621,7 +621,7 @@ TEST_F(MemfileLeaseMgrTest, leaseFileFinish) {
// be moved to the previous file.
std::string finish_file_contents = new_file_contents +
"2001:db8:1::2,01:01:01:01:01:01:01:01:01:01:01:01:01,200,800,"
- "8,100,0,7,0,1,1,,\n";
+ "8,100,0,7,0,1,1,,,1\n";
LeaseFileIO finish_file(getLeaseFilePath("leasefile6_0.csv.completed"));
finish_file.writeFile(finish_file_contents);
@@ -668,15 +668,15 @@ TEST_F(MemfileLeaseMgrTest, leaseFileCopy) {
std::string new_file_contents =
"address,duid,valid_lifetime,expire,subnet_id,"
"pref_lifetime,lease_type,iaid,prefix_len,fqdn_fwd,"
- "fqdn_rev,hostname,hwaddr\n";
+ "fqdn_rev,hostname,hwaddr,state\n";
// This string contains the contents of the current lease file.
// It should not be moved.
std::string current_file_contents = new_file_contents +
"2001:db8:1::1,00:01:02:03:04:05:06:0a:0b:0c:0d:0e:0f,200,200,"
- "8,100,0,7,0,1,1,,\n"
+ "8,100,0,7,0,1,1,,,1\n"
"2001:db8:1::1,00:01:02:03:04:05:06:0a:0b:0c:0d:0e:0f,200,800,"
- "8,100,0,7,0,1,1,,\n";
+ "8,100,0,7,0,1,1,,,1\n";
LeaseFileIO current_file(getLeaseFilePath("leasefile6_0.csv"));
current_file.writeFile(current_file_contents);
@@ -686,7 +686,7 @@ TEST_F(MemfileLeaseMgrTest, leaseFileCopy) {
// the same.
std::string input_file_contents = new_file_contents +
"2001:db8:1::2,01:01:01:01:01:01:01:01:01:01:01:01:01,200,800,"
- "8,100,0,7,0,1,1,,\n";
+ "8,100,0,7,0,1,1,,,1\n";
LeaseFileIO input_file(getLeaseFilePath("leasefile6_0.csv.1"));
input_file.writeFile(input_file_contents);
@@ -1011,43 +1011,6 @@ TEST_F(MemfileLeaseMgrTest, testLease6Mac) {
testLease6MAC();
}
-/// @brief Tests whether memfile is able to work with old CSV file (without mac)
-///
-/// Ticket #3555 introduced MAC address support in Lease6. Instead of developing
-/// an upgrade script, the code is written in a way that allows reading old CSV
-/// (i.e. format that was used in Kea 0.9), hence no upgrade is necessary.
-TEST_F(MemfileLeaseMgrTest, testUpgrade0_9_0_to_0_9_1) {
-
- // Let's write a CSV file without hwaddr column. Sorry about the long
- // lines, but nobody was around to whine about 80 columns limit when CSV
- // format was invented :).
- string csv_nohwaddr =
- "address,duid,valid_lifetime,expire,subnet_id,pref_lifetime,lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname\n"
- "2001:db8::1,42:42:42:42:42:42:42:42,3677,127133,73,3600,1,42,0,0,1,myhost.example.com.\n"
- "2001:db8::2,3a:3a:3a:3a:3a:3a:3a:3a,5412,239979,73,1800,2,89,7,0,0,myhost.example.com.\n"
- "2001:db8::3,1f:20:21:22:23:24:25:26,7000,241567,37,7200,0,4294967294,28,1,0,myhost.example.com.\n";
-
- ofstream csv(getLeaseFilePath("leasefile6_0.csv").c_str(), ios::out | ios::trunc);
- ASSERT_TRUE(csv.is_open());
- csv << csv_nohwaddr;
- csv.close();
-
- startBackend(V6);
-
- // None of the leases should have any hardware addresses assigned.
- Lease6Ptr stored1 = lmptr_->getLease6(leasetype6_[1], ioaddress6_[1]);
- ASSERT_TRUE(stored1);
- EXPECT_FALSE(stored1->hwaddr_);
-
- Lease6Ptr stored2 = lmptr_->getLease6(leasetype6_[2], ioaddress6_[2]);
- ASSERT_TRUE(stored2);
- EXPECT_FALSE(stored2->hwaddr_);
-
- Lease6Ptr stored3 = lmptr_->getLease6(leasetype6_[3], ioaddress6_[3]);
- ASSERT_TRUE(stored3);
- EXPECT_FALSE(stored3->hwaddr_);
-}
-
// Check that memfile reports version correctly.
TEST_F(MemfileLeaseMgrTest, versionCheck) {
@@ -1069,22 +1032,22 @@ TEST_F(MemfileLeaseMgrTest, versionCheck) {
TEST_F(MemfileLeaseMgrTest, load4MultipleLeaseFiles) {
LeaseFileIO io2(getLeaseFilePath("leasefile4_0.csv.2"));
io2.writeFile("address,hwaddr,client_id,valid_lifetime,expire,subnet_id,"
- "fqdn_fwd,fqdn_rev,hostname\n"
- "192.0.2.2,02:02:02:02:02:02,,200,200,8,1,1,,\n"
- "192.0.2.11,bb:bb:bb:bb:bb:bb,,200,200,8,1,1,,\n");
+ "fqdn_fwd,fqdn_rev,hostname,state\n"
+ "192.0.2.2,02:02:02:02:02:02,,200,200,8,1,1,,1\n"
+ "192.0.2.11,bb:bb:bb:bb:bb:bb,,200,200,8,1,1,,1\n");
LeaseFileIO io1(getLeaseFilePath("leasefile4_0.csv.1"));
io1.writeFile("address,hwaddr,client_id,valid_lifetime,expire,subnet_id,"
- "fqdn_fwd,fqdn_rev,hostname\n"
- "192.0.2.1,01:01:01:01:01:01,,200,200,8,1,1,,\n"
- "192.0.2.11,bb:bb:bb:bb:bb:bb,,200,400,8,1,1,,\n"
- "192.0.2.12,cc:cc:cc:cc:cc:cc,,200,200,8,1,1,,\n");
+ "fqdn_fwd,fqdn_rev,hostname,state\n"
+ "192.0.2.1,01:01:01:01:01:01,,200,200,8,1,1,,1\n"
+ "192.0.2.11,bb:bb:bb:bb:bb:bb,,200,400,8,1,1,,1\n"
+ "192.0.2.12,cc:cc:cc:cc:cc:cc,,200,200,8,1,1,,1\n");
LeaseFileIO io(getLeaseFilePath("leasefile4_0.csv"));
io.writeFile("address,hwaddr,client_id,valid_lifetime,expire,subnet_id,"
- "fqdn_fwd,fqdn_rev,hostname\n"
- "192.0.2.10,0a:0a:0a:0a:0a:0a,,200,200,8,1,1,,\n"
- "192.0.2.12,cc:cc:cc:cc:cc:cc,,200,400,8,1,1,,\n");
+ "fqdn_fwd,fqdn_rev,hostname,state\n"
+ "192.0.2.10,0a:0a:0a:0a:0a:0a,,200,200,8,1,1,,1\n"
+ "192.0.2.12,cc:cc:cc:cc:cc:cc,,200,400,8,1,1,,1\n");
startBackend(V4);
@@ -1127,27 +1090,27 @@ TEST_F(MemfileLeaseMgrTest, load4MultipleLeaseFiles) {
TEST_F(MemfileLeaseMgrTest, load4CompletedFile) {
LeaseFileIO io2(getLeaseFilePath("leasefile4_0.csv.2"));
io2.writeFile("address,hwaddr,client_id,valid_lifetime,expire,subnet_id,"
- "fqdn_fwd,fqdn_rev,hostname\n"
- "192.0.2.2,02:02:02:02:02:02,,200,200,8,1,1,,\n"
- "192.0.2.11,bb:bb:bb:bb:bb:bb,,200,200,8,1,1,,\n");
+ "fqdn_fwd,fqdn_rev,hostname,state\n"
+ "192.0.2.2,02:02:02:02:02:02,,200,200,8,1,1,,1\n"
+ "192.0.2.11,bb:bb:bb:bb:bb:bb,,200,200,8,1,1,,1\n");
LeaseFileIO io1(getLeaseFilePath("leasefile4_0.csv.1"));
io1.writeFile("address,hwaddr,client_id,valid_lifetime,expire,subnet_id,"
- "fqdn_fwd,fqdn_rev,hostname\n"
- "192.0.2.1,01:01:01:01:01:01,,200,200,8,1,1,,\n"
- "192.0.2.11,bb:bb:bb:bb:bb:bb,,200,400,8,1,1,,\n"
- "192.0.2.12,cc:cc:cc:cc:cc:cc,,200,200,8,1,1,,\n");
+ "fqdn_fwd,fqdn_rev,hostname,state\n"
+ "192.0.2.1,01:01:01:01:01:01,,200,200,8,1,1,,1\n"
+ "192.0.2.11,bb:bb:bb:bb:bb:bb,,200,400,8,1,1,,1\n"
+ "192.0.2.12,cc:cc:cc:cc:cc:cc,,200,200,8,1,1,,1\n");
LeaseFileIO io(getLeaseFilePath("leasefile4_0.csv"));
io.writeFile("address,hwaddr,client_id,valid_lifetime,expire,subnet_id,"
- "fqdn_fwd,fqdn_rev,hostname\n"
- "192.0.2.10,0a:0a:0a:0a:0a:0a,,200,200,8,1,1,,\n"
- "192.0.2.12,cc:cc:cc:cc:cc:cc,,200,400,8,1,1,,\n");
+ "fqdn_fwd,fqdn_rev,hostname,state\n"
+ "192.0.2.10,0a:0a:0a:0a:0a:0a,,200,200,8,1,1,,1\n"
+ "192.0.2.12,cc:cc:cc:cc:cc:cc,,200,400,8,1,1,,1\n");
LeaseFileIO ioc(getLeaseFilePath("leasefile4_0.csv.completed"));
ioc.writeFile("address,hwaddr,client_id,valid_lifetime,expire,subnet_id,"
- "fqdn_fwd,fqdn_rev,hostname\n"
- "192.0.2.13,ff:ff:ff:ff:ff:ff,,200,200,8,1,1,,\n");
+ "fqdn_fwd,fqdn_rev,hostname,state\n"
+ "192.0.2.13,ff:ff:ff:ff:ff:ff,,200,200,8,1,1,,1\n");
startBackend(V4);
@@ -1203,29 +1166,32 @@ TEST_F(MemfileLeaseMgrTest, load4LFCInProgress) {
TEST_F(MemfileLeaseMgrTest, load6MultipleLeaseFiles) {
LeaseFileIO io2(getLeaseFilePath("leasefile6_0.csv.2"));
io2.writeFile("address,duid,valid_lifetime,expire,subnet_id,pref_lifetime,"
- "lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname,hwaddr\n"
+ "lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname,hwaddr,"
+ "state\n"
"2001:db8:1::1,01:01:01:01:01:01:01:01:01:01:01:01:01,"
- "200,200,8,100,0,7,0,1,1,,\n"
+ "200,200,8,100,0,7,0,1,1,,,1\n"
"2001:db8:1::2,02:02:02:02:02:02:02:02:02:02:02:02:02,"
- "200,200,8,100,0,7,0,1,1,,\n");
+ "200,200,8,100,0,7,0,1,1,,,1\n");
LeaseFileIO io1(getLeaseFilePath("leasefile6_0.csv.1"));
io1.writeFile("address,duid,valid_lifetime,expire,subnet_id,pref_lifetime,"
- "lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname,hwaddr\n"
+ "lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname,hwaddr,"
+ "state\n"
"2001:db8:1::3,03:03:03:03:03:03:03:03:03:03:03:03:03,"
- "200,200,8,100,0,7,0,1,1,,\n"
+ "200,200,8,100,0,7,0,1,1,,,1\n"
"2001:db8:1::2,02:02:02:02:02:02:02:02:02:02:02:02:02,"
- "300,800,8,100,0,7,0,1,1,,\n"
+ "300,800,8,100,0,7,0,1,1,,,1\n"
"2001:db8:1::4,04:04:04:04:04:04:04:04:04:04:04:04:04,"
- "200,200,8,100,0,7,0,1,1,,\n");
+ "200,200,8,100,0,7,0,1,1,,,1\n");
LeaseFileIO io(getLeaseFilePath("leasefile6_0.csv"));
io.writeFile("address,duid,valid_lifetime,expire,subnet_id,pref_lifetime,"
- "lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname,hwaddr\n"
+ "lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname,hwaddr,"
+ "state\n"
"2001:db8:1::4,04:04:04:04:04:04:04:04:04:04:04:04:04,"
- "400,1000,8,100,0,7,0,1,1,,\n"
+ "400,1000,8,100,0,7,0,1,1,,,1\n"
"2001:db8:1::5,05:05:05:05:05:05:05:05:05:05:05:05:05,"
- "200,200,8,100,0,7,0,1,1,,\n");
+ "200,200,8,100,0,7,0,1,1,,,1\n");
startBackend(V6);
@@ -1266,21 +1232,23 @@ TEST_F(MemfileLeaseMgrTest, load6MultipleLeaseFiles) {
TEST_F(MemfileLeaseMgrTest, load6MultipleNoSecondFile) {
LeaseFileIO io1(getLeaseFilePath("leasefile6_0.csv.1"));
io1.writeFile("address,duid,valid_lifetime,expire,subnet_id,pref_lifetime,"
- "lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname,hwaddr\n"
+ "lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname,hwaddr,"
+ "state\n"
"2001:db8:1::3,03:03:03:03:03:03:03:03:03:03:03:03:03,"
- "200,200,8,100,0,7,0,1,1,,\n"
+ "200,200,8,100,0,7,0,1,1,,,1\n"
"2001:db8:1::2,02:02:02:02:02:02:02:02:02:02:02:02:02,"
- "300,800,8,100,0,7,0,1,1,,\n"
+ "300,800,8,100,0,7,0,1,1,,,1\n"
"2001:db8:1::4,04:04:04:04:04:04:04:04:04:04:04:04:04,"
- "200,200,8,100,0,7,0,1,1,,\n");
+ "200,200,8,100,0,7,0,1,1,,,1\n");
LeaseFileIO io(getLeaseFilePath("leasefile6_0.csv"));
io.writeFile("address,duid,valid_lifetime,expire,subnet_id,pref_lifetime,"
- "lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname,hwaddr\n"
+ "lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname,hwaddr,"
+ "state\n"
"2001:db8:1::4,04:04:04:04:04:04:04:04:04:04:04:04:04,"
- "400,1000,8,100,0,7,0,1,1,,\n"
+ "400,1000,8,100,0,7,0,1,1,,,1\n"
"2001:db8:1::5,05:05:05:05:05:05:05:05:05:05:05:05:05,"
- "200,200,8,100,0,7,0,1,1,,\n");
+ "200,200,8,100,0,7,0,1,1,,,1\n");
startBackend(V6);
@@ -1312,19 +1280,21 @@ TEST_F(MemfileLeaseMgrTest, load6MultipleNoSecondFile) {
TEST_F(MemfileLeaseMgrTest, load6MultipleNoFirstFile) {
LeaseFileIO io2(getLeaseFilePath("leasefile6_0.csv.2"));
io2.writeFile("address,duid,valid_lifetime,expire,subnet_id,pref_lifetime,"
- "lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname,hwaddr\n"
+ "lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname,hwaddr,"
+ "state\n"
"2001:db8:1::1,01:01:01:01:01:01:01:01:01:01:01:01:01,"
- "200,200,8,100,0,7,0,1,1,,\n"
+ "200,200,8,100,0,7,0,1,1,,,1\n"
"2001:db8:1::2,02:02:02:02:02:02:02:02:02:02:02:02:02,"
- "200,200,8,100,0,7,0,1,1,,\n");
+ "200,200,8,100,0,7,0,1,1,,,1\n");
LeaseFileIO io(getLeaseFilePath("leasefile6_0.csv"));
io.writeFile("address,duid,valid_lifetime,expire,subnet_id,pref_lifetime,"
- "lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname,hwaddr\n"
+ "lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname,hwaddr,"
+ "state\n"
"2001:db8:1::4,04:04:04:04:04:04:04:04:04:04:04:04:04,"
- "400,1000,8,100,0,7,0,1,1,,\n"
+ "400,1000,8,100,0,7,0,1,1,,,1\n"
"2001:db8:1::5,05:05:05:05:05:05:05:05:05:05:05:05:05,"
- "200,200,8,100,0,7,0,1,1,,\n");
+ "200,200,8,100,0,7,0,1,1,,,1\n");
startBackend(V6);
@@ -1358,35 +1328,39 @@ TEST_F(MemfileLeaseMgrTest, load6MultipleNoFirstFile) {
TEST_F(MemfileLeaseMgrTest, load6CompletedFile) {
LeaseFileIO io2(getLeaseFilePath("leasefile6_0.csv.2"));
io2.writeFile("address,duid,valid_lifetime,expire,subnet_id,pref_lifetime,"
- "lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname,hwaddr\n"
+ "lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname,hwaddr,"
+ "state\n"
"2001:db8:1::1,01:01:01:01:01:01:01:01:01:01:01:01:01,"
- "200,200,8,100,0,7,0,1,1,,\n"
+ "200,200,8,100,0,7,0,1,1,,,1\n"
"2001:db8:1::2,02:02:02:02:02:02:02:02:02:02:02:02:02,"
- "200,200,8,100,0,7,0,1,1,,\n");
+ "200,200,8,100,0,7,0,1,1,,,1\n");
LeaseFileIO io1(getLeaseFilePath("leasefile6_0.csv.1"));
io1.writeFile("address,duid,valid_lifetime,expire,subnet_id,pref_lifetime,"
- "lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname,hwaddr\n"
+ "lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname,hwaddr,"
+ "state\n"
"2001:db8:1::3,03:03:03:03:03:03:03:03:03:03:03:03:03,"
- "200,200,8,100,0,7,0,1,1,,\n"
+ "200,200,8,100,0,7,0,1,1,,,1\n"
"2001:db8:1::2,02:02:02:02:02:02:02:02:02:02:02:02:02,"
- "300,800,8,100,0,7,0,1,1,,\n"
+ "300,800,8,100,0,7,0,1,1,,,1\n"
"2001:db8:1::4,04:04:04:04:04:04:04:04:04:04:04:04:04,"
- "200,200,8,100,0,7,0,1,1,,\n");
+ "200,200,8,100,0,7,0,1,1,,,1\n");
LeaseFileIO io(getLeaseFilePath("leasefile6_0.csv"));
io.writeFile("address,duid,valid_lifetime,expire,subnet_id,pref_lifetime,"
- "lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname,hwaddr\n"
+ "lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname,hwaddr,"
+ "state\n"
"2001:db8:1::4,04:04:04:04:04:04:04:04:04:04:04:04:04,"
- "400,1000,8,100,0,7,0,1,1,,\n"
+ "400,1000,8,100,0,7,0,1,1,,,1\n"
"2001:db8:1::5,05:05:05:05:05:05:05:05:05:05:05:05:05,"
- "200,200,8,100,0,7,0,1,1,,\n");
+ "200,200,8,100,0,7,0,1,1,,,1\n");
LeaseFileIO ioc(getLeaseFilePath("leasefile6_0.csv.completed"));
ioc.writeFile("address,duid,valid_lifetime,expire,subnet_id,pref_lifetime,"
- "lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname,hwaddr\n"
+ "lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname,hwaddr,"
+ "state\n"
"2001:db8:1::125,ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff,"
- "400,1000,8,100,0,7,0,1,1,,\n");
+ "400,1000,8,100,0,7,0,1,1,,,1\n");
startBackend(V6);