Browse Source

[3146] getLease6() methods now have extra param: LeaseType

Tomek Mrugalski 11 years ago
parent
commit
95729b096e

+ 4 - 2
src/bin/dhcp6/dhcp6_srv.cc

@@ -1316,7 +1316,8 @@ Dhcpv6Srv::renewIA_NA(const Subnet6Ptr& subnet, const DuidPtr& duid,
         return (ia_rsp);
     }
 
-    Lease6Ptr lease = LeaseMgrFactory::instance().getLease6(*duid, ia->getIAID(),
+    Lease6Ptr lease = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA,
+                                                            *duid, ia->getIAID(),
                                                             subnet->getID());
 
     if (!lease) {
@@ -1579,7 +1580,8 @@ Dhcpv6Srv::releaseIA_NA(const DuidPtr& duid, const Pkt6Ptr& query,
         return (ia_rsp);
     }
 
-    Lease6Ptr lease = LeaseMgrFactory::instance().getLease6(release_addr->getAddress());
+    Lease6Ptr lease = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA,
+                                                            release_addr->getAddress());
 
     if (!lease) {
         // client releasing a lease that we don't know about.

+ 16 - 11
src/bin/dhcp6/tests/dhcp6_srv_unittest.cc

@@ -1024,7 +1024,8 @@ TEST_F(Dhcpv6SrvTest, RenewBasic) {
     ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
 
     // Check that the lease is really in the database
-    Lease6Ptr l = LeaseMgrFactory::instance().getLease6(addr);
+    Lease6Ptr l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA,
+                                                        addr);
     ASSERT_TRUE(l);
 
     // Check that T1, T2, preferred, valid and cltt really set and not using
@@ -1116,7 +1117,8 @@ TEST_F(Dhcpv6SrvTest, RenewReject) {
     OptionPtr clientid = generateClientId();
 
     // Check that the lease is NOT in the database
-    Lease6Ptr l = LeaseMgrFactory::instance().getLease6(addr);
+    Lease6Ptr l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA,
+                                                        addr);
     ASSERT_FALSE(l);
 
     // Let's create a RENEW
@@ -1147,7 +1149,7 @@ TEST_F(Dhcpv6SrvTest, RenewReject) {
     checkIA_NAStatusCode(ia, STATUS_NoBinding);
 
     // Check that there is no lease added
-    l = LeaseMgrFactory::instance().getLease6(addr);
+    l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA, addr);
     ASSERT_FALSE(l);
 
     // CASE 2: Lease is known and belongs to this client, but to a different IAID
@@ -1189,7 +1191,7 @@ TEST_F(Dhcpv6SrvTest, RenewReject) {
     ASSERT_TRUE(ia);
     checkIA_NAStatusCode(ia, STATUS_NoBinding);
 
-    lease = LeaseMgrFactory::instance().getLease6(addr);
+    lease = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA, addr);
     ASSERT_TRUE(lease);
     // Verify that the lease was not updated.
     EXPECT_EQ(123, lease->cltt_);
@@ -1226,7 +1228,8 @@ TEST_F(Dhcpv6SrvTest, ReleaseBasic) {
     ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
 
     // Check that the lease is really in the database
-    Lease6Ptr l = LeaseMgrFactory::instance().getLease6(addr);
+    Lease6Ptr l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA,
+                                                        addr);
     ASSERT_TRUE(l);
 
     // Let's create a RELEASE
@@ -1265,11 +1268,12 @@ TEST_F(Dhcpv6SrvTest, ReleaseBasic) {
 
     // Check that the lease is really gone in the database
     // get lease by address
-    l = LeaseMgrFactory::instance().getLease6(addr);
+    l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA, addr);
     ASSERT_FALSE(l);
 
     // get lease by subnetid/duid/iaid combination
-    l = LeaseMgrFactory::instance().getLease6(*duid_, iaid, subnet_->getID());
+    l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA, *duid_, iaid,
+                                              subnet_->getID());
     ASSERT_FALSE(l);
 }
 
@@ -1301,7 +1305,8 @@ TEST_F(Dhcpv6SrvTest, ReleaseReject) {
     OptionPtr clientid = generateClientId();
 
     // Check that the lease is NOT in the database
-    Lease6Ptr l = LeaseMgrFactory::instance().getLease6(addr);
+    Lease6Ptr l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA,
+                                                        addr);
     ASSERT_FALSE(l);
 
     // Let's create a RELEASE
@@ -1334,7 +1339,7 @@ TEST_F(Dhcpv6SrvTest, ReleaseReject) {
     checkMsgStatusCode(reply, STATUS_NoBinding);
 
     // Check that the lease is not there
-    l = LeaseMgrFactory::instance().getLease6(addr);
+    l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA, addr);
     ASSERT_FALSE(l);
 
     // CASE 2: Lease is known and belongs to this client, but to a different IAID
@@ -1356,7 +1361,7 @@ TEST_F(Dhcpv6SrvTest, ReleaseReject) {
     checkMsgStatusCode(reply, STATUS_NoBinding);
 
     // Check that the lease is still there
-    l = LeaseMgrFactory::instance().getLease6(addr);
+    l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA, addr);
     ASSERT_TRUE(l);
 
     // CASE 3: Lease belongs to a client with different client-id
@@ -1379,7 +1384,7 @@ TEST_F(Dhcpv6SrvTest, ReleaseReject) {
     checkMsgStatusCode(reply, STATUS_NoBinding);
 
     // Check that the lease is still there
-    l = LeaseMgrFactory::instance().getLease6(addr);
+    l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA, addr);
     ASSERT_TRUE(l);
 
     // Finally, let's cleanup the database

+ 2 - 1
src/bin/dhcp6/tests/dhcp6_test_utils.h

