Commit 7088f78b authored by Francis Dupont's avatar Francis Dupont

[567-remove-lease-t1_-and-t2_-members] Removed t1/t2 from leases

parent ea481320
......@@ -537,11 +537,11 @@ TEST_F(CtrlChannelDhcpv4SrvTest, controlLeasesReclaim) {
// (valid lifetime = 60, cltt = now - 100).
HWAddrPtr hwaddr0(new HWAddr(HWAddr::fromText("00:01:02:03:04:05")));
Lease4Ptr lease0(new Lease4(IOAddress("10.0.0.1"), hwaddr0,
ClientIdPtr(), 60, 10, 20,
ClientIdPtr(), 60,
time(NULL) - 100, SubnetID(1)));
HWAddrPtr hwaddr1(new HWAddr(HWAddr::fromText("01:02:03:04:05:06")));
Lease4Ptr lease1(new Lease4(IOAddress("10.0.0.2"), hwaddr1,
ClientIdPtr(), 60, 10, 20,
ClientIdPtr(), 60,
time(NULL) - 100, SubnetID(1)));
// Add leases to the database.
......@@ -614,11 +614,11 @@ TEST_F(CtrlChannelDhcpv4SrvTest, controlLeasesReclaimRemove) {
// (valid lifetime = 60, cltt = now - 100).
HWAddrPtr hwaddr0(new HWAddr(HWAddr::fromText("00:01:02:03:04:05")));
Lease4Ptr lease0(new Lease4(IOAddress("10.0.0.1"), hwaddr0,
ClientIdPtr(), 60, 10, 20,
ClientIdPtr(), 60,
time(NULL) - 100, SubnetID(1)));
HWAddrPtr hwaddr1(new HWAddr(HWAddr::fromText("01:02:03:04:05:06")));
Lease4Ptr lease1(new Lease4(IOAddress("10.0.0.2"), hwaddr1,
ClientIdPtr(), 60, 10, 20,
ClientIdPtr(), 60,
time(NULL) - 100, SubnetID(1)));
// Add leases to the database.
......
......@@ -207,7 +207,7 @@ Dhcp4Client::applyConfiguration() {
/// @todo Set the valid lifetime, t1, t2 etc.
config_.lease_ = Lease4(IOAddress(context_.response_->getYiaddr()),
context_.response_->getHWAddr(),
0, 0, 0, 0, 0, time(NULL), 0, false, false,
0, 0, 0, time(NULL), 0, false, false,
"");
}
}
......@@ -215,7 +215,7 @@ Dhcp4Client::applyConfiguration() {
void
Dhcp4Client::createLease(const asiolink::IOAddress& addr,
const uint32_t valid_lft) {
Lease4 lease(addr, hwaddr_, 0, 0, valid_lft, valid_lft / 2, valid_lft,
Lease4 lease(addr, hwaddr_, 0, 0, valid_lft,
time(NULL), 0, false, false, "");
config_.lease_ = lease;
}
......
......@@ -1302,8 +1302,6 @@ TEST_F(Dhcpv4SrvTest, RenewBasic) {
ASSERT_NO_THROW(srv.reset(new NakedDhcpv4Srv(0)));
const IOAddress addr("192.0.2.106");
const uint32_t temp_t1 = 50;
const uint32_t temp_t2 = 75;
const uint32_t temp_valid = 100;
const time_t temp_timestamp = time(NULL) - 10;
......@@ -1318,18 +1316,15 @@ TEST_F(Dhcpv4SrvTest, RenewBasic) {
HWAddrPtr hwaddr2(new HWAddr(hwaddr2_data, sizeof(hwaddr2_data), HTYPE_ETHER));
Lease4Ptr used(new Lease4(IOAddress("192.0.2.106"), hwaddr2,
&client_id_->getDuid()[0], client_id_->getDuid().size(),
temp_valid, temp_t1, temp_t2, temp_timestamp,
subnet_->getID()));
temp_valid, temp_timestamp, subnet_->getID()));
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(used));
// Check that the lease is really in the database
Lease4Ptr l = LeaseMgrFactory::instance().getLease4(addr);
ASSERT_TRUE(l);
// Check that T1, T2, preferred, valid and cltt really set.
// Check that preferred, valid and cltt really set.
// Constructed lease looks as if it was assigned 10 seconds ago
// EXPECT_EQ(l->t1_, temp_t1);
// EXPECT_EQ(l->t2_, temp_t2);
EXPECT_EQ(l->valid_lft_, temp_valid);
EXPECT_EQ(l->cltt_, temp_timestamp);
......@@ -1363,9 +1358,7 @@ TEST_F(Dhcpv4SrvTest, RenewBasic) {
l = checkLease(ack, clientid, req->getHWAddr(), addr);
ASSERT_TRUE(l);
// Check that T1, T2, preferred, valid and cltt were really updated
EXPECT_EQ(l->t1_, subnet_->getT1());
EXPECT_EQ(l->t2_, subnet_->getT2());
// Check that preferred, valid and cltt were really updated
EXPECT_EQ(l->valid_lft_, subnet_->getValid());
// Checking for CLTT is a bit tricky if we want to avoid off by 1 errors
......
......@@ -316,7 +316,7 @@ public:
Lease4Ptr lease(new Lease4(addr, hwaddr,
&generateClientId()->getData()[0],
generateClientId()->getData().size(),
100, 50, 75, time(NULL), subnet_->getID()));
100, time(NULL), subnet_->getID()));
// @todo Set this through the Lease4 constructor.
lease->hostname_ = hostname;
lease->fqdn_fwd_ = fqdn_fwd;
......
// Copyright (C) 2015-2018 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2015-2019 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -1748,8 +1748,6 @@ TEST_F(HooksDhcpv4SrvTest, lease4RenewSimple) {
IfaceMgr::instance().openSockets4();
const IOAddress addr("192.0.2.106");
const uint32_t temp_t1 = 50;
const uint32_t temp_t2 = 75;
const uint32_t temp_valid = 100;
const time_t temp_timestamp = time(NULL) - 10;
......@@ -1768,8 +1766,7 @@ TEST_F(HooksDhcpv4SrvTest, lease4RenewSimple) {
HWAddrPtr hwaddr2(new HWAddr(hwaddr2_data, sizeof(hwaddr2_data), HTYPE_ETHER));
Lease4Ptr used(new Lease4(IOAddress("192.0.2.106"), hwaddr2,
&client_id_->getDuid()[0], client_id_->getDuid().size(),
temp_valid, temp_t1, temp_t2, temp_timestamp,
subnet_->getID()));
temp_valid, temp_timestamp, subnet_->getID()));
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(used));
// Check that the lease is really in the database
......@@ -1797,9 +1794,7 @@ TEST_F(HooksDhcpv4SrvTest, lease4RenewSimple) {
l = checkLease(ack, clientid, req->getHWAddr(), addr);
ASSERT_TRUE(l);
// Check that T1, T2, preferred, valid and cltt were really updated
EXPECT_EQ(l->t1_, subnet_->getT1());
EXPECT_EQ(l->t2_, subnet_->getT2());
// Check that preferred, valid and cltt were really updated
EXPECT_EQ(l->valid_lft_, subnet_->getValid());
// Check that the callback called is indeed the one we installed
......@@ -1848,8 +1843,6 @@ TEST_F(HooksDhcpv4SrvTest, lease4RenewSkip) {
IfaceMgr::instance().openSockets4();
const IOAddress addr("192.0.2.106");
const uint32_t temp_t1 = 50;
const uint32_t temp_t2 = 75;
const uint32_t temp_valid = 100;
const time_t temp_timestamp = time(NULL) - 10;
......@@ -1868,18 +1861,15 @@ TEST_F(HooksDhcpv4SrvTest, lease4RenewSkip) {
HWAddrPtr hwaddr2(new HWAddr(hwaddr2_data, sizeof(hwaddr2_data), HTYPE_ETHER));
Lease4Ptr used(new Lease4(IOAddress("192.0.2.106"), hwaddr2,
&client_id_->getDuid()[0], client_id_->getDuid().size(),
temp_valid, temp_t1, temp_t2, temp_timestamp,
subnet_->getID()));
temp_valid, temp_timestamp, subnet_->getID()));
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(used));
// Check that the lease is really in the database
Lease4Ptr l = LeaseMgrFactory::instance().getLease4(addr);
ASSERT_TRUE(l);
// Check that T1, T2, preferred, valid and cltt really set.
// Check that preferred, valid and cltt really set.
// Constructed lease looks as if it was assigned 10 seconds ago
// EXPECT_EQ(l->t1_, temp_t1);
// EXPECT_EQ(l->t2_, temp_t2);
EXPECT_EQ(l->valid_lft_, temp_valid);
EXPECT_EQ(l->cltt_, temp_timestamp);
......@@ -1902,9 +1892,7 @@ TEST_F(HooksDhcpv4SrvTest, lease4RenewSkip) {
l = checkLease(ack, clientid, req->getHWAddr(), addr);
ASSERT_TRUE(l);
// Check that T1, T2, valid and cltt were NOT updated
EXPECT_EQ(temp_t1, l->t1_);
EXPECT_EQ(temp_t2, l->t2_);
// Check that valid and cltt were NOT updated
EXPECT_EQ(temp_valid, l->valid_lft_);
EXPECT_EQ(temp_timestamp, l->cltt_);
......@@ -2121,8 +2109,6 @@ TEST_F(HooksDhcpv4SrvTest, lease4ReleaseSimple) {
IfaceMgr::instance().openSockets4();
const IOAddress addr("192.0.2.106");
const uint32_t temp_t1 = 50;
const uint32_t temp_t2 = 75;
const uint32_t temp_valid = 100;
const time_t temp_timestamp = time(NULL) - 10;
......@@ -2141,8 +2127,7 @@ TEST_F(HooksDhcpv4SrvTest, lease4ReleaseSimple) {
HWAddrPtr hw(new HWAddr(mac_addr, sizeof(mac_addr), HTYPE_ETHER));
Lease4Ptr used(new Lease4(addr, hw,
&client_id_->getDuid()[0], client_id_->getDuid().size(),
temp_valid, temp_t1, temp_t2, temp_timestamp,
subnet_->getID()));
temp_valid, temp_timestamp, subnet_->getID()));
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(used));
// Check that the lease is really in the database
......@@ -2214,8 +2199,6 @@ TEST_F(HooksDhcpv4SrvTest, lease4ReleaseSkip) {
IfaceMgr::instance().openSockets4();
const IOAddress addr("192.0.2.106");
const uint32_t temp_t1 = 50;
const uint32_t temp_t2 = 75;
const uint32_t temp_valid = 100;
const time_t temp_timestamp = time(NULL) - 10;
......@@ -2234,8 +2217,7 @@ TEST_F(HooksDhcpv4SrvTest, lease4ReleaseSkip) {
HWAddrPtr hw(new HWAddr(mac_addr, sizeof(mac_addr), HTYPE_ETHER));
Lease4Ptr used(new Lease4(addr, hw,
&client_id_->getDuid()[0], client_id_->getDuid().size(),
temp_valid, temp_t1, temp_t2, temp_timestamp,
subnet_->getID()));
temp_valid, temp_timestamp, subnet_->getID()));
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(used));
// Check that the lease is really in the database
......@@ -2329,8 +2311,6 @@ TEST_F(HooksDhcpv4SrvTest, lease4ReleaseDrop) {
IfaceMgr::instance().openSockets4();
const IOAddress addr("192.0.2.106");
const uint32_t temp_t1 = 50;
const uint32_t temp_t2 = 75;
const uint32_t temp_valid = 100;
const time_t temp_timestamp = time(NULL) - 10;
......@@ -2349,8 +2329,7 @@ TEST_F(HooksDhcpv4SrvTest, lease4ReleaseDrop) {
HWAddrPtr hw(new HWAddr(mac_addr, sizeof(mac_addr), HTYPE_ETHER));
Lease4Ptr used(new Lease4(addr, hw,
&client_id_->getDuid()[0], client_id_->getDuid().size(),
temp_valid, temp_t1, temp_t2, temp_timestamp,
subnet_->getID()));
temp_valid, temp_timestamp, subnet_->getID()));
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(used));
// Check that the lease is really in the database
......
......@@ -769,7 +769,7 @@ TEST_F(JSONFileBackendTest, timers) {
// current configuration.
HWAddrPtr hwaddr_expired(new HWAddr(HWAddr::fromText("00:01:02:03:04:05")));
Lease4Ptr lease_expired(new Lease4(IOAddress("10.0.0.1"), hwaddr_expired,
ClientIdPtr(), 60, 10, 20,
ClientIdPtr(), 60,
time(NULL) - 100, SubnetID(1)));
// Create expired-reclaimed lease. The lease has expired 1000 - 60 seconds
......@@ -777,7 +777,7 @@ TEST_F(JSONFileBackendTest, timers) {
// goes off.
HWAddrPtr hwaddr_reclaimed(new HWAddr(HWAddr::fromText("01:02:03:04:05:06")));
Lease4Ptr lease_reclaimed(new Lease4(IOAddress("10.0.0.2"), hwaddr_reclaimed,
ClientIdPtr(), 60, 10, 20,
ClientIdPtr(), 60,
time(NULL) - 1000, SubnetID(1)));
lease_reclaimed->state_ = Lease4::STATE_EXPIRED_RECLAIMED;
......
......@@ -862,11 +862,11 @@ TEST_F(CtrlChannelDhcpv6SrvTest, controlLeasesReclaim) {
// (valid lifetime = 60, cltt = now - 100).
DuidPtr duid0(new DUID(DUID::fromText("00:01:02:03:04:05:06").getDuid()));
Lease6Ptr lease0(new Lease6(Lease::TYPE_NA, IOAddress("3000::1"),
duid0, 1, 50, 60, 10, 20, SubnetID(1)));
duid0, 1, 50, 60, SubnetID(1)));
lease0->cltt_ = time(NULL) - 100;
DuidPtr duid1(new DUID(DUID::fromText("01:02:03:04:05:06:07").getDuid()));
Lease6Ptr lease1(new Lease6(Lease::TYPE_NA, IOAddress("3000::2"),
duid1, 1, 50, 60, 10, 20, SubnetID(1)));
duid1, 1, 50, 60, SubnetID(1)));
lease1->cltt_ = time(NULL) - 100;
// Add leases to the database.
......@@ -924,11 +924,11 @@ TEST_F(CtrlChannelDhcpv6SrvTest, controlLeasesReclaimRemove) {
// (valid lifetime = 60, cltt = now - 100).
DuidPtr duid0(new DUID(DUID::fromText("00:01:02:03:04:05:06").getDuid()));
Lease6Ptr lease0(new Lease6(Lease::TYPE_NA, IOAddress("3000::1"),
duid0, 1, 50, 60, 10, 20, SubnetID(1)));
duid0, 1, 50, 60, SubnetID(1)));
lease0->cltt_ = time(NULL) - 100;
DuidPtr duid1(new DUID(DUID::fromText("01:02:03:04:05:06:07").getDuid()));
Lease6Ptr lease1(new Lease6(Lease::TYPE_NA, IOAddress("3000::2"),
duid1, 1, 50, 60, 10, 20, SubnetID(1)));
duid1, 1, 50, 60, SubnetID(1)));
lease1->cltt_ = time(NULL) - 100;
// Add leases to the database.
......
......@@ -169,8 +169,7 @@ Dhcp6Client::applyRcvdConfiguration(const Pkt6Ptr& reply, uint32_t state) {
iaaddr->getAddress(),
duid_, ia->getIAID(),
iaaddr->getPreferred(),
iaaddr->getValid(),
ia->getT1(), ia->getT2(), 0,
iaaddr->getValid(), 0,
hwaddr);
lease.cltt_ = time(NULL);
lease.state_ = state;
......@@ -189,8 +188,7 @@ Dhcp6Client::applyRcvdConfiguration(const Pkt6Ptr& reply, uint32_t state) {
iaprefix->getAddress(), duid_,
ia->getIAID(),
iaprefix->getPreferred(),
iaprefix->getValid(),
ia->getT1(), ia->getT2(), 0,
iaprefix->getValid(), 0,
hwaddr,
iaprefix->getLength());
lease.cltt_ = time(NULL);
......@@ -361,8 +359,6 @@ Dhcp6Client::copyIAsFromLeases(const Pkt6Ptr& dest) const {
}
Option6IAPtr opt(new Option6IA(leases[0].type_ == Lease::TYPE_NA ?
D6O_IA_NA : D6O_IA_PD, *iaid));
opt->setT1(leases[0].t1_);
opt->setT2(leases[0].t2_);
for (std::vector<Lease6>::const_iterator lease = leases.begin();
lease != leases.end(); ++lease) {
if ((lease->preferred_lft_ != 0) && (lease->valid_lft_ != 0)) {
......@@ -874,15 +870,11 @@ bool
Dhcp6Client::getTeeTimes(const uint32_t iaid, uint32_t& t1, uint32_t& t2) const {
auto leases = getLeasesByIAID(iaid);
if (leases.empty()) {
if (leases.empty()) {
// No aquired leases so punt.
return (false);
}
// All leases for a given iaid should have the same values for T1
// and T2, so using them from the first one should be fine.
t1 = leases[0].t1_;
t2 = leases[0].t2_;
return (true);
}
......
......@@ -261,7 +261,7 @@ Dhcpv6SrvTest::testRenewBasic(Lease::Type type, const std::string& existing_addr
if (insert_before_renew) {
// Note that preferred, valid, T1 and T2 timers and CLTT are set to invalid
// value on purpose. They should be updated during RENEW.
Lease6Ptr lease(new Lease6(type, existing, duid_, iaid, 501, 502, 503, 504,
Lease6Ptr lease(new Lease6(type, existing, duid_, iaid, 501, 502,
subnet_->getID(), HWAddrPtr(), prefix_len));
lease->cltt_ = 1234;
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
......@@ -270,10 +270,8 @@ Dhcpv6SrvTest::testRenewBasic(Lease::Type type, const std::string& existing_addr
l = LeaseMgrFactory::instance().getLease6(type, existing);
ASSERT_TRUE(l);
// Check that T1, T2, preferred, valid and cltt really set and not using
// Check that preferred, valid and cltt really set and not using
// previous (500, 501, etc.) values
EXPECT_NE(l->t1_, subnet_->getT1());
EXPECT_NE(l->t2_, subnet_->getT2());
EXPECT_NE(l->preferred_lft_, subnet_->getPreferred());
EXPECT_NE(l->valid_lft_, subnet_->getValid());
EXPECT_NE(l->cltt_, time(NULL));
......@@ -331,9 +329,7 @@ Dhcpv6SrvTest::testRenewBasic(Lease::Type type, const std::string& existing_addr
isc_throw(BadValue, "Invalid lease type");
}
// Check that T1, T2, preferred, valid and cltt were really updated
EXPECT_EQ(subnet_->getT1(), l->t1_);
EXPECT_EQ(subnet_->getT2(), l->t2_);
// Check that preferred, valid and cltt were really updated
EXPECT_EQ(subnet_->getPreferred(), l->preferred_lft_);
EXPECT_EQ(subnet_->getValid(), l->valid_lft_);
......@@ -370,7 +366,7 @@ Dhcpv6SrvTest::testRenewWrongIAID(Lease::Type type, const IOAddress& addr) {
// Note that preferred, valid, T1 and T2 timers and CLTT are set to invalid
// value on purpose. They should be updated during RENEW.
Lease6Ptr lease(new Lease6(type, addr, duid_, valid_iaid,
501, 502, 503, 504, subnet_->getID(),
501, 502, subnet_->getID(),
HWAddrPtr(), prefix_len));
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
......@@ -419,7 +415,7 @@ Dhcpv6SrvTest::testRenewSomeoneElsesLease(Lease::Type type, const IOAddress& add
// Let's create a lease.
Lease6Ptr lease(new Lease6(type, addr, duid_, valid_iaid,
501, 502, 503, 504, subnet_->getID(),
501, 502, subnet_->getID(),
HWAddrPtr(), prefix_len));
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
......@@ -481,7 +477,7 @@ Dhcpv6SrvTest::testReleaseBasic(Lease::Type type, const IOAddress& existing,
// Let's prepopulate the database
Lease6Ptr lease(new Lease6(type, existing, duid_, iaid,
501, 502, 503, 504, subnet_->getID(),
501, 502, subnet_->getID(),
HWAddrPtr(), prefix_len));
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
......@@ -609,8 +605,8 @@ Dhcpv6SrvTest::testReleaseReject(Lease::Type type, const IOAddress& addr) {
// CASE 2: Lease is known and belongs to this client, but to a different IAID
SCOPED_TRACE("CASE 2: Lease is known and belongs to this client, but to a different IAID");
Lease6Ptr lease(new Lease6(type, addr, duid_, valid_iaid, 501, 502, 503,
504, subnet_->getID(), HWAddrPtr(), prefix_len));
Lease6Ptr lease(new Lease6(type, addr, duid_, valid_iaid, 501, 502,
subnet_->getID(), HWAddrPtr(), prefix_len));
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
// Let's create a different RELEASE, with a bogus iaid
......
// Copyright (C) 2013-2018 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2013-2019 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -85,8 +85,8 @@ public:
// generateClientId assigns DUID to duid_.
generateClientId();
lease_.reset(new Lease6(Lease::TYPE_NA, IOAddress("2001:db8:1::1"),
duid_, 1234, 501, 502, 503,
504, 1, HWAddrPtr(), 0));
duid_, 1234, 501, 502,
1, HWAddrPtr(), 0));
// Config DDNS to be enabled, all controls off
enableD2();
}
......
......@@ -2682,7 +2682,7 @@ TEST_F(HooksDhcpv6SrvTest, basicLease6Renew) {
// Note that preferred, valid, T1 and T2 timers and CLTT are set to invalid
// value on purpose. They should be updated during RENEW.
Lease6Ptr lease(new Lease6(Lease::TYPE_NA, addr, duid_, iaid,
501, 502, 503, 504, subnet_->getID(),
501, 502, subnet_->getID(),
HWAddrPtr(), 0));
lease->cltt_ = 1234;
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
......@@ -2785,7 +2785,7 @@ TEST_F(HooksDhcpv6SrvTest, leaseUpdateLease6Renew) {
// Note that preferred, valid, T1 and T2 timers and CLTT are set to invalid
// value on purpose. They should be updated during RENEW.
Lease6Ptr lease(new Lease6(Lease::TYPE_NA, addr, duid_, iaid,
501, 502, 503, 504, subnet_->getID(),
501, 502, subnet_->getID(),
HWAddrPtr(), 0));
lease->cltt_ = 1234;
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
......@@ -2885,7 +2885,7 @@ TEST_F(HooksDhcpv6SrvTest, skipLease6Renew) {
// Note that preferred, valid, T1 and T2 timers and CLTT are set to invalid
// value on purpose. They should be updated during RENEW.
Lease6Ptr lease(new Lease6(Lease::TYPE_NA, addr, duid_, iaid,
501, 502, 503, 504, subnet_->getID(),
501, 502, subnet_->getID(),
HWAddrPtr(), 0));
lease->cltt_ = 1234;
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
......@@ -3311,7 +3311,7 @@ TEST_F(HooksDhcpv6SrvTest, basicLease6Release) {
// Note that preferred, valid, T1 and T2 timers and CLTT are set to invalid
// value on purpose. They should be updated during RENEW.
Lease6Ptr lease(new Lease6(Lease::TYPE_NA, addr, duid_, iaid,
501, 502, 503, 504, subnet_->getID(),
501, 502, subnet_->getID(),
HWAddrPtr(), 0));
lease->cltt_ = 1234;
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
......@@ -3392,7 +3392,7 @@ TEST_F(HooksDhcpv6SrvTest, basicLease6ReleasePD) {
// Note that preferred, valid, T1 and T2 timers and CLTT are set to invalid
// value on purpose. They should be updated during RENEW.
Lease6Ptr lease(new Lease6(Lease::TYPE_PD, prefix, duid_, iaid,
501, 502, 503, 504, subnet_->getID(),
501, 502, subnet_->getID(),
HWAddrPtr(), 80));
lease->cltt_ = 1234;
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
......@@ -3474,7 +3474,7 @@ TEST_F(HooksDhcpv6SrvTest, skipLease6Release) {
// Note that preferred, valid, T1 and T2 timers and CLTT are set to invalid
// value on purpose. They should be updated during RENEW.
Lease6Ptr lease(new Lease6(Lease::TYPE_NA, addr, duid_, iaid,
501, 502, 503, 504, subnet_->getID(),
501, 502, subnet_->getID(),
HWAddrPtr(), 0));
lease->cltt_ = 1234;
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
......@@ -3541,7 +3541,7 @@ TEST_F(HooksDhcpv6SrvTest, dropLease6Release) {
// Note that preferred, valid, T1 and T2 timers and CLTT are set to invalid
// value on purpose. They should be updated during RENEW.
Lease6Ptr lease(new Lease6(Lease::TYPE_NA, addr, duid_, iaid,
501, 502, 503, 504, subnet_->getID(),
501, 502, subnet_->getID(),
HWAddrPtr(), 0));
lease->cltt_ = 1234;
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
......@@ -3808,7 +3808,7 @@ TEST_F(HooksDhcpv6SrvTest, basicLease6Rebind) {
// Note that preferred, valid, T1 and T2 timers and CLTT are set to invalid
// value on purpose. They should be updated during REBIND.
Lease6Ptr lease(new Lease6(Lease::TYPE_NA, addr, duid_, iaid,
501, 502, 503, 504, subnet_->getID(),
501, 502, subnet_->getID(),
HWAddrPtr(), 0));
lease->cltt_ = 1234;
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
......@@ -3906,7 +3906,7 @@ TEST_F(HooksDhcpv6SrvTest, leaseUpdateLease6Rebind) {
// Note that preferred, valid, T1 and T2 timers and CLTT are set to invalid
// value on purpose. They should be updated during REBIND.
Lease6Ptr lease(new Lease6(Lease::TYPE_NA, addr, duid_, iaid,
501, 502, 503, 504, subnet_->getID(),
501, 502, subnet_->getID(),
HWAddrPtr(), 0));
lease->cltt_ = 1234;
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
......@@ -4004,7 +4004,7 @@ TEST_F(HooksDhcpv6SrvTest, skipLease6Rebind) {
// Note that preferred, valid, T1 and T2 timers and CLTT are set to invalid
// value on purpose. They should be updated during REBIND.
Lease6Ptr lease(new Lease6(Lease::TYPE_NA, addr, duid_, iaid,
501, 502, 503, 504, subnet_->getID(),
501, 502, subnet_->getID(),
HWAddrPtr(), 0));
lease->cltt_ = 1234;
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
......
......@@ -716,7 +716,7 @@ TEST_F(JSONFileBackendTest, timers) {
// current configuration.
DuidPtr duid_expired(new DUID(DUID::fromText("00:01:02:03:04:05:06").getDuid()));
Lease6Ptr lease_expired(new Lease6(Lease::TYPE_NA, IOAddress("3000::1"),
duid_expired, 1, 50, 60, 10, 20, SubnetID(1)));
duid_expired, 1, 50, 60, SubnetID(1)));
lease_expired->cltt_ = time(NULL) - 100;
......@@ -725,7 +725,7 @@ TEST_F(JSONFileBackendTest, timers) {
// goes off.
DuidPtr duid_reclaimed(new DUID(DUID::fromText("01:02:03:04:05:06:07").getDuid()));
Lease6Ptr lease_reclaimed(new Lease6(Lease::TYPE_NA, IOAddress("3000::2"),
duid_reclaimed, 1, 50, 60, 10, 20, SubnetID(1)));
duid_reclaimed, 1, 50, 60, SubnetID(1)));
lease_reclaimed->cltt_ = time(NULL) - 1000;
lease_reclaimed->state_ = Lease6::STATE_EXPIRED_RECLAIMED;
......
// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2018-2019 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -35,7 +35,7 @@ Lease4Ptr createLease4() {
HWAddrPtr hwaddr(new HWAddr(std::vector<uint8_t>(6, 11), HTYPE_ETHER));
Lease4Ptr lease4(new Lease4(IOAddress("192.1.2.3"), hwaddr,
static_cast<const uint8_t*>(0), 0,
60, 30, 40, 0, 1));
60, 0, 1));
return (lease4);
}
......@@ -48,7 +48,7 @@ Lease4Ptr createLease4() {
Lease6Ptr createLease6() {
DuidPtr duid(new DUID(std::vector<uint8_t>(8, 02)));
Lease6Ptr lease6(new Lease6(Lease::TYPE_NA, IOAddress("2001:db8:1::cafe"),
duid, 1234, 50, 60, 30, 40, 1));
duid, 1234, 50, 60, 1));
return (lease6);
}
......
// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2018-2019 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -351,7 +351,7 @@ TEST_F(HAImplTest, leases4Committed) {
HWAddrPtr hwaddr(new HWAddr(std::vector<uint8_t>(6, 1), HTYPE_ETHER));
Lease4Ptr lease4(new Lease4(IOAddress("192.1.2.3"), hwaddr,
static_cast<const uint8_t*>(0), 0,
60, 30, 40, 0, 1));
60, 0, 1));
leases4->push_back(lease4);
callout_handle->setArgument("leases4", leases4);
......@@ -417,7 +417,7 @@ TEST_F(HAImplTest, leases6Committed) {
// updates.
DuidPtr duid(new DUID(std::vector<uint8_t>(8, 2)));
Lease6Ptr lease6(new Lease6(Lease::TYPE_NA, IOAddress("2001:db8:1::cafe"), duid,
1234, 50, 60, 30, 40, 1));
1234, 50, 60, 1));
leases6->push_back(lease6);
callout_handle->setArgument("leases6", leases6);
......
......@@ -79,7 +79,7 @@ void generateTestLeases(std::vector<Lease4Ptr>& leases) {
Lease4Ptr lease(new Lease4(IOAddress(lease_address),
HWAddrPtr(new HWAddr(hwaddr, HTYPE_ETHER)),
ClientIdPtr(),
60, 30, 40,
60,
static_cast<time_t>(1000 + i),
SubnetID(i)));
leases.push_back(lease);
......@@ -96,7 +96,7 @@ void generateTestLeases(std::vector<Lease6Ptr>& leases) {
address_bytes[6] += i;
Lease6Ptr lease(new Lease6(Lease::TYPE_NA,
IOAddress::fromBytes(AF_INET6, &address_bytes[0]),
duid, 1, 50, 60, 30, 40, SubnetID(i)));
duid, 1, 50, 60, SubnetID(i)));
leases.push_back(lease);
}
}
......@@ -673,14 +673,14 @@ public:
HWAddrPtr hwaddr(new HWAddr(std::vector<uint8_t>(6, 1), HTYPE_ETHER));