// (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.
// (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.
/// @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,
"");
}
}
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;
}
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;
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);
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
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
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;
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
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
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;
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);
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_);
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;
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
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;
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
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;
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
// 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
// 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;
// (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.
// (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.
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;
iaprefix->getAddress(), duid_,
ia->getIAID(),
iaprefix->getPreferred(),
- iaprefix->getValid(),
- ia->getT1(), ia->getT2(), 0,
+ iaprefix->getValid(), 0,
hwaddr,
iaprefix->getLength());
lease.cltt_ = time(NULL);
}
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)) {
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);
}
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));
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));
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_);
// 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));
// 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));
// 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));
// 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
// 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();
}
// 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));
// 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));
// 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));
// 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));
// 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));
// 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));
// 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));
// 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));
// 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));
// 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));
// 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;
// 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
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);
}
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
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);
// 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);
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);
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);
}
}
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);
// Create deleted leases collection and put the lease there too.
Lease4CollectionPtr deleted_leases4(new Lease4Collection());
Lease4Ptr deleted_lease4(new Lease4(IOAddress("192.2.3.4"), hwaddr,
static_cast<const uint8_t*>(0), 0,
- 60, 30, 40, 0, 1));
+ 60, 0, 1));
deleted_leases4->push_back(deleted_lease4);
// The communication state is the member of the HAServce object. We have to
Lease6CollectionPtr leases6(new Lease6Collection());
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);
// Create deleted leases collection and put the lease there too.
Lease6CollectionPtr deleted_leases6(new Lease6Collection());
Lease6Ptr deleted_lease6(new Lease6(Lease::TYPE_NA, IOAddress("2001:db8:1::efac"),
- duid, 1234, 50, 60, 30, 40, 1));
+ duid, 1234, 50, 60, 1));
deleted_leases6->push_back(deleted_lease6);
// The communication state is the member of the HAServce object. We have to
-// Copyright (C) 2017-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-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
}
// Let's fabricate some data and we're ready to go.
- uint32_t t1 = subnet->getT1();
- uint32_t t2 = subnet->getT2();
- Lease4Ptr l(new Lease4(addr, hwaddr_ptr, client_id, valid_lft, t1, t2,
+ Lease4Ptr l(new Lease4(addr, hwaddr_ptr, client_id, valid_lft,
cltt, subnet_id,
fqdn_fwd, fqdn_rev, hostname));
l->state_ = state;
}
// Let's fabricate some data and we're ready to go.
- uint32_t t1 = subnet->getT1();
- uint32_t t2 = subnet->getT2();
- Lease6Ptr l(new Lease6(type, addr, duid_ptr, iaid, pref_lft, valid_lft, t1, t2,
+ Lease6Ptr l(new Lease6(type, addr, duid_ptr, iaid, pref_lft, valid_lft,
subnet_id, fqdn_fwd, fqdn_rev, hostname,
hwaddr_ptr, prefix_len));
l->cltt_ = cltt;
-// Copyright (C) 2017-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-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
lease->addr_ = IOAddress(ip_address);
- // Initialize unused fields.
- lease->t1_ = 0; // Not saved
- lease->t2_ = 0; // Not saved
-
// Set other parameters. For historical reasons, address 0 is not used.
lease->hwaddr_.reset(new HWAddr(vector<uint8_t>(6, hw_address_pattern), HTYPE_ETHER));
lease->client_id_ = ClientIdPtr(new ClientId(vector<uint8_t>(8, client_id_pattern)));
-// 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
lease->addr_ = IOAddress(ip_address);
- // Initialize unused fields.
- lease->t1_ = 0; // Not saved
- lease->t2_ = 0; // Not saved
-
-
++hwaddr_[5];
// Set other parameters. For historical reasons, address 0 is not used.
expired->duid_ = ctx.duid_;
expired->preferred_lft_ = ctx.subnet_->getPreferred();
expired->valid_lft_ = ctx.subnet_->getValid();
- expired->t1_ = ctx.subnet_->getT1();
- expired->t2_ = ctx.subnet_->getT2();
expired->cltt_ = time(NULL);
expired->subnet_id_ = ctx.subnet_->getID();
expired->hostname_ = ctx.hostname_;
Lease6Ptr lease(new Lease6(ctx.currentIA().type_, addr, ctx.duid_,
ctx.currentIA().iaid_, ctx.subnet_->getPreferred(),
- ctx.subnet_->getValid(), ctx.subnet_->getT1(),
- ctx.subnet_->getT2(), ctx.subnet_->getID(),
+ ctx.subnet_->getValid(), ctx.subnet_->getID(),
ctx.hwaddr_, prefix_len));
lease->fqdn_fwd_ = ctx.fwd_dns_update_;
lease->preferred_lft_ = ctx.subnet_->getPreferred();
lease->valid_lft_ = ctx.subnet_->getValid();
- lease->t1_ = ctx.subnet_->getT1();
- lease->t2_ = ctx.subnet_->getT2();
lease->hostname_ = ctx.hostname_;
lease->fqdn_fwd_ = ctx.fwd_dns_update_;
lease->fqdn_rev_ = ctx.rev_dns_update_;
const uint8_t* local_copy0 = local_copy.empty() ? 0 : &local_copy[0];
Lease4Ptr lease(new Lease4(addr, ctx.hwaddr_, local_copy0, local_copy.size(),
- ctx.subnet_->getValid(), ctx.subnet_->getT1(),
- ctx.subnet_->getT2(),
+ ctx.subnet_->getValid(),
now, ctx.subnet_->getID()));
// Set FQDN specific lease parameters.
lease->hwaddr_ = ctx.hwaddr_;
lease->client_id_ = ctx.subnet_->getMatchClientId() ? ctx.clientid_ : ClientIdPtr();
lease->cltt_ = time(NULL);
- lease->t1_ = ctx.subnet_->getT1();
- lease->t2_ = ctx.subnet_->getT2();
lease->valid_lft_ = ctx.subnet_->getValid();
lease->fqdn_fwd_ = ctx.fwd_dns_update_;
lease->fqdn_rev_ = ctx.rev_dns_update_;
}
Lease4Ptr result(new Lease4(addr4, hwaddr, client_id_.data(),
- client_id_.size(), valid_lifetime_, 0, 0,
+ client_id_.size(), valid_lifetime_,
cltt, subnet_id_, fqdn_fwd_, fqdn_rev_,
hostname_));
// expire time retrieved from the database).
Lease6Ptr result(
new Lease6(static_cast<Lease::Type>(lease_type_), addr, duid, iaid_,
- pref_lifetime_, valid_lifetime_, 0, 0, subnet_id_,
+ pref_lifetime_, valid_lifetime_, subnet_id_,
fqdn_fwd_, fqdn_rev_, hostname_, hwaddr, prefix_len_));
time_t cltt = 0;
-// Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-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
client_id_vec.empty() ? NULL : &client_id_vec[0],
client_id_len,
readValid(row),
- 0, 0, // t1, t2 = 0
readCltt(row),
readSubnetID(row),
readFqdnFwd(row),
-// Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-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
lease.reset(new Lease6(readType(row), readAddress(row), readDUID(row),
readIAID(row), readPreferred(row),
- readValid(row), 0, 0, // t1, t2 = 0
+ readValid(row),
readSubnetID(row),
readHWAddr(row),
readPrefixLen(row)));
-// Copyright (C) 2012-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-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
const uint32_t Lease::STATE_DECLINED = 0x1;
const uint32_t Lease::STATE_EXPIRED_RECLAIMED = 0x2;
-Lease::Lease(const isc::asiolink::IOAddress& addr, uint32_t t1, uint32_t t2,
+Lease::Lease(const isc::asiolink::IOAddress& addr,
uint32_t valid_lft, SubnetID subnet_id, time_t cltt,
const bool fqdn_fwd, const bool fqdn_rev,
const std::string& hostname, const HWAddrPtr& hwaddr)
- :addr_(addr), t1_(t1), t2_(t2), valid_lft_(valid_lft), cltt_(cltt),
+ :addr_(addr), valid_lft_(valid_lft), cltt_(cltt),
subnet_id_(subnet_id), hostname_(hostname), fqdn_fwd_(fqdn_fwd),
fqdn_rev_(fqdn_rev), hwaddr_(hwaddr), state_(STATE_DEFAULT) {
}
}
Lease4::Lease4(const Lease4& other)
- : Lease(other.addr_, other.t1_, other.t2_, other.valid_lft_,
+ : Lease(other.addr_, other.valid_lft_,
other.subnet_id_, other.cltt_, other.fqdn_fwd_,
other.fqdn_rev_, other.hostname_, other.hwaddr_) {
const HWAddrPtr& hw_address,
const ClientIdPtr& client_id,
const uint32_t valid_lifetime,
- const uint32_t t1,
- const uint32_t t2,
const time_t cltt,
const SubnetID subnet_id,
const bool fqdn_fwd,
const bool fqdn_rev,
const std::string& hostname)
- : Lease(address, t1, t2, valid_lifetime, subnet_id, cltt, fqdn_fwd,
+ : Lease(address, valid_lifetime, subnet_id, cltt, fqdn_fwd,
fqdn_rev, hostname, hw_address),
client_id_(client_id) {
}
Lease4::decline(uint32_t probation_period) {
hwaddr_.reset(new HWAddr());
client_id_.reset();
- t1_ = 0;
- t2_ = 0;
cltt_ = time(NULL);
hostname_ = string("");
fqdn_fwd_ = false;
Lease4::operator=(const Lease4& other) {
if (this != &other) {
addr_ = other.addr_;
- t1_ = other.t1_;
- t2_ = other.t2_;
valid_lft_ = other.valid_lft_;
cltt_ = other.cltt_;
subnet_id_ = other.subnet_id_;
Lease6::Lease6(Lease::Type type, const isc::asiolink::IOAddress& addr,
DuidPtr duid, uint32_t iaid, uint32_t preferred, uint32_t valid,
- uint32_t t1, uint32_t t2, SubnetID subnet_id,
- const HWAddrPtr& hwaddr, uint8_t prefixlen)
- : Lease(addr, t1, t2, valid, subnet_id, 0/*cltt*/, false, false, "", hwaddr),
+ SubnetID subnet_id, const HWAddrPtr& hwaddr, uint8_t prefixlen)
+ : Lease(addr, valid, subnet_id, 0/*cltt*/, false, false, "", hwaddr),
type_(type), prefixlen_(prefixlen), iaid_(iaid), duid_(duid),
preferred_lft_(preferred) {
if (!duid) {
Lease6::Lease6(Lease::Type type, const isc::asiolink::IOAddress& addr,
DuidPtr duid, uint32_t iaid, uint32_t preferred, uint32_t valid,
- uint32_t t1, uint32_t t2, SubnetID subnet_id,
- const bool fqdn_fwd, const bool fqdn_rev,
+ SubnetID subnet_id, const bool fqdn_fwd, const bool fqdn_rev,
const std::string& hostname, const HWAddrPtr& hwaddr,
uint8_t prefixlen)
- : Lease(addr, t1, t2, valid, subnet_id, 0/*cltt*/,
+ : Lease(addr, valid, subnet_id, 0/*cltt*/,
fqdn_fwd, fqdn_rev, hostname, hwaddr),
type_(type), prefixlen_(prefixlen), iaid_(iaid), duid_(duid),
preferred_lft_(preferred) {
}
Lease6::Lease6()
- : Lease(isc::asiolink::IOAddress("::"), 0, 0, 0, 0, 0, false, false, "",
+ : Lease(isc::asiolink::IOAddress("::"), 0, 0, 0, false, false, "",
HWAddrPtr()), type_(TYPE_NA), prefixlen_(0), iaid_(0),
duid_(DuidPtr()), preferred_lft_(0) {
}
Lease6::decline(uint32_t probation_period) {
hwaddr_.reset();
duid_.reset(new DUID(DUID::EMPTY()));
- t1_ = 0;
- t2_ = 0;
preferred_lft_ = 0;
valid_lft_ = probation_period;
cltt_ = time(NULL);
stream << "Address: " << addr_ << "\n"
<< "Valid life: " << valid_lft_ << "\n"
- << "T1: " << t1_ << "\n"
- << "T2: " << t2_ << "\n"
<< "Cltt: " << cltt_ << "\n"
<< "Hardware addr: " << (hwaddr_ ? hwaddr_->toText(false) : "(none)") << "\n"
<< "Client id: " << (client_id_ ? client_id_->toText() : "(none)") << "\n"
nullOrEqualValues(client_id_, other.client_id_) &&
addr_ == other.addr_ &&
subnet_id_ == other.subnet_id_ &&
- t1_ == other.t1_ &&
- t2_ == other.t2_ &&
valid_lft_ == other.valid_lft_ &&
cltt_ == other.cltt_ &&
hostname_ == other.hostname_ &&
iaid_ == other.iaid_ &&
preferred_lft_ == other.preferred_lft_ &&
valid_lft_ == other.valid_lft_ &&
- t1_ == other.t1_ &&
- t2_ == other.t2_ &&
cltt_ == other.cltt_ &&
subnet_id_ == other.subnet_id_ &&
hostname_ == other.hostname_ &&
-// 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
/// @brief Constructor
///
/// @param addr IP address
- /// @param t1 renewal time
- /// @param t2 rebinding time
/// @param valid_lft Lifetime of the lease
/// @param subnet_id Subnet identification
/// @param cltt Client last transmission time
/// @param fqdn_rev If true, reverse DNS update is performed for a lease.
/// @param hostname FQDN of the client which gets the lease.
/// @param hwaddr Hardware/MAC address
- Lease(const isc::asiolink::IOAddress& addr, uint32_t t1, uint32_t t2,
+ Lease(const isc::asiolink::IOAddress& addr,
uint32_t valid_lft, SubnetID subnet_id, time_t cltt,
const bool fqdn_fwd, const bool fqdn_rev,
const std::string& hostname,
/// IPv4, IPv6 address or, in the case of a prefix delegation, the prefix.
isc::asiolink::IOAddress addr_;
- /// @brief Renewal timer
- ///
- /// Specifies renewal time. Although technically it is a property of the
- /// IA container and not the address itself, since our data model does not
- /// define a separate IA entity, we are keeping it in the lease. In the
- /// case of multiple addresses/prefixes for the same IA, each must have
- /// consistent T1 and T2 values. This is specified in seconds since cltt.
- uint32_t t1_;
-
- /// @brief Rebinding timer
- ///
- /// Specifies rebinding time. Although technically it is a property of the
- /// IA container and not the address itself, since our data model does not
- /// define a separate IA entity, we are keeping it in the lease. In the
- /// case of multiple addresses/prefixes for the same IA, each must have
- /// consistent T1 and T2 values. This is specified in seconds since cltt.
- uint32_t t2_;
-
/// @brief Valid lifetime
///
/// Expressed as number of seconds since cltt.
/// @brief Sets lease to DECLINED state.
///
/// All client identifying parameters will be stripped off (HWaddr,
- /// client_id, hostname), timers set to 0 (t1, t2), cltt will be set
- /// to current time and valid_lft to parameter specified as probation
- /// period. Note that This method only sets fields in the structure.
+ /// client_id, hostname), cltt will be set to current time and
+ /// valid_lft to parameter specified as probation period.
+ /// Note that This method only sets fields in the structure.
/// It is caller's responsibility to clean up DDNS, bump up stats,
/// log, call hooks ets.
///
/// @param clientid Client identification buffer
/// @param clientid_len Length of client identification buffer
/// @param valid_lft Lifetime of the lease
- /// @param t1 renewal time
- /// @param t2 rebinding time
/// @param cltt Client last transmission time
/// @param subnet_id Subnet identification
/// @param fqdn_fwd If true, forward DNS update is performed for a lease.
/// @param hostname FQDN of the client which gets the lease.
Lease4(const isc::asiolink::IOAddress& addr, const HWAddrPtr& hwaddr,
const uint8_t* clientid, size_t clientid_len, uint32_t valid_lft,
- uint32_t t1, uint32_t t2, time_t cltt, uint32_t subnet_id,
+ time_t cltt, uint32_t subnet_id,
const bool fqdn_fwd = false, const bool fqdn_rev = false,
const std::string& hostname = "")
- : Lease(addr, t1, t2, valid_lft, subnet_id, cltt, fqdn_fwd, fqdn_rev,
+ : Lease(addr, valid_lft, subnet_id, cltt, fqdn_fwd, fqdn_rev,
hostname, hwaddr) {
if (clientid_len) {
client_id_.reset(new ClientId(clientid, clientid_len));
/// @param hw_address Pointer to client's HW addresss.
/// @param client_id pointer to the client id structure.
/// @param valid_lifetime Valid lifetime value.
- /// @param t1 Renew timer.
- /// @param t2 Rebind timer.
/// @param cltt Timestamp when the lease is acquired, renewed.
/// @param subnet_id Subnet identifier.
/// @param fqdn_fwd Forward DNS update performed.
const HWAddrPtr& hw_address,
const ClientIdPtr& client_id,
const uint32_t valid_lifetime,
- const uint32_t t1,
- const uint32_t t2,
const time_t cltt,
const SubnetID subnet_id,
const bool fqdn_fwd = false,
/// @brief Default constructor
///
/// Initialize fields that don't have a default constructor.
- Lease4() : Lease(0, 0, 0, 0, 0, 0, false, false, "", HWAddrPtr())
+ Lease4() : Lease(0, 0, 0, 0, false, false, "", HWAddrPtr())
{
}
/// @param iaid IAID.
/// @param preferred Preferred lifetime.
/// @param valid Valid lifetime.
- /// @param t1 A value of the T1 timer.
- /// @param t2 A value of the T2 timer.
/// @param subnet_id A Subnet identifier.
/// @param hwaddr hardware/MAC address (optional)
/// @param prefixlen An address prefix length (optional, defaults to 128)
Lease6(Lease::Type type, const isc::asiolink::IOAddress& addr, DuidPtr duid,
- uint32_t iaid, uint32_t preferred, uint32_t valid, uint32_t t1,
- uint32_t t2, SubnetID subnet_id, const HWAddrPtr& hwaddr = HWAddrPtr(),
+ uint32_t iaid, uint32_t preferred, uint32_t valid,
+ SubnetID subnet_id, const HWAddrPtr& hwaddr = HWAddrPtr(),
uint8_t prefixlen = 128);
/// @brief Constructor, including FQDN data.
/// @param iaid IAID.
/// @param preferred Preferred lifetime.
/// @param valid Valid lifetime.
- /// @param t1 A value of the T1 timer.
- /// @param t2 A value of the T2 timer.
/// @param subnet_id A Subnet identifier.
/// @param fqdn_fwd If true, forward DNS update is performed for a lease.
/// @param fqdn_rev If true, reverse DNS update is performed for a lease.
/// @param hwaddr hardware address (MAC), may be NULL
/// @param prefixlen An address prefix length (optional, defaults to 128)
Lease6(Lease::Type type, const isc::asiolink::IOAddress& addr, DuidPtr duid,
- uint32_t iaid, uint32_t preferred, uint32_t valid, uint32_t t1,
- uint32_t t2, SubnetID subnet_id, const bool fqdn_fwd,
+ uint32_t iaid, uint32_t preferred, uint32_t valid,
+ SubnetID subnet_id, const bool fqdn_fwd,
const bool fqdn_rev, const std::string& hostname,
const HWAddrPtr& hwaddr = HWAddrPtr(), uint8_t prefixlen = 128);
}
}
- // note that T1 and T2 are not stored
Lease4Ptr lease(new Lease4(addr4_, hwaddr,
client_id_buffer_, client_id_length_,
- valid_lifetime_, 0, 0, cltt, subnet_id_,
+ valid_lifetime_, cltt, subnet_id_,
fqdn_fwd_, fqdn_rev_, hostname));
// Set state.
// Create the lease and set the cltt (after converting from the
// expire time retrieved from the database).
Lease6Ptr result(new Lease6(type, addr, duid_ptr, iaid_,
- pref_lifetime_, valid_lifetime_, 0, 0,
+ pref_lifetime_, valid_lifetime_,
subnet_id_, fqdn_fwd_, fqdn_rev_,
hostname, hwaddr, prefixlen_));
time_t cltt = 0;
-// Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-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
Lease4Ptr result(new Lease4(addr4_, hwaddr,
client_id_buffer_, client_id_length_,
- valid_lifetime_, 0, 0, cltt_,
+ valid_lifetime_, cltt_,
subnet_id_, fqdn_fwd_, fqdn_rev_,
hostname_));
Lease6Ptr result(new Lease6(lease_type_, addr, duid_ptr,
iaid_u_.uval_, pref_lifetime_,
- valid_lifetime_, 0, 0,
+ valid_lifetime_,
subnet_id_, fqdn_fwd_, fqdn_rev_,
hostname_, hwaddr, prefix_len_));
result->cltt_ = cltt_;
uint8_t clientid2[] = { 8, 7, 6, 5, 4, 3, 2, 1 };
time_t now = time(NULL);
Lease4Ptr used(new Lease4(IOAddress("192.0.2.106"), hwaddr2,
- clientid2, sizeof(clientid2), 1, 2, 3, now, subnet_->getID()));
+ clientid2, sizeof(clientid2), 1, now, subnet_->getID()));
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(used));
// Another client comes in and request an address that is in pool, but
uint8_t clientid2[] = { 8, 7, 6, 5, 4, 3, 2, 1 };
time_t now = time(NULL);
Lease4Ptr lease(new Lease4(addr, hwaddr2, clientid2,
- sizeof(clientid2), 501, 502, 503, now,
+ sizeof(clientid2), 501, now,
subnet_->getID()));
lease->cltt_ = time(NULL) - 10; // Allocated 10 seconds ago
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
Lease4Ptr
insertLease(std::string addr, SubnetID subnet_id) {
Lease4Ptr lease(new Lease4(IOAddress(addr), hwaddr2_, ClientIdPtr(),
- 501, 502, 503, time(NULL), subnet_id));
+ 501, time(NULL), subnet_id));
lease->cltt_ = time(NULL) - 10; // Allocated 10 seconds ago
if (!LeaseMgrFactory::instance().addLease(lease)) {
ADD_FAILURE() << "Attempt to add a lease for IP " << addr
// Let's create a lease for the client to make sure the lease is not
// renewed but a reserved lease is offerred.
Lease4Ptr lease2(new Lease4(IOAddress("192.0.2.17"), hwaddr_, ClientIdPtr(),
- 501, 502, 503, time(NULL), subnet1_->getID()));
+ 501, time(NULL), subnet1_->getID()));
lease->cltt_ = time(NULL) - 10; // Allocated 10 seconds ago
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease2));
ctx.subnet_ = subnet1_;
// Let's create a lease for the client to make sure the lease is not
// renewed but a reserved lease is offerred.
Lease4Ptr lease2(new Lease4(IOAddress("192.0.2.17"), hwaddr_, ClientIdPtr(),
- 501, 502, 503, time(NULL), subnet1_->getID()));
+ 501, time(NULL), subnet1_->getID()));
lease->cltt_ = time(NULL) - 10; // Allocated 10 seconds ago
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease2));
ctx.subnet_ = subnet1_;
// Let's create a lease for the client to make sure the lease is not
// renewed but a reserved lease is allocated again.
Lease4Ptr lease2(new Lease4(IOAddress("192.0.2.17"), hwaddr_, ClientIdPtr(),
- 501, 502, 503, time(NULL), subnet1_->getID()));
+ 501, time(NULL), subnet1_->getID()));
lease->cltt_ = time(NULL) - 10; // Allocated 10 seconds ago
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease2));
ctx.subnet_ = subnet1_;
// Let's create a lease for the client to make sure the lease is not
// renewed but a reserved lease is allocated again.
Lease4Ptr lease2(new Lease4(IOAddress("192.0.2.17"), hwaddr_, ClientIdPtr(),
- 501, 502, 503, time(NULL), subnet1_->getID()));
+ 501, time(NULL), subnet1_->getID()));
lease->cltt_ = time(NULL) - 10; // Allocated 10 seconds ago
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease2));
ctx.subnet_ = subnet1_;
uint8_t clientid2[] = { 8, 7, 6, 5, 4, 3, 2, 1 };
time_t now = time(NULL) - 500; // Allocated 500 seconds ago
Lease4Ptr lease(new Lease4(addr, hwaddr2, clientid2, sizeof(clientid2),
- 495, 100, 200, now, subnet_->getID()));
+ 495, now, subnet_->getID()));
// Copy the lease, so as it can be compared with the old lease returned
// by the allocation engine.
Lease4 original_lease(*lease);
time_t now = time(NULL) - 500; // Allocated 500 seconds ago
Lease4Ptr lease(new Lease4(addr, hwaddr2, clientid2, sizeof(clientid2),
- 495, 100, 200, now, subnet_->getID()));
+ 495, now, subnet_->getID()));
// Make a copy of the lease, so as we can compare that with the old lease
// instance returned by the allocation engine.
Lease4 original_lease(*lease);
// identifier and HW address.
TEST_F(AllocEngine4Test, identifyClientLease) {
Lease4Ptr lease(new Lease4(IOAddress("192.0.2.101"), hwaddr_, clientid_,
- 100, 30, 60, time(NULL), subnet_->getID()));
+ 100, time(NULL), subnet_->getID()));
LeaseMgrFactory::instance().addLease(lease);
AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
Lease4Ptr lease(new Lease4(IOAddress("192.0.2.101"), hwaddr_,
&clientid_->getClientId()[0],
clientid_->getClientId().size(),
- 100, 30, 60, time(NULL), subnet_->getID(),
+ 100, time(NULL), subnet_->getID(),
false, false, ""));
// Create the second lease. Note that we use the same client id here and
// we expect that the allocation engine will figure out that the hardware
Lease4Ptr lease2(new Lease4(IOAddress("192.0.2.102"), hwaddr2_,
&clientid_->getClientId()[0],
clientid_->getClientId().size(),
- 100, 30, 60, time(NULL), subnet_->getID(),
+ 100, time(NULL), subnet_->getID(),
false, false, ""));
// Add leases for both clients to the Lease Manager.
LeaseMgrFactory::instance().addLease(lease);
Lease4Ptr lease(new Lease4(IOAddress("192.0.2.101"), hwaddr_,
&clientid_->getClientId()[0],
clientid_->getClientId().size(),
- 100, 30, 60, time(NULL), subnet_->getID(),
+ 100, time(NULL), subnet_->getID(),
false, false, ""));
LeaseMgrFactory::instance().addLease(lease);
// Allocate a lease for the client A for the same address as reserved
// for the client B.
Lease4Ptr lease(new Lease4(IOAddress("192.0.2.123"), hwaddr2_, 0, 0,
- 100, 30, 60, time(NULL), subnet_->getID(),
+ 100, time(NULL), subnet_->getID(),
false, false, ""));
LeaseMgrFactory::instance().addLease(lease);
// Create a lease for the client A.
Lease4Ptr lease(new Lease4(IOAddress("192.0.2.123"), hwaddr2_, 0, 0,
- 100, 30, 60, time(NULL), subnet_->getID(),
+ 100, time(NULL), subnet_->getID(),
false, false, ""));
LeaseMgrFactory::instance().addLease(lease);
// Create a lease for the client for a different address than reserved.
Lease4Ptr lease(new Lease4(IOAddress("192.0.2.101"), hwaddr_, ClientIdPtr(),
- 100, 30, 60, time(NULL), subnet_->getID(),
+ 100, time(NULL), subnet_->getID(),
false, false, ""));
LeaseMgrFactory::instance().addLease(lease);
Lease4Ptr lease(new Lease4(IOAddress("192.0.2.101"), hwaddr_,
&clientid_->getClientId()[0],
clientid_->getClientId().size(),
- 100, 30, 60, time(NULL), subnet_->getID(),
+ 100, time(NULL), subnet_->getID(),
false, false, ""));
LeaseMgrFactory::instance().addLease(lease);
Lease4Ptr lease(new Lease4(IOAddress("192.0.2.101"), hwaddr_,
&clientid_->getClientId()[0],
clientid_->getClientId().size(),
- 100, 30, 60, time(NULL), subnet_->getID(),
+ 100, time(NULL), subnet_->getID(),
false, false, ""));
LeaseMgrFactory::instance().addLease(lease);
Lease4Ptr lease(new Lease4(IOAddress("192.0.2.101"), hwaddr_,
&clientid_->getClientId()[0],
clientid_->getClientId().size(),
- 100, 30, 60, time(NULL), subnet_->getID(),
+ 100, time(NULL), subnet_->getID(),
false, false, ""));
LeaseMgrFactory::instance().addLease(lease);
Lease4Ptr lease(new Lease4(IOAddress("192.0.2.101"), hwaddr_,
&clientid_->getClientId()[0],
clientid_->getClientId().size(),
- 100, 30, 60, time(NULL), subnet_->getID(),
+ 100, time(NULL), subnet_->getID(),
false, false, ""));
LeaseMgrFactory::instance().addLease(lease);
Lease4Ptr lease(new Lease4(IOAddress("192.0.2.101"), hwaddr_,
&clientid_->getClientId()[0],
clientid_->getClientId().size(),
- 100, 30, 60, time(NULL), subnet_->getID(),
+ 100, time(NULL), subnet_->getID(),
false, false, ""));
LeaseMgrFactory::instance().addLease(lease);
DuidPtr other_duid = DuidPtr(new DUID(vector<uint8_t>(12, 0xff)));
const uint32_t other_iaid = 3568;
Lease6Ptr lease(new Lease6(Lease::TYPE_NA, addr, other_duid, other_iaid,
- 501, 502, 503, 504, subnet_->getID(),
+ 501, 502, subnet_->getID(),
HWAddrPtr(), 0));
lease->cltt_ = time(NULL) - 10; // Allocated 10 seconds ago
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
DuidPtr other_duid = DuidPtr(new DUID(vector<uint8_t>(12, 0xff)));
const uint32_t other_iaid = 3568;
Lease6Ptr lease(new Lease6(Lease::TYPE_NA, addr, other_duid, other_iaid,
- 501, 502, 503, 504, subnet_->getID(),
+ 501, 502, subnet_->getID(),
HWAddrPtr(), 0));
lease->cltt_ = time(NULL) - 500; // Allocated 500 seconds ago
lease->valid_lft_ = 495; // Lease was valid for 495 seconds
const SubnetID other_subnetid = 999;
Lease6Ptr lease(new Lease6(Lease::TYPE_NA, addr, other_duid, other_iaid,
- 501, 502, 503, 504, other_subnetid, HWAddrPtr(),
+ 501, 502, other_subnetid, HWAddrPtr(),
0));
lease->cltt_ = time(NULL) - 500; // Allocated 500 seconds ago
TEST_F(AllocEngine6Test, requestExtendLeaseLifetime) {
// Create a lease for the client.
Lease6Ptr lease(new Lease6(Lease::TYPE_NA, IOAddress("2001:db8:1::15"),
- duid_, iaid_, 300, 400, 100, 200,
+ duid_, iaid_, 300, 400,
subnet_->getID(), HWAddrPtr(), 128));
// Allocated 200 seconds ago - half of the lifetime.
// Create a lease for the client.
Lease6Ptr lease(new Lease6(Lease::TYPE_NA, IOAddress("2001:db8:1::1c"),
- duid_, iaid_, 300, 400, 100, 200,
+ duid_, iaid_, 300, 400,
subnet_->getID(), HWAddrPtr(), 128));
// Allocated 200 seconds ago - half of the lifetime.
TEST_F(AllocEngine6Test, renewExtendLeaseLifetime) {
// Create a lease for the client.
Lease6Ptr lease(new Lease6(Lease::TYPE_NA, IOAddress("2001:db8:1::15"),
- duid_, iaid_, 300, 400, 100, 200,
+ duid_, iaid_, 300, 400,
subnet_->getID(), HWAddrPtr(), 128));
// Allocated 200 seconds ago - half of the lifetime.
// Create a lease for the client.
Lease6Ptr lease(new Lease6(Lease::TYPE_NA, IOAddress("2001:db8:1::15"),
- duid_, iaid_, 300, 400, 100, 200,
+ duid_, iaid_, 300, 400,
subnet_->getID(), HWAddrPtr(), 128));
// Allocated 200 seconds ago - half of the lifetime.
// Allocate the lease.
Lease6Ptr lease(new Lease6(Lease::TYPE_NA, IOAddress(address.str()),
- duid, iaid, 501, 502, 503, 504, subnet_->getID(),
+ duid, iaid, 501, 502, subnet_->getID(),
HWAddrPtr(), 0));
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
}
// Let's create an expired lease
Lease6Ptr lease(new Lease6(Lease::TYPE_NA, addr, duid_, iaid_,
- 501, 502, 503, 504, subnet_->getID(), HWAddrPtr(),
+ 501, 502, subnet_->getID(), HWAddrPtr(),
0));
lease->cltt_ = time(NULL) - 500; // Allocated 500 seconds ago
lease->valid_lft_ = 495; // Lease was valid for 495 seconds
Lease6Ptr
insertLease(std::string addr, SubnetID subnet_id) {
Lease6Ptr lease(new Lease6(Lease::TYPE_NA, IOAddress(addr), duid_, iaid_,
- 501, 502, 503, 504, subnet_->getID(),
+ 501, 502, subnet_->getID(),
HWAddrPtr(), 0));
lease->cltt_ = time(NULL) - 10; // Allocated 10 seconds ago
if (!LeaseMgrFactory::instance().addLease(lease)) {
DuidPtr other_duid(new DUID(vector<uint8_t>(12, 0xff)));
const uint32_t other_iaid = 3568;
Lease6Ptr lease(new Lease6(Lease::TYPE_NA, IOAddress("2001:db8:1::1"),
- other_duid, other_iaid, 501, 502, 503, 504,
+ other_duid, other_iaid, 501, 502,
subnet1_->getID(),
HWAddrPtr(), 0));
lease->cltt_ = time(NULL) - 10; // Allocated 10 seconds ago
// reclaimed state initially to allow for checking whether the lease
// gets renewed.
Lease6Ptr lease(new Lease6(Lease::TYPE_NA, IOAddress("2001:db8:2::1"),
- duid_, iaid_, 501, 502, 503, 504,
+ duid_, iaid_, 501, 502,
subnet2_->getID(), HWAddrPtr(), 128));
lease->state_ = Lease::STATE_EXPIRED_RECLAIMED;
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
IOAddress address(address_s.str());
// Create lease.
- Lease6Ptr lease(new Lease6(Lease::TYPE_NA, address, duid, 1, 50, 60, 10,
- 20, SubnetID(1), true, true,
+ Lease6Ptr lease(new Lease6(Lease::TYPE_NA, address, duid, 1, 50, 60,
+ SubnetID(1), true, true,
generateHostnameForLeaseIndex(i)));
leases_.push_back(lease);
// Copy the lease before adding it to the lease manager. We want to
IOAddress address(address_s.str());
// Create lease.
- Lease4Ptr lease(new Lease4(address, hwaddr, ClientIdPtr(), 60, 10, 20,
+ Lease4Ptr lease(new Lease4(address, hwaddr, ClientIdPtr(), 60,
time(NULL), SubnetID(1), true, true,
generateHostnameForLeaseIndex(i)));
leases_.push_back(lease);
-// 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
callout_handle.getArgument("lease6", lease);
callback_addr_updated_ = addr_override_;
lease->addr_ = callback_addr_updated_;
- lease->t1_ = t1_override_;
- lease->t2_ = t2_override_;
lease->preferred_lft_ = pref_override_;
lease->valid_lft_ = valid_override_;
// Values to be used in callout to override lease6 content
static const IOAddress addr_override_;
- static const uint32_t t1_override_;
- static const uint32_t t2_override_;
static const uint32_t pref_override_;
static const uint32_t valid_override_;
// linker complains about undefined references if they are defined within
// the class declaration.
const IOAddress HookAllocEngine6Test::addr_override_("2001:db8::abcd");
-const uint32_t HookAllocEngine6Test::t1_override_ = 6000;
-const uint32_t HookAllocEngine6Test::t2_override_ = 7000;
const uint32_t HookAllocEngine6Test::pref_override_ = 8000;
const uint32_t HookAllocEngine6Test::valid_override_ = 9000;
// Make sure that the overridden values are different than the ones from
// subnet originally used to create the lease
- ASSERT_NE(t1_override_, subnet_->getT1());
- ASSERT_NE(t2_override_, subnet_->getT2());
ASSERT_NE(pref_override_, subnet_->getPreferred());
ASSERT_NE(valid_override_, subnet_->getValid());
ASSERT_FALSE(subnet_->inRange(addr_override_));
// See if the values overridden by callout are there
EXPECT_TRUE(lease->addr_.equals(addr_override_));
- EXPECT_EQ(t1_override_, lease->t1_);
- EXPECT_EQ(t2_override_, lease->t2_);
EXPECT_EQ(pref_override_, lease->preferred_lft_);
EXPECT_EQ(valid_override_, lease->valid_lft_);
// Check if values in the database are overridden
EXPECT_TRUE(from_mgr->addr_.equals(addr_override_));
- EXPECT_EQ(t1_override_, from_mgr->t1_);
- EXPECT_EQ(t2_override_, from_mgr->t2_);
EXPECT_EQ(pref_override_, from_mgr->preferred_lft_);
EXPECT_EQ(valid_override_, from_mgr->valid_lft_);
callout_handle.getArgument("lease4", lease);
callback_addr_updated_ = addr_override_;
lease->addr_ = callback_addr_updated_;
- lease->t1_ = t1_override_;
- lease->t2_ = t2_override_;
lease->valid_lft_ = valid_override_;
return (0);
// Values to be used in callout to override lease4 content
static const IOAddress addr_override_;
- static const uint32_t t1_override_;
- static const uint32_t t2_override_;
static const uint32_t valid_override_;
// Callback will store original and overridden values here
// linker complains about undefined references if they are defined within
// the class declaration.
const IOAddress HookAllocEngine4Test::addr_override_("192.0.3.1");
-const uint32_t HookAllocEngine4Test::t1_override_ = 4000;
-const uint32_t HookAllocEngine4Test::t2_override_ = 7000;
const uint32_t HookAllocEngine4Test::valid_override_ = 9000;
IOAddress HookAllocEngine4Test::callback_addr_original_("::");
// Make sure that the overridden values are different than the ones from
// subnet originally used to create the lease
- ASSERT_NE(t1_override_, subnet_->getT1());
- ASSERT_NE(t2_override_, subnet_->getT2());
ASSERT_NE(valid_override_, subnet_->getValid());
ASSERT_FALSE(subnet_->inRange(addr_override_));
// See if the values overridden by callout are there
EXPECT_TRUE(lease->addr_.equals(addr_override_));
- EXPECT_EQ(t1_override_, lease->t1_);
- EXPECT_EQ(t2_override_, lease->t2_);
EXPECT_EQ(valid_override_, lease->valid_lft_);
// Now check if the lease is in the database
// Check if values in the database are overridden
EXPECT_TRUE(from_mgr->addr_.equals(addr_override_));
- EXPECT_EQ(t1_override_, from_mgr->t1_);
- EXPECT_EQ(t2_override_, from_mgr->t2_);
EXPECT_EQ(valid_override_, from_mgr->valid_lft_);
// Check if the callout handle state was reset after the callout.
HWAddrPtr hwaddr(new HWAddr());
time_t now = time(NULL);
Lease4Ptr declined(new Lease4(addr, hwaddr, ClientIdPtr(), 495,
- 100, 200, now, subnet_->getID()));
+ now, subnet_->getID()));
declined->decline(probation_period);
declined->cltt_ = now - probation_period + expired;
return (declined);
DuidPtr duid2 = boost::shared_ptr<DUID>(new DUID(vector<uint8_t>(8, 0xff)));
time_t now = time(NULL);
Lease6Ptr used(new Lease6(type, used_addr,
- duid2, 1, 2, 3, 4, now, subnet_->getID()));
+ duid2, 1, 2, now, subnet_->getID()));
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(used));
// Another client comes in and request an address that is in pool, but
time_t probation_period,
int32_t expired) {
Lease6Ptr declined(new Lease6(Lease::TYPE_NA, IOAddress(addr),
- duid_, iaid_, 100, 100, 100, 100, subnet_->getID()));
+ duid_, iaid_, 100, 100, subnet_->getID()));
time_t now = time(NULL);
declined->decline(probation_period);
EXPECT_EQ(iaid_, lease->iaid_);
EXPECT_EQ(subnet_->getValid(), lease->valid_lft_);
EXPECT_EQ(subnet_->getPreferred(), lease->preferred_lft_);
- EXPECT_EQ(subnet_->getT1(), lease->t1_);
- EXPECT_EQ(subnet_->getT2(), lease->t2_);
EXPECT_EQ(exp_pd_len, lease->prefixlen_);
EXPECT_EQ(fqdn_fwd_, lease->fqdn_fwd_);
EXPECT_EQ(fqdn_rev_, lease->fqdn_rev_);
// Check that it has proper parameters
EXPECT_EQ(subnet_->getValid(), lease->valid_lft_);
- EXPECT_EQ(subnet_->getT1(), lease->t1_);
- EXPECT_EQ(subnet_->getT2(), lease->t2_);
if (lease->client_id_ && !clientid_) {
ADD_FAILURE() << "Lease4 has a client-id, while it should have none.";
} else
// Test checks whether simple add, get and delete operations are possible
// on Lease6
TEST_F(CqlLeaseMgrTest, testAddGetDelete6) {
- testAddGetDelete6(false);
+ testAddGetDelete6();
}
/// @brief Basic Lease6 Checks
-// Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-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
Lease4Ptr lease(new Lease4(IOAddress("192.0.3.2"),
hwaddr0_,
NULL, 0,
- 200, 50, 80, 0, 8, true, true,
+ 200, 0, 8, true, true,
"host.example.com"));
lease->state_ = Lease::STATE_EXPIRED_RECLAIMED;
{
lease.reset(new Lease4(IOAddress("192.0.3.10"),
hwaddr1_,
CLIENTID, sizeof(CLIENTID),
- 100, 60, 90, 0, 7));
+ 100, 0, 7));
lease->setContext(Element::fromJSON("{ \"foobar\": true }"));
{
SCOPED_TRACE("Second write");
Lease4Ptr lease(new Lease4(IOAddress("192.0.3.2"),
hwaddr0_,
NULL, 0,
- 0xFFFFFFFF, 50, 80, time(0),
+ 0xFFFFFFFF, time(0),
8, true, true,
"host.example.com"));
// Write this lease out to the lease file.
-// Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-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
Lease6Ptr lease(new Lease6(Lease::TYPE_NA, IOAddress("2001:db8:1::1"),
makeDUID(DUID0, sizeof(DUID0)),
- 7, 100, 200, 50, 80, 8, true, true,
+ 7, 100, 200, 8, true, true,
"host.example.com"));
lease->cltt_ = 0;
{
lease.reset(new Lease6(Lease::TYPE_NA, IOAddress("2001:db8:2::10"),
makeDUID(DUID1, sizeof(DUID1)),
- 8, 150, 300, 40, 70, 6, false, false,
+ 8, 150, 300, 6, false, false,
"", HWAddrPtr(), 128));
lease->cltt_ = 0;
{
lease.reset(new Lease6(Lease::TYPE_PD, IOAddress("3000:1:1::"),
makeDUID(DUID0, sizeof(DUID0)),
- 7, 150, 300, 40, 70, 10, false, false,
+ 7, 150, 300, 10, false, false,
"", HWAddrPtr(), 64));
lease->cltt_ = 0;
lease->setContext(Element::fromJSON("{ \"foobar\": true }"));
// Write lease with very high lease lifetime and current time.
Lease6Ptr lease(new Lease6(Lease::TYPE_NA, IOAddress("2001:db8:1::1"),
makeDUID(DUID0, sizeof(DUID0)),
- 7, 100, 0xFFFFFFFF, 50, 80, 8, true, true,
+ 7, 100, 0xFFFFFFFF, 8, true, true,
"host.example.com"));
// Write this lease out to the lease file.
-// Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-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
// Set the address of the lease
lease->addr_ = IOAddress(address);
- // Initialize unused fields.
- lease->t1_ = 0; // Not saved
- lease->t2_ = 0; // Not saved
-
// Set other parameters. For historical reasons, address 0 is not used.
if (address == straddress4_[0]) {
lease->hwaddr_.reset(new HWAddr(vector<uint8_t>(6, 0x08), HTYPE_ETHER));
// Set the address of the lease
lease->addr_ = IOAddress(address);
- // Initialize unused fields.
- lease->t1_ = 0; // Not saved
- lease->t2_ = 0; // Not saved
-
// Set other parameters. For historical reasons, address 0 is not used.
if (address == straddress6_[0]) {
lease->type_ = leasetype6_[0];
}
void
-GenericLeaseMgrTest::testAddGetDelete6(bool check_t1_t2) {
+GenericLeaseMgrTest::testAddGetDelete6() {
const std::string addr234("2001:db8:1::234");
const std::string addr456("2001:db8:1::456");
const std::string addr789("2001:db8:1::789");
SubnetID subnet_id = 8; // just another number
- Lease6Ptr lease(new Lease6(Lease::TYPE_NA, addr, duid, iaid, 100, 200, 50,
- 80, subnet_id));
+ Lease6Ptr lease(new Lease6(Lease::TYPE_NA, addr, duid, iaid, 100, 200,
+ subnet_id));
EXPECT_TRUE(lmptr_->addLease(lease));
EXPECT_EQ(Lease::TYPE_NA, x->type_);
EXPECT_EQ(100, x->preferred_lft_);
EXPECT_EQ(200, x->valid_lft_);
- if (check_t1_t2) {
- // Backend supports T1,T2 storage: check the values
- EXPECT_EQ(50, x->t1_);
- EXPECT_EQ(80, x->t2_);
- } else {
- // Backend does not support storing, check that it returns 0s.
- EXPECT_EQ(0, x->t1_);
- EXPECT_EQ(0, x->t2_);
- }
// Test getLease6(duid, iaid, subnet_id) - positive case
Lease6Ptr y = lmptr_->getLease6(Lease::TYPE_NA, *duid, iaid, subnet_id);
// Only IPv6 address can be used.
EXPECT_THROW(lmptr_->getLeases6(IOAddress("192.0.2.0"), LeasePageSize(3)),
InvalidAddressFamily);
-
}
void
DuidPtr duid(new DUID(vector<uint8_t>(8, 0x77)));
- // Initialize unused fields.
- empty_lease->t1_ = 0; // Not saved
- empty_lease->t2_ = 0; // Not saved
empty_lease->iaid_ = 142;
empty_lease->duid_ = DuidPtr(new DUID(*duid));
empty_lease->subnet_id_ = 23;
SubnetID subnet_id = 8; // radom number
- Lease6Ptr lease1(new Lease6(Lease::TYPE_NA, addr1, duid1, iaid, 100, 200, 50,
- 80, subnet_id));
- Lease6Ptr lease2(new Lease6(Lease::TYPE_NA, addr2, duid2, iaid, 100, 200, 50,
- 80, subnet_id));
- Lease6Ptr lease3(new Lease6(Lease::TYPE_PD, addr3, duid3, iaid, 100, 200, 50,
- 80, subnet_id, HWAddrPtr(), 64));
+ Lease6Ptr lease1(new Lease6(Lease::TYPE_NA, addr1, duid1, iaid, 100, 200,
+ subnet_id));
+ Lease6Ptr lease2(new Lease6(Lease::TYPE_NA, addr2, duid2, iaid, 100, 200,
+ subnet_id));
+ Lease6Ptr lease3(new Lease6(Lease::TYPE_PD, addr3, duid3, iaid, 100, 200,
+ subnet_id, HWAddrPtr(), 64));
EXPECT_TRUE(lmptr_->addLease(lease1));
EXPECT_TRUE(lmptr_->addLease(lease2));
EXPECT_TRUE(lmptr_->addLease(lease3));
-
+
Lease6Collection returned1 = lmptr_->getLeases6(*(lease1->duid_));
Lease6Collection returned2 = lmptr_->getLeases6(*(lease2->duid_));
Lease6Collection returned3 = lmptr_->getLeases6(*(lease3->duid_));
-
- //verify if the returned lease mathces
+
+ //verify if the returned lease mathces
EXPECT_EQ(returned1.size(), 1);
EXPECT_EQ(returned2.size(), 1);
EXPECT_EQ(returned3.size(), 1);
//verify that the returned lease are same
- EXPECT_TRUE(returned1[0]->addr_ == lease1->addr_);
+ EXPECT_TRUE(returned1[0]->addr_ == lease1->addr_);
EXPECT_TRUE(returned2[0]->addr_ == lease2->addr_);
EXPECT_TRUE(returned3[0]->addr_ == lease3->addr_);
-
+
//now verify we return empty for a lease that has not been stored
returned3 = lmptr_->getLeases6(*duid4);
EXPECT_TRUE(returned3.empty());
-
+
//clean up
(void) lmptr_->deleteLease(addr1);
(void) lmptr_->deleteLease(addr2);
(void) lmptr_->deleteLease(addr3);
-
+
//now verify we return empty for a lease that has not been stored
returned3 = lmptr_->getLeases6(*duid4);
EXPECT_TRUE(returned3.empty());
bytes.push_back(prefix_len);
Lease6Ptr lease(new Lease6(type, addr, DuidPtr(new DUID(bytes)), 77,
- 16000, 24000, 0, 0, subnet_id, HWAddrPtr(),
+ 16000, 24000, subnet_id, HWAddrPtr(),
prefix_len));
lease->state_ = state;
ASSERT_TRUE(lmptr_->addLease(lease));
void testLease6HWTypeAndSource();
/// @brief Test that IPv6 lease can be added, retrieved and deleted.
- ///
- /// This method checks basic IPv6 lease operations. There's check_t1_t2
- /// parameter that controls whether the backend supports storing T1, T2
- /// parameters. memfile supports it, while MySQL doesn't. If T1,T2
- /// storage is not supported, the expected values are 0.
- ///
- /// @param check_t1_t2 controls whether T1,T2 timers should be checked
- void testAddGetDelete6(bool check_t1_t2);
+ void testAddGetDelete6();
/// @brief Check GetLease6 methods - access by DUID/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
for (int i = 0; i < sizeof(ADDRESS) / sizeof(ADDRESS[0]); ++i) {
// Create the lease
- Lease4 lease(ADDRESS[i], hwaddr_, clientid_, VALID_LIFETIME, 0, 0,
+ Lease4 lease(ADDRESS[i], hwaddr_, clientid_, VALID_LIFETIME,
current_time, SUBNET_ID, true, true,
"hostname.example.com.");
EXPECT_EQ(ADDRESS[i], lease.addr_.toUint32());
EXPECT_TRUE(util::equalValues(hwaddr_, lease.hwaddr_));
EXPECT_TRUE(util::equalValues(clientid_, lease.client_id_));
- EXPECT_EQ(0, lease.t1_);
- EXPECT_EQ(0, lease.t2_);
EXPECT_EQ(VALID_LIFETIME, lease.valid_lft_);
EXPECT_EQ(current_time, lease.cltt_);
EXPECT_EQ(SUBNET_ID, lease.subnet_id_);
const time_t current_time = time(NULL);
// Create the lease
- Lease4 lease(0xffffffff, hwaddr_, clientid_, VALID_LIFETIME, 0, 0, current_time,
+ Lease4 lease(0xffffffff, hwaddr_, clientid_, VALID_LIFETIME, current_time,
SUBNET_ID);
// Declined is a non-default state. We'll see if the state will be copied
const time_t current_time = time(NULL);
// Create the lease
- Lease4 lease(0xffffffff, hwaddr_, clientid_, VALID_LIFETIME, 0, 0, current_time,
+ Lease4 lease(0xffffffff, hwaddr_, clientid_, VALID_LIFETIME, current_time,
SUBNET_ID);
// Declined is a non-default state. We'll see if the state will be copied
const time_t current_time = time(NULL);
// Check when the leases are equal.
- Lease4 lease1(ADDRESS, hwaddr_, clientid_, VALID_LIFETIME, current_time, 0,
- 0, SUBNET_ID);
+ Lease4 lease1(ADDRESS, hwaddr_, clientid_, VALID_LIFETIME, current_time,
+ SUBNET_ID);
lease1.setContext(Element::fromJSON("{ \"foobar\": 1234 }"));
// We need to make an explicit copy. Otherwise the second lease will just
ClientIdPtr clientid_copy(new ClientId(*clientid_));
Lease4 lease2(ADDRESS, hwcopy, clientid_copy, VALID_LIFETIME, current_time,
- 0, 0, SUBNET_ID);
+ SUBNET_ID);
lease2.setContext(Element::fromJSON("{ \"foobar\": 1234 }"));
EXPECT_TRUE(lease1 == lease2);
EXPECT_FALSE(lease1 != lease2);
EXPECT_TRUE(lease1 == lease2); // Check that the reversion has made the
EXPECT_FALSE(lease1 != lease2); // ... leases equal
- ++lease1.t1_;
- EXPECT_FALSE(lease1 == lease2);
- EXPECT_TRUE(lease1 != lease2);
- lease1.t1_ = lease2.t1_;
- EXPECT_TRUE(lease1 == lease2); // Check that the reversion has made the
- EXPECT_FALSE(lease1 != lease2); // ... leases equal
-
- ++lease1.t2_;
- EXPECT_FALSE(lease1 == lease2);
- EXPECT_TRUE(lease1 != lease2);
- lease1.t2_ = lease2.t2_;
- EXPECT_TRUE(lease1 == lease2); // Check that the reversion has made the
- EXPECT_FALSE(lease1 != lease2); // ... leases equal
-
++lease1.valid_lft_;
EXPECT_FALSE(lease1 == lease2);
EXPECT_TRUE(lease1 != lease2);
TEST_F(Lease4Test, toText) {
const time_t current_time = 12345678;
- Lease4 lease(IOAddress("192.0.2.3"), hwaddr_, clientid_, 3600, 123,
- 456, current_time, 789);
+ Lease4 lease(IOAddress("192.0.2.3"), hwaddr_, clientid_, 3600,
+ current_time, 789);
lease.setContext(Element::fromJSON("{ \"foobar\": 1234 }"));
std::stringstream expected;
expected << "Address: 192.0.2.3\n"
<< "Valid life: 3600\n"
- << "T1: 123\n"
- << "T2: 456\n"
<< "Cltt: 12345678\n"
<< "Hardware addr: " << hwaddr_->toText(false) << "\n"
<< "Client id: " << clientid_->toText() << "\n"
expected.str("");
expected << "Address: 192.0.2.3\n"
<< "Valid life: 3600\n"
- << "T1: 123\n"
- << "T2: 456\n"
<< "Cltt: 12345678\n"
<< "Hardware addr: (none)\n"
<< "Client id: (none)\n"
TEST_F(Lease4Test, toElement) {
const time_t current_time = 12345678;
- Lease4 lease(IOAddress("192.0.2.3"), hwaddr_, clientid_, 3600, 123,
- 456, current_time, 789, true, true, "urania.example.org");
+ Lease4 lease(IOAddress("192.0.2.3"), hwaddr_, clientid_, 3600,
+ current_time, 789, true, true, "urania.example.org");
lease.setContext(Element::fromJSON("{ \"foobar\": 1234 }"));
std::string expected = "{"
TEST_F(Lease4Test, decline) {
const time_t current_time = 12345678;
- Lease4 lease(IOAddress("192.0.2.3"), hwaddr_, clientid_, 3600, 123,
- 456, current_time, 789);
+ Lease4 lease(IOAddress("192.0.2.3"), hwaddr_, clientid_, 3600,
+ current_time, 789);
lease.hostname_="foo.example.org";
lease.fqdn_fwd_ = true;
lease.fqdn_rev_ = true;
ASSERT_TRUE(lease.hwaddr_);
EXPECT_EQ("", lease.hwaddr_->toText(false));
EXPECT_FALSE(lease.client_id_);
- EXPECT_EQ(0, lease.t1_);
- EXPECT_EQ(0, lease.t2_);
EXPECT_TRUE(now <= lease.cltt_);
EXPECT_TRUE(lease.cltt_ <= now + 1);
for (int i = 0; i < sizeof(ADDRESS) / sizeof(ADDRESS[0]); ++i) {
IOAddress addr(ADDRESS[i]);
Lease6Ptr lease(new Lease6(Lease::TYPE_NA, addr,
- duid, iaid, 100, 200, 50, 80,
+ duid, iaid, 100, 200,
subnet_id));
EXPECT_TRUE(lease->addr_ == addr);
EXPECT_TRUE(lease->type_ == Lease::TYPE_NA);
EXPECT_TRUE(lease->preferred_lft_ == 100);
EXPECT_TRUE(lease->valid_lft_ == 200);
- EXPECT_TRUE(lease->t1_ == 50);
- EXPECT_TRUE(lease->t2_ == 80);
EXPECT_FALSE(lease->fqdn_fwd_);
EXPECT_FALSE(lease->fqdn_rev_);
EXPECT_TRUE(lease->hostname_.empty());
IOAddress addr(ADDRESS[0]);
Lease6Ptr lease2;
EXPECT_THROW(lease2.reset(new Lease6(Lease::TYPE_NA, addr,
- DuidPtr(), iaid, 100, 200, 50, 80,
+ DuidPtr(), iaid, 100, 200,
subnet_id)), InvalidOperation);
}
for (int i = 0; i < sizeof(ADDRESS) / sizeof(ADDRESS[0]); ++i) {
IOAddress addr(ADDRESS[i]);
Lease6Ptr lease(new Lease6(Lease::TYPE_NA, addr,
- duid, iaid, 100, 200, 50, 80, subnet_id,
+ duid, iaid, 100, 200, subnet_id,
true, true, "host.example.com."));
EXPECT_TRUE(lease->addr_ == addr);
EXPECT_TRUE(lease->type_ == Lease::TYPE_NA);
EXPECT_TRUE(lease->preferred_lft_ == 100);
EXPECT_TRUE(lease->valid_lft_ == 200);
- EXPECT_TRUE(lease->t1_ == 50);
- EXPECT_TRUE(lease->t2_ == 80);
EXPECT_TRUE(lease->fqdn_fwd_);
EXPECT_TRUE(lease->fqdn_rev_);
EXPECT_EQ("host.example.com.", lease->hostname_);
IOAddress addr(ADDRESS[0]);
Lease6Ptr lease2;
EXPECT_THROW(lease2.reset(new Lease6(Lease::TYPE_NA, addr,
- DuidPtr(), iaid, 100, 200, 50, 80,
+ DuidPtr(), iaid, 100, 200,
subnet_id)), InvalidOperation);
}
SubnetID subnet_id = 8; // just another number
// Check for equality.
- Lease6 lease1(Lease::TYPE_NA, addr, duid, iaid, 100, 200, 50, 80,
- subnet_id);
- Lease6 lease2(Lease::TYPE_NA, addr, duid, iaid, 100, 200, 50, 80,
- subnet_id);
+ Lease6 lease1(Lease::TYPE_NA, addr, duid, iaid, 100, 200, subnet_id);
+ Lease6 lease2(Lease::TYPE_NA, addr, duid, iaid, 100, 200, subnet_id);
lease1.setContext(Element::fromJSON("{ \"foobar\": 1234 }"));
lease2.setContext(Element::fromJSON("{ \"foobar\": 1234 }"));
EXPECT_TRUE(lease1 == lease2); // Check that the reversion has made the
EXPECT_FALSE(lease1 != lease2); // ... leases equal
- ++lease1.t1_;
- EXPECT_FALSE(lease1 == lease2);
- EXPECT_TRUE(lease1 != lease2);
- lease1.t1_ = lease2.t1_;
- EXPECT_TRUE(lease1 == lease2); // Check that the reversion has made the
- EXPECT_FALSE(lease1 != lease2); // ... leases equal
-
- ++lease1.t2_;
- EXPECT_FALSE(lease1 == lease2);
- EXPECT_TRUE(lease1 != lease2);
- lease1.t2_ = lease2.t2_;
- EXPECT_TRUE(lease1 == lease2); // Check that the reversion has made the
- EXPECT_FALSE(lease1 != lease2); // ... leases equal
-
++lease1.cltt_;
EXPECT_FALSE(lease1 == lease2);
EXPECT_TRUE(lease1 != lease2);
const DuidPtr duid(new DUID(duid_array, sizeof(duid_array)));
const uint32_t iaid = IAID; // Just a number
const SubnetID subnet_id = 8; // Just another number
- Lease6 lease(Lease::TYPE_NA, addr, duid, iaid, 100, 200, 50, 80,
- subnet_id);
+ Lease6 lease(Lease::TYPE_NA, addr, duid, iaid, 100, 200, subnet_id);
// Case 1: a second before expiration
lease.cltt_ = time(NULL) - 100;
HWAddrPtr hwaddr(new HWAddr(HWADDR, sizeof(HWADDR), HTYPE_ETHER));
// Let's create a lease for 2001:db8::1, DUID, iaid=1234,
- // t1=1000, t2=2000, pref=3000, valid=4000, subnet-id = 1
+ // pref=3000, valid=4000, subnet-id = 1
Lease6 lease(Lease::TYPE_NA, IOAddress("2001:db8::1"), duid,
- 1234, 3000, 4000, 1000, 2000, 1, hwaddr);
+ 1234, 3000, 4000, 1, hwaddr);
lease.cltt_ = 12345678;
lease.hostname_ = "foo.example.org";
lease.fqdn_fwd_ = true;
ASSERT_TRUE(lease.duid_);
ASSERT_EQ("00", lease.duid_->toText());
ASSERT_FALSE(lease.hwaddr_);
- EXPECT_EQ(0, lease.t1_);
- EXPECT_EQ(0, lease.t2_);
EXPECT_EQ(0, lease.preferred_lft_);
EXPECT_TRUE(now <= lease.cltt_);
DuidPtr duid(new DUID(llt, sizeof(llt)));
Lease6 lease(Lease::TYPE_NA, IOAddress("2001:db8::1"), duid, 123456,
- 400, 800, 100, 200, 5678, hwaddr, 128);
+ 400, 800, 5678, hwaddr, 128);
lease.cltt_ = 12345678;
lease.state_ = Lease::STATE_DECLINED;
lease.setContext(Element::fromJSON("{ \"foobar\": 1234 }"));
DuidPtr duid(new DUID(llt, sizeof(llt)));
Lease6 lease(Lease::TYPE_NA, IOAddress("2001:db8::1"), duid, 123456,
- 400, 800, 100, 200, 5678, hwaddr, 128);
+ 400, 800, 5678, hwaddr, 128);
lease.cltt_ = 12345678;
lease.state_ = Lease::STATE_DECLINED;
lease.hostname_ = "urania.example.org";
"\"user-context\": { \"foobar\": 1234 },"
"\"valid-lft\": 800"
"}";
-
+
runToElementTest<Lease6>(expected, lease);
// Now let's try with a lease without hardware address and user context.
"\"type\": \"IA_NA\","
"\"valid-lft\": 800"
"}";
-
+
runToElementTest<Lease6>(expected, lease);
// And to finish try with a comment.
"\"type\": \"IA_NA\","
"\"valid-lft\": 800"
"}";
-
+
runToElementTest<Lease6>(expected, lease);
}
DuidPtr duid(new DUID(llt, sizeof(llt)));
Lease6 lease(Lease::TYPE_PD, IOAddress("2001:db8::"), duid, 123456,
- 400, 800, 100, 200, 5678, hwaddr, 56);
+ 400, 800, 5678, hwaddr, 56);
lease.cltt_ = 12345678;
lease.state_ = Lease::STATE_DEFAULT;
lease.hostname_ = "urania.example.org";
-// Copyright (C) 2012-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-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
///
/// The following lease parameters are set to constant values:
/// - valid lifetime = 1200,
- /// - T1 = 600,
- /// - T2 = 900,
/// - DNS update forward flag = false,
/// - DNS update reverse flag = false,
///
fillRandom(clientid.begin(), clientid.end());
uint32_t valid_lft = 1200;
- uint32_t t1 = 600;
- uint32_t t2 = 900;
time_t timestamp = time(NULL) - 86400 + random()%86400;
bool fqdn_fwd = false;
bool fqdn_rev = false;
// Return created lease.
return (Lease4Ptr(new Lease4(address, hwaddr, &clientid[0],
- clientid.size(), valid_lft, t1, t2,
+ clientid.size(), valid_lft,
timestamp, subnet_id, fqdn_fwd,
fqdn_rev, hostname.str())));
}
/// - lease type = IA_NA
/// - valid lifetime = 1200,
/// - preferred lifetime = 1000
- /// - T1 = 600,
- /// - T2 = 900,
/// - DNS update forward flag = false,
/// - DNS update reverse flag = false,
///
uint32_t iaid = 1 + random()%100;
uint32_t valid_lft = 1200;
uint32_t preferred_lft = 1000;
- uint32_t t1 = 600;
- uint32_t t2 = 900;
time_t timestamp = time(NULL) - 86400 + random()%86400;
bool fqdn_fwd = false;
bool fqdn_rev = false;
// Return created lease.
Lease6Ptr lease(new Lease6(lease_type, address, duid, iaid,
- preferred_lft, valid_lft, t1, t2,
+ preferred_lft, valid_lft,
subnet_id, fqdn_fwd, fqdn_rev,
hostname.str()));
lease->cltt_ = timestamp;
HWAddrPtr hwaddr(new HWAddr(hwaddr_vec, HTYPE_ETHER));
Lease4Ptr new_lease(new Lease4(IOAddress("192.0.2.45"), hwaddr,
static_cast<const uint8_t*>(0), 0,
- 100, 50, 60, 0, 1));
+ 100, 0, 1));
ASSERT_NO_THROW(lease_mgr->addLease(new_lease));
std::string updated_file_contents = new_file_contents +
// Check if we can still write to the lease file.
std::vector<uint8_t> duid_vec(13);
DuidPtr duid(new DUID(duid_vec));
- Lease6Ptr new_lease(new Lease6(Lease::TYPE_NA, IOAddress("3000::1"),duid,
- 123, 300, 400, 100, 300, 2));
+ Lease6Ptr new_lease(new Lease6(Lease::TYPE_NA, IOAddress("3000::1"), duid,
+ 123, 300, 400, 2));
new_lease->cltt_ = 0;
ASSERT_NO_THROW(lease_mgr->addLease(new_lease));
// Checks that adding/getting/deleting a Lease6 object works.
TEST_F(MemfileLeaseMgrTest, addGetDelete6) {
startBackend(V6);
- testAddGetDelete6(true); // true - check T1,T2 values
- // memfile is able to preserve those values, but some other
- // backends can't do that.
+ testAddGetDelete6();
}
/// @brief Basic Lease4 Checks
// Test checks whether simple add, get and delete operations are possible
// on Lease6
TEST_F(MySqlLeaseMgrTest, testAddGetDelete6) {
- testAddGetDelete6(false);
+ testAddGetDelete6();
}
/// @brief Basic Lease6 Checks
-// Copyright (C) 2015-2017 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
/// @brief Implementation of the method creating DHCPv6 lease instance.
virtual void initLease() {
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));
}
};
/// @brief Implementation of the method creating DHCPv4 lease instance.
virtual void initLease() {
lease_.reset(new Lease4(IOAddress("192.0.2.1"), hwaddr_, ClientIdPtr(),
- 100, 30, 60, time(NULL), 1));
+ 100, time(NULL), 1));
}
};
// Test checks whether simple add, get and delete operations are possible
// on Lease6
TEST_F(PgSqlLeaseMgrTest, testAddGetDelete6) {
- testAddGetDelete6(false);
+ testAddGetDelete6();
}
/// @brief Basic Lease6 Checks
-// 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
// Return created lease.
return (Lease4Ptr(new Lease4(address, hwaddr,
&clientid[0], 0, // no client-id
- 1200, 600, 900, // valid, t1, t2
+ 1200, // valid
timestamp, subnet_id, false, false, "")));
}
// Return created lease.
Lease6Ptr lease(new Lease6(lease_type, address, duid, iaid,
- 1000, 1200, 600, 900, // pref, valid, t1, t2
+ 1000, 1200, // pref, valid
subnet_id,
false, false, "")); // fqdn fwd, rev, hostname
return (lease);