@@ -377,7 +377,8 @@ public:
                          boost::shared_ptr<Option6IAAddr> addr) {
         boost::shared_ptr<Option6IA> ia = boost::dynamic_pointer_cast<Option6IA>(ia_na);
 
-        Lease6Ptr lease = LeaseMgrFactory::instance().getLease6(addr->getAddress());
+        Lease6Ptr lease = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA,
+                                                                addr->getAddress());
         if (!lease) {
             std::cout << "Lease for " << addr->getAddress().toText()
                       << " not found in the database backend.";

+ 18 - 10
src/bin/dhcp6/tests/hooks_unittest.cc

@@ -1076,7 +1076,8 @@ TEST_F(HooksDhcpv6SrvTest, basic_lease6_renew) {
     ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
 
     // Check that the lease is really in the database
-    Lease6Ptr l = LeaseMgrFactory::instance().getLease6(addr);
+    Lease6Ptr l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA,
+                                                        addr);
     ASSERT_TRUE(l);
 
     // Check that T1, T2, preferred, valid and cltt really set and not using
@@ -1172,7 +1173,8 @@ TEST_F(HooksDhcpv6SrvTest, leaseUpdate_lease6_renew) {
     ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
 
     // Check that the lease is really in the database
-    Lease6Ptr l = LeaseMgrFactory::instance().getLease6(addr);
+    Lease6Ptr l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA,
+                                                        addr);
     ASSERT_TRUE(l);
 
     // Check that T1, T2, preferred, valid and cltt really set and not using
@@ -1262,7 +1264,8 @@ TEST_F(HooksDhcpv6SrvTest, skip_lease6_renew) {
     ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
 
     // Check that the lease is really in the database
-    Lease6Ptr l = LeaseMgrFactory::instance().getLease6(addr);
+    Lease6Ptr l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA,
+                                                        addr);
     ASSERT_TRUE(l);
 
     // Check that T1, T2, preferred, valid and cltt really set and not using
@@ -1293,7 +1296,7 @@ TEST_F(HooksDhcpv6SrvTest, skip_lease6_renew) {
     // Check that our callback was called
     EXPECT_EQ("lease6_renew", callback_name_);
 
-    l = LeaseMgrFactory::instance().getLease6(addr);
+    l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA, addr);
 
     // Check that the old values are still there and they were not
     // updated by the renewal
@@ -1337,7 +1340,8 @@ TEST_F(HooksDhcpv6SrvTest, basic_lease6_release) {
     ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
 
     // Check that the lease is really in the database
-    Lease6Ptr l = LeaseMgrFactory::instance().getLease6(addr);
+    Lease6Ptr l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA,
+                                                        addr);
     ASSERT_TRUE(l);
 
     // Let's create a RELEASE
@@ -1375,11 +1379,12 @@ TEST_F(HooksDhcpv6SrvTest, basic_lease6_release) {
 
     // Check that the lease is really gone in the database
     // get lease by address
-    l = LeaseMgrFactory::instance().getLease6(addr);
+    l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA, addr);
     ASSERT_FALSE(l);
 
     // Get lease by subnetid/duid/iaid combination
-    l = LeaseMgrFactory::instance().getLease6(*duid_, iaid, subnet_->getID());
+    l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA, *duid_, iaid,
+                                              subnet_->getID());
     ASSERT_FALSE(l);
 }
 
@@ -1416,7 +1421,8 @@ TEST_F(HooksDhcpv6SrvTest, skip_lease6_release) {
     ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
 
     // Check that the lease is really in the database
-    Lease6Ptr l = LeaseMgrFactory::instance().getLease6(addr);
+    Lease6Ptr l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA,
+                                                        addr);
     ASSERT_TRUE(l);
 
     // Let's create a RELEASE
@@ -1442,11 +1448,13 @@ TEST_F(HooksDhcpv6SrvTest, skip_lease6_release) {
 
     // Check that the lease is still there
     // get lease by address
-    l = LeaseMgrFactory::instance().getLease6(addr);
+    l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA,
+                                              addr);
     ASSERT_TRUE(l);
 
     // Get lease by subnetid/duid/iaid combination
-    l = LeaseMgrFactory::instance().getLease6(*duid_, iaid, subnet_->getID());
+    l = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA, *duid_, iaid,
+                                              subnet_->getID());
     ASSERT_TRUE(l);
 }
 

+ 9 - 4
src/lib/dhcpsrv/alloc_engine.cc

@@ -222,7 +222,9 @@ AllocEngine::allocateAddress6(const Subnet6Ptr& subnet,
         }
 
         // check if there's existing lease for that subnet/duid/iaid combination.
