BIND 10 trac3171, updated. 7509a8d1bc64d4f688f6746d195987e5e22d4933 [3171] PD test for allocation with bogus hint implemented
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Sep 20 16:55:34 UTC 2013
The branch, trac3171 has been updated
via 7509a8d1bc64d4f688f6746d195987e5e22d4933 (commit)
from cbda6551031656b6d03f7d5578d0389c562a4238 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 7509a8d1bc64d4f688f6746d195987e5e22d4933
Author: Tomek Mrugalski <tomasz at isc.org>
Date: Fri Sep 20 18:55:20 2013 +0200
[3171] PD test for allocation with bogus hint implemented
-----------------------------------------------------------------------
Summary of changes:
src/lib/dhcpsrv/tests/alloc_engine_unittest.cc | 76 ++++++++++++++++--------
1 file changed, 51 insertions(+), 25 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/dhcpsrv/tests/alloc_engine_unittest.cc b/src/lib/dhcpsrv/tests/alloc_engine_unittest.cc
index 64a2865..359dd58 100644
--- a/src/lib/dhcpsrv/tests/alloc_engine_unittest.cc
+++ b/src/lib/dhcpsrv/tests/alloc_engine_unittest.cc
@@ -273,6 +273,51 @@ public:
detailCompareLease(lease, from_mgr);
}
+ /// @brief checks if bogus hint can be ignored and the allocation succeeds
+ ///
+ /// This test checks if the allocation with a hing that is out of the blue
+ /// can succeed. The invalid hint should be ingored completely.
+ ///
+ /// @param type Lease type
+ /// @param hint hint (as send by a client)
+ /// @param expectd_pd_len (used in validation)
+ void allocBogusHint6(Lease::Type type, IOAddress hint,
+ uint8_t expected_pd_len) {
+ boost::scoped_ptr<AllocEngine> engine;
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE,
+ 100)));
+ ASSERT_TRUE(engine);
+
+ // Client would like to get a 3000::abc lease, which does not belong to any
+ // supported lease. Allocation engine should ignore it and carry on
+ // with the normal allocation
+ Lease6Ptr lease;
+ EXPECT_NO_THROW(lease = expectOneLease(engine->allocateAddress6(subnet_,
+ duid_, iaid_, hint, type, false,
+ false, "", false, CalloutHandlePtr())));
+
+ // Check that we got a lease
+ ASSERT_TRUE(lease);
+
+ // We should NOT get what we asked for, because it is used already
+ EXPECT_NE(hint.toText(), lease->addr_.toText());
+
+ // Do all checks on the lease
+ checkLease6(lease, type, expected_pd_len);
+
+ // Check that the lease is indeed in LeaseMgr
+ 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
+ detailCompareLease(lease, from_mgr);
+
+
+
+
+ }
+
virtual ~AllocEngine6Test() {
factory_.destroy();
@@ -430,34 +475,15 @@ TEST_F(AllocEngine6Test, pdAllocWithUsedHint6) {
// This test checks if the allocation with a hint that is out the blue
// can succeed. The invalid hint should be ignored completely.
TEST_F(AllocEngine6Test, allocBogusHint6) {
- boost::scoped_ptr<AllocEngine> engine;
- ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
- ASSERT_TRUE(engine);
-
- // Client would like to get a 3000::abc lease, which does not belong to any
- // supported lease. Allocation engine should ignore it and carry on
- // with the normal allocation
- Lease6Ptr lease;
- EXPECT_NO_THROW(lease = expectOneLease(engine->allocateAddress6(subnet_,
- duid_, iaid_, IOAddress("3000::abc"), Lease::TYPE_NA, false,
- false, "", false, CalloutHandlePtr())));
-
- // Check that we got a lease
- ASSERT_TRUE(lease);
-
- // We should NOT get what we asked for, because it is used already
- EXPECT_TRUE(lease->addr_.toText() != "3000::abc");
- // Do all checks on the lease
- checkLease6(lease, Lease::TYPE_NA, 128);
+ allocBogusHint6(Lease::TYPE_NA, IOAddress("3000::abc"), 128);
+}
- // Check that the lease is indeed in LeaseMgr
- Lease6Ptr from_mgr = LeaseMgrFactory::instance().getLease6(lease->type_,
- lease->addr_);
- ASSERT_TRUE(from_mgr);
+// This test checks if the allocation with a hint that is out the blue
+// can succeed. The invalid hint should be ignored completely.
+TEST_F(AllocEngine6Test, pdAllocBogusHint6) {
- // Now check that the lease in LeaseMgr has the same parameters
- detailCompareLease(lease, from_mgr);
+ allocBogusHint6(Lease::TYPE_PD, IOAddress("3000::abc"), 64);
}
// This test checks that NULL values are handled properly
More information about the bind10-changes
mailing list