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();
// 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
// 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
/// @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";
}
};
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
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
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";
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
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.
// 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;
// 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);
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
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);
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
// 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
// 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);
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);
// 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);
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);
// 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);
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) {
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);
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);
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);
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);
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);
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);