-        Lease6Ptr existing = LeaseMgrFactory::instance().getLease6(*duid, iaid, subnet->getID());
+        /// @todo: Make this generic
+        Lease6Ptr existing = LeaseMgrFactory::instance().getLease6(
+                             Lease6::LEASE_IA_NA, *duid, iaid, subnet->getID());
         if (existing) {
             // we have a lease already. This is a returning client, probably after
             // his reboot.
@@ -231,7 +233,8 @@ AllocEngine::allocateAddress6(const Subnet6Ptr& subnet,
 
         // check if the hint is in pool and is available
         if (subnet->inPool(hint)) {
-            existing = LeaseMgrFactory::instance().getLease6(hint);
+            existing = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA,
+                                                             hint);
             if (!existing) {
                 /// @todo: check if the hint is reserved once we have host support
                 /// implemented
@@ -284,7 +287,8 @@ AllocEngine::allocateAddress6(const Subnet6Ptr& subnet,
             /// @todo: check if the address is reserved once we have host support
             /// implemented
 
-            Lease6Ptr existing = LeaseMgrFactory::instance().getLease6(candidate);
+            Lease6Ptr existing = LeaseMgrFactory::instance().getLease6(
+                                 Lease6::LEASE_IA_NA, candidate);
             if (!existing) {
                 // there's no existing lease for selected candidate, so it is
                 // free. Let's allocate it.
@@ -795,7 +799,8 @@ Lease6Ptr AllocEngine::createLease6(const Subnet6Ptr& subnet,
 
         // It is for advertise only. We should not insert the lease into LeaseMgr,
         // but rather check that we could have inserted it.
-        Lease6Ptr existing = LeaseMgrFactory::instance().getLease6(addr);
+        Lease6Ptr existing = LeaseMgrFactory::instance().getLease6(
+                             Lease6::LEASE_IA_NA, addr);
         if (!existing) {
             return (lease);
         } else {

+ 11 - 7
src/lib/dhcpsrv/lease_mgr.h

@@ -318,9 +318,9 @@ struct Lease6 : public Lease {
 
     /// @brief Type of lease contents
     typedef enum {
-        LEASE_IA_NA, /// the lease contains non-temporary IPv6 address
-        LEASE_IA_TA, /// the lease contains temporary IPv6 address
-        LEASE_IA_PD  /// the lease contains IPv6 prefix (for prefix delegation)
+        LEASE_IA_NA = 0, /// the lease contains non-temporary IPv6 address
+        LEASE_IA_TA = 1, /// the lease contains temporary IPv6 address
+        LEASE_IA_PD = 2  /// the lease contains IPv6 prefix (for prefix delegation)
     } LeaseType;
 
     /// @brief Lease type
@@ -533,10 +533,12 @@ public:
     /// The assumption here is that there will not be site or link-local
     /// addresses used, so there is no way of having address duplication.
     ///
+    /// @param type specifies lease type: (NA, TA or PD)
     /// @param addr address of the searched lease
     ///
     /// @return smart pointer to the lease (or NULL if a lease is not found)
-    virtual Lease6Ptr getLease6(const isc::asiolink::IOAddress& addr) const = 0;
+    virtual Lease6Ptr getLease6(Lease6::LeaseType type,
+                                const isc::asiolink::IOAddress& addr) const = 0;
 
     /// @brief Returns existing IPv6 leases for a given DUID+IA combination
     ///
@@ -545,22 +547,24 @@ public:
     /// can be more than one. Thus return type is a container, not a single
     /// pointer.
     ///
+    /// @param type specifies lease type: (NA, TA or PD)
     /// @param duid client DUID
     /// @param iaid IA identifier
     ///
     /// @return smart pointer to the lease (or NULL if a lease is not found)
-    virtual Lease6Collection getLease6(const DUID& duid,
+    virtual Lease6Collection getLease6(Lease6::LeaseType type, const DUID& duid,
                                        uint32_t iaid) const = 0;
 
     /// @brief Returns existing IPv6 lease for a given DUID+IA combination
     ///
+    /// @param type specifies lease type: (NA, TA or PD)
     /// @param duid client DUID
     /// @param iaid IA identifier
     /// @param subnet_id subnet id of the subnet the lease belongs to
     ///
     /// @return smart pointer to the lease (or NULL if a lease is not found)
-    virtual Lease6Ptr getLease6(const DUID& duid, uint32_t iaid,
-                                SubnetID subnet_id) const = 0;
+    virtual Lease6Ptr getLease6(Lease6::LeaseType type, const DUID& duid,
+                                uint32_t iaid, SubnetID subnet_id) const = 0;
 
     /// @brief Updates IPv4 lease.
     ///

+ 7 - 4
src/lib/dhcpsrv/memfile_lease_mgr.cc

@@ -46,7 +46,7 @@ Memfile_LeaseMgr::addLease(const Lease6Ptr& lease) {
     LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
               DHCPSRV_MEMFILE_ADD_ADDR6).arg(lease->addr_.toText());
 
-    if (getLease6(lease->addr_)) {
+    if (getLease6(lease->type_, lease->addr_)) {
         // there is a lease with specified address already
         return (false);
     }
@@ -186,7 +186,8 @@ Memfile_LeaseMgr::getLease4(const ClientId& client_id,
 }
 
 Lease6Ptr
-Memfile_LeaseMgr::getLease6(const isc::asiolink::IOAddress& addr) const {
+Memfile_LeaseMgr::getLease6(Lease6::LeaseType /* not used yet */,
+                            const isc::asiolink::IOAddress& addr) const {
     LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
               DHCPSRV_MEMFILE_GET_ADDR6).arg(addr.toText());
 
@@ -199,7 +200,8 @@ Memfile_LeaseMgr::getLease6(const isc::asiolink::IOAddress& addr) const {
 }
 
 Lease6Collection
-Memfile_LeaseMgr::getLease6(const DUID& duid, uint32_t iaid) const {
+Memfile_LeaseMgr::getLease6(Lease6::LeaseType /* not used yet */,
+                            const DUID& duid, uint32_t iaid) const {
     LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
               DHCPSRV_MEMFILE_GET_IAID_DUID).arg(iaid).arg(duid.toText());
 
@@ -207,7 +209,8 @@ Memfile_LeaseMgr::getLease6(const DUID& duid, uint32_t iaid) const {
 }
 
 Lease6Ptr
-Memfile_LeaseMgr::getLease6(const DUID& duid, uint32_t iaid,
+Memfile_LeaseMgr::getLease6(Lease6::LeaseType /* not used yet */,
+                            const DUID& duid, uint32_t iaid,
                             SubnetID subnet_id) const {
     LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
               DHCPSRV_MEMFILE_GET_IAID_SUBID_DUID)

+ 9 - 4
src/lib/dhcpsrv/memfile_lease_mgr.h

@@ -140,33 +140,38 @@ public:
     /// This function returns a copy of the lease. The modification in the
     /// return lease does not affect the instance held in the lease storage.
     ///
+    /// @param type specifies lease type: (NA, TA or PD)
     /// @param addr An address of the searched lease.
     ///
     /// @return smart pointer to the lease (or NULL if a lease is not found)
-    virtual Lease6Ptr getLease6(const isc::asiolink::IOAddress& addr) const;
+    virtual Lease6Ptr getLease6(Lease6::LeaseType type,
+                                const isc::asiolink::IOAddress& addr) const;
 
     /// @brief Returns existing IPv6 lease for a given DUID+IA combination
     ///
     /// @todo Not implemented yet
     ///
+    /// @param type specifies lease type: (NA, TA or PD)
     /// @param duid client DUID
     /// @param iaid IA identifier
     ///
     /// @return collection of IPv6 leases
-    virtual Lease6Collection getLease6(const DUID& duid, uint32_t iaid) const;
+    virtual Lease6Collection getLease6(Lease6::LeaseType type,
+                                       const DUID& duid, uint32_t iaid) const;
 
     /// @brief Returns existing IPv6 lease for a given DUID/IA/subnet-id tuple
     ///
     /// This function returns a copy of the lease. The modification in the
     /// return lease does not affect the instance held in the lease storage.
     ///
+    /// @param type specifies lease type: (NA, TA or PD)
     /// @param duid client DUID
     /// @param iaid IA identifier
     /// @param subnet_id identifier of the subnet the lease must belong to
     ///
     /// @return smart pointer to the lease (or NULL if a lease is not found)
-    virtual Lease6Ptr getLease6(const DUID& duid, uint32_t iaid,
-                                SubnetID subnet_id) const;
+    virtual Lease6Ptr getLease6(Lease6::LeaseType type, const DUID& duid,
+                                uint32_t iaid, SubnetID subnet_id) const;
 
     /// @brief Updates IPv4 lease.
     ///

+ 9 - 5
src/lib/dhcpsrv/mysql_lease_mgr.cc

@@ -984,8 +984,9 @@ public:
 
             default:
                 isc_throw(BadValue, "invalid lease type returned (" <<
-                          lease_type_ << ") for lease with address " <<
-                          address << ". Only 0, 1, or 2 are allowed.");
+                          static_cast<int>(lease_type_) << ") for lease with "
+                          << "address " << address << ". Only 0, 1, or 2 are "
+                          << "allowed.");
         }
 
         // Set up DUID,
@@ -1650,7 +1651,8 @@ MySqlLeaseMgr::getLease4(const ClientId& clientid, SubnetID subnet_id) const {
 
 
 Lease6Ptr
-MySqlLeaseMgr::getLease6(const isc::asiolink::IOAddress& addr) const {
+MySqlLeaseMgr::getLease6(Lease6::LeaseType /* type - not used yet */,
+                         const isc::asiolink::IOAddress& addr) const {
     LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
               DHCPSRV_MYSQL_GET_ADDR6).arg(addr.toText());
 
@@ -1676,7 +1678,8 @@ MySqlLeaseMgr::getLease6(const isc::asiolink::IOAddress& addr) const {
 
 
 Lease6Collection
-MySqlLeaseMgr::getLease6(const DUID& duid, uint32_t iaid) const {
+MySqlLeaseMgr::getLease6(Lease6::LeaseType /* type - not used yet */,
+                         const DUID& duid, uint32_t iaid) const {
     LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
               DHCPSRV_MYSQL_GET_IAID_DUID).arg(iaid).arg(duid.toText());
 
@@ -1718,7 +1721,8 @@ MySqlLeaseMgr::getLease6(const DUID& duid, uint32_t iaid) const {
 
 
 Lease6Ptr
-MySqlLeaseMgr::getLease6(const DUID& duid, uint32_t iaid,
+MySqlLeaseMgr::getLease6(Lease6::LeaseType /* type - not used yet */,
+                         const DUID& duid, uint32_t iaid,
                          SubnetID subnet_id) const {
     LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
               DHCPSRV_MYSQL_GET_IAID_SUBID_DUID)

+ 8 - 4
src/lib/dhcpsrv/mysql_lease_mgr.h

@@ -244,6 +244,7 @@ public:
     /// The assumption here is that there will not be site or link-local
     /// addresses used, so there is no way of having address duplication.
     ///
+    /// @param type specifies lease type: (NA, TA or PD)
     /// @param addr address of the searched lease
     ///
     /// @return smart pointer to the lease (or NULL if a lease is not found)
@@ -255,7 +256,8 @@ public:
     ///        programming error.
     /// @throw isc::dhcp::DbOperationError An operation on the open database has
     ///        failed.
-    virtual Lease6Ptr getLease6(const isc::asiolink::IOAddress& addr) const;
+    virtual Lease6Ptr getLease6(Lease6::LeaseType type,
+                                const isc::asiolink::IOAddress& addr) const;
 
     /// @brief Returns existing IPv6 leases for a given DUID+IA combination
     ///
@@ -264,6 +266,7 @@ public:
     /// can be more than one. Thus return type is a container, not a single
     /// pointer.
     ///
+    /// @param type specifies lease type: (NA, TA or PD)
     /// @param duid client DUID
     /// @param iaid IA identifier
     ///
@@ -276,11 +279,12 @@ public:
     ///        programming error.
     /// @throw isc::dhcp::DbOperationError An operation on the open database has
     ///        failed.
-    virtual Lease6Collection getLease6(const DUID& duid,
+    virtual Lease6Collection getLease6(Lease6::LeaseType type, const DUID& duid,
                                        uint32_t iaid) const;
 
     /// @brief Returns existing IPv6 lease for a given DUID+IA combination
     ///
+    /// @param type specifies lease type: (NA, TA or PD)
     /// @param duid client DUID
     /// @param iaid IA identifier
     /// @param subnet_id subnet id of the subnet the lease belongs to
@@ -294,8 +298,8 @@ public:
     ///        programming error.
     /// @throw isc::dhcp::DbOperationError An operation on the open database has
     ///        failed.
-    virtual Lease6Ptr getLease6(const DUID& duid, uint32_t iaid,
-                                SubnetID subnet_id) const;
+    virtual Lease6Ptr getLease6(Lease6::LeaseType type, const DUID& duid,
+                                uint32_t iaid, SubnetID subnet_id) const;
 
     /// @brief Updates IPv4 lease.
     ///

+ 18 - 9
src/lib/dhcpsrv/tests/alloc_engine_unittest.cc

@@ -219,7 +219,8 @@ TEST_F(AllocEngine6Test, simpleAlloc6) {
     checkLease6(lease);
 
     // Check that the lease is indeed in LeaseMgr
-    Lease6Ptr from_mgr = LeaseMgrFactory::instance().getLease6(lease->addr_);
+    Lease6Ptr from_mgr = LeaseMgrFactory::instance().getLease6(lease->type_,
+                                                               lease->addr_);
     ASSERT_TRUE(from_mgr);
 
     // Now check that the lease in LeaseMgr has the same parameters
@@ -244,7 +245,8 @@ TEST_F(AllocEngine6Test, fakeAlloc6) {
     checkLease6(lease);
 
     // Check that the lease is NOT in LeaseMgr
-    Lease6Ptr from_mgr = LeaseMgrFactory::instance().getLease6(lease->addr_);
+    Lease6Ptr from_mgr = LeaseMgrFactory::instance().getLease6(lease->type_,
+                                                               lease->addr_);
     ASSERT_FALSE(from_mgr);
 }
 
@@ -270,7 +272,8 @@ TEST_F(AllocEngine6Test, allocWithValidHint6) {
     checkLease6(lease);
 
     // Check that the lease is indeed in LeaseMgr
-    Lease6Ptr from_mgr = LeaseMgrFactory::instance().getLease6(lease->addr_);
+    Lease6Ptr from_mgr = LeaseMgrFactory::instance().getLease6(lease->type_,
+                                                               lease->addr_);
     ASSERT_TRUE(from_mgr);
 
     // Now check that the lease in LeaseMgr has the same parameters
@@ -311,7 +314,8 @@ TEST_F(AllocEngine6Test, allocWithUsedHint6) {
     checkLease6(lease);
 
     // Check that the lease is indeed in LeaseMgr
-    Lease6Ptr from_mgr = LeaseMgrFactory::instance().getLease6(lease->addr_);
+    Lease6Ptr from_mgr = LeaseMgrFactory::instance().getLease6(lease->type_,
+                                                               lease->addr_);
     ASSERT_TRUE(from_mgr);
 
     // Now check that the lease in LeaseMgr has the same parameters
@@ -342,7 +346,8 @@ TEST_F(AllocEngine6Test, allocBogusHint6) {
     checkLease6(lease);
 
     // Check that the lease is indeed in LeaseMgr
-    Lease6Ptr from_mgr = LeaseMgrFactory::instance().getLease6(lease->addr_);
+    Lease6Ptr from_mgr = LeaseMgrFactory::instance().getLease6(lease->type_,
+                                                               lease->addr_);
     ASSERT_TRUE(from_mgr);
 
     // Now check that the lease in LeaseMgr has the same parameters
@@ -468,7 +473,8 @@ TEST_F(AllocEngine6Test, smallPool6) {
     checkLease6(lease);
 
     // Check that the lease is indeed in LeaseMgr
-    Lease6Ptr from_mgr = LeaseMgrFactory::instance().getLease6(lease->addr_);
+    Lease6Ptr from_mgr = LeaseMgrFactory::instance().getLease6(lease->type_,
+                                                               lease->addr_);
     ASSERT_TRUE(from_mgr);
 
     // Now check that the lease in LeaseMgr has the same parameters
@@ -595,7 +601,8 @@ TEST_F(AllocEngine6Test, requestReuseExpiredLease6) {
     EXPECT_EQ(addr.toText(), lease->addr_.toText());
 
     // Check that the lease is indeed updated in LeaseMgr
-    Lease6Ptr from_mgr = LeaseMgrFactory::instance().getLease6(addr);
+    Lease6Ptr from_mgr = LeaseMgrFactory::instance().getLease6(Lease6::LEASE_IA_NA,
+                                                               addr);
     ASSERT_TRUE(from_mgr);
 
     // Now check that the lease in LeaseMgr has the same parameters
@@ -1272,7 +1279,8 @@ TEST_F(HookAllocEngine6Test, lease6_select) {
     checkLease6(lease);
 
     // Check that the lease is indeed in LeaseMgr
-    Lease6Ptr from_mgr = LeaseMgrFactory::instance().getLease6(lease->addr_);
+    Lease6Ptr from_mgr = LeaseMgrFactory::instance().getLease6(lease->type_,
+                                                               lease->addr_);
     ASSERT_TRUE(from_mgr);
 
     // Check that callouts were indeed called
@@ -1345,7 +1353,8 @@ TEST_F(HookAllocEngine6Test, change_lease6_select) {
     EXPECT_EQ(valid_override_, lease->valid_lft_);
 
     // Now check if the lease is in the database
-    Lease6Ptr from_mgr = LeaseMgrFactory::instance().getLease6(lease->addr_);
+    Lease6Ptr from_mgr = LeaseMgrFactory::instance().getLease6(lease->type_,
+                                                               lease->addr_);
     ASSERT_TRUE(from_mgr);
 
     // Check if values in the database are overridden

+ 6 - 3
src/lib/dhcpsrv/tests/lease_mgr_unittest.cc

@@ -128,7 +128,8 @@ public:
     /// @param addr address of the searched lease
     ///
     /// @return smart pointer to the lease (or NULL if a lease is not found)
-    virtual Lease6Ptr getLease6(const isc::asiolink::IOAddress&) const {
+    virtual Lease6Ptr getLease6(Lease6::LeaseType /* not used yet */,
+                                const isc::asiolink::IOAddress&) const {
         return (Lease6Ptr());
     }
 
@@ -138,7 +139,8 @@ public:
     /// @param iaid IA identifier
     ///
     /// @return collection of IPv6 leases
-    virtual Lease6Collection getLease6(const DUID&, uint32_t) const {
+    virtual Lease6Collection getLease6(Lease6::LeaseType /* not used yet */,
+                                       const DUID&, uint32_t) const {
         return (Lease6Collection());
     }
 
@@ -149,7 +151,8 @@ public:
     /// @param subnet_id identifier of the subnet the lease must belong to
     ///
     /// @return smart pointer to the lease (or NULL if a lease is not found)
-    virtual Lease6Ptr getLease6(const DUID&, uint32_t, SubnetID) const {
+    virtual Lease6Ptr getLease6(Lease6::LeaseType /* not used yet */,
+                                const DUID&, uint32_t, SubnetID) const {
         return (Lease6Ptr());
     }
 

+ 13 - 7
src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc

@@ -80,10 +80,12 @@ TEST_F(MemfileLeaseMgrTest, addGetDelete6) {
     // should not be allowed to add a second lease with the same address
     EXPECT_FALSE(lease_mgr->addLease(lease));
 
-    Lease6Ptr x = lease_mgr->getLease6(IOAddress("2001:db8:1::234"));
+    Lease6Ptr x = lease_mgr->getLease6(Lease6::LEASE_IA_NA,
+                                       IOAddress("2001:db8:1::234"));
     EXPECT_EQ(Lease6Ptr(), x);
 
-    x = lease_mgr->getLease6(IOAddress("2001:db8:1::456"));
+    x = lease_mgr->getLease6(Lease6::LEASE_IA_NA,
+                             IOAddress("2001:db8:1::456"));
     ASSERT_TRUE(x);
 
     EXPECT_EQ(x->addr_.toText(), addr.toText());
@@ -100,7 +102,8 @@ TEST_F(MemfileLeaseMgrTest, addGetDelete6) {
     EXPECT_EQ(x->t2_, 80);
 
     // Test getLease6(duid, iaid, subnet_id) - positive case
-    Lease6Ptr y = lease_mgr->getLease6(*duid, iaid, subnet_id);
+    Lease6Ptr y = lease_mgr->getLease6(Lease6::LEASE_IA_NA, *duid, iaid,
+                                       subnet_id);
     ASSERT_TRUE(y);
     EXPECT_TRUE(*y->duid_ == *duid);
     EXPECT_EQ(y->iaid_, iaid);
@@ -108,16 +111,19 @@ TEST_F(MemfileLeaseMgrTest, addGetDelete6) {
 
     // Test getLease6(duid, iaid, subnet_id) - wrong iaid
     uint32_t invalid_iaid = 9; // no such iaid
-    y = lease_mgr->getLease6(*duid, invalid_iaid, subnet_id);
+    y = lease_mgr->getLease6(Lease6::LEASE_IA_NA, *duid, invalid_iaid,
+                             subnet_id);
     EXPECT_FALSE(y);
 
     uint32_t invalid_subnet_id = 999;
-    y = lease_mgr->getLease6(*duid, iaid, invalid_subnet_id);
+    y = lease_mgr->getLease6(Lease6::LEASE_IA_NA, *duid, iaid,
+                             invalid_subnet_id);
     EXPECT_FALSE(y);
 
     // truncated duid
     DuidPtr invalid_duid(new DUID(llt, sizeof(llt) - 1));
-    y = lease_mgr->getLease6(*invalid_duid, iaid, subnet_id);
+    y = lease_mgr->getLease6(Lease6::LEASE_IA_NA, *invalid_duid, iaid,
+                             subnet_id);
     EXPECT_FALSE(y);
 
     // should return false - there's no such address
@@ -127,7 +133,7 @@ TEST_F(MemfileLeaseMgrTest, addGetDelete6) {
     EXPECT_TRUE(lease_mgr->deleteLease(IOAddress("2001:db8:1::456")));
 
     // after the lease is deleted, it should really be gone
-    x = lease_mgr->getLease6(IOAddress("2001:db8:1::456"));
+    x = lease_mgr->getLease6(Lease6::LEASE_IA_NA, IOAddress("2001:db8:1::456"));
     EXPECT_EQ(Lease6Ptr(), x);
 }
 

+ 24 - 21
src/lib/dhcpsrv/tests/mysql_lease_mgr_unittest.cc

@@ -484,15 +484,15 @@ TEST_F(MySqlLeaseMgrTest, basicLease6) {
     // Reopen the database to ensure that they actually got stored.
     reopen();
 
-    Lease6Ptr l_returned = lmptr_->getLease6(ioaddress6_[1]);
+    Lease6Ptr l_returned = lmptr_->getLease6(leasetype6_[1], ioaddress6_[1]);
     ASSERT_TRUE(l_returned);
     detailCompareLease(leases[1], l_returned);
 
-    l_returned = lmptr_->getLease6(ioaddress6_[2]);
+    l_returned = lmptr_->getLease6(leasetype6_[2], ioaddress6_[2]);
     ASSERT_TRUE(l_returned);
     detailCompareLease(leases[2], l_returned);
 
-    l_returned = lmptr_->getLease6(ioaddress6_[3]);
+    l_returned = lmptr_->getLease6(leasetype6_[3], ioaddress6_[3]);
     ASSERT_TRUE(l_returned);
     detailCompareLease(leases[3], l_returned);
 
@@ -502,12 +502,12 @@ TEST_F(MySqlLeaseMgrTest, basicLease6) {
     // Delete a lease, check that it's gone, and that we can't delete it
     // a second time.
     EXPECT_TRUE(lmptr_->deleteLease(ioaddress6_[1]));
-    l_returned = lmptr_->getLease6(ioaddress6_[1]);
+    l_returned = lmptr_->getLease6(leasetype6_[1], ioaddress6_[1]);
     EXPECT_FALSE(l_returned);
     EXPECT_FALSE(lmptr_->deleteLease(ioaddress6_[1]));
 
     // Check that the second address is still there.
-    l_returned = lmptr_->getLease6(ioaddress6_[2]);
+    l_returned = lmptr_->getLease6(leasetype6_[2], ioaddress6_[2]);
     ASSERT_TRUE(l_returned);
     detailCompareLease(leases[2], l_returned);
 }
@@ -525,7 +525,7 @@ TEST_F(MySqlLeaseMgrTest, lease6InvalidHostname) {
     ASSERT_TRUE(lmptr_->addLease(leases[1]));
 
     // The new lease must be in the database.
-    Lease6Ptr l_returned = lmptr_->getLease6(ioaddress6_[1]);
+    Lease6Ptr l_returned = lmptr_->getLease6(leasetype6_[1], ioaddress6_[1]);
     detailCompareLease(leases[1], l_returned);
 
     // Let's delete the lease, so as we can try to add it again with
@@ -835,7 +835,8 @@ TEST_F(MySqlLeaseMgrTest, getLease6DuidIaid) {
     }
 
     // Get the leases matching the DUID and IAID of lease[1].
-    Lease6Collection returned = lmptr_->getLease6(*leases[1]->duid_,
+    Lease6Collection returned = lmptr_->getLease6(leasetype6_[1],
+                                                  *leases[1]->duid_,
                                                   leases[1]->iaid_);
 
     // Should be three leases, matching leases[1], [4] and [5].
@@ -854,14 +855,15 @@ TEST_F(MySqlLeaseMgrTest, getLease6DuidIaid) {
 
     // Check that nothing is returned when either the IAID or DUID match
     // nothing.
-    returned = lmptr_->getLease6(*leases[1]->duid_, leases[1]->iaid_ + 1);
+    returned = lmptr_->getLease6(leasetype6_[1], *leases[1]->duid_,
+                                 leases[1]->iaid_ + 1);
     EXPECT_EQ(0, returned.size());
 
     // Alter the leases[1] DUID to match nothing in the database.
     vector<uint8_t> duid_vector = leases[1]->duid_->getDuid();
     ++duid_vector[0];
     DUID new_duid(duid_vector);
-    returned = lmptr_->getLease6(new_duid, leases[1]->iaid_);
+    returned = lmptr_->getLease6(leasetype6_[1], new_duid, leases[1]->iaid_);
     EXPECT_EQ(0, returned.size());
 }
 
@@ -885,7 +887,8 @@ TEST_F(MySqlLeaseMgrTest, getLease6DuidIaidSize) {
         vector<uint8_t> duid_vec(i, i);
         leases[1]->duid_.reset(new DUID(duid_vec));
         EXPECT_TRUE(lmptr_->addLease(leases[1]));
-        Lease6Collection returned = lmptr_->getLease6(*leases[1]->duid_,
+        Lease6Collection returned = lmptr_->getLease6(leasetype6_[1],
+                                                      *leases[1]->duid_,
                                                       leases[1]->iaid_);
         ASSERT_EQ(1, returned.size());
         detailCompareLease(leases[1], *returned.begin());
@@ -909,7 +912,7 @@ TEST_F(MySqlLeaseMgrTest, getLease6DuidIaidSubnetId) {
     }
 
     // Get the leases matching the DUID and IAID of lease[1].
-    Lease6Ptr returned = lmptr_->getLease6(*leases[1]->duid_,
+    Lease6Ptr returned = lmptr_->getLease6(leasetype6_[1], *leases[1]->duid_,
                                            leases[1]->iaid_,
                                            leases[1]->subnet_id_);
     ASSERT_TRUE(returned);
@@ -917,19 +920,19 @@ TEST_F(MySqlLeaseMgrTest, getLease6DuidIaidSubnetId) {
 
     // Modify each of the three parameters (DUID, IAID, Subnet ID) and
     // check that nothing is returned.
-    returned = lmptr_->getLease6(*leases[1]->duid_, leases[1]->iaid_ + 1,
-                                 leases[1]->subnet_id_);
+    returned = lmptr_->getLease6(leasetype6_[1], *leases[1]->duid_,
+                                 leases[1]->iaid_ + 1, leases[1]->subnet_id_);
     EXPECT_FALSE(returned);
 
-    returned = lmptr_->getLease6(*leases[1]->duid_, leases[1]->iaid_,
-                                 leases[1]->subnet_id_ + 1);
+    returned = lmptr_->getLease6(leasetype6_[1], *leases[1]->duid_,
+                                 leases[1]->iaid_, leases[1]->subnet_id_ + 1);
     EXPECT_FALSE(returned);
 
     // Alter the leases[1] DUID to match nothing in the database.
     vector<uint8_t> duid_vector = leases[1]->duid_->getDuid();
     ++duid_vector[0];
     DUID new_duid(duid_vector);
-    returned = lmptr_->getLease6(new_duid, leases[1]->iaid_,
+    returned = lmptr_->getLease6(leasetype6_[1], new_duid, leases[1]->iaid_,
                                  leases[1]->subnet_id_);
     EXPECT_FALSE(returned);
 }
@@ -954,7 +957,7 @@ TEST_F(MySqlLeaseMgrTest, getLease6DuidIaidSubnetIdSize) {
         vector<uint8_t> duid_vec(i, i);
         leases[1]->duid_.reset(new DUID(duid_vec));
         EXPECT_TRUE(lmptr_->addLease(leases[1]));
-        Lease6Ptr returned = lmptr_->getLease6(*leases[1]->duid_,
+        Lease6Ptr returned = lmptr_->getLease6(leasetype6_[1], *leases[1]->duid_,
                                                leases[1]->iaid_,
                                                leases[1]->subnet_id_);
         ASSERT_TRUE(returned);
@@ -1030,7 +1033,7 @@ TEST_F(MySqlLeaseMgrTest, updateLease6) {
     EXPECT_TRUE(lmptr_->addLease(leases[1]));
     lmptr_->commit();
 
-    Lease6Ptr l_returned = lmptr_->getLease6(ioaddress6_[1]);
+    Lease6Ptr l_returned = lmptr_->getLease6(leasetype6_[1], ioaddress6_[1]);
     ASSERT_TRUE(l_returned);
     detailCompareLease(leases[1], l_returned);
 
@@ -1046,7 +1049,7 @@ TEST_F(MySqlLeaseMgrTest, updateLease6) {
 
     // ... and check what is returned is what is expected.
     l_returned.reset();
-    l_returned = lmptr_->getLease6(ioaddress6_[1]);
+    l_returned = lmptr_->getLease6(leasetype6_[1], ioaddress6_[1]);
     ASSERT_TRUE(l_returned);
     detailCompareLease(leases[1], l_returned);
 
@@ -1058,14 +1061,14 @@ TEST_F(MySqlLeaseMgrTest, updateLease6) {
     lmptr_->updateLease6(leases[1]);
 
     l_returned.reset();
-    l_returned = lmptr_->getLease6(ioaddress6_[1]);
+    l_returned = lmptr_->getLease6(leasetype6_[1], ioaddress6_[1]);
     ASSERT_TRUE(l_returned);
     detailCompareLease(leases[1], l_returned);
 
     // Check we can do an update without changing data.
     lmptr_->updateLease6(leases[1]);
     l_returned.reset();
-    l_returned = lmptr_->getLease6(ioaddress6_[1]);
+    l_returned = lmptr_->getLease6(leasetype6_[1], ioaddress6_[1]);
     ASSERT_TRUE(l_returned);
     detailCompareLease(leases[1], l_returned);
 

+ 11 - 8
src/lib/dhcpsrv/tests/test_utils.cc

@@ -108,6 +108,9 @@ GenericLeaseMgrTest::GenericLeaseMgrTest()
         straddress6_.push_back(addr);
         IOAddress ioaddr(addr);
         ioaddress6_.push_back(ioaddr);
+
+        /// Let's create different lease types
+        leasetype6_.push_back(static_cast<Lease6::LeaseType>(i%3));
     }
 }
 
@@ -264,7 +267,7 @@ GenericLeaseMgrTest::initializeLease6(std::string address) {
 
     // Set other parameters.  For historical reasons, address 0 is not used.
     if (address == straddress6_[0]) {
-        lease->type_ = Lease6::LEASE_IA_TA;
+        lease->type_ = leasetype6_[0];
         lease->prefixlen_ = 4;
         lease->iaid_ = 142;
         lease->duid_ = DuidPtr(new DUID(vector<uint8_t>(8, 0x77)));
@@ -277,7 +280,7 @@ GenericLeaseMgrTest::initializeLease6(std::string address) {
         lease->hostname_ = "myhost.example.com.";
 
     } else if (address == straddress6_[1]) {
-        lease->type_ = Lease6::LEASE_IA_TA;
+        lease->type_ = leasetype6_[1];
         lease->prefixlen_ = 0;
         lease->iaid_ = 42;
         lease->duid_ = DuidPtr(new DUID(vector<uint8_t>(8, 0x42)));
@@ -290,7 +293,7 @@ GenericLeaseMgrTest::initializeLease6(std::string address) {
         lease->hostname_ = "myhost.example.com.";
 
     } else if (address == straddress6_[2]) {
-        lease->type_ = Lease6::LEASE_IA_PD;
+        lease->type_ = leasetype6_[2];
         lease->prefixlen_ = 7;
         lease->iaid_ = 89;
         lease->duid_ = DuidPtr(new DUID(vector<uint8_t>(8, 0x3a)));
@@ -303,7 +306,7 @@ GenericLeaseMgrTest::initializeLease6(std::string address) {
         lease->hostname_ = "myhost.example.com.";
 
     } else if (address == straddress6_[3]) {
-        lease->type_ = Lease6::LEASE_IA_NA;
+        lease->type_ = leasetype6_[3];
         lease->prefixlen_ = 28;
         lease->iaid_ = 0xfffffffe;
         vector<uint8_t> duid;
@@ -326,7 +329,7 @@ GenericLeaseMgrTest::initializeLease6(std::string address) {
 
     } else if (address == straddress6_[4]) {
         // Same DUID and IAID as straddress6_1
-        lease->type_ = Lease6::LEASE_IA_PD;
+        lease->type_ = leasetype6_[4];
         lease->prefixlen_ = 15;
         lease->iaid_ = 42;
         lease->duid_ = DuidPtr(new DUID(vector<uint8_t>(8, 0x42)));
@@ -340,7 +343,7 @@ GenericLeaseMgrTest::initializeLease6(std::string address) {
 
     } else if (address == straddress6_[5]) {
         // Same DUID and IAID as straddress6_1
-        lease->type_ = Lease6::LEASE_IA_PD;
+        lease->type_ = leasetype6_[5];
         lease->prefixlen_ = 24;
         lease->iaid_ = 42;                          // Same as lease 4
         lease->duid_ = DuidPtr(new DUID(vector<uint8_t>(8, 0x42)));
@@ -355,7 +358,7 @@ GenericLeaseMgrTest::initializeLease6(std::string address) {
 
     } else if (address == straddress6_[6]) {
         // Same DUID as straddress6_1
-        lease->type_ = Lease6::LEASE_IA_PD;
+        lease->type_ = leasetype6_[6];
         lease->prefixlen_ = 24;
         lease->iaid_ = 93;
         lease->duid_ = DuidPtr(new DUID(vector<uint8_t>(8, 0x42)));
@@ -370,7 +373,7 @@ GenericLeaseMgrTest::initializeLease6(std::string address) {
 
     } else if (address == straddress6_[7]) {
         // Same IAID as straddress6_1
-        lease->type_ = Lease6::LEASE_IA_PD;
+        lease->type_ = leasetype6_[7];
         lease->prefixlen_ = 24;
         lease->iaid_ = 42;
         lease->duid_ = DuidPtr(new DUID(vector<uint8_t>(8, 0xe5)));

+ 1 - 0
src/lib/dhcpsrv/tests/test_utils.h

@@ -105,6 +105,7 @@ public:
     std::vector<std::string>  straddress4_;   ///< String forms of IPv4 addresses
     std::vector<isc::asiolink::IOAddress> ioaddress4_;  ///< IOAddress forms of IPv4 addresses
     std::vector<std::string>  straddress6_;   ///< String forms of IPv6 addresses
+    std::vector<Lease6::LeaseType> leasetype6_; ///< Lease types
     std::vector<isc::asiolink::IOAddress> ioaddress6_;  ///< IOAddress forms of IPv6 addresses
 
     LeaseMgr*   lmptr_;             ///< Pointer to the lease manager